How To Make Your Arduino Pachube Client
This article picks up on the (outdated) Pachube Article that explains how to create a self-resetting Pachube client with Arduino and the Ethernet Shield. My detailed Hardware and Software configurations are documented on the Github repository. Basically, use an Arduino Uno with the Freetronics Ethernet Shield, an improved version of the official shield. The Arduino Uno takes advantage of the Optiboot's exposure of the AVR watchdog timer for periodic resets of the AVR when it fails to register a watchdog event.
- Download the Pachube_Client sketch from the Github repository.
- Install the EthernetDHCP library into your Arduino libraries (I am using IDE 21)
- Get your Pachube account, create a feed, and obtain your API Key
- Load the sketch onto your Arduino Uno after changing the feed numbers and API Key variables
- Power down, plug in the Ethernet Shield and network cable, you should be up and running with DHCP after a few minutes. If you have problems, comment out the DHCP code and connect manually to your router.
- Optional Step to take full advantage of the code: Solder a jumper to WZT RST and connect it to Digital Pin 9. (I haven't tried this yet, but it's recommended by the original article. So far the watchdog timer seems to be enough to reset the device)
The DHCP library took a few iterations of the datalogging loop to kick in and discover an IP, so when following along at home, be patient! I had my serial monitor opened while Google'ing "Arduino EthernetDCHP problems" when I noticed the feed being populated. Ka-ching! Detailed in another page are my experiments that document the tests run as part of this article.
Improvements In The Arduino Since Last Year: Optiboot On The Uno
Before the start of Australian Robotics in the June of 2010, I was working on a project to create a reliable data logger using Arduino, Ethernet Shield and the web service Pachube.com. As a recap, here are some links to the previous works documenting a series of trials with Pachube and the initial Pachube + Arduino project.
To sum it up, the Arduino and Ethernet Shield make good dataloggers in the short term, but eventually will need a RESET when the hardware crashes-- so you'll notice lot's of "frozen" Pachube feeds out there and very few "live" feeds. Pachube will detect that it hasn't had an update from your device in something like 10 minutes, then it will set your feed to a frozen status. Here is a link to my Pachube Feed Number 8281.
Since June of 2010 a few changes have happened including the introduction of the new Arduino Uno, and the decision by Italy to package the Optiboot bootloader with all Arduino Uno's. Of particular interest to Pachube users is that Optiboot builds upon and includes LadyAda's watchdog enhancements which are now a part of the core Optiboot. As you'll see a key part of the code using the watchdog timer to reset the Arduino if there has been no registration to the watchdog in 8 seconds. The second key part of the code is to physically reset the Ethernet Shield by asserting Digital Pin 9 before every loop of useEthernet( ).
Live visualisation from Pachube feed. Mind the funny data during my tests :)
Contact With Jonathon Oxer: The Freetronics Undocumented Features
Today after some correspondence with Jonathon Oxer regarding Ethernet Shields and his new EtherTen Arduino with built in Ethernet, he pointed out an undocumented feature of the Freetronics Ethernet Shield. Jonathon has included in his design a shield reset pad marked as "WIZ RST" found to the top right of the Wiznet chip. This can be used with a digital output on the Arduino in order to reset the shield separately from the Arduino otherwise not possible without bending out the RESET pin of your Ethernet Shield.
Today after some correspondence with Jonathon Oxer regarding Ethernet Shields and his new EtherTen, he pointed out an undocumented feature of the Freetronics Ethernet Shield.
A procedure to do just that is documented in this (outdated) Pachube article on using the Watchdog timer with Arduino to create a reliable datalogger. Using the WIZ RST pad on the Freetronics Ethernet Shield, one can opt out of modding the shield and simply run a jumper to this pad from a digital pin to reset the shield. Jonathon has coupled the Arduino reset with the Ethernet reset to add this functionality while at the same time allowing the Ethernet Shield to be reset when the Arduino is reset.
Asserting the WZT RST Pad from an Arduino Digital Out will reset the shield only. Nice work Jonathon!
Shortly after his email, I was inspired to pick up the project I left off before starting Australian Robotics. Most of my time over the past 8 months has been spent merchandising and working on the e-commerce backend, front end and visual designs for my web store. Quickly I revised the code from the Pachube article to use Arduino IDE 21, the latest EthernetDHCP library and my old Pachube Feed to get some data logged.