Do desktop computer motherboards have GPIO? If they do, how to read from or write to them

Normal PCs don't have GPIO as such in the sense of "pins intended to be general purpose". The connectors on a PC motherboard (whether internal headers or external ports) were all designed for specific functions. However, some of them can be repurposed for your own ends.

The closest thing to GPIO that PCs have is probably the parallel printer port which has a number of data lines and handshake lines. These lines are somewhat like GPIO pins, though you have less flexibility in terms of their directions. http://retired.beyondlogic.org/spp/parallel.htm

The handshake lines on serial ports can also be used as general IO, though they have weird voltage levels.

Parallel and serial ports are less common than they used to be, but it's still pretty easy to find motherboards that have them if you shop around.

You may also be able to repurpose inputs and outputs intended for case LEDs, buttons etc, but I would imagine the details will be very specific to a particular system.

PCs use an I2C based bus called SMBUS for various management functions. I'm sure I've seen reports of people putting their own I2C devices on this bus through soldering wires to it before, but I can't find links right now.

There's another I2C bus on the video ports used for monitor identification. Whether you can get software access to it depends on what OS and video hardware you are using http://www.instructables.com/id/Worlds-Cheapest-I2C-I-Squared-C-Adapter/step5/Software-and-Projects/

And of course, there is USB. There are now cheap microcontrollers with USB interfaces which you can use to connect to this.


I know this is an older topic, but anyway...

Having programmed BIOS code, I can say that every motherboard has GPIO's and they are completely available in the user address space and the port address is usually very close to the parallel port. I've made custom drivers for custom motherboards using standard parallel port drivers, all I had to do was modify the address number, but I knew that number in advance.

Can you use them? Well that depends on the person that programmed the BIOS. The state of all GPIO's has to be set pre-compile, all unused GPIO's could be easily set to be disabled.

If a GPIO is unused and unset, what is its default state? Quite likely just floating (most are tri-state so good luck)..

Does a GPIO have a pullup/pulldown? Who knows if the EE added one..

Are there traces for any of the unused GPIO's? I doubt it, but hey anything is possible..

In short, you have to get lucky that an unused GPIO has been set in a manner that you can use it; much like arduino (but without real defaults), think "INPUT/OUTPUT/TRI". It has to have a usable trace on the motherboard that hopefully has a pin or pad to solder to. Then if you know the address location of the GPIO you can use a standard user space driver easily.


I think the question if motherboards have GPIO is very specific to the model and make. Some may, some don't.

E.g. on my Asus desktop board it contains a Nuvoton NCT6775 for fan control and temperature read out. This is accessible from the (vendors custom) BIOS and Windows desktop utilities. I need to run Asus' software in order for the fan control to work, which means the PWM fan control is done by software. On a Linux installation I need to set up it manually via this kernel module and pwmconfig.

If you look at the Nuvoton NCT677xF datasheet you will find generic hardware for controlling PWM, reading temperature & voltages and also GPIO via SMBus. Equipped with both gives you a decent start to make it work. In theory you could use this chipset for GPIO functions.

However I wouldn't touch it. You don't know what hardware is connected to it, unless you want to dive into a very specific model of motherboard and reverse engineer it (e.g. layout, pin allocations etc.). It is not broken out to a connector neither.

Most importantly, if your application needs to last for several years, the motherboard model should as well. If not, tying to very specific motherboard hardware is not a good idea.