Turning on/off an arduino from another arduino

Hello,

I'm working for several months on a navigation system for my sailboat. It has a couple of arduino mega, gps module, mpu9250 for attitude angles, sim800l for gprs communication and some other sensors. Everything is powered from a 12 v battery.

When not sailing, the system turns on every 2 hours to report to a server through gprs and then goes off again.

On top of the whole system I have a atmega328p standalone (low power designed) that decides when to turn everything on or off. To do so it controls a mosfet on the ground side of the system. This standalone unit comunicates through serial with the system.

The problem I have is that the system won't turn off because the rx and tx cables make a path for the system to ground. So even when the mosfet is open, the system keeps on through the tx and rx acting as ground.

If I disconnect tx and rx the system will turn on/off as expected, depending on whether the standalone atmega opens or closes the mosfet, but I need the serial communication.

I've tried to use Serial.end() and configure pin rx and tx as inputs before turning the system off but still rx and tx act as ground.

Do you guys have any idea how to solve it?

Why not just set the said Pins used by the master Arduino for Serial to a digitalWrite or pinMode and then set it HIGH, just before you fire the mosfet to turn of the power, then back to Serial mode upon boot thus no power flowing through them when they are off, you don't have to setup the pin state in the setup only, most think that is a rule but it is not stated in any documentation by Arduino for the states and usage and i do it alot as i find it invaluable. I'm sure that will fix your issue :slight_smile:

The easy way is the best way :stuck_out_tongue:

If it's just for waking up, you can also use an RTC for that. Most have a wake signal available, with which they can wake up an Arduino from deep sleep, when done the Arduino sets itself back to deep sleep again.

Hi and thanks for your replies.

I had set those pins to input before turning off but I'll try setting them to high too and see what the current is.

Kawasaki, the serial pins are inactive when the system is off. Now I turn on the system by counting time with the atmega328p standalone millis(). I could program an alarm in the rtc ds3231 but I would still have the same problem with current flowing from + cable through the system and back through the serial pins to the atmega standalone master unit.

I prefer to keep the atmega standalone running at 1 MHz and with low quiescent current power regulator so I can keep it waking up every few seconds and checking for bilge and door alarm circuits. That way I the mean current is around 0.5 mA and only when some conditions are met it turns on the whole system.

Is there any way to isolate rx and tx lines? I was thinking with optocouplers but I'm not sure how to set the circuit.

Another way I was thinking is to place a mosfet in the positive line that supplies power to the system but I guess the n-channel mosfets I have wouldn't work for that job.

I'm posting the current diagram so it's easier to understand.

This is the electric diagram

juanibarracantavella:
When not sailing, the system turns on every 2 hours to report to a server through gprs and then goes off again.

On top of the whole system I have a atmega328p standalone (low power designed) that decides when to turn everything on or off. To do so it controls a mosfet on the ground side of the system. This standalone unit comunicates through serial with the system.

Why not use a P-CH Mosfet in the positive power wire to the 328 system?
Tom... :slight_smile: