Maker uses Arduino with an Ethernet shield to send you an email whenever your external IP address changes.
A Maker by the name of “Bayres” has devised a pretty slick project using an Arduino with an Ethernet shield that is capable of obtaining an external IP address of your Internet connection and then notifying you of any changes by email.
The idea was first conceived after his father bought a video camera system to remotely monitor their rural property. Unfortunately, given the area, the only reasonable Internet connection that he was able to get was DSL. As you can imagine, the service wasn’t too stable which caused the external IP address to fluctuate quite frequently. Once this happened, there was no way to know what the address was changed to and no way to access the camera system unless he had local access to the network.
“I looked into DDNS services but most require a client running on a PC 24/7. This is undesirable because of power consumption and if the power goes out, which occurs frequently, the PC will shut off,” Bayres explains.
The Maker’s solution to the problem consisted of using an Atmel based Arduino with an Ethernet shield to acquire the web connection’s external IP address and monitor it periodically. In the event that it were to vary, an email is sent via SMTP, indicating the new IP address. Bayres decided to add a shell that was accessible via the Arduino’s Serial port, thereby letting a user enter their own parameters that are then stored in the board’s EEPROM. From there, the Arduino starts and enters the setup() function.
“The serial port is initialized then the existing parameters are read from the EEPROM and copied into string variables. Since the parameters vary in length the starting address for each parameter in EEPROM is dynamic. To address this, the first seven bytes of EEPROM contain the length of each parameter. The length of each parameter is first read out of EEPROM. Then the start address of each parameter is calculated and stored in RAM so the Arduino know what portion of EEPROM each parameter occupies.”
The program compares the current and previous values. Should there be any disparity between the two, it uses the Sendmail() function to establish a connection with the SMTP server and send an email alert. Once the message is sent, the connection to the SMTP server is severed.
Meanwhile, the system includes a small LCD as well, which is attached to the Arduino and driven by a 74HC595 shift register, that displays the current IP address output. This also makes it super easy for a user to check up on the connection. To enable this, the Maker turned to the Textfinder Arduino library that was tasked with searching through the returned string and identifying the address.
Intrigued? Head over to the project’s official page to learn more.