Control real-world hardware on your PC
Users of Raspberry Pi and Arduino SBCs are familiar with these boards’ GPIO (general purpose input/output) ports that enable them to interface to real-world electronic devices. PCs are devoid of GPIOs, but boards are available that provide that facility and connect to the PC via a USB port. Two such devices are the FT232H and the MCP2221, both from Adafruit, and here we see how to use them.
Our main emphasis is on hardware because we expect a lot of PC users who’ll be interested in this topic probably won’t have dabbled with SBCs and so won’t have learned much about electronics. Having said that, we provide some Python code to get you started and show you how to learn more.
These two boards differ in their number of various types of GPIO pins. The FT232H (£14.10 from Pimoroni) has 12 digital in/outs but no analogue in/outs, while the MCP2221 (£6.30 from Pimoroni) adds three analogue inputs, one of which can be used as an analogue output, but only has four digital in/outs, and three of these share pins with the analogue in/outs. Note that these boards have USB C sockets, so to connect them to your PC you’ll need either a USB C to USB A lead or, to use a common micro-USB to USB A lead, you’ll need an adapter, as you’ll see in our photos.
Installation and testing
We’ll be using Python to work with these boards. Although this will already be installed on your system, there are supporting elements you’ll need to install. Since installation instructions are provided for the FT232H at https: and for the MCP221 at https: we aren’t
You’re reading a preview, subscribe to read more.
Start your free 30 days