Why we need a GPIO expander

So why do we need a GPIO expander right off the bat, when the Raspberry Pi has so many GPIO pins? This is because PWM pins require computing resources and timers, and many microcontrollers have a limited number of hardware PWM pins. You can emulate PWM pins with software, but the results tend to be on the unreliable side. The Arduino Uno, for example, has eight PWM pins. The Raspberry Pi has only one GPIO pin, and many projects (including the servo and motor projects included later in this book) will require many more than one, and we do not want to use software PWM. 

This is why we are using the PCA9685 GPIO expander: it has 16 dedicated PWM pins and provides all the resources to run them. It communicates with the Raspberry Pi using a protocol called I2C (pronounced eye-squared-see), the details of which are outside the scope of this book, and are abstracted away in the Johnny-Five component object. See the Further reading section if you'd like to learn more about how I2C works.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.15.1