Our products, Nanode, wireless, MCUs, electronics and more

Nanode + WickedNode + DHCP + DNS + Pachube!

Posted: August 13th, 2011 | Author: | Filed under: Wireless | Tags: , , , , , , , | 3 Comments »

The other day I got my Nanode talking to Pachube! That in and of itself is pretty cool, and it was also pretty easy given that there are a fair number of examples out on the web and a well documented API for interacting with Pachube. I extended some of these examples to use our Wicked Node and post received data to a Pachube sensor feed. I think my biggest contribution here perhaps was a bit of refactoring of the code so that the major chunks are re-usable in future sketches. Maybe some of it can maybe even make it’s way into the EtherShield library. I’ll provide my sketch attached to this post for anyone who wants to check out the details. I also want to share some general knowledge about debugging networks and software that interacts with networks, which I’ll dedicate my next post to.

So part one – the general program flow goes like this:

setup()
   1. Set Serial to 2400 baud (for radio interface)
   2. Initialize the Ethernet interface with a MAC address
   3. Get an IP address using DHCP (optional)
   4. Initialize the IP/UDP/TCP stack with a MAC address, IP address, and WWW port
   5. Set the Gateway and DNS IP addresses
   6. Wait for the Gateway to recognize the Nanode
   7. Resolve "api.pachube.com" to an IP address using DNS
   8. Initialize the Web Client part of the EtherShield library
loop()
   1. Wait for wireless sensor data to be recieved
   2. When data is received populate a template string and post it to Pachube

Pretty simple, right!? Well there is an example with the EtherShield library for demonstrating DNS and a separate example for demonstrating DHCP, and another example that demonstrates Pachube (getting information *from* Pachube actually), but besides the DHCP example, nothing really tied in DHCP; the other examples just use static IP addresses and call it day. So I refactored the code in the DHCP example so as to make the acquisition of an IP address over DHCP into a function call that I could just call from setup(). I insightfully named this function acquireIPAddress, and I’m pretty sure it will be useful in many a sketch in the future (for me and others I hope). Similarly in looking at the DNS example, it was kind of hard to see how you ended up with a resolved address, so I made another function that I think is a little more intuitive from an API standpoint that takes a null-terminated string as the address to resolves and a buffer into which it puts the resolved IP address. I decided not to get too creative and named this function resolveHost.

I think factoring out these two functions really makes reading the setup and loop functions a whole lot more digestible to the average human. As a last step I tidied up my code and moved things around so that all the configuration for the sketch is up top, including whether you want to use static of dynamic IP parameters, your Pachube API key and how you format and populate your Pachube post template. If you want to use the sketch as a basis for your own application, you’ll have to download the EtherShield library and WickedReceiver library and drop them in your Arduino libraries folder to get it all to compile.

Have fun getting your Nanode onto the internet and let us know what cool things you’re doing it!

Download the Sketch Here: Pachube_WickedNode

Check out this other blog post for a variation on the sketch that doesn’t use the Wicked Node, but instead posts ADC inputs directly from the Nanode.

Update: 12/14/2012 – The EtherShield library was retired earlier this year in favor of the EtherCard library. At some point I may get around to making another update to this post, but the EtherCard library already comes with a pretty easy to follow Cosm (the new name for Pachube) sketch. As always, feel free to post to our forum if you have questions.


Two new products – transmitter and receiver

Posted: January 1st, 2011 | Author: | Filed under: NewProduct, Wireless | Tags: , , , | Comments Off

Announcing two new products, a 433 MHz transmitter+sensor, and a receiver shield, both available in our store. Both are designed for short range, power sensitive applications.

The transmitter and sensor combination makes it very easy to add both digital and analog remote sensing to your projects. It has modes for periodic and event based transmission. Sensor pads make it very easy to solder up to 4 sensors to each sensor. Range is up to 300′ line of sight. It is extremely power frugal, ideal for drop-and-forget sampling.

The receiver is simple, and gives you wireless capability on your ‘duino for under $10, the cheapest we have seen. Together they provide a short range wireless link and sensor package for under $25.

The make pages are:

We hope you enjoy them!


FireFly Real-Time Sensor Networks

Posted: August 16th, 2010 | Author: | Filed under: Uncategorized | Tags: | Comments Off

An interesting wireless project from CMU.

  • Uses XBee (mesh).
  • Uses a radio timekeeping synchronization pulse send from a base station so sensors don’t have to keep accurate time. This lowers power requirements and. “… extends the lifetime of each node by a
    factor of 4-5X …”, which is a pretty impressive increase.
  • Accurate time keeping helps have lots of transmitters, no collisions.

FireFly Real-Time Sensor Networks :: Carnegie Mellon University.