Feeder vissen (10 / 10 stap)

Stap 10: codering

Let op: deze code is zonder de subprojecten!

 /* Arduino is connected with USB to Raspberry PI Two programs are running1 Rasberry PI is the master Sending lines: - line01 : date - line02 : time - line03 : water temperature - line04 : when is the sunrise - line05 : when is the sundown - line06 : when is the time/manual/off and result of feeding of the fish 1 - line07 : when is the time/manual/off and result of feeding of the fish 2 - line08 : when is the time/manual/off and result of feeding of the fish 3 - line09 : when is the time/manual/off and resukt of feeding of the fish 4 - line10 : optional Sending times: - time01 : minutes until next feed - time02 : minutes until sunrise - time03 : minutes until sundown Receiving: - resullt of the feeding - request for sending line 01 to 10 2 Arduino is the slave Sending & Receiving to Raspberry PI Pins - LiquidCrystal (8, 9, 4, 5, 6, 7) & A0 - Softwareserial (10, 11) RX, TX - ReadingCds (A1, A2, A3, A4, A5) - Servo 1 (2) - Servo 2 (3) - Servo aan/uit (12) - Led aan/uit (13) Looping 1 Request & Read line 01 to 10 Request & Read time 01 to 03 If time 01 < 1 Display a countdown & Feed If time 02 or 03 < 1 Display a countdown Dispay current setting line01 to line10 1 per second */ /* Power consumption General power consumption Arduino: 50-60mA LCD screen Checking the USB-port, Arduino only, Arduino with LCD lsusb -v|egrep "^Bus|MaxPower" Bus 001 Device 006: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter MaxPower 96mA USB devices must tell the controller how much current they draw Using a multimeter reports 23mA Servo 1 Library: Servo, Delay 10ms, angle When detached the multimeter reports 5mA When attached the multimeter reports 150mA 1 Library: Servo, Delay 30ms, angle When detached the multimeter reports 5mA When attached the multimeter reports 125mA 2 Library: VarSpeedServo, speed 30 When detached the multimeter reports 5mA When attached the multimeter reports 150mA 3 Library: Servo, writeMicroseconds When detached the multimeter reports 5mA When attached the multimeter reports 110mA For servo please note: Keep friction low Total Servo1 Servo2 Arduino 50mA 50mA LCD 25mA 25mA Servo1 110mA 5mA Servo2 5mA 110mA LED 20mA 20mA NPN 20mA 20mA --- + --- + 230mA 230mA */ // Setting up the Keypas LCD #include LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 ); /* initialize the library with the numbers of the interface pins Arduino : LiquidCrystal lcd(12, 11, 5, 4, 3, 2); Clone : LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 ); A note about the Pin 10 bug Just one thing to mention, they all happen to have a flaw in the design, so don’t use pin 10 when using this shield. The library has functions to enable and disable the backlight. But in the design, a flaw exists, that when pin 10 is set to output, and set high, it could cause the IO pin of the MCU (the main Atmel chip) to deliver too much current (over the datasheet’s maximum rating) to the backlight LED. This may cause the over stressing of the MCU and may reduce its life, or maybe even blow it up. - To set the backlight on, set pin 10 as input. - To set the backlight off, set pin 10 as output, and immediately set output low (never high!) Clip off pin 10 */ // Setting up the serial link with Raspberry pi // #include // SoftwareSerial mySerial(10, 11); // RX, TX // * RX is digital pin 10 (connect to TX of other device) // * TX is digital pin 11 (connect to RX of other device) // Setting up the servo #include Servo servo1; // create servo1 object to control servo feeder Servo servo2; // create servo2 object to control servo hatchh int servo1_pos = 0; // variable to store the servo1 position int servo2_pos = 0; // variable to store the servo2 position // Setting up the Led & LDR int var_blink_led = 0; // Setting up the array for A1-A5 int var_A1[99]; int var_A2[99]; int var_A3[99]; int var_A4[99]; int var_A5[99]; int led_pos=0; int wacht=100; void setup() { // - Servo aan/uit (12) pinMode(12, OUTPUT); // - Led aan/uit (13) pinMode(13, OUTPUT); } void servo_on(){ digitalWrite(12, HIGH); // power on to the servo delay (1000); // wait until the capacitor is filled } void servo_off(){ digitalWrite(12, LOW); // power off to the servo delay (1000); // wait until the capacitor is empty } void blink_led(){ // just a simple test when feeding starts or stops for (var_blink_led=0; var_blink_led<5; var_blink_led +=1) { digitalWrite(13, HIGH); // Turn the led on delay (1000); digitalWrite(13, LOW); // Turn the led off delay (1000); } } void led_on(){ // turn on the led digitalWrite(13, HIGH); // Turn the led on } void led_off(){ // turn on the led digitalWrite(13, LOW); // Turn the led off } void feeding() { /* Normally a servo is attached at the setup void setup() { myservo.attach(9); // attaches the servo on pin 9 to the servo object } The servo receives commands through the program and works to keep the right angle In this program the servos runs for a few seconds and keeps idle until next command To keep power consumption and noise low the feeding loop has an internal attach en detach Attaching and detaching affects the power consumtion of the servo-pin The second step is using the power circuit that turns on/off the 5V Position start | 75% servo position 6:00 1100 Move to loading position / 100% servo position 7:30 700 Move to horizontal position - 25% servo position 3:00 1900 Move to empty position / 0% servo position 1:30 2300 Return to start position | 75% servo position 6:00 1100 */ for (led_pos = 1; led_pos <= 99; led_pos += 1) { // 1 to 99 clear analog array var_A1[led_pos]=0; var_A2[led_pos]=0; var_A3[led_pos]=0; var_A4[led_pos]=0; var_A5[led_pos]=0; } servo1.attach(2); // attaches the servo on pin 2 to the servo object // Move to loading postion for (servo1_pos = 1100; servo1_pos >= 710; servo1_pos -= 1) { // goes from 6:00 to 7:30 servo1.writeMicroseconds(servo1_pos); // tell servo to go to position in variable 'pos' delay(5); // waits 5ms for the servo to reach the position } // Move to horizontal position for (servo1_pos = 710; servo1_pos <= 1900; servo1_pos += 1) { // goes from 7:30 to 3:00 servo1.writeMicroseconds(servo1_pos); // tell servo to go to position in variable 'pos' delay(5); // waits 5ms for the servo to reach the position } // Move to empty position led_on(); for (servo1_pos = 1900; servo1_pos <= 2290; servo1_pos += 10) { // goes from 3:00 to 1:30 servo1.writeMicroseconds(servo1_pos); // tell servo to go to position in variable 'pos' delay(5); // ((2300-1900)/10)*5 = 200ms desceend time 100-150ms } // Measure quantity for (led_pos = 1; led_pos <= 99; led_pos +=1) { //A1 analogRead(A1); // read analog input A1 delay(10); var_A1[led_pos]=analogRead(A1); //A2 analogRead(A2); delay(10); var_A2[led_pos]=analogRead(A2); //A3 analogRead(A3); delay(10); var_A3[led_pos]=analogRead(A3); //A4 analogRead(A4); delay(10); var_A4[led_pos]=analogRead(A4); //A5 analogRead(A5); delay(10); var_A5[led_pos]=analogRead(A5); } led_off(); // Return to start position for (servo1_pos = 2290; servo1_pos >= 1100; servo1_pos -= 1) { // goes from 1:30 to 6:00 servo1.writeMicroseconds(servo1_pos); // tell servo to go to position in variable 'pos' delay(5); // waits 5ms for the servo to reach the position } servo1.detach(); // detaches the servo on pin 2 to the servo object } void openhatch() { /* See also void feeding Position start closed | 100% servo position 12:00 2300 Position end open | 0% servo position 6:00 700 */ servo2.attach(3); // attaches the servo on pin 3 to the servo object for (servo2_pos = 2290; servo2_pos >= 710; servo2_pos -= 1) { // goes from 12:00 to 6:00 servo2.writeMicroseconds(servo2_pos); // tell servo to go to position in variable 'pos' delay(5); // waits 5ms for the servo to reach the position } servo2.detach(); // detaches the servo on pin 2 to the servo object } void closehatch() { /* See also void feeding Position start closed | 100% servo position 12:00 2300 Position end open | 0% servo position 6:00 700 */ servo2.attach(3); // attaches the servo on pin 3 to the servo object for (servo2_pos = 710; servo2_pos <= 2290; servo2_pos += 1) { // goes from 6:00 to 12:00 servo2.writeMicroseconds(servo2_pos); // tell servo to go to position in variable 'pos' delay(5); // waits 5ms for the servo to reach the position } servo2.detach(); // detaches the servo on pin 2 to the servo object } void loop() { servo_on(); // power on to the servo blink_led(); openhatch(); // open the hatch blink_led(); feeding(); // turn the feeding tube blink_led(); closehatch(); // close the hatch blink_led(); servo_off(); // power off to the servo } 

