Monday 12 September 2016

Driving motors using the Adafruit Motor Shield and the esp-12f


IMPORTANT.
The Adafruit Motor Shield normally gets its logic voltage from the Arduino Uno which runs at 5V,  and the ESP-12f uses 3.3V so you may think that a logic level converter is required and a 5V source. However the motor shield I2C and drive system works fine with connecting Vin to the 3.3V used by the esp-12f. The motors are power separately and you need to remove the Vin jumper.

The motor shield and esp-12f communicate using I2C.
The pins on the ESP-12f are GPIO4( blue wire on my breadboard) is SDA and GPIO5 ( orange wire on my breadboard) is SCL.
The pins on the motor shield are as for  Arduino Uno as it i a shield, That is pin A4( analog 4) for SDA and pin A5(analog 5) for SCL. Note that similarity in numbers between the two devices.

The I2C address of the motor shield is hardcoded in the  library as 60.

Interfacing with the robot using a Web Browser

I next followed the tutorial in https://learn.adafruit.com/build-an-esp8266-mobile-robot. The simplest way is to clone the example code git repo into the Arduino sketches folder and
  1. eps8266_robot.ino - set the ssid and password appropriately, compile and upload
  2. scripts.js - set the ip address of the esp8266 
Then simply open the demo.html and you're off.

No comments:

Post a Comment