control Raspberry Pi power supply via relay on Arduino Uno

Hi there,

I've got a bit of a specific issue. For a project I've made a custom Arduino Uno style PCB that sits on top of a Raspberry Pi. I can program the chip via SPI directly from the Raspberry Pi which turned out pretty neat. Also they can talk to each other using RX/TX.

Only it has a bit of a bad side-effect :-/ I want to turn the Raspberry Pi on and off via a relay (omron g5v-1) that's connected to the ATMega328.

This only seems to work if the SPI pins aren't connected to the Raspberry Pi's GPIO.

Also the Arduino's Reset pin which is attached to pin 15 on the GPIO seems to be triggered the moment the Raspberry Pi gets turned on.

With the current setting, if I read a button to flip the relay, it switches for a very short moment, and then is turned off again. With the SPI and reset pin unattached it works fine.

My guess is that I'd need some resistors to prevent this from happening (there's currently a 1k resistor to gnd on every SPI pin) would anyone be able to point me in the right direction on wether it needs to be pull-up/down and what type of value would make sense?

Best and great thanks,
Mick

It would be helpful if you post a schematic of the circuit, with power supplies, resistors, diodes, capacitors....


Hope this gives some insight, there's two labels that say relay_1 and relay_2, those are external relays for high voltage things, not related to the Raspberry Pi.

The power supply runs at 5V 2A btw, so should be plenty to power both the Pi and the ATMega

upon closer inspection it seems mostly related to the reset pin, SPI has a lot less to do with it.

Things function for instance if I add a 10uF capacitor between reset and gnd. Only downside ofc is that then I can't flash the ATMega via the Pi anymore. A 10K resistor between 5V and Reset doesn't seem to have any effect.

ok, more or less solved my own issue, added an NPN transistor with a 1k resistor on the reset pin.

Great. Glad I could help......finding and fixing your own issues is the best way in my opinion. Still, sometimes external help is needed.

Tom