Off-Topic Android controlled Raspberry Pi based remote control car with webcam

Discussion in 'Off-Topic Chat' started by SpeedyGee, Wednesday 17th Apr, 2013.

  1. SpeedyGee Administrator Staff Team

    England Speedy Birmingham
    14,999
    5,593
    4
    I've started a little project for my 6 year old son, I'm going to attempt to make from scratch a small remote control car with a webcam on it.

    To control the car I'll need to write an Android application. The Android application will talk to a little computer called a Raspberry Pi (which will live on the car), it will display the output of the onboard webcam on the Android device and also recieve control instructions from the Android.

    A Raspberry Pi (also called RPi) is a credit controlled sized compuer that you can buy for under £30. It has input and output ports which you can use to control and monitor stuff.

    rsz_raspberry-pi-b-256.

    So the idea is that this little computer will be built into the remote control car, it will wirelessly communicate with the Android device, recieve control instructions and stream the webcam data.

    For the remote control car I've decided to go for tank control style steering, so I've ordered four high torque motors.

    $T2eC16FHJFoE9nh6m+lpBP4)bIkb5w~~60_12.JPG These will work in pairs, so left side motors work together, right side motors work together.

    The motors require a 12v supply, so I'll need a "h bridge" motor controller board to link the 3.3v low amp control signals from the RPi to control the motors. A H-bridge is a circuit which enables a voltage to be applied across a load in either direction.

    I could buy a H bridge chip and make my own H bridge controller circuit but it's easier to just buy a ready made H Bridge motor controller cricuit board.
    So I've chosen this dual H bridge controller (dual as I want to control left and right motors).

    $(KGrHqFHJBsE-+yefv7lBP4KTBQnqQ~~60_12.JPG

    To allow speed control of the motors I'll need to implement some Pulse Width Modulation (PWM) from the RPi.
    I need to have think about how I will implement this but basically I think I'll need to write some software to generate pulses on the RPi of varying length to control the speed of the motors.

    I will also need to install a 12v (rechargeable) power source on the car and install a 5v voltage regulator to run the RPi.

    That's the hardware side, on the software side I'll need to write an Android application to display the video stream and also send control commands, on the RPi I will need to find some software to send the video stream and write some stuff to process the control commands coming from the Android device.

    I'm gathering hardward stuff together at the moment, I'll keep you posted as I make progress .. probably slow progress.
     
    Loading...
    DeviateDefiant likes this.
  2. Ichiban Founder Staff Team

    England CJ Leeds
    30,129
    6,381
    516
    We should have a AOC RC car of any choice .. Looking forward to this.

    mate if you do this we can do kits for members.. or my mind has gone into overdrive!!:Hooray:AOC RC meeting coming close to you .
     
    Loading...
  3. SpeedyGee Administrator Staff Team

    England Speedy Birmingham
    14,999
    5,593
    4
    LOL, funny idea CJ. You'll need a new section on the forum... "AOC RC", so everyone can document/discuss mods and performance enhancments to their AOC RC car :Smile:

    I'll start with bigger wheels and an NSX Bodyshell :Happy:
     
    Loading...
  4. ArcticFire-Account Closed Banned Getting Started

    Scotland Graham Scotland
    3,521
    1,051
    7
    Sounds like a really interesting project, well beyond what I could do. Was wondering, would reverse engineering an off-the-shelf remote control car help at all?
     
    Loading...
  5. Ichiban Founder Staff Team

    England CJ Leeds
    30,129
    6,381
    516
    NSX shell for me too at 12 quid its a steal (dead link removed by staff)
     
    Last edited by a moderator: Sunday 15th Feb, 2015
    Loading...
  6. Ichiban Founder Staff Team

    England CJ Leeds
    30,129
    6,381
    516
    Why not mate if you make the kits and we assemble them and race them! it will be ace. I would like to know the hardware cost once you have completed.
     
    Loading...
  7. SpeedyGee Administrator Staff Team

    England Speedy Birmingham
    14,999
    5,593
    4
    Yes, that's perfectly possible but most of those are radio controlled. I wanted to control it from an Android device, so all that circuitry would just be ripped out, so lots of wastage.

    Also I wanted to have a go at doing this all from scratch.

    Ohh nice .. but very low profile .. doubt I can get everything to fit into that.

    I will get this up and running as ugly as it maybe and worry about cosmetics later.
     
    Loading...
  8. ann_kelvin Club Member ★ ☆ ☆ ☆ ☆

    This is going to be an excited project! Keep us posted on the progress :Smile:
     
    Loading...
  9. SpeedyGee Administrator Staff Team

    England Speedy Birmingham
    14,999
    5,593
    4
    I aim to spend about an hour on this project most days of the week.

    So today's hour was spent setting up the RPi to run on the battery pack that I've just received through the post.

    I ordered a 2600mAh Ni-MH battery pack and charger.

    Here is everything plugged in :-

    rpi_carrc.

    This picture is actually taken by the webcam attached to the Raspberry Pi itself :Smile:

    Those of you that have played with Raspberry Pi's will know that they are very sensitive to power supplies.
    Yesterday I had trouble getting both the Edimax wireless dongle and the Logitech webcam working together, I traced this down to the fact that the 5v power adaptor I was using wasn't providing the RPi with enough current to the run the RPi plus the webcam and wifi dongle together.

    When I switched over to using the 2A rated power supply for my Galaxy Tab 2 tablet, everything started working together happily (as opposed to only the wifi dongle or only the webcam).

    So I was really pleased when both worked just fine running off this NiMH battery pack. That's another tick in project todo list.

    I'm current using mjpg-streamer software to stream the video over http. I've found that the refresh rate isn't particularly great, but it's a start and it works. I'll look at other alternatives at some point, see if there is anything else out there.

    I chose the Edimax wireless dongle as its compact and listed on the RPi site as being the compatible with the RPi. I'm not sure what range it will give, we'll cross that bridge when we get to it.

    rsz_edimax-usb-wifi-dongle-500x500.

    I chose the Logitech C310 camera as it is a UVC (Universal Video Camera). This means that it will have Linux UVC drivers available for it (the RPi runs a Linux OS).

    41QNcbkM9OL._SY300_.

    So that's today's update .. the setup has been successfully tested on battery power, which is a big relief :Smile:

    Tomorrow I'll try and get some motor control going from the RPi.
     
    Last edited: Wednesday 17th Apr, 2013
    Loading...
  10. Ichiban Founder Staff Team

    England CJ Leeds
    30,129
    6,381
    516
    Spot just shows the level of attention required to achieve perfection.