Please welcome Carmadillo, a UDOO powered, Android Controlled and Fun Driven Rover!
This Project was such an amazing task for us, and we’re really proud of what we achieved. So, let’s see what this tiny little Rover is capable of:
- Remote Control via a custom Built Android Application, it can go forward and backwards and steer
- Video Stream from UDOO’s camera module to Android App
- Camera can tilt and rotate
- Reach extreme levels of amaziness
This was achieved by stripping down a 30 dollars old RC Car and hacking its internals, then the rest is all software wizardry. The recipe:
THE BUILD PROCESS
You know, that here in UDOO’s HQ we enjoy recycling a lot, and giving new life to old electronic components is always a nice challenge. So, we got an old RC Car, and prepared it to become the chassis of Carmadillo. We were lucky to find an RC Car that was powered by 8 type AA batteries, providing a grand 12 volts and 1,5 Amp of power. As you may know, UDOO needs at least 6 volts to work properly and about 500mA @12 volts to operate at medium loads. So, with 1,5A we had enough power to operate both UDOO and the motors of the RC Car.
So, we tore apart old electronics, and installed UDOO paired with a Arduino Motor Shield. We then connected the 2 stepped motors to it, and hooked up the Camera Module. Once this was done, we took care of the Rc Car motors, connecting both the drivetrain and the steering mechanism to the same Motor Shield. So, the Battery Pack will feed directly Udoo, and all the motors are fed on demand trough the Motor Shield, which will use the same power Rail (from Udoo). We choose this wiring method, less is more when weight is important!
We then fed Power trough UDOO’s auxiliary DC connector, and surprisingly, nothing blew up. Hardware Hacking done!
THE SOFTWARE SIDE OF THE MOON
Then we took care of the software. We knew we had to set up different parts of the system to work seamlessly together:
- A minimal debian filesystem, optimized to run as smooth as possible in order to reduce latencies and decrease power consumption (every mA counts!)
- A server that will listen to the Android Client communications, and forward them to
/dev/ttymxc3
serial port, letting Sam3x Arduino processor to control the motors via the motor Shield - An Arduino Sketch, that will get sorted the last above step
- A RTSP Server, which will stream Camera Video to the Android Client Application
SYSTEM SET UP
As base system we choose the minimal Ubuntu 12.04, and we installed few more utilities we needed:
- Oracle Java Environment, all the steps required are covered here
- Add librxtxSerial, to handle serial communications, follow the steps here
- Installed compiler tools and more libraries
- Install wicd-curses to manage Wireless Networks without a GUI
After you’ve connected to your Wireless-Network via Wicd-curses, congratulations! Your system is set up!
JAVA UDP SERVER
This is the software control unit of our Carmadillo Rover. It receives Udp commands from the Client Android App and then translates them to serial, to allow Sam3x Arduino Compatible controller to operate the motors via the Motor Shield.
You can find the carmadillo.jar server, and the complete source code on UDOO’s project github
RTSP SERVER
The RTSP Server will just grab the video from the Camera Module and stream to our Android Client App. We used the Freescale provided element mfw_v4lsrc, as described here. Then we set up the RTSP Server, with
We then compiled it with make, please note that you should of course create correct symlinks for makefile libraries.
An example application can be found in this excellent tutorial. As usual, you can find the complete source code on UDOO Project’s github.
To execute all the above on startup, and allowing proper serial operations, we added those lines to rc.local init script:
This will, in order:
- Create a symbolic link between serial and ttyS0
- Wait 60 seconds (to ensure Wi-Fi is connected)
- Start the RTSP Server
- Launch the Java Server
ARDUINO SKETCH
Last but not least, we compiled and uploaded this Arduino Sketch:
It translates commands received by the Java server to allow Motors control. Simple and effective!
ANDROID CLIENT
You see, all the code above results just in a still Carmadillo. What we need now is an handy way to control it! Since this is our Mk1 version of Carmadillo, we opted for a dirty, but effective way to achieve Camera Vision and control in the Same UI. We created an overlay application with 2 joysticks (right one is for camera sight movement, left one is to control Car’s direction and speed), then we launched an instance of VLC, connected to our RTSP stream. May not be the most elegant solution, but sure it works!
Our biggest challenge here was to achieve the lowest latencies possible. By carefully optimizing the RTSP server, serial speed, and the Arduino sketch we achieved a 500ms latency, both for controls and camera streams.
To take a look at the App code, you know github is your friend , and if you want to discover where we took inspiration, you can just stumble here and here
Thats it! We had a lot of fun with this Project, and we do really hope this will be inspirational also for you guys. As previously mentioned, this is just a MarkI Carmadillo, we already heaten up our soldering irons and started working on an improved MkII version, which will feature a Semi-Pro RC Car and even more funtions (some have heard nightvision and obstacle detection, but that’s just gossip! ).
So, have fun with UDOO and never think your imagination is too much to become real with it! Stay tuned and let us know what you think in our forum!
Comments