Gerelateerde Artikelen

Met behulp van Arduino Feeder vissen

Met behulp van Arduino Feeder vissen

Dit instructable ontstond vervulling het projecteis van de Makecourse bij de Universiteit van Zuid-Florida (www.makecourse.com)Onderdelen die nodig zijn:1 x Arduino Uno R3 bestuur1 x Full-size breadboard1 x usbkabel (meegeleverd met de Arduino board)
Vissen Feeder Sensor Array

Vissen Feeder Sensor Array

IntroductieWaarom dit projectMijn aquarium is een Juwel Rekord 800 en heeft een Juwel feeding machine. Ik kocht de machine om mijn vissen waardplanten reguliere tijden wanneer ik niet rond te kunnen. Het is een geweldige machine, maar als een ingenie
AquaFeeder: Een geautomatiseerde Fish Feeder

AquaFeeder: Een geautomatiseerde Fish Feeder

AquaFeeder is een slimme gecontroleerd Arduino robot die automatisch uw vissen op een bepaald moment, alle door haarzelf voedt! Het maakt gebruik van twee motoren, een controle op het deksel van het aquarium, en de andere dropping vis eten. Het besch
AquaFeeder 2.0: Automatic Fish Feeder (met WiFi)

AquaFeeder 2.0: Automatic Fish Feeder (met WiFi)

