Netduino: Motion Sensor + Pachube

As noted in The Internet of Things in the cloud, Pachube is a cloud-based data-logging service, that works well with network-enabled MCU-based solutions.

To test it out I made a simple project that sends data to Pachube at MotionPachube – Pachube.

006

The hardware is really simple: A motion sensor (the white dome) is connected to a digital port with a pull-up resistor on a prototype shield that’s connected to a Netduino. The IR distance sensor down-right is not used in this project.

The software shows motion sensor status via an RGB LED. It’s intentionally made dim via PWM, as it’s otherwise very bright.

  • red: there’s an active alarm
  • yellow: waiting for the 5 seconds alarm timeout
  • green: there’s no alarm
  • violet: sending data to Pachube

Each 30 seconds the software checks whether there has been any motion during that interval. If it has, a 1 is sent to Pachube, Otherwise a 0 is sent. Unfortunately Pachube only supports numeric values, primarily as a basis for diagrams. Boolean and string/enumerated values would be useful too, to simplify use of the recorded information, provided that the information is state-based rather than analog. which is often the case for e.g. alarms, switches etc.

Initially I sent data only when there was a transition, but Pachube considered the feed “frozen” if the time between updates was too long. Also, the 30 seconds interval keeps it safely within the 5 messages per minute limit in a free Pachube account.