Introduction: Voltaic Solar Powered Pollution Monitor

Who wouldn't want to know more about the quality of the air in the area they live in? Sure, you could look up the statistics on many websites, but where’s the fun in that? Living here in Florida there are many areas that lend themselves to doing these kinds of tests and being that the Tampa Hackerspace is located near a high traffic area by the I-4 / I-275 interchange, well, we used the opportunity that the space's location provided.

The thought of pollution and plenty of sunlight is how the idea bore of a Solar powered pollution monitor. The goal we set out with was to measure CO in real time using a remote sensor, then after taking the sampling, publish it publicly to an interactive map. All of this, of course, while being powered by solar energy using the 6 Watt Solar Charger Kit from Voltaic Systems. A self-contained solution.

Step 1: Parts and Pre-requisites

Let’s start by pulling all of our tools and parts together as well as downloading the code / drivers to be used.

Tools
- A Soldering iron
- Solder
- PC or Laptop that can program your Arduino (or clone), with a USB port

Prerequisite
Go get and install drivers for the DigiX from: http://digistump.com/wiki/digix/tutorials/software

Project Code
Github Repo: https://github.com/TampaHackerspace/pollution-sensor-network


Parts
- 6 Watt Solar Charger Kit by Voltaic Systems (http://www.voltaicsystems.com/6wattkit.php)
- Arduino or Arduino Clone with Wi-Fi built in (we used the DigiX by Digistump Version 1.0)
- USB to Micro Connector to Power the Arduino, this comes with the  Solar Charger Kit
- USB to Micro Connector to Program the Arduino (unfortunately you can’t use the one that comes with the Solar Charger Kit)
- MQ-7 Carbon Monoxide sensor from SparkFun
- Gas Sensor Adapter Board from SparkFun
- BUK553-100 Mosfet (N-channel Logic level Mosfet, any N-channel level Mosfet handling 1 Amp)
- 2 x 10K Ohm Resistors
- Spare PC Board (Solderable Prototype board)
- Male Header Pins (enough to handle at least 8, the final number will depend on the number of sensors you want to attach should you choose to expand from this Instructable!)
- 1 x 2 inch by ¼ inch Carriage Bolt  (we chose this bolt as there is a square piece just under the mushroom head that wedges nicely against the PVC to prevent rotation)
- 3 x ¼ inch nuts for the Carriage Bolt
- 1 x 1 inch PVC pipe that is roughly 4 inches long
- 4 x 1 inch pieces of heat shrink tubing of 3/16 inch size
- 1 Orange 24 AWG wire 1.5 meters long
- 1 Black 24 AWG wire 1.5 meters long
- 1 Red 24 AWG wire 1.5 meters long
- 1 Yellow 24 AWG wire 1.5 meters long

Note: While it’s not necessary, we recommend the 4 colors of hookup wire.  It can really be all the same color, but using different colors helps to avoid making improper connections.

Step 2:

Install the drivers on your PC / Laptop from DigiX for the Arduino / Clone.  If you chose to go with the DigiX, you will need to follow the instructions on their website (http://digistump.com/wiki/digix/tutorials/software) to make sure you get the critical library for Wi-Fi.  Following these steps will help test to make sure you can also see it, for later on in the project. 

Ensure you can see it by executing one of the standard Arduino sketches.  We recommend using 01.Basics, then select Blink.  This will make sure you can program the Arduino when it comes time.

Step 3:

Set up the Wi-Fi on the Arduino.  Follow the instructions on the tutorial link to ensure Wi-Fi works on the Arduino / Clone.  At the end of the doc, to test, they have a test Sketch to run.  It’s on DigiFi, then BasicClient.

Click Play, it’ll run, then open the Serial Monitor.  It will say “Press Any key”.  Put in any letter you want, then click Send.  Watch the Serial Monitor for confirmation that it is communicating.

Setup Wi-Fi on the DigiX:
http://digistump.com/wiki/digix/tutorials/wifi

Step 4:

Now it's time to create the Sensor Shield.

To do this, we will install the Headers. 

The Headers need to line up with the following Arduino pin locations:
+3.3V   (our connection 1)
+5V   (our connection 2)
Ground   (our connection 3)
Ground   (our connection 4)
Voltage In   (our connection 5)
Leave a Gap (this is where the Arduino has a space in it’s Female connector)  (our connection 6)
A0    (our connection 7)
A1    (our connection 8)
A2     (our connection 9)

Step 5:

Install the first one of the resistors.

The Resistor will connect the 7th and 9th connector slots, adjacent to A0 and A2.

Step 6:

Install the Mosfet

Mosfet goes on 7, 8, and 9 on our board.

Connections are:
Pin1 on the Mosfet (which is the Gate), lines up with Slot 7 (which is above but not connected to A0)

Pin 2 on the Mosfet (which is the Drain), lines up with Slot 8 (which is above but not connected to A1)

Pin3 on the Mosfet (which is the Source), lines up with Slot 9 (which is above but not connected to A2)

Step 7:

Install the second resistor on the 3rd connection.  Bring out the resistor to a convenient connection point, at least 3 or 4 pads out.

Install the A0 to Pin1 Mosfet connection (which is the Gate), using the Yellow wire.

Step 8:

Install 2 more connections.

Install the Pin3 of the Mosfet (which is the Source), to pin 4 on the Headers (which goes to the Arduino Ground)

Install the end of the resistor from Step 7 to the 9th slot header pin which is going to A2 on the Arduino board.

Step 9:

Installing the wire connections on the  Gas Sensor Adapter Board

Use about 1 meter of wire for each connection
Solder the black wire to the GND (Ground)
Solder the yellow wire to the B1
Solder the orange wire to the A1
Solder the red wire to the H1 (this is the heater power)

Now that the connections are soldered, plug in the sensor to the board itself.

Step 10:

Twist the 4 wires of the sensor to make about a 2 inch twist.  Slide over the heat shrink tubing.  Very carefully, apply heat to the tubing to make it shrink over the wires.  Do this starting nearest the sensor first.

Step 11:

Install the sensor Ground wire (the black one) to the Mosfet Pin 2 (which is the Drain).  Don’t be fooled by the picture, it curves in!

Step 12:

Install the sensor B1 yellow wire to the resistor on slot 3

Step 13:

Install the orange A1 Sensor wire to Slot 1 on the Header pins (which is Arduino 3.3+)
Install the red H1 Sensor wire to Slot 2 on the Header pins (which is Arduino +5)

Step 14:

Now connect the “shield” you have just created on to the Arduino.  Be sure to start Slot 1 at the Arduino 3.3+, and ensure that Slot 7 ends up over A0.  You may find that Slot 7 to A0 is the easier one to line up given the Gap.

At this time, you might want to install a couple of extra header pins that really don’t do anything but provide stability on the board as it lays.

Step 15:

Cut a slot in the PVC about the width of the Carriage Bolt (¼ inch), and 1 inch deep.

Take the Carriage Bolt and put on all 3 nuts.

At this time, put a slight bend in the Sensor wire about 1 inch back from the sensor.

Step 16:

Now, slide the sensor into the PVC facing away from the slot you just cut.
After you have placed the sensor, put the Carriage bolt in behind it, wedging the sensor in place.
Secure the Carriage bolt by tightening one of the nuts to the PVC

The point of doing this is to provide a moisture shield and prevent debris from easily affecting the sensor, while still allowing for flow of air to prevent stale air measurements.

Step 17:

Open the Arduino Sketch on your PC, and make sure the Arduino is connected to your USB cable.  Now load the Sketch on to your Arduino.  Open up the Serial monitor and ensure it’s communicating with your sensor.  You should see a lot of debugging text as it counts down to taking the readings.  The system is currently set to take readings as follows:

Heater goes on for 60 seconds then it goes to Idle which is mid range for 90 seconds (where it takes readings, but only after every 5 minutes between sampling periods as this is during the next available Idle time period)

We take the reading every 10 seconds during this idle period during the 5th minute.  We throw out the highest, the lowest, then we average the remaining.  This is to get rid of noise.

Step 18:

Now it's time to register to post your data!

You will need to go to this URL and register for your API key: 
http://tampahackerspace.com/dontpollute/api.php

Just create a quick account and the page will output the USER_ID, SENSOR_ID, and API_KEY that you will be using in the following steps (in your Arduino code).

Step 19:

Now it's time to get your Latitude and Longitude for your Arduino code.  For this, we recommend the following site as it's very easy to use:

http://itouchmap.com/latlong.html

Just enter your address, then grab the values that are created in the Latitude and Longitude box.  You will be using them in the next step.

Step 20:

Time to put your registration info into your sketch code.  Look for the lines in the
“Network and Location Information” section of the Arduino

Download the new code just like Step 17, then test it.

Step 21:

Connect the power only USB from Voltaic, from the Voltaic battery to the Arduino.  Connect the solar panel to the Voltaic battery.

Step 22:

Mount it outside, or inside, or anywhere!

Step 23:

That's it!  You are up and running.

The great thing about the power source for this project is, the Voltaic Panel gives us 6 watts, the battery gives us 5 watts, and we consume 1 - 2 watts.  So we should theoretically, never run dry. 

A completely self-contained powered project!  It’ll run through the night, and charge in the day!

Credit where credit due:
Wesley Faler
Bill Shaw
Jon Adair
William Stillwell
Charles Bucher
Alexander Wingeier