CO gas sensor
nnimar
Posts: 2
Hi,
I'm fairly new at the basic stamp and I'm trying to use the CO Gas sensor (http://www.parallax.com/Store/Sensors/AllSensors/tabid/760/CategoryID/46/List/0/SortField/0/Level/a/ProductID/547/Default.aspx) but I don't understand the program :
In the program description, there is two phases : ' The first phase is the PURGE phase where the heater element is turned on at a full 5V.'
But in the program, LOW HSW is used to Turn the Heater ON ?
Then the second phase, "the SENSE phase where the heater element is run at
~1.4V for 90 seconds.
LOW HSW ' Turn Heater ON
PAUSE 15 ' For 15 mS
INPUT HSW ' Turn Heater OFF
PAUSE 3 ' For 3 mS
Again, LOW HSW to turn the heater on and what is INPUT HSW and does it interact with the LOW HSW ? Is this program correct ? Thanks for any tips using this particular sensor !
Here is the complete program as posted on the sensor page :
' =========================================================================
'
' File...... CO Gas Sensor.bs2
' Purpose... Runs the CO Gas Sensor Module Heater
' Author.... Parallax, Inc.
' E-mail.... support@parallax.com
' Started... 02-09-2009
' Updated...
'
' {$STAMP BS2}
' {$PBASIC 2.5}
'
' =========================================================================
'
[noparse][[/noparse] Program Description ]
' This program runs the Gas Sensor Heater through two phases (voltages) as
' recommended by the manufacturer datasheet. The sensor should run for at
' least 10 minutes in clean air before any calibration is done.
' The first phase is the PURGE phase where the heater element is turned on
' at a full 5V. This clears the sensor and no checking for an alarm
' condition is done here. The DEBUG screen will count down the 60 seconds
' of this phase.
' The second phase is the SENSE phase where the heater element is run at
' ~1.4V for 90 seconds. It is during this phase that the sensor can be
' calibrated or that the sensor is checked for alarm conditions.
'
[noparse][[/noparse] I/O Definitions ]
HSW PIN 0 ' Heater Switch Control
ALR PIN 1 ' Alarm Input Sense
'
[noparse][[/noparse] Variables ]
index VAR Word ' Counter Variable
'
[noparse][[/noparse] Program Code ]
Main:
DO
LOW HSW ' Turn Heater ON
FOR index = 59 TO 0 ' Count Down 60 Seconds
DEBUG HOME, "PURGE MODE...", DEC2 index, " "
PAUSE 1000 ' 1 Second Pause
NEXT
index = 1710 ' Approximately 90 Seconds
DO ' Of Iterations On BS2
DEBUG HOME, "SENSE MODE...", DEC2 index / 19
LOW HSW ' Turn Heater ON
PAUSE 15 ' For 15 mS
INPUT HSW ' Turn Heater OFF
PAUSE 3 ' For 3 mS
index = index - 1 ' Decrement Counter
IF ALR = 1 THEN ' Check For Alarm Condition
DEBUG " ***ALARM***" ' Display Alarm Condition
ELSE
DEBUG " " ' Clear Alarm Condition
ENDIF
LOOP UNTIL index = 0 ' End Of Sense Mode Loop
LOOP
[url=http://][/url][url=http://][/url][noparse][[/noparse]code]
I'm fairly new at the basic stamp and I'm trying to use the CO Gas sensor (http://www.parallax.com/Store/Sensors/AllSensors/tabid/760/CategoryID/46/List/0/SortField/0/Level/a/ProductID/547/Default.aspx) but I don't understand the program :
In the program description, there is two phases : ' The first phase is the PURGE phase where the heater element is turned on at a full 5V.'
But in the program, LOW HSW is used to Turn the Heater ON ?
Then the second phase, "the SENSE phase where the heater element is run at
~1.4V for 90 seconds.
LOW HSW ' Turn Heater ON
PAUSE 15 ' For 15 mS
INPUT HSW ' Turn Heater OFF
PAUSE 3 ' For 3 mS
Again, LOW HSW to turn the heater on and what is INPUT HSW and does it interact with the LOW HSW ? Is this program correct ? Thanks for any tips using this particular sensor !
Here is the complete program as posted on the sensor page :
' =========================================================================
'
' File...... CO Gas Sensor.bs2
' Purpose... Runs the CO Gas Sensor Module Heater
' Author.... Parallax, Inc.
' E-mail.... support@parallax.com
' Started... 02-09-2009
' Updated...
'
' {$STAMP BS2}
' {$PBASIC 2.5}
'
' =========================================================================
'
[noparse][[/noparse] Program Description ]
' This program runs the Gas Sensor Heater through two phases (voltages) as
' recommended by the manufacturer datasheet. The sensor should run for at
' least 10 minutes in clean air before any calibration is done.
' The first phase is the PURGE phase where the heater element is turned on
' at a full 5V. This clears the sensor and no checking for an alarm
' condition is done here. The DEBUG screen will count down the 60 seconds
' of this phase.
' The second phase is the SENSE phase where the heater element is run at
' ~1.4V for 90 seconds. It is during this phase that the sensor can be
' calibrated or that the sensor is checked for alarm conditions.
'
[noparse][[/noparse] I/O Definitions ]
HSW PIN 0 ' Heater Switch Control
ALR PIN 1 ' Alarm Input Sense
'
[noparse][[/noparse] Variables ]
index VAR Word ' Counter Variable
'
[noparse][[/noparse] Program Code ]
Main:
DO
LOW HSW ' Turn Heater ON
FOR index = 59 TO 0 ' Count Down 60 Seconds
DEBUG HOME, "PURGE MODE...", DEC2 index, " "
PAUSE 1000 ' 1 Second Pause
NEXT
index = 1710 ' Approximately 90 Seconds
DO ' Of Iterations On BS2
DEBUG HOME, "SENSE MODE...", DEC2 index / 19
LOW HSW ' Turn Heater ON
PAUSE 15 ' For 15 mS
INPUT HSW ' Turn Heater OFF
PAUSE 3 ' For 3 mS
index = index - 1 ' Decrement Counter
IF ALR = 1 THEN ' Check For Alarm Condition
DEBUG " ***ALARM***" ' Display Alarm Condition
ELSE
DEBUG " " ' Clear Alarm Condition
ENDIF
LOOP UNTIL index = 0 ' End Of Sense Mode Loop
LOOP
[url=http://][/url][url=http://][/url][noparse][[/noparse]code]
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
·
Doesn't this mean it must be active HIGH to turn on? Seems the same thing on the PDF for the module (#27929) where on page 2 pin E1 CNTL is defined as active HIGH.
Does this mean that the program should be changed accordingly? Ie: replace LOW HSW with HIGH HSW and change PWM part?
Thanks for any info, I'm using this for a home-brewing station that emails you when fermentation begins.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
·