Shop OBEX P1 Docs P2 Docs Learn Events
CO Gas Sensor module #27931 issues with HSW using BS2 uP — Parallax Forums

CO Gas Sensor module #27931 issues with HSW using BS2 uP

jorge_saldanajorge_saldana Posts: 8
edited 2012-02-18 05:39 in Accessories
Hi guys,

Now im working with a BS2 module. The programing and communications are running great. I use as programing base the same sample code of the CO Sensor gas module, and added what I need for my project. The issue im having rigth now is that; when i connect the HSW connection to the co module, it looks like is sinking too much current, the diodes start blinking with low intensity, and the debug window stats showing Smile on the instructions that are running. I tried isolating the HSW line with a 2N3904 switching transistor, but same occurs. Atteched is a drawing of the circuit and the modified code.

Gracias!
Jorge

Schematic:

attachment.php?attachmentid=89668&d=1329571938&thumb=1


' ================================================== =======================
'
' 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}
' {$PORT COM4}
'
' ================================================== =======================

'
[ 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
SENSEled PIN 2 ' sense LED Display
ALRled PIN 3 ' Alarm LED Display

'
[ Variables ]

index VAR Word ' Counter Variable
sPin CON 16 'Serial Pin - P16, Programming port
Baud CON 84 'Baud mode for a rate of 9600, 8-N-1
'
[ Program Code ]

PAUSE 1000 'Allow data communications to stabilize
SEROUT sPin,Baud,[CR] 'Send a lone CR to ensure PLX-DAQ buffer is ready
SEROUT sPin,Baud,["CLEARDATA",CR] 'Clear all data columns (A-J) in Excel
SEROUT sPin,Baud,["RESETTIMER",CR] 'Reset Timer to 0
SEROUT sPin,Baud,["LABEL,Time,ALARM VALUE,STATUS",CR]

Main:
DO
HIGH ALRled 'Turn ALARM LED off
LOW SENSEled 'Turn SENSE LED ON(PURGE MODE)
HIGH HSW 'Turn Heater ON
index=60
FOR index = 60 TO 0 'Count Down 60 Seconds
SEROUT sPin,Baud,["MSG,PURGE MODE....",DEC index,CR] 'Purge Mode Alarm status is off(ALARM=0)
PAUSE 1000 ' 1 Second Pause
NEXT
index = 90 'Approximately 90 Seconds
DO
SEROUT sPin,Baud,["MSG,SENSE MODE....",DEC index,CR]
HIGH SENSEled 'Turn OFF SENSE LED
HIGH HSW ' Turn Heater ON
PAUSE 15 ' For 15 mS
INPUT HSW ' Turn Heater OFF
PAUSE 3 ' For 3 mS
index = index - 1 ' Decrement Counter
PAUSE 800
LOW SENSEled 'Turn SENSE LED ON
IF ALR = 1 THEN ' Check For Alarm Condition
SEROUT sPin,Baud,["DATA,TIME,","1",",","ALARM ON!!!! ",DEC index,CR]
LOW ALRled 'Turn ALARM LED ON
ELSE
HIGH ALRled 'TURN ALARM LED OFF
ENDIF
LOOP UNTIL index = 0 ' End Of Sense Mode Loop
LOOP
Sign In or Register to comment.