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

7
  • Ah, let me see. If generator starts, current flows out. So you can make use a "current sensor". You might like to skim the following current senor Q&A and see if they help: (1) raspberrypi.stackexchange.com/questions/96175/… (2) raspberrypi.stackexchange.com/questions/94403/… (3) raspberrypi.stackexchange.com/questions/96175/…. Cheers. – tlfong01 May 12 '20 at 2:20
  • 1
    I see the value of the current sensor. I may change my design to feed the power supply through the current sensor and connect that to the Pi. – David Green May 12 '20 at 13:09
  • 1
    I'll have a 120V USB-type power supply that puts out 5V connected to 1 leg of the 240V output on the generator. I doubt it will draw enough amps to worry about an imbalance across each of the 240V legs. there's no guarantee my house is using an equal draw across the legs anyway. the power supply will be wired through the current sensor, which in turn will be wired to the Pi, instead of wiring the power supply directly to the Pi. I can also fuse the power supply if necessary. – David Green May 14 '20 at 19:07
  • 1
    I added a picture. the generator is 240V. I would use one side (120V) of that 240. I hope the picture is clear. – David Green May 19 '20 at 12:30
  • 1
    The circuit in the diagram works exactly the way I want it to in my testing. – David Green May 19 '20 at 12:42
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.

1
  • 1
    thank you. I have reservations also. the pin numbering I am using is the WiringPi numbering, so it is physical pin 15 – David Green May 12 '20 at 13:10
1

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

1
  • 1
    Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year. – Ingo May 14 '20 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.