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

About Parallax CO gas sensor.

JoeJoe Posts: 184
edited 2011-02-18 16:17 in Accessories
Hi,

Some hours ago I posted a question but not here in this sensor forum.

The question is about a CO sensor :

Parallax code = 27931

I need to take the information from the sensor using a Basic Stamp and display
it with the Parallax 2x16 LCD.

The problem I have is that I don't understand how to take the information from
the sensor. Even I don't understand if it is possible.

Could you help me ?

Thanks, Joe

Comments

  • ercoerco Posts: 20,256
    edited 2011-02-17 13:30
    Tons of info at http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/27931/List/0/SortField/4/ProductID/547/Default.aspx, includes all this:

    Downloads & Resources:
    CO Gas Sensor Module Docs v2.2 (.pdf)
    CO Gas Sensor Module Example Code (.zip)
    CO Gas Sensor Module SchematicDocumentation (.pdf)
    MQ-7 Datasheet (.pdf)

    It's not an analog measurement sensor, but a digital sensor that signals whether or not a gas is sensed at or above a preset threshold concentration. The sample code listed is short & sweet:


    ' =========================================================================
    '
    ' 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}
    '
    ' =========================================================================


    '
    [ 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.


    '
    [ I/O Definitions ]

    HSW PIN 0 ' Heater Switch Control
    ALR PIN 1 ' Alarm Input Sense


    '
    [ Variables ]

    index VAR Word ' Counter Variable


    '
    [ 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
  • JoeJoe Posts: 184
    edited 2011-02-18 12:59
    Hi,

    I tried the code from Parallax PDF but I insist that the sensor sends 1 or 0 and
    I need to show the amount of CO gas.

    It seems that the sensor is not capable to send more than a 0 or a 1 to the microcontroller.
    Could you confirm please ?

    Thanks , Joe
  • ercoerco Posts: 20,256
    edited 2011-02-18 13:25
    As stated, it's a digital sensor; 0 or 1 is all it can tell you.
  • JoeJoe Posts: 184
    edited 2011-02-18 14:10
    I understand , thanks.

    Any way , the other problem I have is that each time I turn off and on the
    sensor resets and I must calibrate again.

    Do you know how can I avoid the calibration each time I turn it off ?

    Thanks , Joe
  • ercoerco Posts: 20,256
    edited 2011-02-18 15:16
    I have not used that sensor, so I'm just reading along here. Per http://www.parallax.com/Portals/0/Downloads/docs/prod/sens/27904_27930-1-2-GasSensor-v2.2.pdf , it's not a one-time calibration, but a purge cycle. That Parallax-provided program purposely cycles eternally through a 60-second purge phase (when it ain't sensing) and a 90-second sensing phase. Those Parallax fellows are smart; this implies that it's not a "flip it on and go" sensor. I heartily suggest you use their method.

    Per that doc, the sensitivity level is adjustable by carefully adjusting the onboard pot.
  • JoeJoe Posts: 184
    edited 2011-02-18 16:17
    Thanks Erco
Sign In or Register to comment.