APC

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 has 12 digital in/ outs but no analogue in/outs, while the MCP2221 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 and for the MCP221 at we aren’t repeating that information here. Although

You’re reading a preview, subscribe to read more.

More from APC

APC9 min readSecurity
How Do You Know If You’ve Been Hacked
Cyberattacks don’t look like you might expect – and they certainly don’t look like they do in the movies. If your security is compromised, you probably won’t see a big flashing sign saying “YOU HAVE BEEN HACKED”, or weird skull-and-crossbones graphic
APC5 min read
Snapdragon X Elite Beats Apple, AMD And Intel Flagship Mobile CPUs
Microsoft is set to unveil its Surface Pro 10 and Surface Laptop 6 in June, and the tech giant has high expectations for the ARM CPUs that will power those PCs. Microsoft is reportedly confident that its new Surface PCs running on Qualcomm Snapdragon
APC2 min read
Panasonic’s Astrova In-flight Entertainment System Will Make Economy Travel Less Arduous
Flying in cattle class in the 21st century is generally not all that enjoyable – unless you’re 150cm tall or an excited child that is. You have to put up with shrinking legroom, long queues at check in and security, unappealing food and generally poo

Related