Yun based web controlled rover
Last week I bought an Arduino Yun from my local Radio Shack. It was on clearence just as all the items there due to closing :(
I wanted to do something with it, so decided to make a simple web crontrolled rover. My plans are to use the Yun bridge and communicate with the the rover from a web browser using some lite ajax (javascript/html) calling a REST interface on the bot.
The build was simple, as I used a metal chassis from Robotkits India along with 4 of their 60rpm gear motors and a set of tracks and matching wheels. The motors are controlled by a L298 shield with a motor control library I wrote for the L298/L293. The Yun gets it power from a 2600mah Duracell USB Li-ion pack and the motors are powered from a 11.1v 1600mah Lipo. I have also installed an 8gig sd card to boost the Yuns storage space (7meg I think)
As of now, I have the Web code mostly worked out and coded as well as a base code for the Arduino uC side. There was NO linux code written or needed and it uses just the stock Bridge service and libraies for all communication. I will be adding a pan and tilt turret along with a Logitech webcam and a simple setup with fswebcam (for testing) Later I plan to do full realtime streaming to the webpage.
The first draft of the HTML is included if you care to have look (no images included for now). The interface screen looks like:
I have it coded in the javascript to allow for keyboard control. It's a simple interface that allows easy (kind of :) contol of the rover. I will feed the POV image back to a div on the webpage. All actions to the rover are sent via a http REST calls (like a url).
An example, to get the bot to start moving forward you would do a http GET (send) of 'forward' to the webserver on the Yun. This will be processed and sent to your listening sketch (via the bridge interface and library) on the uC side. This is a simplified explanation of course.
So far it's been very easy to get it to work, with just a few issues here and there. The code included have these issues all worked out. The Yun is a great way to use Arduino with Linux. It gives you the 5v ease of interfacing with things like sensors, lot's of shields, built-in wifi and internet connectivity, and access to the Arduino libraries (thats good and bad :-)
Pros:
- Easy to use and setup (via a web browser)
- Access to Arduino IDE
- Arduino Shield access (though you might need header extenders or a screw shield)
- Very small!
- Lives in a 5v world
- Arduino library access (like I said, good and bad)
- Linux!!!
- Lot's of supported packages
Cons:
- Slower than a Raspberry Pi or PCduino
- Cost more than a Pi, but does have a uC onboard
- Uses more power than a standard Arduino
- To get shields on you may need an "adaptor" like a screw shield
- Small amount of built in NAND flash (can be extended via external SD card)
It's still a work-in-progress, and I will post as I get things done (a video as well). The next step is to mount the turret and webcam. I will post all of the completed code to Github later.
Feb 17, 2015 Update
Mounted the webcam (without the turret) and found out I need more room on this little chassis. I will be adding a second deck to it and place the batteries on the first level and the Yun and turret/webcam on the second. This will also give me room to "hide" the usb cables along with the batteries. The 2600mah Li-Ion running the Yun is not giving long running results with the addition of the cam. The run time with both is @ 30 mins now. I am looking into another power pack in the 15k-20k range, but may just use another lipo and ubec. I was able to feed the images from the webcam back to the webpage and have it update automaticly (with the image under the contols). Will look into using real live streaming later.
Feb 21st, 2015 Update
Found an aluminium plate to make a top deck. Dilled it out and have it mounted now. Posted new pic. Added code to do 45 deg turns and options to turn the webcam on and off. Will be posting the code on Github soon. Debating adding the turret now, not sure if it's needed, but dilled the holes already just in case. Hope to get out tomorrow and shoot a video.
Feb 22nd, 2015 Update
Changed screen shot to refect not keeping (or at least using) a pan and tilt servo setup. Just going with plain ole POV and will not need it. Set it up to stream video with mjpg_streamer and the new screen shot shows that. Please ignore the mess in my spare room :)