Arduino YUN powered Home Surveillance Rover

In a previous article (Internet of things), we looked into how to make a Web Controlled Mobile Home Surveillance rover. In this article, we will look into how to optimize the previous rover in every ways possible.

Disadvantages of Rover V1
1) The cost of building the rover was exorbitant. There were many circuits involved which could have been avoided.
2) There was an additional cost involved and this was the power cost. In order to power these circuits, many power supplies were required because every circuit had different voltage and current requirements.
3) Another factor was that the HTML used to control the rover was coded without AJAX which meant every command required whole page load. This caused many requests to the Rover to be skipped as the Wifi shield was not able to handle it and controlling the rover was very difficult.
4) As the eye of the rover was through Raspberry Pi camera and control was through Arduino, the viewfinder and control page were different and hence navigating the rover was difficult.

Advantages of Rover V2

1) The cost of building the rover was brought down as instead of 4 boards (i.e. Arduino UNO, Arduino Wifi shield, Arduino Motor shield and Raspberry Pi), only 2 boards sufficed (i.e. Arduino YUN and Arduino Motor shield).
2) Power cost has been reduced as only 2 boards have to be powered.
3) Controlling the Rover has become very smooth as AJAX requests are very efficient and the YUN handles these very efficiently.
4) The viewfinder and Controls are on the same page using iframes.

Arduino Yun Rover

Components Used

For Body

DFRobotShop Rover Chassis Kitdfrobotshop-rover-chassis-kit-2

This forms the basis of the vehicle. The kit includes Tamiya Twin Motor Gear Box (Kit), Tamiya Track and Wheel Set, DFRobotShop Rover Lexan Plate, Metal Brackets, Mounting hardware and a couple of motors. The problem with these motors are that the optimum voltage required by them is pretty low at around 1-1.5V. So if you drive it continuously at higher voltages, it will spoil the motors. Buy the kit here for USD 39.43.

DFRobotShop Rover Expansion PlateExpansion of rover via lexan plate

This component goes on top of the Chassis Kit and can be used to mount additional hardware. Since there are so many components, it is better to have it although I must say it is expensive. Buy here for USD 20.39.

Brushed DC Motor 6V, 11500rpmbrushed-dc-motor-6v-11500rpm

I used these motors as the Arduino Motor shield is driven by 7.2V (6×1.2V batteries) and thus 6V is closest to it. Also, the motors have the same form factor as the included motors, so it fits perfectly into the Gearbox. Buy here for USD 1.79.

For Brain

Arduino YUN

ArduinoYunFront_2_450px

This component forms the brain of the whole project. This is what controls the speed, direction, brakes, etc. of the rover. Also, this is used to control the Pan Tilt mechanism for the camera. Since a YUN has linux on it, we can connect a USB Webcam for our viewfinder. It has built-in Wifi which eliminates the need for a Wifi shield. You should be able to procure this item locally as it is very common amongst kids and college students.

Arduino Motor Shieldarduino-motor-shield-v3

This is the power behind the motors without which you cannot power and control the motors as the current requirement is high and which the Arduino cannot natively provide. It can control 2 independent DC motors. You can get it online here for around USD 30.

For Eyes

The best thing about using the Arduino YUN is the Linux it is running. Also, there is a USB port on it on which we can connect USB peripherals. Using an ordinary webcam which supports UVC, we can give eyes to our project. In this project I have used logitech HD Webcam C270.

Logitech HD Webcam C270

Logitech HD Webcam C270

You can refer to the Arduino site to install, configure and test the Webcam. Also, you will have to start the webcam at boot so that you don’t have to run the script manually.

Dagu Mini Pan and Tilt Kitdagu-mini-pan-and-tilt-kit

This kit is what controls the direction of the camera. You should be able to procure something similar locally. If not, you can get it here for USD 15.

Assembly

I will not be discussing how to assemble the rover as this has already been discussed in the previous article. I will only discuss the electronics aspect of the project. The Arduino motor shield is mounted on top of the Arduino YUN. Power to the motor shield is provided by a set of 6 rechargeable batteries. Power to the YUN is provided by a battery bank. In order to stop the motor shield feeding power back into the YUN, I have bent the Vin pin of the motor shield. There are 2 servo motors which are connected to pin A2 and A4. The webcam is connected to USB port of the YUN.

Accessing the Rover over the Internet

The better way to make the Yun web page accessible over the Internet is via Yaler service. You can access the procedure here. Also, add it to startup so that you don’t have to manually run the script. After this, the page should be accessible as http://gsiot-xxxx-xxxx.try.yaler.net/sd/rover. The problem here is that although the control section of the page will be visible but the viewfinder iframe will not be seen because it is not accessible over the Internet. I have put the public ip address of my Internet in the iframe section and done port forwarding on my router for port 8080. I wish there was easier method via Yaler itself.

Sketch and HTML Upload procedure

If you have an sd card in the Yun and an /arduino/www created in the root directory of the sd card, the Yun will automatically transfer the HTML you wrote from your sketch directory to /arduino/www/sketch folder. For example, if my sketch is in \Documents\Arduino\”sketch” folder, I will have to create a folder www in “sketch” directory and have my HTML as index.html. Now when I upload the sketch using wifi, the index.html will be placed in /arduino/www/”sketch”/index.html in the Yun and you can access this page by entering “http://ip address of yun/sd/sketch”. Following is an example video explaining the above procedure

Sample Video

Video Tutorial for accessing Arduino YUN over the Internet

Project Files

You can find the HTML and sketch files here

 

8 thoughts on “Arduino YUN powered Home Surveillance Rover

    • I have added a “Project files” section so you can download from there. The files I have added is a modified version of the one on the page as I keep upgrading it however possible.

      • hello,
        I’m trying to transfer the sketch into the yun, but the foolowing message (‘process’ was not declared in this scope), appears. What should I do ?
        I have exactly the same components.Should I include librairies ?
        Thank for your feedback, and great job.
        Chris

      • You must have all the 4 libraries installed. If you install yun board in the IDE, you should get the libraries. Whichever process error you are getting, its library has to be present.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s