Op zoek na twee aquaria is niet een gemakkelijke taak, vooral voor iemand als me zo vergeetachtig. Soms zou ik vergeten te voeden de visjes voor meerdere dagen totdat mijn moeder zwevende vis skeletten merken zou. Nou, tegenwoordig dat nooit gebeurt,
Automatische vis feeder

Automatische vis feeder

Als u in uw huis en niemand voor de verzorging van uw vissen bent, kunt u vertrouwen op zelfgemaakte vis feeder. De productie duurt ongeveer 3 uur, ongeveer 2 uur voor het mechanische deel en 1 uur voor de elektronica. Ook zal je niet overvoeren van
Zonne-energie aangedreven LED Fish Feeder

Zonne-energie aangedreven LED Fish Feeder

veel mensen hebben visvijvers. Sommige zijn gewoon decoratieve en anderen zijn vis voor markt aantrekken of voer het gezin.Dit Instructable is gericht op het verhogen van de productiviteit van kleine schaal visvijvers. Het is echt goedkoop te maken,
Automatische vis feeder met licht

Automatische vis feeder met licht

Als student wilde ik iets tot bloei van mijn kamer. Een kleine fish tank leek perfect. Maar aangezien ik altijd weg voor het weekend of zelfs langere perioden tijdens de zomervakantie, ik zou kunnen voeden van de vissen, en ze waarschijnlijk niet leu
(Kleine vis Feeder AT)

(Kleine vis Feeder AT)

In deze tutorial zal ik u tonen hoe maak je een automatische feeder vissen. Dit is wat ik gebruiken om mijn huisdieren voeden terwijl ik weg ben en het werkt vrij goed!**********************************************************************************
Geautomatiseerde kat Feeder

Geautomatiseerde kat Feeder

Somedays niemand thuis om te voeden de kat aan de rechterkant kan blijven keer. Dit is vooral vervelend als u een kat met een zwakke maag, dus hij eten van meerdere kleine maaltijden per dag, moet omdat met één grote maaltijd zal hij het uit kotsen.
Vensterbank Aquaponics systeem

Vensterbank Aquaponics systeem

Ik wilde nieuwe huisdieren, maar ik niet veel zorg voor hen te doen alsof werken. Ik ook graag dingen groeien. De Unie van de twee was een aquaponics systeem. Het probleem... Ik woon in New York City. En, te parafraseren Genie in Aladdin, "Oneindige
Aquarium Gids

Aquarium Gids

Hallo, en welkom op mijn instructable. In deze korte maar zeer informatieve handleiding hopelijk hebt u een duidelijk inzicht in hoe te starten en onderhouden van een aquarium. Als u een mooi aquarium zoals die in de bovenstaande foto's maken wilt (o
DIY Man Cave (voor midden/hoge scholieren)

DIY Man Cave (voor midden/hoge scholieren)

Ik ga u tonen hoe te bouwen van een eenvoudige man grot. Dit Instructable zal u tonen hoe te bouwen van een ontzagwekkende hangout dat is gemakkelijk, relatief snel, en vooral... KOSTEN EFFICIËNT. Deze tutorial zal passen de meeste tieners budgetten,
Inleiding tot de Seahorse zorg

Inleiding tot de Seahorse zorg

Zeepaardjes zijn fascinerende wezens die u in uw eigen huis met de juiste kennis van hun veehouderij genieten kunt. Mijn moeder had haar eigen aquarium bedrijf toen ik opgroeide en voor 8 jaar we een seahorse-centric tank in de woonkamer hadden, beid
De armen mans aquaponic systeem

De armen mans aquaponic systeem

Dit is een aquaponic systeem dat kan worden gemaakt en in een gemakkelijk te onderhouden en gebouwd voor ongeveer 15 dollar.Stap 1: benodigdheden -eerst en vooral moet u een glazen vis kom (ik heb de mijne uit een thrift shop voor 3 dollar)-Ten tweed