I have a pi3 running Android. I have one app on it which is an irrigation system. The pi is connected to two 16 channels Sainsmart relay boards which control the valves and it all works just fine except when I shut down the pi. 2 of the relays switch on (connected to BCM2 and BCM3) as the pi shuts down.

I close down the pi carefully, making sure all the relays are closed before calling:

Runtime.getRuntime().exec("reboot -p");

It seems as if the actual close down of the pi triggers the 2 relays to switch on.

Also, switching on the pi lights up the same 2 relays, until my app starts running and ensures all the relays are off.

Is there something wrong with my pi?



  • This is a poor question, lacking any real information about the OS, the hardware or software. It is even unclear WHY you need to shut it down. It is most probable that the cause of your problem is the 1.8Ω pullups on pins 3,5
    – Milliways
    Jan 12 '20 at 11:25
  • gpio pins have a "default" state - I believe those two pins have a default "high" state - use different pins - not BCM14 or BCM15 though - but, are those relays active low or active high? Jan 12 '20 at 11:45
  • Does it do the same thing if you boot plain Raspbian on it?
    – Dougie
    Jan 12 '20 at 11:57

Thanks Jaromanada. BCM2:"SDA includes a fixed, 1.8 kohms pull-up to 3.3v, which means this pin is not suitable for use as a general purpose IO where no pullup resistor is desired." Switching to BCM 17 and 18 fixed that (the only two pio's left available for me).

Milliways: Sorry my question was disappointing for you. It did however contain sufficient information to solicit the correct answer. I can think of lots of reasons to daily reboot a pi controlling an irrigation system, and providing a web based UI control system. Until this recent upgrade, the system has worked flawlessly for nearly a year.

Dougie: Thanks, as so often, quick with a good suggestion, though it was easier to switch PIO's and now it's solved.

  • 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
    Jan 13 '20 at 21:03

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.