====== Garagenzugang ======
---- datatemplateentry project ----
template : :sys:tpl:project
description : Automatische Geragentorverrigelung/-öffnung
coordinators : [[:users:skruppy:]]
confidants :
state_tags : in progress
type_tags : elektro, software, AVR, C
----
===== IR Sensor =====
4-Fach OP-Verstärker:
KIA324P
8C
Komplette Platine analog => Lampe als Schnitstelle zu mC verwenden + Helligkeitssensor abzicken (dunkel machen) [oder im gehäuse lassen und wieder abkleben]
{{:projects:pir-sensor-back.jpeg?direct&760|}}
{{:projects:pir-sensor-front.jpeg?direct&500|}}
===== Türöffner =====
{{:projects:door-lock.jpeg?direct&750|}}
===== System =====
{{:projects:garage.jpg?direct&300|}}
setState(state) {
switch(state) {
unlocked:
disableIsr(unlockSwitch/ir);
enableIsr(door);
break;
locked:
enableIsr(unlockSwitch/ir);
disableIsr(door);
break;
}
}
ISR(unlockSwitch/ir) {
setState(unlocked);
}
ISR(door) {
setState(unlocked);
setLed();
}
////////////////////////////////////////////////////////////
// Detect current peak //
////////////////////////////////////////////////////////////
// Find a rising edge (the same as the code below) (rising edge has to be detected before falling ege to prevent detection of the power on current)
// Find a falling edge
while(true) {
if(adx >= error) {
stop();
}
else if(adc > max) {
max = adc;
th = adc;
}
else if(adc < th) {
if(th == max) {
th *= 0.9;
}
else {
stop();
}
}
}
[[http://www.ganssle.com/debouncing-pt1.htm|Debouncing statistics]]