circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

November 2004, Issue 172

Wi-Fi Sunlogger


by Ingo Cyliax


The data logger’s basic strategy is to consume as little power as possible. Most of the time is spent in Sleep mode with the CompactFlash adapter in Off mode and the I/O in the low-power state. However, the system needs to collect data. In order to do this, it restores the state to a configuration it needs to communicate with the ADC controller to take a reading. The processor can do this in Slow Clock mode in order to conserve some power.

After enough data has been collected and you want to send it, check the battery condition to see if it is sufficiently charged in order to communicate via Wi-Fi. Make sure the battery voltage is over 3.6 V. Now you’re set to bring the I/O pins in a state to communicate with the CompactFlash adapter and turn on the power to the CompactFlash adapter. Then, reset the card and configure the network up. This network configuration will use DHCP to dynamically configure its IP address, DNS server, and router address. After the network is up, compose an e-mail message that contains the data you want to send.

The e-mail message is delivered directly to the SMTP server, which hosts the e-mail recipient. With all of the SPAM, this turned out to be the easiest way for an embedded system to send e-mail. Using a relay server involves adding the embedded system’s IP number to its allowed list. Of course, because you don’t know what your IP address is (remember you dynamically allocated it) this is not always easy.

A better way would be to add SMTP server authentication. In this way, an e-mail client will send login/password information to a relay server that authenticates the client. This is the way you set up your e-mail on a PC when you want to send e-mail via your ISP’s outgoing e-mail server. However, this would potentially involve adding SSL or AES encryption, which is an entire article in itself.

After the system has sent the e-mail, it shuts down the TCP/IP stack by unconfiguring its interface, and turns off the power to the CF adapter. The system is now ready to enter Sleep mode until the next time it needs to send an e-mail.

The logger does mostly nothing. It has a spurt of activity at high speed in order to reduce the amount of time the CompactFlash adapter is powered up. This behavior (dynamic power management) is typical of low-powered devices. Even laptops and cell phones use this strategy to maximize battery life.