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.
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.
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.
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.
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.
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.
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.
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.
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.
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
Video Tutorial for accessing Arduino YUN over the Internet
You can find the HTML and sketch files here