Hranilica za životinje
CTK RijekaHranilica za životinje. Kad smo na poslu ili u školi, možemo našu kućnu životinju koja je sama kod kuće nadzirati pomoću aplikacije Alfred. Aplikaciju moramo instalirati na starom mobilnom uređaju, kao kameru a na svome uređaju kao viewer (monitor). kad vidimo da je zdjelica hrane ili vode prazna otvorimo aplikaciju blynk i preko nje daljinski pomoću našeg uređaja nadodamo potrebno.
Video snimka
Izrada projekta
Mobilna aplikacija
Shema projekta
Pumpa spojena preko tranzistora s baterijom od 4.5 V a servo motor direktno na MKR1000.
Shemu ovoga projekta možete preuzeti ovdje.
Arduino program
#define BLYNK_PRINT /* /************************************************************* Download latest Blynk library here: https://github.com/blynkkk/blynk-library/releases/latest Blynk is a platform with iOS and Android apps to control Arduino, Raspberry Pi and the likes over the Internet. You can easily build graphic interfaces for all your projects by simply dragging and dropping widgets. Downloads, docs, tutorials: http://www.blynk.cc Sketch generator: http://examples.blynk.cc Blynk community: http://community.blynk.cc Follow us: http://www.fb.com/blynkapp Tweets by blynk_app Blynk library is licensed under MIT license This example code is in public domain. ************************************************************* This example shows how to use Arduino MKR1000 to connect your project to Blynk. Note: This requires WiFi101 library from http://librarymanager/all#WiFi101 Feel free to apply it to any other example. It's simple! *************************************************************/ /* Comment this out to disable prints and save space */ #define BLYNK_PRINT Serial #include #include #include #include "Servo.h" Servo servo; // kreiramo servo objekt za upravljanje motorom int pos = 0; // varijabla u koju spremamo trenutnu poziciju motora int pinValue;// Varijabla za dugme iz Blynka). int pinValue0;// Varijabla za dugme iz Blynka). char auth[] = "19aebd4f72494940bcc82808d303fc21";// You should get Auth Token in the Blynk App. char ssid[] = "AndroidAP";// Your WiFi credentials. char pass[] = "3042311471"; // Set password to "" for open networks. BLYNK_WRITE(V0){ //potprogram koji se vrši kad blynk promjeni stanje virtualnog pina int pinValue0 = param.asInt();//sprema stanje virtualnog pina u pinValue digitalWrite(9, HIGH); // Uključi pumpu) delay(5000); // čekaj 20 sekundi digitalWrite(9, LOW); // ugasi pumpu) } BLYNK_WRITE(V1){ //potprogram koji se vrši kad blynk promjeni stanje virtualnog pina int pinValue = param.asInt();//sprema stanje virtualnog pina u pinValue if (pinValue == HIGH) { servo.attach(8);// spaja servo motor na pin D8 for (pos = 0; pos <= 70; pos += 1) { // goes from 0 degrees to 50 degrees in steps of 1 degree servo.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } delay (1000);//Pauza između otvaranja i zatvaranja for (pos = 70; pos >= 0; pos -= 1) { // goes from 50 degrees to 0 degrees servo.attach(8); servo.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } servo.detach(); } } void setup() { Serial.begin(9600); servo.write(0); Blynk.begin(auth, ssid, pass); pinMode(9, OUTPUT); } void loop() { Blynk.run(); }
Arduino program ovoga projekta možete preuzeti ovdje.
Autori
Projekt je izradio Dominik Rogić uz mentorstvo Saše Škalamere iz CTK Rijeka.
Projekt je prijavljen na temu: Internet of Things: Kućni ljubimci i domaće životinje.