hoho
Posts: 3
Joined: Thu Jun 02, 2016 10:49 pm

Reset Raspberry Pi from Arduino

Thu Jun 02, 2016 10:59 pm

Hi,

I know that I can reset Pi by shorting two pins marked «RUN».

I need to be able to reset Pi from Arduino and the most obvious solution is to use a relay to short «RUN» pins. At the same moment it looks like an overkill. Is there a simpler way? Can I just connect one of the Arduino's pins to one of the «RUN» pins and just set this Arduino's pin to HIGH whenever I need to reset my Pi? Maybe there are other solutions?

Thanks.

User avatar
Burngate
Posts: 6427
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Reset Raspberry Pi from Arduino

Fri Jun 03, 2016 5:22 pm

...connect one of the Arduino's pins to one of the «RUN» pins and just set this Arduino's pin to HIGH whenever I need to reset my Pi?
Probably not a good idea, as the Pi requires a short to reset it, not a High signal.
However, a FET could do the job for you - ground and Run to source and drain, gate to Arduino.

hippy
Posts: 9170
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Reset Raspberry Pi from Arduino

Fri Jun 03, 2016 5:44 pm

Not familiar with Arduino chips but the RUN pin appears to be a pull to 0V connection. In which case one should be able to use an I/O pin set output low to reset, input to leave it floating and allow the SoC to run.

blaablaaguy
Posts: 623
Joined: Sun Sep 27, 2015 3:26 pm

Re: Reset Raspberry Pi from Arduino

Fri Jun 03, 2016 7:16 pm

What about a transistor?
This signature intentionally left blank.

gregeric
Posts: 1509
Joined: Mon Nov 28, 2011 10:08 am

Re: Reset Raspberry Pi from Arduino

Fri Jun 03, 2016 7:44 pm

hippy's proposal elegantly avoids the need for external components, whilst avoiding any 5V/3V3 issues - the Arduino pin is either a high impedance input, or driven low as output briefly to reset the Pi

It might be worth including a series resistor from Arduino output to RUN input of a couple of kohm or so, just in case, for peace of mind. Or investigate whether setting the Arduino input's internal pull-down is sufficient to reset the Pi, instead of output driven low.

Open collector/drain junction transistor or fet would work too. Your choice.

MikeDK
Posts: 86
Joined: Thu Mar 19, 2015 12:01 pm

Re: Reset Raspberry Pi from Arduino

Fri Jun 03, 2016 9:01 pm

one question: do you really need a hard reset? or would it be sufficient to let the OS reboot?

regards,
MikeDK

MarkTF
Posts: 318
Joined: Tue Mar 03, 2015 4:59 pm

Re: Reset Raspberry Pi from Arduino

Fri Jun 03, 2016 10:06 pm

