3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Air quality balloons

Step 3Program the PICAXE

Program the PICAXE
First, you need to install the PICAXE IDE and drivers for your computer from http://www.rev-ed.co.uk/picaxe/software.htm

Second you have to assemble your PICAXE programming board or whatever you choose to use to program the pic. Refer to http://www.rev-ed.co.uk/ for details on starting out with the PIC.

The code is very simple. It samples the sensor output, and if it's below, within or above certain thresholds, it turns the LED green, yellow or red. Each sensor might have slightly different thresholds. Here are the values I used, based on collecting data around my city:


main:
'w5 = 270 'DIESEL GREEN'
'w6 = 295 'DIESEL RED'

'w5 = 448 'VOC GREEN'
'w6 = 470 'VOC RED'

w5 = 360 'EXHAUST GREEN'
w6 = 380 'EXHAUST RED'

goto runsensor

runsensor:
readadc10 4, w3 'SENSOR VALUE'
if w3 < w5 then 'GREEN'
high 1
low 2
endif

if w3 >= w5 and w3 < w6 then 'YELLOW'
high 1
high 2
endif

if w3 >= w6 then 'RED'
low 1
high 2
endif
pause 500
goto runsensor

An easy way to guess what the green, yellow and red values might be after you already wired up the circuit is by using a voltmeter. You can see what voltage the sensor is giving off at different locations and translate that into analog values:

1023 * sensor voltage / your battery voltage

« Previous StepDownload PDFView All StepsNext Step »
3 comments
Oct 14, 2011. 10:47 PMExiumind says:
how do i program using the flow chart?
Aug 5, 2010. 4:07 PMpixiecrossing says:
Wow...I can't understand any of this. :-(
Aug 7, 2010. 6:30 AMKurremkarmerruk says:
"An easy way to guess what the green, yellow and red values might be after you already wired up the circuit is by using a voltmeter. You can see what voltage the sensor is giving off at different locations and translate that into analog values:" Yeah that's a bit rough on my brain too.

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
49
Followers
4
Author:staceyk