Explorer pHAT Output voltage float problem


#1

According to the documentation on github, the output pins on the explorer are to be driven low using explorerhat.output.one.off() there by allowing 5V VCC to flow to the output as GND. What I am seeing is that when the pin is driven high, the voltage seems to be fluctuating all over the place when it should be ~0.

My test setup on the Explorer pHAT is 5V to a 330 ohm resistor, then to Output 1. I then have a lead from the same breadboard row going to Analog 1 so I can test the voltage. Here is the bit of code I am using to test:

import explorerhat
import time

V = 0

while True:
V = explorerhat.analog.two.read()
print(V)

time.sleep(2)

When I run that code and then drive the Output pin low I get a nice steady voltage as follows:

5.127
5.136
5.145
5.139
5.133
5.127
5.13
5.136
5.139
5.133
5.148
5.13

When I drive the pin high I get the following voltage:

2.643
5.121
2.706
4.425
4.17
3.093
4.671
5.118
2.667
5.13
3.039
1.23
2.88
4.905
5.112
3.948
2.883
3.786
3.051
4.512
3.228
2.928
5.118
5.124
3.771
5.118

I believe the pin is floating and that is likely what is causing the fluctuation. However for my application I need to insure that there is minimal voltage going to my sensor when the pin is driven high. Is this the expected behavior or is there something I am missing?

Thanks!


#2

The output will be floating if you aren’t driving it (it’s a Darlington array driven output for powered loads so not really designed for general IO use). If you wanted to make it function that way you could add a pullup resistor (10k should be fine) from the output pin to 5V.