I have a project for the IP gurus among us. I'm sure someone here already has code laying around that does basically does what I'm after, but let me explain. FYI, I'm located in Texas, of the United States.
I would like to monitor a handful of atmospheric sensors at three distinct locations. These locations each have full time internet connectivity available, and static IP addresses with port forwarding routers. Essentially, the Arduinos will operate as a watchdog, sending emails to a predetermined list of addresses any time a sensor goes out of bounds. Let me lay it out this way:
-3 locations with internet access; static IPs
-Each router is set to port forward to an onsite Arduino Mega 2560 via Ethernet shield; on grid power
-1 additional location serves as a master monitor, to ping and detect if any Arduinos go down or lose internet
-Each location monitors a handful of sensors for fault conditions (i.e. over temp, water leak, etc); I can code in the specific sensors and fault titles myself
-Either the master or each location makes logs and sends email alerts in case of fault condition
-MAYBE the master would serve a simple webpage to display current statuses of each location and cycle one output via HTML pushbutton? Not sure how critical this is
Obviously, there is nothing special about the application at each locale, but I would like to get some help with the exchange of data and ping watchdog via internet. I have the Ethernet shield and email alert working currently, and can code the rest of the specifics once I have working code that makes Arduinos talk to each other...
This forum and the people who frequent it are awesome. Any help is welcome, and if anyone is interested in collaborating to payment, that works, too. No big hurry, but I'm not sure how much something like this is worth. I can't imagine there aren't other uses for a system like this.
It is important that this project remains Mega based with wired IP. I need the high input count of the Mega, and Wifi is not available. I have a working sketch that connects my Mega via Arduino Ethernet shield to the internet, and successfully sends email alerts currently. So this should not be a problem.
I should only need enough code to get Arduinos talking to each other over the Internet, passing data from one to another, pinging to check for outages, and serving a simple status webpage. I will program the watchdog functions for the inputs, as well as the email alerts and logs.
So you want each arduino to be both a client and server:
Client when reporting monitoring data to the central master (what failover strategy ?)
server for the health status pulse
shouldnt the regular heartbeat reporting be enough for health status? That would makes things simpler...and usually simpler == more robust. In IT complexity is a debt you carry in the future.
Or do you need arduino on site to also perform tasks you would remotely trigger? In that case would two arduinos in remote locations be of consideration? They could watch over each other (What's the self healing process in remote locations? Auto reboot? None, someone goes on site?)
If you want your master to send emails when Bad Stuff happens, that means you have to code up an email client if you are using a bare arduino. A better option might be a small linux box. A shell script can send a GET to the arduinos (curl or wget), parse the content with awk or something, and send email There are microprocessor boards running linux - provided they support the utilities you need, they would do fine for the master. As a bonus, you could run a small webserver on them and have a nice-looking website interface.
J-M-L:
So you want each arduino to be both a client and server:
Client when reporting monitoring data to the central master (what failover strategy ?)
server for the health status pulse
I don't think the individual sites really NEED to report sensor data back to the master (it would be convenient to go to one central page for current status, but might be too much trouble). So I will probably use the master device only to ping the site controllers. In other words...
Master controller pings sites; emails if one doesn't respond
Site controllers monitor pins; emails if there is an issue on-site
I already have email working on my sketch via SMTP2Go, and I just found the ICMPPing library, so those parts should be easy enough to deal with
PaulMurrayCbr:
I put this up on the playground a while ago: Arduino Playground - HomePage . It may be kinda/sorta relevant.
If you want your master to send emails when Bad Stuff happens, that means you have to code up an email client if you are using a bare arduino. A better option might be a small linux box. A shell script can send a GET to the arduinos...
I had thought of doing something like this, where the master handled all the emailing. Honestly, that is way beyond my understanding, but I will look at your code.
That does pose a problem if the master loses internet. And, like I said, I have the Arduinos email capable currently, so they can send their own alerts. Your suggestion is super elegant, though.