0

I want to use a Raspberry Pi to detect whether a generator has started. I had planned to hook a 5V power supply to 1 of the 240V legs on the generator and then run that through a 3.3V voltage regulator to the Pi. When the generator is running it will make power and the Pi should detect the 3.3v. At least that was my thinking based on the research I have done for people with similar needs.

I have GPIO pin 3 configured as pull-down. Testing this the pin always reads 0 whether the power supply is plugged in or not. I am using the WiringPi GPIO utility from the command line.

`gpio read 3` 

is the command. I would expect it to read 1 if there was voltage and 0 if not. I don't care about the voltage level, just that there is voltage. Testing with my meter it reads 3.29V, so I know the circuit is working and that should be close enough to the 3.3 for the Pi.

the circuit I plan to use

crokett
  • 119
  • 7

2 Answers2

3

GPIO 3 Physical pin 5 (also 3) have on-board 1.8kΩ pullups and are intended for I²C so will be HIGH unless pulled down.

I suggest you use a different pin.

I have some reservations about what you are proposing. You should include some protection - a 1kΩ series resistor at least.

I would omit the 3.3V regulator and substitute a resistive divider - dimensioned to produce 2.2V from the 5V supply. The threshold of the Pi GPIO is ~1.3V anything above this is considered HIGH. This will also limit current, replacing a protective series resistor.

Milliways
  • 62,573
  • 32
  • 113
  • 225
1

I did some more testing. I had a bad ground.

crokett
  • 119
  • 7