Let's Make Robots!

RPi - Arduino - iPad robot

Obstacle avoidance and streaming video (someday soon)

http://pinkypibot.blogspot.com/

Here is a link to my blog that has a lot of project details. Current code available as txt files Arduino and Python.  UPDATE 08-19-2013: I now have the iPad app (RasPiConnect) operating and the bot doing basic obstacle avoidance. Integrating camera next, then some OpenCV processing.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
How are the two connected?

You may want to add more info about your bot as well to help others.
What do you get when you do: sudo i2cdetect -y 1
Do you see the Arduino at your listening i2c address?
You may want to not run the arduino off the pi's 5v supply. That will cause problems later if not now. You could use the 5v supply from the l298 board as a temporary supply for devl work.
I know from my experience with the pi, it gets power hungry fast with usb adaptors and networking.

I would just use one l298 board for those motors. 2 per channel should be fine, but thats just a "kiss" perf on my part.

Thanks for the help / advice, greatly appreciated.  I didn't know whether one l298 would be OK or not so I went overkill.  I'll simplify.

I'll try the i2cdetect tonight.  I did do that early on and got the address.  I know that i2c comm is working at least for a while, since I'm able to actually send commands and the Arduino responds appropriately, for a while, then it fails. For development I have the bot up on a stand and am using the serial out of the Arduino to monitor the ping distance and the RPi terminal is printing out the commands and a return string from the Arduino so I can see that it's working for a while.  Here is an example of the error message in the RPi terminal from the Python program.  When I figure out how I'll upload the code.

Exception in thread Thread-2:

Traceback (most recent call last):

  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner

    self.run()

  File "/usr/lib/python2.7/threading.py", line 505, in run

    self.__target(*self.__args, **self.__kwargs)

  File "pibot.py", line 87, in txrx_i2c

    toWrite(bytearraytowrite)

  File "pibot.py", line 22, in toWrite

    bus.write_byte(address, i)

IOError: [Errno 5] Input/output error

 

For anyone interested, there is considerably more info in the blog (see link in first post), but the wiring diagram would probably be helpful to repeat here.  The blog is really intended as a project diary with my grandaughter.

BTW, the basic project is a takeoff on Ladvien's Blueberry Pi... Thanks!

Over the weekend I tried everything I could think of with all resulting in better stability but it always fails: HARDWARE - powered Arduino from the h-bridge 5v, re-wired several components to ensure good connections, fixed a ground connection, and tried bypassing the level shifter completely (read a lot of articles that said this was safe due to the Pi internal pull-ups). SOFTWARE - disabled the software activation of the internal Arduino pull-ups in the Wire library, created a simple Arduino sketch without all the motor and sensor routines. Several times I could get it to run for quite some time and confirmed good comm but always it would fail and when it did I would check i2cdetect and the 03 address was always there in addition to the 20.

I loaded the code to my bot tonight and let it run. 

At varing times it would bail with the error, sometimes with an i2c corruption (03) and others with none. 

I changed the timer.sleep to 100ms and made sure it matched in the dunio code.  That seemed to help some, but it stilled bailed. 

I feel sure it's a timing issue.  I would try a more serialized approch to it for at least a test.

See http://blog.oscarliang.net/raspberry-pi-arduino-connected-i2c/ for a simple example.

For my bot, I will be using a combonation of i2c and psedo interupts, and will publish the code as I move along with it. I will use C, but may look more into using python as well.

I just got my devl computer back in order this weekend so am just getting to the code.

 

*NOTE: I tested with two different lvl shifters (China cheapie and the EzSBC.com board) as well with none.  All giving the same results.

I also noticed (for me anyway) if it failed on a write, it did not blast the duino i2c connection and no 03. On a write fail it did though.

I'm actually evaluating RasPiConnect app and server for the iPad interface now. It seemed a bit easier than NetIO but we'll see. I have the Pi and iPad talking but haven't had time to integrate the robot commands into a UI yet.
RasPiConnect up and operating. Controlling bot from iPad and displaying sensor data and camera stills. Using time lapse in Raspistill saved to a file that RasPiConnect sends to the webview on the iPad. Problem is the refresh rate is limited to 3 sec or more so it's not optimum but it works. I may try using safari for a video stream and RasPiConnect for controls.
I'm using 8 x AA NiMH rechargeables for the motor drivers and they seem to drain pretty quick...is that normal?