Introduction: Wifi Controlled Camera-car
The easiest and most efficient way to make a wireless and connected controlled car !
A few months ago I bought a 5$ RC car in a mall. With my roommate, we fought it would be fun to hack it so we could control it with something more interesting that the super cheap plastic remote.
We did it with an arduino, but the result was messy, full of wires and not really aesthetic.
That's why we decided to go beyond that and make something we could really be proud of! We bought a new RC car (a better one this time), and though everything trough before boring head down in the hardware and the code.
We also decided to use the Intel Edison, which is smaller and corresponded to our needs.
You can use pretty much any RC car on the market, it only need to have one motor on the front (for the steering) and one in the back (to move the car).
Every car with those motors should work well.
We hope you'll enjoy our instructable as much as we enjoyed making the car !
Step 1: Setup the Intel Edison (Part I)
As you probably now, the Edison comes in two version, the Arduino board and the mini breakout.
Since we didn't need the arduino board, we used the breakout. Or actually, we used the Sparkfun's Baseblock so we could use other shields on the board. Sparkfun base block
The Sparkfun Base block is powered over the USB console port. So the USB OTG port stay free to be used for the webcam.
In addition of the baseblock and the edison, we are using Sparkfun's
dual H bridge. We could have done without it and do everything by hand, but we wanted to have a clean look. Sparkfun block dual H-bridge
Let's get technical and start setting up the Edison. We'll start with the hardware.
First step, you need to plug the Edison into the h-bridge and the baseblock.
You'll then need to plug the webcam. Plug it using an usb OTG, micro usb male - usb female in the OTG port. OTG examples
There's a lot of different webcams you can use, it just need to be UVC compliant.
You can check if yours is compatible on this list: http://www.ideasonboard.org/uvc/
Now that your camera is connected, plug in the battery. Any external phone battery should do the trick (as long it is 5v). We are using a 3000mAh / 1,5A battery and the autonomy is pretty good (images).
If you're looking for more ways to power your edison, you can check this instructable. The sparkfun baseblock allows you to power your board on the Console port, so plug it in and go to the next step where we'll set up the software.
Step 2: Setting Up the Edison (Part II)
For this part, I suggest that you'll check the Intel's website where the quick-start process is clearly described.
Once edison's wifi is correctly configured, you'll need to update your Edison. While doing
this tutorial on multiple Edisons, we had a lot of issues because of an outdated firmware.
On our edison the firmware version is 159 :
root@edison:~# configure_edison --version
159
Youhave many options too upgrade your firmware. I personally use the "configure_edison" to flash the .bin file downloaded with wget.
All you need is here :
https://software.intel.com/en-us/iot/hardware/edison/downloads
Once your Edison is set-up and wifi configured, you can execute our script :
root@edison:~# sh -c "$(wget https://raw.githubusercontent.com/wyd/edi-car/master/install.sh -O -)"
You can read it to execute step by hand and understand how it' working.
The main jobs of this script are :
First, you'll need to add some sources to Opkg, the package manager of Yocto (the Linux installed on your board).
It's pretty easy, you just need to add the following lines to /etc/opkg/base-feeds.conf.
src/gz all http://repo.opkg.net/edison/repo/all
src/gz edison http://repo.opkg.net/edison/repo/edison
src/gz core2-32 http://repo.opkg.net/edison/repo/core2-32
then run :
root@edison:~# opkg update
The output should look like a few lines saying Downloading (...) and inflating (...).
You can now install Git to get our fork of the edicar project.
Just type :
root@edison:~# opkg install git
When it's done, download the edi-car's repo by typing :
root@edison:~# git clone https://github.com/wyd/edi-car.git
Once you've got everything, it's time to go to the next step and connect the motors to the edison.
Step 3: Access the Car's Board, Change It and Connect Everything
Ok, know that everything is working, let's get our hands dirty and open the car.
The process is probably the approximately same on average RC car. But the main idea is that you get the electronics out, leave the motors and put the edison and battery in.
The battery only provides power to the card and the webcam, so you'll need to keep the car's battery in and charged.
Now that everything is running on the software part, we need to connect the existing motors to the Edison's dual H bridge. You'll just need to cut the motor's wires and a solder them to the H-bridge block (check the schematic in images or here).
The goal of a H bridge is to be able to send current into a wire (connected to a motor in our case) in both directions. It allows us the make the motors move in either ways. And since we have two motors, we are using a dual H bridge.
The connection is pretty easy since there's only six wires to connect. The schema shows you how to do it, it should be pretty straight forward.
If you check the code, you'll see that A is for the front motor and B for the back motor,but feel free to adapt the code or/and the pinout as you want.
Step 4: Get the App and Have Fun!
Now that your car is built, let's have fun with it!
For the aesthetics, we tried to fix everything nicely to the car and give it some paint job. It's of course to your discretion ;).
To play, simply start the Edison (with the car turned off or the wheels will go crazy). Our software should start automaticly.
After a few seconds (20, let's say), the camera should be turned on. You can now turn on the car as well, and connect to your Edison's wireless network (with your phone, computer or anything).
Go on edison URL (ex: "edison.local:8080") or IP (ex: "192.168.42.1:8080") and play !
Personally we used a QR-code generator to connect directly to the webapp, and we sticked it on the bottom of the car. Now we just have to flash it to go on the web app.
Use the arrows on a PC (and space to boost) or your thumbs on a mobile to control the car, it should be pretty easy.
We have plan to do more complex things with this project. A web site to follow the project's evolution is coming.
It's easy, don't hesitate to make your own and show us ;).
If you like what we do, follow us on Facebook!
Have fun and stay tuned,
The blackfoot team.