- Sat Apr 02, 2016 8:30 pm
#44705
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.