Ok... so let me start with...
I've been humbled by the sheer
simplicity with which some of these bots on LMR (Lets Make Robots) are made. Functional
and clean.
The one article that has made me rethink my strategy the most is Oddbot's article Pushing the limits with encoders
In
my Robot here, I use a RaspBerry Pi to talk to two Arduino's via Serial
over USB. The premise being that the USB was already there for
programming... might as well use it for communications. Then one of the
Arduino's is also an I2C master to various sensors, that it then
translates into serial feeds for the RPI.... hmmmmm.... can anyone say
"inefficient"?
I *had* investigated the option of using the RPI
as a I2C master, and the two Arduino's, along with all of the I2C
sensors would become slaves... looking back, I passed up on this quickly
because I would have had to build or buy a level converter.... really?
I've
spent probably close to $500-$600 on this thing so far... and yet a few
bucks... or more likely an hour at the soldering iron made my decision
for me.
I've struggled for WEEKS on timing issues related to
getting commands accurately into the Arduino running the motors (using
the Motorshield V3) which uses two PWM drivers, as well as the two
servos .... The UNO fully consumes Timer 0/1/2 to take care of these,
and so all code has to be devoid of "delay()" or "millis()".... Sending
a Serial command formated with specific start character, as well as a
command UID to be used to validate completion of the command back to the
RPI.
So.....
I'm going to step back for a week... regroup... reassess what functions are best suited to which processor, and clean it up.
Raspberry
PI being I2C Master. Arduino UNO retaining Motor control as well as
Wheel encoder and IR proximity, but as an I2C slave as opposed to
"Serial - hope-it-gets-interpreted-properly".
As I was simply
replaying the I2C sensors via serial for the RPI to interpret, store,
react, anyway.... This will be a workload removed from the UNO.
I
will still dedicate the Arduino FIO to managing the Sonar POD servos and
MAXSonar EZ1s, for now... but will communicate with the RPI as an I2C
slave.
I may ultimately be able to eliminate one of the Arduino's .... but we'll save that for the next robot.
Any suggestions, tips, words of kindness... laughter... bring it on...
References:
http://blog.oscaraConnect Raspberry Pi and Arduino with Serial USB Cable
Raspberry Pi and Arduino Connected Using I2C
Raspberry Pi and Arduino Connected Over Serial GPIO
Step by Step Guide on Making an I2C Slave Device with an Arduino
Arduino.cc: Arduino as I2C Slave ?
Instructables: I2C between Arduino's
http://digitalcave.ca/resources/avr/arduino-i2c.jsp
Raspberry Pi master controls Arduino UNO slaves via I2C
I2C communication between a RPI and a Arduino
No comments:
Post a Comment