It's Pi Day [well, almost: news travels slowly where I am] and I thought I'd add a simple electronic experiment to all the other good stuff that people are doing.
Not all experimenting has to be complicated or requires the use of lots of expensive equipment. I was curious about the GPIO pins on a Pi 3 Model B+, the one that I bought to attempt the PiCasso Design Challenge last year, so I thought I'd have a quick go at measuring one of the basic characteristics myself rather than simply looking up the figures. They are probably going to be very similar to any microcontroller, but I'd like to see for myself.
The method is going to be very simple. I'm going to load the output with a resistor to the opposite rail to the one the output is pulling to, measure the current through the resistor and the voltage difference between the rail and the output, and plot the results on a graph for both a logic high and a logic low output. To set the output, I'll use a simple piece of Python code.
Here's what it looks like. I made the resistor a 10k potentiometer in series with a 47R. Unfortunately it's a linear pot, so at higher currents it is very touchy to adjust. The 47R is to limit the current to no more than 70mA, which I reckoned the Pi would survive for the time it would take me to notice and reduce it.
Here's the Python code I used. It's sitting in the Nano editor on the Pi, as viewed remotely via Putty. It just sets the output of GPIO17 either high or low and waits for 4 minutes before ending. I could have done more with it but there wasn't any point.
The voltage and current were each measured with a handheld multimeter.
Here's the graph I got.
The voltage is the difference from the respective rail, so is approximately the voltage dropped by the internal MOSFET. Keep in mind that, as an experiment, this is very 'rough and ready'. The slope of the line [voltage over current] is a resistance, roughly speaking the rds(on) of the MOSFET. At lower currents, that's looking like about 30 Ohms. It goes off a bit at higher currents [how real that is is perhaps open to question - it was getting hard to adjust the current accurately by that stage - but we might also surmise that local heating of what is a fairly small transistor is changing the rds(on) value].
Happy Pi Day everyone.
If you found this interesting and would like to see more blogs I've written, a list can be found here: jc2048 Blog Index