-->
Page 1 of 1

ESP8266 motor driver

PostPosted: Sun Mar 27, 2016 11:52 pm
by onehorse
I am working on an ESP8266 motor controller with a motion sensor hub and 2 DRV8837 H-bridge motor drivers on a two-wheeled Pololu robot platform. The board has a 5 V boost converter to make sure there is plenty of current even when the motors are driven at full speed. I plan to use RCKit to control the robot using an iPhone but haven't quite got that worked out yet. The trick is to use ESP8266 wifi instead of the Arduino wifi shield that the API was written for.

Re: ESP8266 motor driver

PostPosted: Sat Apr 02, 2016 8:30 pm
by onehorse
I managed to get the RCTX code to work with the iPhone APP (thanks Greg!); it is actually pretty straightforward. The ESP8266 is recognized by the iPhone and the code receives UDP data packets from the iPhone app depending on the position of the joystick. The position data is 8-bit (1 byte) only so center position is 127 and left is 0 and right is 255, etc. This makes PWM programming easy but there is a mismatch between the 10-bit ESP8266 PWM and the 8-bit data of the app. I just did some simple scaling in the code but there are better ways to map the differences. So far I am only using one joystick for forward and backward for each of the two (left /right) motors. This is enough to give the robot a surprising agility for such a simple device.

I had to replace the 3xAA battery pack since it was not able to output enough current to power the ESP8266 consistently; it kept rebooting the ESP8266 and ran the motors at full power since the data stream returned always read 0 (full throttle). This is a data structure problem that I might work on if I continue to use this app. Anyway, replacing the battery pack with a 1S 3.7 V 350 mAH LiPo battery solved this particular problem; the robot + iPhone control app is working more or less as expected.