« « Error Installing wxPython- No appropriate 64-bit architecture | Ultrasonic and Compass Out, Android In » »

Arduino RC Car Gets Bluetooth, Python Interface

Sep 11, 2012 by     1 Comment    Posted under: Arduino, Python, Self Driving Car
The RC Car with Arduino, Bluetooth, Compass, and Ultrasonic Sensors.

The RC Car with Arduino, Bluetooth, Compass, and Ultrasonic Sensors.

I spent some time yesterday getting the car talking to python on my laptop via Bluetooth. Configuring the Bluetooth connection was a huge pain. I would have everything working, then it would just stop working or start sending gibberish to the car. I spent a bunch of time combing through the code trying to figure out what broke it when it would just start working again.

Aside from that frustration, everything was pretty straightforward. I created a simple GUI in wxPython with two sliders, one for steering and one for driving. The sliders’ values range from -255 to 255, which correspond to the full range of possible motor speeds forward and backward for each motor. When the slider is updated, it sends the value of each slider to the Bluetooth interface, which is received by the Arduino and used to determine the power for each motor. I was surprised how well it worked, and how responsive the car was when a slider was updated.

Simple Python GUI

Simple Python GUI with slider for steering and one for driving.

Today I’m going to swap the sliders for a joystick type control so it’s easier to control both motors with a mouse. After everything is working smoothly, the next step will be to send sensor data from the car back to my laptop. My ultimate goal is to have the laptop process sensor data from the car and map out the car’s current location. Using current and past locations hopefully it can map out a route for the car and drive it autonomously.

I’m also running into some limitations with the Arduino. I want to hook up a camera to the car to try some real computer vision, but I don’t think the Arduino is powerful enough to process the images, or fast enough to transfer them to a laptop. To get around this limitation I’ve been looking at the Raspberry Pi, which I think would be able to do everything right from the car. I want to get as far as I can with the Arduino first though.

1 Comment + Add Comment

  • can you upload the code for the arduino and python please

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>