Skip to content

kreier/T400

Repository files navigation

T400

GitHub release Build Status MIT license

Robot car with WiFi, programmed and controlled by MicroPython. The OLED screen gives information about status, connection and WiFi network to connect to (AP mode).

T400 T400 lite

Project

This car was build during ASA session III in 2019/2020 at the AISVN. In 11 weeks from February 24th to May 22nd we successfully created 8 robot cars. Here are some pictures of the finished products:

Key features

Over the time of 3 months the students will reach different stages of their project, but here are some key features:

  • Central unit is a ESP8266 with 32 kByte RAM and 4 GByte Flash memory, running at 160 MHz.
  • The programming language is MicroPython with an interactive prompt REPL.
  • The control unit is powered by a standard 5V powerbank.
  • The drive unit is a caterpillar base with two 12V motors.
  • The robot car can be controlled via WiFi.
  • An OLED display 128x64 (ssd1306) gives status updates.

Materials

The materials used for this project were ordered at IC ĐÂY RỒI, thegioiic.com and lazada.vn. Here is a list of materials:

Nr Name Amount Unit Price Sum Supplier
1 ESP8266 NodeMCU 1 83000 VND 83000 VND link thegioiic
2 Motor Shield L293D 1 30000 VND 30000 VND link thegioiic
3 OLED display 126x64 I2C 1 79000 VND 79000 VND link thegioiic
4 Wires DuPont MF and FF 20 300 VND 6000 VND link thegioiic
5 Robot caterpillar 12V unit 1 483000 VND 483000 VND link lazada.vn
6 Powerbank 10000 mAh 2 USB 1 249000 VND 249000 VND link nguyenkim
7 DC step-up converter 5V 12V 1 23000 VND 23000 VND link thegioiic
8 Robot 4DOF kit 1 246000 VND 246000 VND link lazada.vn
9 Servo SG90 5 29000 VND 145000 VND link icdayroi
10 Ultrasonic Module US-100 3.3V 1 59000 VND 59000 VND link thegioiic
11 I2C servo controller PCA9685 1 49000 VND 49000 VND link thegioiic
12 USB male connector Type A 2 1800 VND 3600 VND link thegioiic
13 Buzzer 3.3 Volt 1 3000 VND 3000 VND link thegioiic
14 Screw M3 8mm 8 550 VND 4400 VND link thegioiic
15 HEX-M3 spacer 15mm 4 1000 VND 4000 VND link thegioiic
VND 1467000 VND

Pin layout

Pin esp8266

Code

This is an example of the MicroPython code we are going to use:

from machine import Pin, I2C
import ssd1306

# ESP32 Pin assignment 
# i2c = I2C(1, scl=Pin(22), sda=Pin(21))

# ESP8266 Pin assignment
i2c = I2C(scl=Pin(12), sda=Pin(14))

oled_width = 128
oled_height = 64
oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)

# draw some boxes

for x in range(0, 127): # horizontal lines
  oled.pixel(x, 0, 1)
  oled.pixel(x, 15, 1)
  oled.pixel(x, 16, 1)
  oled.pixel(x, 63, 1)
  
for y in range(0, 63): # vertical lines
  oled.pixel(0, y, 1)
  oled.pixel(127, y, 1)

oled.text('T400 Robot Car', 8, 4)
oled.text('Programmed in', 4, 22)
oled.text('MicroPython on', 4, 32)
oled.text('a ESP8266.', 4, 42)
oled.text('Used at AISVN.', 4, 52)
  
oled.show()

I2C connector

2020/07/09

Following the inspiration of SparkFun with their QWIIC connector I tried to replicate the pin order. But instead of SMD 1.0 mm connector I just use the regular 2.54mm raster with XH connector on the board and respective 4 pin connector wire.

QWIIC system

Following the same order the pins are assigned:

  1. black - GND
  2. red - 3.3 V
  3. blue - SDA
  4. yellow - SCL

XH 2.54 connector

The order does not match several OLED displays, but the ZS-042 rtc clock, the 1602 display adapter and many more.

2020/11/27

With the new T-Display project I included the I2C connector as well. The pins look like this:

I2C on T-Display

At the ESP32 SCL (SCK) is on GPIO 22 and SDA (SDI) is on GPIO 21.