Detektor pokreta sa logiranjem vremena detektovanja aktivnosti. LPC1768 + TinyRTC DS1307 + PIR detektor pokreta. Mogućnost deaktivacije sustava.

Dependencies:   mbed DetectOff RTC-DS1307

https://os.mbed.com/media/uploads/dmartic/sku_161172_1.jpg

TinyRTC modul sa DS1307 RTC i Atmel A24C32 32kb EEPROM memorijom. Posjeduje tri pina za dodavanje DS18B20 1-žičnog termometra ukoliko je potrebna temperaturna kompenzacija.

DS1307 radi na 100kpbs dok A24C32 radi na maksimalnih 400kpbs. Oba se nalaze na istoj bus liniji sa zajedničkim Pull-Up otpornicima od 3.3kOhm. Koristi I2C standardnu komunikaciju s bufferom od 7 podataka: Godina, mjesec, datum, dan u tjednu, sat, minutu i sekundu, tako je default EEprom adresa: 0x1010000r, gdje je r=1 read bit, a r=0 write bit za upis na slave. U slučaju ovakvog rada Mbed je master pa je r=1. https://os.mbed.com/media/uploads/dmartic/ds1307ckt.jpg

Za detekciju pokreta korišten je jednostavan PIR sensor, sa napajanjem i digitalnim izlazom, kada se detektuje temperaturna razlika okoline i tijela u pokretu sensor daje visoku razinu, a nisku razinu ukoliko nema promjene topline okoline. https://os.mbed.com/media/uploads/dmartic/geeetech_20140718193215.jpg

Files at this revision

API Documentation at this revision

Comitter:
dmartic
Date:
Mon Jan 20 13:04:05 2020 +0000
Commit message:
Detektor pokreta sa logiranjem vremena detekcije.; LPC1768 + TinyRTC DS1307 + PIR detektor pokreta.

Changed in this revision

DetectOff.lib Show annotated file Show diff for this revision Revisions of this file
RTC-DS1307.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r a102c2e8077e DetectOff.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DetectOff.lib	Mon Jan 20 13:04:05 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/dmartic/code/DetectOff/#facfaa94f419
diff -r 000000000000 -r a102c2e8077e RTC-DS1307.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RTC-DS1307.lib	Mon Jan 20 13:04:05 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/dmartic/code/RTC-DS1307/#67d9685eaeb0
diff -r 000000000000 -r a102c2e8077e main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jan 20 13:04:05 2020 +0000
@@ -0,0 +1,48 @@
+//Izvorne datoteke
+#include "mbed.h"
+#include "Rtc_Ds1307.h"
+#include "DetectOff.h"
+
+//Inicijalizacija varijabli
+Serial pc(USBTX,USBRX);
+Timer debounce;
+Rtc_Ds1307 rtc(p9,p10);
+InterruptIn detector(p13);
+DigitalOut ledica(p15);
+DigitalIn taster(p18);
+DetectOff led(LED2);
+Rtc_Ds1307::Time_rtc tmt = {};
+LocalFileSystem local("local");
+
+//Detekcija i zapisivanje u datoteku/consolu
+void detection(){
+    FILE* File1 = freopen("/local/activity.txt","a",stdout);
+    if(debounce.read_ms()>200){
+        ledica=1;
+        if(rtc.getTime(tmt)){
+            pc.printf("%02d:%02d:%02d %s, %02d/%02d/%04d \r", tmt.hour, tmt.min, tmt.sec, rtc.weekdayToString(tmt.wday), tmt.mon, tmt.date, tmt.year);
+            fprintf(File1,"%02d:%02d:%02d %s, %02d/%02d/%04d\n", tmt.hour, tmt.min, tmt.sec, rtc.weekdayToString(tmt.wday), tmt.mon, tmt.date, tmt.year);
+        }
+        ledica=0;
+        fclose(File1);
+        debounce.reset();
+    }
+}
+ 
+//Glavna klasa - inicijalizacija
+int main(){
+    while(1){
+    if(taster==1){
+            led.disable(5);
+            detector==0;
+        }
+    else if(taster==0){
+        debounce.start();
+        detector.rise(&detection);
+        }
+    }
+}
+
+
+
+
diff -r 000000000000 -r a102c2e8077e mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jan 20 13:04:05 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file