The Raspberry Pi 3 has ability to rapid fire pulses out of its GPIO. It’s surprising how fast! In other words, it can handle a lot of tasks.
If the only thing the Pi is expected to do is spin a stepper or servo motor really fast, this is good news. Theoretically, the Pi can send pulses to the motor driver faster than most any drive could accept them. The problems start when the Pi is expected to control and monitor numerous devices, all while maintaining exact timing. There just isn’t time to do it all exactly when you want it done.
The solution to the problem is to offload some tasks to another device. That is exactly what we did here with a Raspberry Pi 3 and two Arduino UNO’s.
The Pi and the UNOs are connected via an i2c bus. The Pi functions as the bus master and the UNOs function as slave nodes. With an arrangement like this, each slave node is told what to do with a uniquely addressed packet of data. They handle control of the motors long after the Pi has sent them their instructions, leaving it free to do something else. If the Pi was handling everything itself, it would need to use clever algorithms and more advanced coding methods like timer interrupts to simultaneously control the two motors.
Each Friday is PiDay here at Adafruit! Be sure to check out our posts, tutorials and new Raspberry Pi related products. Adafruit has the largest and best selection of Raspberry Pi accessories and all the code & tutorials to get you up and running in no time!
Make a robot friend with Adafruit’s CRICKIT – A Creative Robotics & Interactive Construction Kit. It’s an add-on to our popular Circuit Playground Express, FEATHER and other platforms to make and program robots with CircuitPython, MakeCode, and Arduino. Start controlling motors, servos, solenoids. You also get signal pins, capacitive touch sensors, a NeoPixel driver and amplified speaker output. It complements & extends your boards so you can still use all the goodies on the microcontroller, now you have a robotics playground as well.