Staubsensor mit ATtiny13          

von Gerd Sinning                      
Elektronik-Labor   Projekte   AVR 

Es gibt einen Staub- und Rauchsensor von Sharp, den GPU206, den man bei Pollin kaufen kann. Den muss man mal testen und vielleicht kann man einen eigenen Rauchmelder bauen. Kurz gesagt, es funktioniert. Die Datenblätter von Sharp sind etwas kryptisch, As input conditions of the LED terminal, please apply LED drive conditions. Man braucht einen Mikrocontroller um den Sensor anzusteuern und auszulesen: Dazu sind 0,4 ms Pulse in einem Abstand von 30 ms nötig. Die erzeugt ein ATtiny13 mit einem kleinen Basic-Programm.

Das Blockschaltbild vom GPU206 mit den Verbindungen zur Außenwelt. Die Steckerleiste hat 2 mm Abstand. (Ich habe einfach Drähte angelötet)

Das Schaltbild mit ATtiny13 und GPU206, rechts das Timing für den Sensor

Den Zeitabstand von 30 ms erzeugt der Timer im ATtiny13, der feuert alle 10 ms. Die Pulse sind an PB1, und bei 3 wird der Puls für den Sensor an PB0 ausgelöst, der soll 0,4 ms dauern und in der Mitte wird gemessen., d. h. man braucht ca 200 µs für das erste Delay, dann wird der ADC ausgelesen, und dann nochmal ca. 200 us. Der erste Versuch mit dem Basic Befehl 'Waitus' war nicht so erfolgreich, daher kommt für den Delay eine bewährte Assembler Routine zum Einsatz, genannt Mydelay. So geht es dann. Die Idee, in der Mitte vom Puls zu messen stammt aus dem Datenblatt vom GP2Y1010AU0F, auch von Sharp. Die Spannung am Output terminal geht an den ADC1 vom ATtiny13 und wird dort ausgewertet und über die serielle Schnittstelle (PB4) an den PC geschickt. Bei meinem Sensor geht die Spannung von 0 bis 890 mV mit Rauch, das entspricht 185 auf der seriellen Schnittstelle. Eine Led zeigt Rauch an, der Schwellwert ist programmierbar: If Voltage > 100 Then Led1 on, das kann man beliebig empfindlich einstellen, und es ist recht empfindlich. Insgesamt braucht der Sensor ca. 12 mA bei 5 Volt.

Rauchmelder kann man natürlich kaufen (langweilig), aber so hat man einen wundervoll konfigurierbaren einzigartigen Rauchmelder.

References

Sharp: GPU206, Sharp's GP2U06 is dust sensor which integrated optical sensor portion and signal amplifier portion. is suitable for indoor air purifier sensor because of compact, thin, low dissipation current type.

Sharp: GP2Y1010AU0F & gp2y1010au_appl_e.pdf

Atmel: ATtiny13

Please don’t do cleaning, because there is a case that this device is not satisfied with its characteristics by cleaning.

Download: Dust1.zip
'***************************************************************************
'
'ATTiny13 dust sensor GP2U06 controller
'
' dust sensor pulse output PB0
' input on ADC channel 1
'
'***************************************************************************
' This program is free software; you can redistribute it and/or
' modify it under the terms of the GNU General Public License.
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY;
'
'***************************************************************************
'
' Pinout ATtiny13/ATtiny13V 8-PDIP/SOIC
'
' (PCINT5/RESET/ADC0/dW) PB5 VCC
' (PCINT3/CLKI/ADC3) PB3 PB2 (SCK/ADC1/T0/PCINT2)
' (PCINT4/ADC2) PB4 PB1 (MISO/AIN1/OC0B/INT0/PCINT1)
' GND PB0 (MOSI/AIN0/OC0A/PCINT0)
'
'***************************************************************************
' PB0 output dust pulse 0.4 ms
' PB1 output Ipulse
' PB2 input ADC channel 1
' PB3 output Led1 hi
' PB4 output RS232
'***************************************************************************

$regfile = "attiny13.dat"
$crystal = 1200000
$hwstack = 8
$swstack = 8
$framesize = 4

Const C_value = 187 - 1 ' Compare Match IRQ 10 ms start
Declare Sub Mydelay

Dpulse Alias Portb.0
Ipulse Alias Portb.1
Led1 Alias Portb.3

Dim Voltage As Word , Avgv As Word
Dim Icnt0 As Byte , Icnt1 As Byte

Portb = &B00000000
Ddrb = &B0011011

Acsr.acd = 0 ' switch off analog comparator

Config Adc = Single , Prescaler = Auto , Reference = Avcc
Didr0.adc1d = 1
Start Adc

Config Timer0 = Timer , Prescale = 64
Ocr0a = C_value ' value for 1.2 MHz
Tccr0a = &B00000010 ' ctc
Timsk0.ocie0a = 1
On Oc0a Tim0_compa
Start Timer0
 


 Elektronik-Labor   Projekte   AVR