MBED Wifi Controlled Robot
Alexander Newton / Chris Price
This was a project for a Georgia Tech ECE 4180 Lab. We set out to use an mbed with a capacitive touch keypad to control an mbed powered robot over wifi. The robot we used was the shadow robot kit from Sparkfun. We used a small MOSFET H-bridge to control the motors and a ESP8266 wifi module. On the controller side we used the same wifi module as well as a capacitive touch number pad for controlling the robots direction. As you can see in the pictures below the robot breadboard also has an IMU chip installed. We had intended to include PID control using the IMU to make the robot driving more accurate, however our priority was the wifi communication.
Demonstration:
A basic overview of the wifi communication is that both mbeds are connected to the same wifi network (GTother in our case), then the robot sets up a web server to constantly receive data. The controller then connects to this web server and sends specific commands, such as forward, backwards, left, and right.
Again, the IMU is not implemented in the included code, but could be relatively easily.
The wifi module is the black IC seen towards the front of the robot. It is important to note that in our particular case the mbed 3.3V Vout could NOT provide enough current to run the wifi module reliably. On both the controller and the robot we had to use an external power source for the wifi module. You can see on the robot I created a simple voltage divider. This is not the most ideal solution since if using batteries the voltage change could be significant and the IC may not receive clean power, a better solution would be a dedicated 3.3v regulator. However, for bench testing we were using an external power supply that gave a very constant 5 volts so the voltage divider was sufficient.
Also, as can be seen on the robot board 330uF decoupling caps were used on both the 3.3v circuit and the 5v circuit. This is incredibly important when running the motors and the electronics from the same power supply because the motors we cause a lot of interference in the power lines and the decoupling caps will help to smooth that out to some degree.
The circuitry for the control board was relatively simple, since it was just the number pad and the wifi module. Once again note the decoupling cap for the wifi module and the wires exiting the bottom left of the picture going to an external 3.3v power supply.
Two notes about controlling the robot:
- The http GET doesn't close properly, so you may need to hit the capactitive touch screen a few times to get it working
- Controls for the touch screen:
Capacttive Number | Direction | Duration |
---|---|---|
2 | Forward | 1 second |
5 | Backward | 1 second |
7 | Left | 0.5 seconds |
10 | Right | 0.5 seconds |
Below is the main.cpp for the controller code:
Import programECE_4180_Lab_4
Code to run the controller for the wifi robot
Pinouts for the capacitive touch controller are below: ESP8266 WiFi Controller
ESP8266 | mbed LPC1768 | 330uf cap |
---|---|---|
Vcc | External 3.3V Power Supply | + |
Gnd | Gnd | - |
Reset | p29 | |
RX | p28-TX | |
TX | p27-RX | |
CH_PD | Vout |
MPR121 I2C Capacitive Touch Sensor
mbed | Touch Keypad | 4.7K ohm pullup to 3.3V? |
---|---|---|
Gnd | Gnd | |
p9 | SDA | Yes |
p10 | SCL | Yes |
p26 | IRQ | |
Vout(3.3V) | Vcc |
And the robot webserver code:
Robot pinouts: ESP8266 WiFi Controller
ESP8266 | mbed LPC1768 | 330uf cap |
---|---|---|
Vcc | External 3.3V Power Supply | + |
Gnd | Gnd | - |
Reset | p29 | |
RX | p28-TX | |
TX | p27-RX | |
CH_PD | Vout |
H-bridge | MBED | Motors |
---|---|---|
GND | GND | |
VCC | VOUT | |
AO1 | Right Red | |
AO2 | Right Black | |
BO2 | Left Black | |
BO1 | Left Red | |
VMOT | 5V(ext) | |
GND | GND | |
PWMA | P26 | |
AIN2 | P25 | |
AIN1 | P24 | |
STBY | VU | |
BIN1 | P23 | |
BIN2 | P22 | |
PWMB | P21 | |
GND | GND |
NOTE: A voltage divider was used to power both the motor and the WiFi module off of 5V wall-power.
Please log in to post comments.