Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

I've built a few motes connected to a soil moisture sensor from Sparkfun (https://www.sparkfun.com/products/13322). I will publish a different blog post with recipe with a hookup guide for that sensor.  In one instance, I'm sampling the moisture sensor once every 5 minutes.  In another version of that project, all motes in a network will simultaneously measure their moisture sensor once per hour.  I decided that I wanted to use my FSR as a user input.  If I want to check right now whether the plant needs watering, I want to press a button that causes the mote to take a reading and send a packet to the manager with that reading.  

I based my project on 04-syncblink from the OCSDK.  In that project, the mote joins, and gets network time from the network.  It uses network time as the basis for a user settable interval to blink an LED.  Using that project with no changes, you can have all your motes blink their LEDs in unison, demonstrating that the motes share a very accurate synchronized clock.  I replaced the simple 'blink' function with a slightly more complex action.  When this function is called, it turns on a digital output to power on the sensor, takes an analog reading from the sensor, and turns the digital output off again.  The Voltage reading is then stuffed into a packet and sent over the air to the manager.  This measurement function gets called whenever a semaphore is set.  There is a separate timer task that sets this semaphore whenever a timer expires.  I used my FSR circuit with a very similar GPIO notification task to interact with that same semaphore.  Now my mote will measure the soil moisture once an hour, and will send an extra reading anytime I press the button.  

...

The Adafruit round force-sensitive sensor is an inexpensive product that allows you to very rapidly prototype pushbutton functionality to your mote project.  In addition to the ease-of-use, it lends itself to an extremely low power consumption setup.  Still, this is just an example of a pushbutton, which are all straightforward to include into your OCSDK project.  Once you have a pushbutton as an input to the mote, there are numerous things you could do with it.  This blog post describes recipe describes a couple high-level examples of things I built to demonstrate the capabilities.