From the Compute Module schematics, "run" is an input to the SOC with a 10k Ohm pullup. (https://www.raspberrypi.org/documentati ... EMATIC.pdf From this one would expect that pulling it low would reset the SOC and letting it go high would allow the SOC to boot.

Since I had the pieces at hand, I tried this out with a 3.3V microcontroller (MCU), an STM8S, not an Arduino, and it seems to work as expected. From the serial terminal, I logged into the Pi (2B), halted it, and then toggled the MCU gpio pin attached to "run". The Pi booted when the "run" pin was released. I also tried holding the Pi reset with MCU, applied power to the Pi, and then from the MCU released the Pi to boot.

I'm not sure what the original poster had in mind, but this would allow the MCU to start the Pi after it has halted, to reduce power perhaps, and it allows the MCU to hold the Pi in a reset state until it decides to let it boot, for system sequencing perhaps.

It should be noted that a lot of Arduinos are 5V I/O so appropriate measures would need to be taken when interfacing with the 3.3 V Pi I/O.

hoho
Posts: 3
Joined: Thu Jun 02, 2016 10:49 pm

Re: Reset Raspberry Pi from Arduino

Fri Jun 03, 2016 10:51 pm

Thank you all very much!

My goal is to implement a watchdog. I expect that my Pi might hang up from time to time and want to automatically reset it.
MarkTF wrote:Since I had the pieces at hand, I tried this out with a 3.3V microcontroller (MCU), an STM8S, not an Arduino, and it seems to work as expected. From the serial terminal, I logged into the Pi (2B), halted it, and then toggled the MCU gpio pin attached to "run". The Pi booted when the "run" pin was released. I also tried holding the Pi reset with MCU, applied power to the Pi, and then from the MCU released the Pi to boot.
A dumb question: to which of two RUN pins (there are round one and square one) of the Pi should I apply 3.3V? I already have a logic level converter (like this one https://www.sparkfun.com/products/12009) since my Arduino and Pi talk via Pi's build in UART serial port, so I have a free line to convert 5V to 3.3V already.

User avatar
DougieLawson
Posts: 40820
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Reset Raspberry Pi from Arduino

Sat Jun 04, 2016 6:27 am

hoho wrote: I know that I can reset Pi by shorting two pins marked «RUN».
If you hit the RUN pins at the wrong time it may not reboot (the hardware will do the hard reset, but the OS may not come back up). If an operating system is running and busy (not halted) then you could damage your root filesystem.
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

User avatar
Burngate
Posts: 6427
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Reset Raspberry Pi from Arduino

Sat Jun 04, 2016 10:04 am

blaablaaguy wrote:What about a transistor?
An fet is a transistor ... ah, you mean a bipolar transistor ... yes that would work, but the discussion has moved on ... apparently neither is needed!

hoho
Posts: 3
Joined: Thu Jun 02, 2016 10:49 pm

Re: Reset Raspberry Pi from Arduino

Sat Jun 04, 2016 10:25 am

DougieLawson wrote:If you hit the RUN pins at the wrong time it may not reboot (the hardware will do the hard reset, but the OS may not come back up). If an operating system is running and busy (not halted) then you could damage your root filesystem.
I understand that. The hardware reset will be used as a last resort and with a quite reasonable timeout. Before that I'll do all possible software watchdogs. It's just if the device is totally not responding for, say, an hour, it's more likely that the OS will recover the filesystem (if needed) after the hardware reset than that it'll unhang again.

User avatar
DougieLawson
Posts: 40820
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Reset Raspberry Pi from Arduino

Sat Jun 04, 2016 10:49 am

hoho wrote: I understand that. The hardware reset will be used as a last resort and with a quite reasonable timeout. Before that I'll do all possible software watchdogs. It's just if the device is totally not responding for, say, an hour, it's more likely that the OS will recover the filesystem (if needed) after the hardware reset than that it'll unhang again.
Having just had a RPi 1B reach 170 days without a reboot (last time was after a whole house power down for some plumbing / electrical maintenance, without that it would now be at 360 days uptime), I think you're overcomplicating things.
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

MarkTF
Posts: 318
Joined: Tue Mar 03, 2015 4:59 pm

Re: Reset Raspberry Pi from Arduino

Sat Jun 04, 2016 12:50 pm

hoho wrote:Thank you all very much!
A dumb question: to which of two RUN pins (there are round one and square one) of the Pi should I apply 3.3V? I already have a logic level converter (like this one https://www.sparkfun.com/products/12009) since my Arduino and Pi talk via Pi's build in UART serial port, so I have a free line to convert 5V to 3.3V already.
It's the square one on my Pi 2B, the one further from the circuit board edge. The other pad is ground. I'd check this with an ohmmeter if you have a different version.

John Public
Posts: 90
Joined: Thu Jan 16, 2014 2:16 pm

Re: Reset Raspberry Pi from Arduino

Fri Feb 02, 2018 4:27 pm

I've Arduino Pro Mini (5V) version. I'd like to use one of the available pin of Arduino to hard reset Raspberry.
What would be most conevenient way to do it from Arduino? I have a bunch of resistors and leds I could use.

MarkTF
Posts: 318
Joined: Tue Mar 03, 2015 4:59 pm

Re: Reset Raspberry Pi from Arduino

Fri Feb 02, 2018 7:20 pm

John Public wrote:
Fri Feb 02, 2018 4:27 pm
I've Arduino Pro Mini (5V) version. I'd like to use one of the available pin of Arduino to hard reset Raspberry.
What would be most conevenient way to do it from Arduino? I have a bunch of resistors and leds I could use.
The issue is that your Arduino wants to output 5V as a logic high which exceeds the specification for a RPi input.

The safest way to interface might be to use a dedicated logic level converter as linked above by "hoho".

In Arduino software you can do a limited emulation of an "open collector" output, that is, an output that is either logic low or high impedance, as follows. The risk with this approach is that a programming error on the Arduino has the potential to damage the RPi.

Code: Select all

void setup ()
{
  digitalWrite (resetPin, LOW) ;
}

void loop ()
{
  ...
  pinMode (resetPin, OUTPUT) ; // drive pin low
  ..
  pinMode (resetPin, INPUT) ; // hi-Z state
}

User avatar
rin67630
Posts: 1105
Joined: Fri Mar 04, 2016 10:15 am

Re: Reset Raspberry Pi from Arduino

Fri Feb 02, 2018 8:56 pm

MarkTF wrote:
Fri Feb 02, 2018 7:20 pm

The issue is that your Arduino wants to output 5V as a logic high which exceeds the specification for a RPi input.
The best way is to use an Arduino 3,3V Pro, so you won't have any problem with level conversions.

A regular 5V Pro mini will work at 3,3 V as well, if you aren't using a overdemanding sketch. Just put 3,3V on VCC.
When powered with 3,3V it should work @8MHz and working @16MHz will be theoretically somewhat overclocked, but practically it will do.

hippy
Posts: 9170
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Reset Raspberry Pi from Arduino

Fri Feb 02, 2018 8:59 pm

To avoid voltage problems, complicated code, one can simply use a diode. Set the output low to reset the PI, set it high or as input to let it run -

Code: Select all

          -.-
          .|.
.------.  |_|                .-----.
|      |   |                 |     |
|  Pi  |---^---(O------|>|---| Ard |
|      |   .---(O---.        |     |
`------'  _|_      _|_       `-----'

MarkR
Posts: 156
Joined: Fri Jan 25, 2013 1:55 pm

Re: Reset Raspberry Pi from Arduino

Sat Feb 03, 2018 12:21 am

hoho wrote:
Fri Jun 03, 2016 10:51 pm
Thank you all very much!

My goal is to implement a watchdog. I expect that my Pi might hang up from time to time and want to automatically reset it.
The Raspberry Pi SoC has a built-in hardware watchdog that can do that. You can enable it with a boot-time parameter (and run a userspace process which monitors the system and kicks the watchdog periodically)

But one thing it can't do is wake up the Pi if it's in shutdown mode, so you might use your microcontroller to periodically wake up a sleeping Pi by pulling its reset pin. Others in this thread have explored ways to do this electrically.

John Public
Posts: 90
Joined: Thu Jan 16, 2014 2:16 pm

Re: Reset Raspberry Pi from Arduino

Sat Feb 03, 2018 7:19 am

Assuming that I have set the voltage to 3.3v in the Arduino what should I connect to the two "run" pins on the Raspberry. The "run" connection are rectangel and round -versions?

MarkDH102
Posts: 458
Joined: Fri Feb 13, 2015 3:18 pm

Re: Reset Raspberry Pi from Arduino

Sat Feb 03, 2018 8:05 am

Possibly not what the OP wants, but my Arduino is connected to the PI via USB.
The Pi runs a python script (that runs automatically at startup).
It I press a particular button on the Arduino, it sends a serial message to the Pi.
The python script picks it up and issues a reboot command...

sudo shutdown - r now

John Public
Posts: 90
Joined: Thu Jan 16, 2014 2:16 pm

Re: Reset Raspberry Pi from Arduino

Sat Feb 03, 2018 11:25 am

I need a hard reset when system has locked up and needs a power down & power up.
With that in mind what wires from Arduino shoul go to the run pins?

MarkDH102
Posts: 458
Joined: Fri Feb 13, 2015 3:18 pm

Re: Reset Raspberry Pi from Arduino

Sat Feb 03, 2018 3:07 pm

When you say "locked up", do you mean you can't VNC in, or your application stops responding.
My Pi has seemingly locked up in the past, but the very simple script running in the background has always picked up the serial message from the Arduino over the USB and managed to either shutdown or restart depending upon what I ask it to do...

klricks
Posts: 7545
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Reset Raspberry Pi from Arduino

Sat Feb 03, 2018 3:55 pm

John Public wrote:
Sat Feb 03, 2018 7:19 am
Assuming that I have set the voltage to 3.3v in the Arduino what should I connect to the two "run" pins on the Raspberry. The "run" connection are rectangel and round -versions?
As has already been mentioned above..... The square pad is the reset and the round pad is ground.
In addition to the reset connection, a ground connection is also needed between the RPi and Arduino. The round pad next to the reset can be used or any other ground point.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

Idahowalker
Posts: 622
Joined: Wed Jan 03, 2018 5:43 pm

Re: Reset Raspberry Pi from Arduino

Sun Feb 04, 2018 1:55 am

hoho wrote:
Thu Jun 02, 2016 10:59 pm
Hi,

I know that I can reset Pi by shorting two pins marked «RUN».

I need to be able to reset Pi from Arduino and the most obvious solution is to use a relay to short «RUN» pins. At the same moment it looks like an overkill. Is there a simpler way? Can I just connect one of the Arduino's pins to one of the «RUN» pins and just set this Arduino's pin to HIGH whenever I need to reset my Pi? Maybe there are other solutions?

Thanks.
Given this a small bit of thought, what I come up with is to get a few NE555 adjustable timer modules. Test the 555's till you find one that will run reliably at 3.3 volts. Have the output of the 555 go to what ever pin you want for what deed you want, may need to add a PN2222 to invert the 555 output. Whenever the RPi receives and process data from the Uno or Mega, have the RPI3 reset the 555 so it starts the timing sequence all over.

As long as the RPi is putting the 555 into reset from processing the Uno/Mega info the RPi 'works.' When the RPi does not put the NE555 into reset, the NE555 times out, switches state and the deed is done.

I checked out 5 NE555's and all 5 worked at 3.3volts.
Idaho, U.S.A.

Paul Hutch
Posts: 565
Joined: Fri Aug 25, 2017 2:58 pm
Location: Blackstone River Valley, MA, USA
Contact: Website

Re: Reset Raspberry Pi from Arduino

Sun Feb 04, 2018 2:33 am

The TLC555 & LMC555 CMOS versions of the NE555 are designed to operate down to 2V & 1.5V respectively and over time and full temperature range.

Return to “Advanced users”