Shop OBEX P1 Docs P2 Docs Learn Events
CO gas sensor — Parallax Forums

CO gas sensor

nnimarnnimar Posts: 2
edited 2010-05-28 21:33 in Accessories
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]

Comments

  • FranklinFranklin Posts: 4,747
    edited 2010-03-14 19:56
    Did the program work for you? Sometimes you switch the ground side of the device and hence the LOW.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • WildmaxWildmax Posts: 1
    edited 2010-03-23 23:23
    What they have done with the second phase of the code is to only pulse the heater on for a short time and then turn it off. While this is only 0V then 5V, this basically delivers an average voltage across the heating element simulating a PWM output.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-03-24 15:34
    Wildmax is correct...it is an attempt at simple PWM while maintaining that the input to the heater switch must be LOW to turn it on and it is pulled HIGH to turn it off. Typically in a circuit where you drive a line LOW to activate it, if the line is pulled HIGH, you don't assert or drive the line HIGH, but instead switch the I/O pin to INPUT mode so that it allows the pull-up resistor to do its job. I hope this helps. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    ·
  • nnimarnnimar Posts: 2
    edited 2010-03-28 14:59
    Thanks Chris and Wildmax !
  • LeibnizLeibniz Posts: 2
    edited 2010-05-24 18:40
    Hey Chris, I'm looking at the schematic for this thing (CO2 Gas Sensor Module - assuming its the same as the CO module) and the CNTL pin is hooked-up to an n-channel E-MOSFET.

    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 SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-05-26 23:18
    The schematic for the CO sensor is almost identical to the CH4 and LPG Gas Sensors Modules, however the CO2 Sensor works on a different principle and therefore has its own schematic which is not very similar to the others.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    ·
  • LeibnizLeibniz Posts: 2
    edited 2010-05-28 21:33
    Ah, OK, I see that now. Thanks for clearing that up.
Sign In or Register to comment.