15.01.2016 Views

YOUR OFFICIAL RASPBERRY PI MAGAZINE

6014BX9nm

6014BX9nm

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

REMOTE CONTROL SPY ROVER<br />

Projects<br />

the rover to reverse, I make both<br />

motors turn anticlockwise. In case<br />

the rover needs to turn right, I<br />

stop the right motor and make the<br />

left motor turn clockwise, and the<br />

same logic applies when the rover<br />

needs to turn left.”<br />

With the mechanics in place,<br />

Stratos turned his attention<br />

to the controller. It made sense<br />

Rover. “After a lot of research, I<br />

found out that I had to use some<br />

libraries, written in C++, inside<br />

the Android app to accomplish<br />

my task. Fortunately, I found<br />

another project that had solved<br />

this problem, so by using parts<br />

of the source code, I was able to<br />

complete the implementation<br />

of the Android application.”<br />

I came up with the idea of cutting<br />

a USB cable and joining its power<br />

cables to those of the UBEC<br />

to use a controller with a screen<br />

so that he could see through<br />

the webcam. Eventually, he<br />

decided to build a controller app<br />

for Android and control the Spy<br />

Rover directly from a phone.<br />

“I have developed some Android<br />

applications in my spare time,<br />

so implementing an Android<br />

application for this project was<br />

not so difficult.”<br />

As Stratos discovered, streaming<br />

the video would prove a bigger<br />

challenge than controlling the Spy<br />

Aside from video streaming,<br />

the hardest part of the project<br />

was power. “The Raspberry<br />

Pi requires a constant power<br />

supply of 5V voltage and up to<br />

3A current. After some research,<br />

I decided to buy a UBEC (Universal<br />

Battery Eliminator Circuit),<br />

which provides 5V from an input<br />

of 5.5V-20V and is capable of<br />

supplying up to 3A. Then I bought<br />

a battery box of six AA batteries<br />

to provide enough voltage (9V)<br />

to the UBEC.<br />

“The next challenge I faced<br />

was connecting the UBEC to the<br />

Raspberry Pi. I had to find a way<br />

to connect the power output wires<br />

of the UBEC to the USB connector.<br />

Fortunately, I came up with the idea<br />

of cutting a USB cable and joining<br />

its two internal power cables to the<br />

output power cables of the UBEC;<br />

this was my real eureka moment.”<br />

Stratos aims to make the next<br />

project faster. “The plan is to<br />

transfer the rover to a plastic toy<br />

car with normal wheels.”<br />

Above The parts<br />

are wired up using<br />

a breadboard.<br />

This enabled the<br />

Raspberry Pi to<br />

be tested with the<br />

L293D controller<br />

and motors<br />

HACK <strong>YOUR</strong> SPY ROVER<br />

>STEP-01<br />

Dismantle the toy<br />

Rather than build a robot from<br />

scratch, Stratos decided to modify a<br />

remote-control toy. The Spy Rover started life<br />

as a Big Bargain King Force Excavator. This<br />

toy comes complete with tracks, as well as<br />

motors that can be modified to work with the<br />

Raspberry Pi.<br />

>STEP-02<br />

Adding the Raspberry Pi<br />

The top half of the King Force toy is<br />

an excavator mechanism, which was<br />

removed to provide a base for the<br />

Raspberry Pi, WiFi dongle, webcam,<br />

and batteries. The L293D controller is<br />

slotted into a breadboard and wired<br />

to the original motors inside.<br />

>STEP-03<br />

The Android controller<br />

The toy connects to a local WiFi<br />

network, and a custom-built Android<br />

app is used to send commands to the<br />

Raspberry Pi. Meanwhile, the view from<br />

the webcam is bounced back to the<br />

Android app. The result is a remotecontrolled<br />

Spy Rover.<br />

raspberrypi.org/magpi January 2016<br />

37

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!