Offload Raspberry Pi Tasks with the i2C Bus @Raspberry_Pi #PiDay #RaspberryPi

via Element 14 Community

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.

Read the complete guide here!


3055 06Each 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!



from Adafruit Industries – Makers, hackers, artists, designers and engineers! http://ift.tt/2tYuom2
via IFTTT