

Show HN: I built a Raspberry Pi/Android driven toy car - doctoboggan

I am not sure if this is fits the HN community, but I am posting it here if people are interested.<p>This is the current iteration of the car: http://i.imgur.com/ko8YBh.jpg<p>Details:<p>I wrote a simple android app that streams the accelerometer data from the phone to the pi over a simple socket. The pi then uses this data to drive the DC motor and the servo motor. Tilting the phone to control the car feels very natural.<p>In this[0] pic you can see the wifi dongle I've used. I am using Adafruit Occidental v0.2[1] as my OS because it has support for my wifi dongle. It also makes some hardware interaction easier and comes pre-installed with some good python libraries.<p>Here[2] is a picture of the breadboard. I am using the L293DNE[3] hbridge chip for DC motor control. The two black wires you see coming off the board connect to the motor.<p>In this[4] pic is the battery pack I am using to power the pi. I purchased it on amazon here[5]. Here is a pic[6] of the battery pack I am using for the DC motor.<p>Here[7] is a closeup of the steering servo. It is an HS-55[8] and I power it directly from the pi's 5v rail. To control it I use the servoblaster kernal module[9].<p>My next plans are to add some sensors and make it autonomous. Let me know what you think.<p>[0] http://i.imgur.com/w0PIk.jpg<p>[1] http://learn.adafruit.com/adafruit-raspberry-pi-educational-linux-distro/occidentalis-v0-dot-2<p>[2] http://i.imgur.com/hhogr.jpg<p>[3] http://www.mouser.com/ProductDetail/Texas-Instruments/L293DNE/?qs=sGAEpiMZZMtYFXwiBRPs0wSafWlCmJbc<p>[4] http://i.imgur.com/3t6NG.jpg<p>[5] http://www.amazon.com/PowerGen-External-Blackberry-Sensation-Thunderbolt/dp/B005VBNYDS<p>[6] http://i.imgur.com/zpgyj.jpg<p>[7] http://i.imgur.com/b8Qnc.jpg<p>[8] http://www.servocity.com/html/hs-55_sub-micro.html<p>[9] https://github.com/richardghirst/PiBits
======
mmastrac
Fascinating project. This is definitely HN-worthy.

~~~
adriand
Agreed, this is really cool. Can you post a video that shows you driving it
while tilting your phone?

~~~
doctoboggan
I just had my roommate film me controlling it. Here is the video:
<https://www.youtube.com/watch?v=tfuv-B1X3ck>

~~~
adriand
That is really cool! Seems to me you're close to having a product you could
sell. Nice work!

------
jaryd
I'm actually on the brink of getting into amateur robotics... I just bought
"Robotic Explorations: Hands on Introduction to Engineering"
([http://www.amazon.com/Robotic-Explorations-Hands-On-
Introduc...](http://www.amazon.com/Robotic-Explorations-Hands-On-Introduction-
Engineering/dp/0130895687)), and am planning on getting a HandyBoard kit.

I was wondering if there are any K'Nex or LEGO Technic kits that are
particularly well-suited for this type of endeavor? I have found plenty of
kits to build a wide variety of vehicles, but it's hard to anticipate what
will comprise a good assortment of build pieces for a more free-flow
introductory robotics project.

Any thoughts or advice on this subject would be greatly appreciated!

Thanks in advance.

EDIT: Awesome project, by the way :)

~~~
doctoboggan
The hardest problem on the mechanical side was connecting the motor to wheels.
You will often need to gear down a motor before you connect it to the wheels.
Without the ability to custom manufacture parts it is very difficult to cobble
something together. The simplest solution is to buy a motor with a prebuilt
gearbox, axel, and wheel. I don't remember where I got mine but something like
this should work: [http://www.amazon.com/KNex-Dragster-Racecar-Rally-
Series/dp/...](http://www.amazon.com/KNex-Dragster-Racecar-Rally-
Series/dp/B0024H3Z2M/ref=pd_sim_t_5)

~~~
jaryd
Thank you for the tip! I was actually just reading about gearing in an article
called "The Art of LEGO Design"
([http://cheme.eng.wayne.edu/neuron/LEGO_ROBOTICS/artoflego_ar...](http://cheme.eng.wayne.edu/neuron/LEGO_ROBOTICS/artoflego_article.pdf))!

Was also looking at Technic kits (such as <http://shop.lego.com/en-
US/Tractor-9393>) with a preference towards those with more pieces, and thus
more flexibility.

~~~
doctoboggan
That paper is great, thanks for sharing! It looks like I need to buy some lego
technique parts.

------
recantha
Brilliant project. Thanks for sharing. You should send this to the people at
raspberrypi.org and/or adafruit.com as I'm sure they would feature it. I'm
going to reblog it at www.recantha.co.uk and put all the images inline to make
it easier to read. Nice one!

~~~
recantha
Reblogged here: <http://www.recantha.co.uk/blog/?p=980>

------
luanfernandes
Great project! I'm really curious about robotics/automation stuff and this is
one of that awesome projects that show how it's really unlimited what you can
do in that area

------
lewispollard
I've been thinking about doing something similar with an air swimmer, but
mounting the pi on the actual swimmer would weigh it down too much to fly.
Instead I was hoping to break open the RC unit and trigger the signals via the
GPIO pins or something. I don't know much about electronics so it's a pipe
dream, any ideas how feasible this is?

~~~
doctoboggan
I would have to see the remote controller before I can say for sure but that
seems feasible.

Most often joysticks in controllers use potentiometers (variable resistors).
You can simulate the effect of a potentiometer using PWM, or you can buy a
digital to analog converter.

------
navneetpandey
Just saw the video it's awesome idea to control bot by accelerometer.

------
sirx
Hi, very interesting project! Could you tell me how you have connected the
phone to the raspberry and shared the accelerometer data? Thank you very much

~~~
doctoboggan
I implemented a socket server in python on the raspi. I wrote a very simple
android app that opened a connection to the pi and continuously streamed the
x, y, and z coordinates.

You can see all the raspi code here: <https://github.com/jminardi/RobotBrain>
And the android code here: <https://github.com/jminardi/RobotBrain-Controller>

------
cookingrobot
Has anyone had success driving motors directly from an Android device?

------
stephengillie
I'm doing this with Arduino. We should talk.

~~~
doctoboggan
Definitely, my contact info is in my profile. I found my biggest pain point
was real time control, specifically for the servo. The arduino is a much
better real time controller, but you lose the modern OS.

~~~
VexXtreme
Well, you can always use Arduino for the main control loop and use Pi on top
of that for telemetry and other things. This is probably the approach I'm
going to use in my quadcopter... A non real time OS just won't cut it for a
UAV.

------
jbcolmena
Awesome ...

