SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
By gussy
#30323
Hi,

Have a read of the datasheet http://www.farnell.com/datasheets/62649.pdf

Once you are have all the right connections for the supply and led, it looks like the voltage output is proportional to the density of dust, you will want to look at the ADC function in bascom.
By Limus
#30330
Hi, thanks for your answer. Actually I started to work with that sensor last week. I have tested it without micro and now I'm trying to interface it with the mega16. I have done a simple code, just to see the adc changes on lcd, but it doesn't work. Im using Adc(1). See the code please. I think it would be better to use a timer with 3rd pin but I don't know how to do that. Could you help me please.

$crystal = 4000000
$regfile = "m16def.dat"


Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portd.3 , Db5 = Portd.2 , Db6 = Portd.1 , Db7 = Portd.0 , E = Portd.6 , Rs = Portd.7

Config Adc = Free , Prescaler = Auto

Dim A As Long
Dim B As Long
Dim Total As Long


'Config Portc.5 = Output
Config Portc.6 = Output
Start Adc

Cls

Do

Set Portc.5
Set Portc.6

Waitms 0.24


Reset Portc.5
Reset Portc.6

Waitms 0.24

A = Getadc(1)
B = Getadc(1)
Total = A + B
Total = Total / 2

Home

Lcd "ADC(1):" ; Total ; " "

Loop
End

Thanks again :wink: