One Arduino to another... Are you still alive?

Hello,

I am wanting to build Arduino circuit to check to see if another Arduino is still alive. How would I do this?

Scenario:

Device 1: Hooked up to a non-battery power-source. Device 2: Hooked up to a battery.

I want to use Device 1 to find out when Device 2 shuts off because of the lack of battery.

I want Device 1 to report to the Serial output (via usb) to deliver this notification.

I can think that I could use a relay, but I don't want to use something that takes any (or almost no) power, plus I want to put Device 2 to sleep every so often.

Could I somehow connect a transistor?

Any options and ideas would be wonderful!

(deleted)

Another option, particularly if you also want a bit more information from device 2 apart from a sign of life (like for instance the battery voltage) is to define device 2 as an I2C slave. You'd connect the devices together over A4 and A5 (assuming UNO, Nano etc.) and as mentioned above, with common ground.

Thanks everyone!!!

spycatcher2k, Do you happen to have an example of how to do this? It seems as though that is what I am looking to do!

Here is what I have, but its not quite there..

First void loop() { pinMode(12, OUTPUT); digitalWrite(12, LOW); delay(1000); }

Second void loop() { val = digitalRead(11); if(val) { //?? What do I do here?? } }

Give your pins names! What is the function of pin 12? What is the function of pin 11? Use words that describe how they are expected to be used. There’s no practical limit on how long variable names can be, so get creative.

I just picked one pin from each device.

billsecond: Second void loop() { val = digitalRead(11); if(val) { //?? What do I do here?? } }

well, since you are posting code and you did not use code tags. I would say to read the sticky post at the top of every forum about 'hot to use this forum' and pay attention to item #7

as for your code, why not connect the two and see what value is there ?

when you lose power, you could send an signal to your wifi to indicate power has been lost data long the time and blink a light.

but then it is your project, what did you have in mind when you found out power was lost ?

you could make one of these ??

https://www.youtube.com/watch?v=nFsee7lLbYw

If one Arduino causes the I/O pin to change from HIGH to LOW and back every 100 millisecs the other Arduino can raise an alarm if the interval between pulses is longer than 100 millisecs.

The code in this link should be suitable.

...R

Everyone, thank you so much for your help. Sorry I am new to some of this, and trying to learn the hardware aspect. I am getting a great point of view now.