Help making alcohol breathalyser, need help with A/D! 16F628

Status
Not open for further replies.

lompa

New Member
i am currently trying to make a system that will light an led for drive and a led for dont drive. I have also added a ready led for the sensor warm up time.

I am using pic basic and have used the POT command and used a Pot to demonstrate the system working. i have just got the sensor and it has a varying output voltage

How do i go about wiring up a A/D to my 16f628 and how do i add the A/D to my PIC program?

is there another way i could do this, eg sticking something on the output of the sensor so that the voltage could vary some resistance somehow, there for i could stick with the POT commands?????




Here is my code so far, i am using PICBasic

'xtal=4 '4mhz
DIM VAR1 as BYTE
symbol LED = Portb.0 'Delay on led
symbol LED2 = Portb.1 'output led1
symbol LED3 = Portb.2 'output led2
'SYMBOL PIN1 = PORTB.3 'inputs
'SYMBOL PIN2 = PORTB.4 'inputs
INPUT PORTB.3 'defining input
'INput PORTB.4 'defining input
Low LED2 'led off
Low LED3 'led off
Delayms 40000 'sensor warm up time 40secs
High LED 'sensor warm led on after 40secs

Start: 'start
VAR1 = POT PORTB.3 , 255
IF VAR1 < 125 THEN High LED2 'if pin1 is less than pin2 make led come on
If VAr1 > 125 THEn Low LED2 'if not led off
IF VAR1 > 125 THEN High LED3 'if pin2 is less than pin1 make led come on
IF Var1 < 125 THEN Low LED3 'if not led off
Goto Start 'go back to start
End

Thanks
 
There are four solutions :
1. Use different PIC, which has AD
2. Use 16F628 and use external AD using SPI or I2C interface
3. Make a comparator AD (low resolution)
4. Use 555 timer to change Voltage to frequency
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…