Wifi RC car; controlled by browser based App from PC or Android/iOS through websockets
I want to show off my project which I am extremely fond of. I loved doing it every bit. And
that is why this post will be quite long – lots of pictures and video.
This is the picture of unhacked car, a car in it’s original form with cover removed.
This is the Raspberry PI v1- the computer. Also unmodified. You can also see WiFi dongle plugged in, which was later turned into Wireless access point.
Raspberry has GPIO which stands for General Purpose Input Output. I needed outputs so I can control the car. I cut the IDE cable so it would fit.
GPIO is signal port – it is weak. So I needed to design my own “driver” board, which is essentially just an signal amplifier. This way I also could separate battery for computer and another battery for car.
It means more stability – I had experiences of computer restarting itself because of single battery.
When I finished PCB design, I did toner transfer method to make the circuit.
I transferred toner – black ink with heat onto cooper board.
Then got rid of paper with help of water and soap.
And threw it into chemical which eats copper.
Requirement of this chemical is to be heated to 50°C so that it can eat cooper.
This is why I did water bath – it is really safe to do. Water heats to 100°C and water heats the plastic pot with chemical.
After etching, I needed to get rid of toner – the black stuff.
But it’s better to drill before removing black paint, because it’s less error prone.
After cleaning it with “nitro paint dissolver” board looked like this. Quite shinny :).
Let’s add stuff to it.
But before I can add stuff, I need to hop into shop and buy stuff.
Soldered some stuff. This is also where IDE from Raspberry PI will connect to – the GPIO.
Boom – finished. I also cut corners.
Because sometimes people make mistakes, they need to repeat everything to get it right.
So there you can see multiple versions of this driver.
Connecting the driver with car
The Raspberry GPIO – IDE connection. Soon to be made.
Quite messy. I need more duct tape.
Ok, after enough duct tape, wires and all other glorious building components, I got the car into this state. I hope NASA doesn’t use this thing in space mission.
Now comes the programming. This is the part you will not see in pictures, but I will describe everything I used.
Raspberry PI computer had Linux installed in it.
For WiFi Dongle, I drivers and some scripts which turned the dongle into Access Point. Basically, I turned computer into router, to which you can connect to with laptop or smartphone.
This is how I mostly programmed the car – from WiFi with my laptop through SSH and SFTP.
Then I downloaded Mono – for C#. The Mono is really nice: It is possible to drop .exe files compiled directly from Visual Studio.
That is, I made my main backend server with C#. I used Fleck library for Websockets.
And thanks god someone did the PI-Blaster. With Pi-Blaster, you can turn GPIO ports into 8 port PWM output. With PWM I controlled the servos and LEDs.
The On/Off icon indicates if connection to car is alive. The lights indicates well, the lights. (Car has LEDs). The brown pad is for touch pad control. This client also works with WASD keys if you run it on computer.
In short, the Raspberry PI had following things so it could work flawlessly:
- drivers for WiFi dongle so the car had it’s own Access Point (so you could connect to it with PC or Smartphone, w/e),
- DHCP server for giving out IP addresses,
- hacked DNS server, so it would route “rc.si” into it’s own server (C# backend),
- HTTP web server, which served HTML web app client, which connected to PI server over webSocket,
- C# control server which worked through webSocket. This program accepted messages from HTML client and sent controls to steering servo, LEDs, motor.
This is picture of functional web client on Samsung Ace with broken glass.
Turning left and right:
Switching lights on and off:
That is all there is to it. I had lots of fun doing this project!
I made also compiled a short movie with help of GO Pro camera. The camera is NOT realtime (I don’t see live feed on web client).
Hope you enjoyed this blog post!
The project was funded by http://cnj.si/#/, you can also see theirs logo on PCB and web app :).