iPhone Wifi controlled RC car
Most of this is described about in the video however this is a little more indepth and more story driven. My first 'real' project, and first post on LMR.
The basis of the robot is an Arduino Uno with an Adafruit motor driver shield. I de-soldered the leads from the power supply and motors on the car and attached them to the motor shield. I programmed the the motors to respond when they received case letters over the serial port example: case 'a' motorSteer blah blah. Testing the car was simple, just had to open the serial monitor and type the letter in and hit enter and the motor moved, however, the next part was harder.
As I wanted the car to be controlled by my iPhone over Wifi like those fancy remote control cars you see in the shops I needed to find a way to send information from my iPhone to my computer and then to the Arduino. Luckily I found a project on YouTube similar to what I wanted to do which used the app TouchOSC.
TouchOSC is meant for DJ's who want to control their rigs or whatever using their iPhone. The user can make thier own custom layouts and name the buttons and sliders and such and give them values such as minimum and maximum. The app sends UDP packets containing the information about what user touched and what the value is to a chosen IP.
Knowing this I searched the internet for ways to read UDP packets from iPhone on my computer and I came across Processing. Processing is an open source software creator basically which allows users to program their own programs and such. Spending a few hours with the program I learnt how it all worked (luckily the syntax is very similar to Arduino IDE, and after which I found out that the Arduino IDE is written is Processing, win) and installed libraries to read those UDP packets.
So basically now what I had was iPhone sending packets of information to be received by Processing but then I wanted that to be sent to the Arduino. More googling found Arduino libraries for Processing that allowed me to write bytes to the serial port, this was exactly what I needed.
After some more work I finally got it all to work, iPhone sends data, Processing interprets data and sends information to the Arduino through the serial ports, Arduino reads the information and responds accordingly.
Sorry if the explanation was not the greatest and I'm definitely not the greatest person out there to talk about this stuff but I hope you got something out of this because I certainly did. After I finish my Year 12 exams I will definitely investigate Processing much more and how I can bridge connections between various peripherals and the Arduino. Thank you for reading. I now realise how big that all is and apologise for the wall of text. :)
If you wish to do something similar I have provided the code below;
Arduino code for car: https://www.dropbox.com/sh/3hlx7aii9jceirw/7S74vcXyye
Processsing code: https://www.dropbox.com/sh/ounfzxrp0lzkoxi/pkJFZafuJ9
And the download link for the app I used;
I have tried to comment the code to the best of my ability. I am by no means the best programmer in the world infact I am probably the worst, if there is a way to make the code more optimised or something let me know how I can fix it and I will update the files for everyone.