Stap 3: Arduino code en bedrading
Nou, in bijlage vindt u de code en bibliotheken die nodig zijn voor het compileren van de code.
Simpelweg unzip de bibliotheken en kopiëren naar de map van de arduino
- datura_mega_v18.Ino is de code
- dht22.zip - de luchtvochtigheid temperatuur sensor bibliotheek
- adafriut_pcd8544.zip - display chars bibliotheek
- adafruit_gfx.zip - weergave grafische bibliotheek
- Ethernet.zip - ethernet bibliotheek
- realtimeclock ds1307.zip - klok bibliotheek
- SD.zip - microsd bibliotheek
EEPROM geheugen toewijzing
EEPROM(0) = n_rel - aantal Relais aangesloten
EEPROM(1) = log in- / uitschakelen
EEPROM(10-15) = automatische/handmatige relay modus
EEPROM(20-27) = pwd
EEPROM(30-41) = max vochtigheid (2 byte x valore)
EEPROM(100-147) = relay namen
EEPROM(1001-1168) = Timer 1-tabel in- / uitschakelen
EEPROM(1169-1336) = tabel Timer 2 aan/uit
/ / pinout:
A0, A1, A2, A3, A4, A5 parameter sensoren (analoge waarden 0-1023)
4 arduino - CS SD-kaart
6 arduino - gereserveerd (lcd activering)
44 arduino - DHT22 temp/hum sensor
46 arduino - flowsensor
10 ethernet gereserveerde (nodig voor arduino uno compatibiliteit)
== > pin 1 lcd - v + 3.3 arduino
13 arduino == > pin 2 lcd - seriële klok uit (SCLK) (10 k res nodig)
11 arduino == > pin 3 lcd - seriële gegevens uit (DIN) (10 k res nodig)
12 arduino == > pin 4 lcd - opdracht/gegevens selecteren (D/C) (10 k res nodig)
Gnd arduino PIN == > pin 5 lcd - LCD chip select (CS)
== > pin 6 lcd - LCD oscillatore est - niet verbonden
Gnd arduino PIN == > pin 7 lcd - GND
== > pin 8 - Vout - optionele led achtergrondverlichting
9 arduino == > pin 9 lcd - Reset (10 k res nodig)
20 arduino == > pin SDA RTC DS1307
21 arduino == > pin SCLK RTC DS1307
30,31,32,33,34,35 Relais
53 arduino - ethernet voorbehouden
Zodra de code op arduino geüpload, is het tijd om het op brand. MAAR geen verbinding maken met hoogspanning estafette! u zult later, tijdens de laatste verbinding.
U ziet ook de werking van de weergave en fietsen tussen Relais.