Netduino 3 Wifi pollution Sensor Part 1

I am working on a Netduino 3 Wifi based version for my original concept as a STEM project for high school students. I wanted to be able to upload data to a Microsoft Azure Eventhub or other HTTPS secured RESTful endpoint (e.g. xivelyIOT) to show how to build a securable solution. This meant a Netduino 3 Wifi device with the TI C3100 which does all the crypto processing was necessary.

The aim was to (over a number of blog posts) build a plug ‘n play box that initially was for measuring airborne particulates and then overtime add more sensors e.g. atmospheric gas concentrations, (Grove multichannel gas sensor), an accelerometer for earthquake early warning/monitoring (Grove 3-Axis Digital Accelerometer) etc.

Netduino 3 Wifi based pollution sensor

Bill of materials for prototype as at (October 2015)

  • Netduino 3 Wifi USD69.95
  • Seeedstudio Grove base shield V2 USD8.90
  • Seeedstudio Grove smart dust sensor USD16.95
  • Seeedstudio Grove Temperature & Humidity Sensor pro USD14.90
  • Seeedstudio ABS outdoor waterproof case USD1.65
  • Seeedstudio Grove 4 pin female to Grove 4 pin conversion cable USD3.90
  • Seeedstudio Grove 4 pin buckled 5CM cabed USD1.90

After the first assembly I have realised the box is a bit small. There is not a lot of clearance around the Netduino board (largely due to the go!bus connectors on the end making it a bit larger than a standard *duino board) and the space for additional sensors is limited so I will need to source a larger enclosure.

The dust sensor doesn’t come with a cable so I used the conversion cable instead. NOTE – The pins on the sensor are numbered right->Left rather than left->right.

The first step is to get the temperature and humidity sensor working with my driver code, then adapt the Seeedstudio Grove-Dust sensor code for the dual outputs of the SM-PWM-01 device.

According to the SM-PWM-01A device datasheet The P1 output is for small particles < 1uM (smoke) and P2 output is for large particles > 2uM (dust). The temperature & humidity sensor is included in the first iteration as other researchers have indicated that humidity levels can impact on the accuracy of optical particle counters.

Then, once the sensors are working as expected I will integrate a cut back version of the AMQPNetLite code and configuration storage code I wrote for my Netduino 3 wifi Azure EventHub Field Gateway.

Netduino Silicon Labs Si7005 Device Driver

A while back I wrote a post about some problems I was having with a Silicon Labs Si7005 device and now I have had some time to package up the code.

My code strobes the I2C SDA line and then initiates a request that will always fail, from there on everything works as expected.

public SiliconLabsSI7005(byte deviceId = DeviceIdDefault, int clockRateKHz = ClockRateKHzDefault, int transactionTimeoutmSec = TransactionTimeoutmSecDefault)
   this.deviceId = deviceId;
   this.clockRateKHz = clockRateKHz;
   this.transactionTimeoutmSec = transactionTimeoutmSec;

   using (OutputPort i2cPort = new OutputPort(Pins.GPIO_PIN_SDA, true))

   using (I2CDevice device = new I2CDevice(new I2CDevice.Configuration(deviceId, clockRateKHz)))
      byte[] writeBuffer = { RegisterIdDeviceId };
      byte[] readBuffer = new byte[1];

      // The first request always fails
      I2CDevice.I2CTransaction[] action = new I2CDevice.I2CTransaction[] 

      if( device.Execute(action, transactionTimeoutmSec) == 0 )
         //   throw new ApplicationException("Unable to send get device id command");

This is how the driver should be used in an application

public static void Main()
   SiliconLabsSI7005 sensor = new SiliconLabsSI7005();

   while (true)
      double temperature = sensor.Temperature();

      double humidity = sensor.Humidity();

      Debug.Print("T:" + temperature.ToString("F1") + " H:" + humidity.ToString("F1"));


I have added code to catch failures and there is a sample application in the project. For a project I’m working on I will modify the code to use one of the I2C sharing libraries so I can have a number of devices on the bus