My plan: building a snake from 8 servos (snake built from 9 sections, 8 servos to turn them (4 servos can turn the next part left or right and 4 servos can turn the next part up or down, the different turning directions would be interleaved for flexibility)).
Current design idea:
- * RPI does the thinking and communication with the rest of the world over wifi
* Atmel's avr-s (atmega328 in my case) are in charge of driving servos
* RPI would communicate with the atmega over I2C bus from the GPIO connector.
* Servos pick up timings from atmegas and turn the sections.
- * rpi with a nano wifi card
* 2 atmega328 chips (and an avr dragon to program these over isp programming)
* 8 digital servos (got them pretty cheap from hobbyking)
* some leds and other common circuit parts (and a 3300 uF cap to stabilize the voltage)
* 4xAA NiMH battery pack
- * power (rpi and atmegas can share the power easily, putting the servos on the same power source is stretching it quite a bit (even with a big cap and when using the servos one by one))
* stability of communication
* debugging on the run what the atmegas are doing
* having to write some C code for the avr-s to translate the I2C messages to servo states.
My reasoning why i don't drive the servos directly from RPI's GPIO:
1) too afraid to lose my RPI (it would take a while to order a new one)
2) i don't want to stress the timings, RPI is good at running linux and atmegas are good at timing servo signals, in addition the atmegas have 6 pwm channels each ...
3) atmegas have some other nice features that i may want to use at some point (i will still have several unused i/o pins
Little ascii art to demonstrate the idea too:
If you have any good suggestions to share, please do (and if you want to steal part of the idea, please do, i don't mind).
Code: Select all
RPI || || /* I2C bus */ || || servo1 servo2 servo3 servo4 || = atmega328 ---------(pwm channels) --------/-------/------/------/ || || servo5 servo6 servo7 servo8 || = atmega328 ---------(pwm channels) --------/-------/------/------/ || || = /* any other future device i want to add here, as long as bandwidth can take it */ ||