├── Design Files
├── README.md
├── PowerShield_Meteo-v3.1
│ ├── README.md
│ ├── Meteo-v3.1-PowerShield-v1.0_top.png
│ ├── Meteo-v3.1-PowerShield-v1.0_schematic.png
│ └── BOM
├── Meteo-v3-layout.png
├── Meteo-v3-schematic.png
├── Meteo-v3.1-layout.png
├── Meteo-v3.1-schematic.png
├── Meteo-v3-assembly_top.png
├── Meteo-v3.1-assembly_top.png
├── Meteo-v3-assembly_bottom.png
├── Meteo-v3.1-assembly_bottom.png
└── Meteo-v3-ESP8266.csv
├── FW examples
├── README.md
├── Blink-LED.ino
├── PIR+GPIO12.ino
├── BMP180+Serial.ino
├── Blink-LED_GPIO12_14_0.ino
├── BMP180_APIv2+Serial.ino
├── Si7021+Serial.ino
├── DS18B20+Serial.ino
├── Si7021+OLED+Serial.ino
├── TSL2561+PWM.ino
├── Si7021+TMEP.ino
├── DS18B20+TMEP.ino
├── BigClown_Soil_Moisture+TMEP.ino
├── Si7021_SoilMoisture_IoTGuruCloud.ino
├── Si7021+TMEP+OLED.ino
├── OLED+Si7021+BMP180+DS18B20+TSL2561+Serial
├── SensorTester.ino
└── ePaper+OpenWeatherMapAPI
├── MeteoV3.1.jpg
├── Meteo-v3-chiptron_1200x780px.JPG
└── README.md
/Design Files/README.md:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/FW examples/README.md:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Design Files/PowerShield_Meteo-v3.1/README.md:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/MeteoV3.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/petus/Meteo-v3-ESP8266/HEAD/MeteoV3.1.jpg
--------------------------------------------------------------------------------
/Design Files/Meteo-v3-layout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/petus/Meteo-v3-ESP8266/HEAD/Design Files/Meteo-v3-layout.png
--------------------------------------------------------------------------------
/Meteo-v3-chiptron_1200x780px.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/petus/Meteo-v3-ESP8266/HEAD/Meteo-v3-chiptron_1200x780px.JPG
--------------------------------------------------------------------------------
/Design Files/Meteo-v3-schematic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/petus/Meteo-v3-ESP8266/HEAD/Design Files/Meteo-v3-schematic.png
--------------------------------------------------------------------------------
/Design Files/Meteo-v3.1-layout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/petus/Meteo-v3-ESP8266/HEAD/Design Files/Meteo-v3.1-layout.png
--------------------------------------------------------------------------------
/Design Files/Meteo-v3.1-schematic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/petus/Meteo-v3-ESP8266/HEAD/Design Files/Meteo-v3.1-schematic.png
--------------------------------------------------------------------------------
/Design Files/Meteo-v3-assembly_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/petus/Meteo-v3-ESP8266/HEAD/Design Files/Meteo-v3-assembly_top.png
--------------------------------------------------------------------------------
/Design Files/Meteo-v3.1-assembly_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/petus/Meteo-v3-ESP8266/HEAD/Design Files/Meteo-v3.1-assembly_top.png
--------------------------------------------------------------------------------
/Design Files/Meteo-v3-assembly_bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/petus/Meteo-v3-ESP8266/HEAD/Design Files/Meteo-v3-assembly_bottom.png
--------------------------------------------------------------------------------
/Design Files/Meteo-v3.1-assembly_bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/petus/Meteo-v3-ESP8266/HEAD/Design Files/Meteo-v3.1-assembly_bottom.png
--------------------------------------------------------------------------------
/Design Files/PowerShield_Meteo-v3.1/Meteo-v3.1-PowerShield-v1.0_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/petus/Meteo-v3-ESP8266/HEAD/Design Files/PowerShield_Meteo-v3.1/Meteo-v3.1-PowerShield-v1.0_top.png
--------------------------------------------------------------------------------
/Design Files/PowerShield_Meteo-v3.1/Meteo-v3.1-PowerShield-v1.0_schematic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/petus/Meteo-v3-ESP8266/HEAD/Design Files/PowerShield_Meteo-v3.1/Meteo-v3.1-PowerShield-v1.0_schematic.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Meteo-v3-ESP8266
2 |
3 | Versatile PCB with ESP8266 (ESP12, ESP07) which may be used like e.g. weather station
4 |
5 | [For czech makers]
6 | Pokud chcete koupit celou stavebnici (bez ESP modulu), můžete tak učinit na e-shopu http://kitman.eprodavac.cz/meteostanice-chiptron-meteov3-x-wifi-sada-1-91/
7 | Představení MeteoV3 i na youtube https://www.youtube.com/watch?v=8mQJllEO83s
8 | MeteoV3 a praktické použití - Si7021 a DS18B20: https://www.youtube.com/watch?v=N-Vpab74EiY
9 | Návod: https://chiptron.cz/articles.php?article_id=223
10 |
11 | [For other makers in english]
12 | English tutorial: https://time4ee.com/articles.php?article_id=121
13 |
14 | 
15 |
--------------------------------------------------------------------------------
/FW examples/Blink-LED.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Meteo-v3
3 | * Blink example - the LED is conencted to GPIO13 (D7)
4 | *
5 | * made by chiptron.cz (2019)
6 | *
7 | * czech website www.chiptron.cz
8 | * english website www.time4ee.com
9 | *
10 | * Based on example from arduino.cc (Blink)
11 | */
12 |
13 | // the setup function runs once when you disconnect DTR pin or power the board
14 | void setup() {
15 | // initialize digital pin GPIO13 (D7) as an output.
16 | pinMode(13, OUTPUT);
17 | }
18 |
19 | // the loop function runs over and over again forever
20 | void loop() {
21 | digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
22 | delay(1000); // wait for a second
23 | digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
24 | delay(1000); // wait for a second
25 | }
26 |
--------------------------------------------------------------------------------
/FW examples/PIR+GPIO12.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Meteo-v3
3 | * PIR example
4 | * The PIR module is connected to GPIO12 and 3.3V and GND.
5 | * If the sensor is active, the LED (GPIO13) on board is switched on.
6 | *
7 | * made by chiptron.cz (2019)
8 | *
9 | * czech website www.chiptron.cz
10 | * english website www.time4ee.com
11 | *
12 | * Based on example from arduino.cc
13 | */
14 |
15 | int val = 0;
16 |
17 | // the setup function runs once when you disconnect DTR pin or power the board
18 | void setup() {
19 |
20 | pinMode(12, INPUT); // initialize digital pin as an input
21 | pinMode(13, OUTPUT); // initialize digital pin as an output
22 |
23 | }
24 |
25 | // the loop function runs over and over again forever
26 | void loop() {
27 |
28 | val = digitalRead(12); // read the input pin
29 | digitalWrite(13, val); // sets the LED to the button's value
30 | }
31 |
--------------------------------------------------------------------------------
/FW examples/BMP180+Serial.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Meteo-v3
3 | * BMP180
4 | * BMP180 module is connected to I2C connector. Temperature and
5 | * pressure are shown on Serial Monitor (9600)
6 | *
7 | * made by chiptron.cz (2019)
8 | *
9 | * czech website www.chiptron.cz
10 | * english website www.time4ee.com
11 | *
12 | * Adafruit BMP085 library (BMP180 is supported)
13 | * https://github.com/adafruit/Adafruit-BMP085-Library/
14 | */
15 | #include
16 | #include
17 |
18 | Adafruit_BMP085 bmp;
19 |
20 | // the setup function runs once when you disconnect DTR pin or power the board
21 | void setup() {
22 |
23 | Serial.begin(9600); // initialize Serial monitor with 9600
24 | bmp.begin();
25 |
26 | }
27 |
28 | // the loop function runs over and over again forever
29 | void loop() {
30 |
31 | int temperature = bmp.readTemperature(); // read temperature
32 | int pressure = bmp.readPressure(); // read pressure
33 |
34 | Serial.print("Temperature: ");
35 | Serial.print(temperature);
36 | Serial.println(" °C");
37 | Serial.print("Pressure: ");
38 | Serial.print(pressure);
39 | Serial.println(" Pa");
40 | delay(1000); // wait one second
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/FW examples/Blink-LED_GPIO12_14_0.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Meteo-v3
3 | * Blink example
4 | * LEDs are connected to GPIO12 or/and GPIO14 or/and GPIO0
5 | *
6 | * made by chiptron.cz (2019)
7 | *
8 | * czech website www.chiptron.cz
9 | * english website www.time4ee.com
10 | *
11 | * Based on example from arduino.cc (Blink)
12 | */
13 |
14 | // the setup function runs once when you disconnect DTR pin or power the board
15 | void setup() {
16 | // initialize digital pins as an output.
17 | pinMode(12, OUTPUT);
18 | pinMode(14, OUTPUT);
19 | pinMode(0, OUTPUT);
20 | }
21 |
22 | // the loop function runs over and over again forever
23 | void loop() {
24 | digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)
25 | digitalWrite(14, HIGH); // turn the LED on (HIGH is the voltage level)
26 | digitalWrite(0, HIGH); // turn the LED on (HIGH is the voltage level)
27 | delay(1000); // wait for a second
28 | digitalWrite(12, LOW); // turn the LED off by making the voltage LOW
29 | digitalWrite(14, LOW); // turn the LED off by making the voltage LOW
30 | digitalWrite(0, LOW); // turn the LED off by making the voltage LOW
31 | delay(1000); // wait for a second
32 | }
33 |
--------------------------------------------------------------------------------
/FW examples/BMP180_APIv2+Serial.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Meteo-v3
3 | * BMP180
4 | * BMP180 module is connected to I2C connector. Temperature and
5 | * pressure are shown on Serial Monitor (9600)
6 | *
7 | * made by chiptron.cz (2019)
8 | *
9 | * czech website www.chiptron.cz
10 | * english website www.time4ee.com
11 | *
12 | * Adafruit BMP085 library (BMP180 is supported) API v2
13 | * https://github.com/adafruit/Adafruit_BMP085_Unified
14 | */
15 | #include
16 | #include
17 | #include
18 |
19 | Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085);
20 |
21 | // the setup function runs once when you disconnect DTR pin or power the board
22 | void setup() {
23 |
24 | Serial.begin(9600); // initialize Serial monitor with 9600
25 | bmp.begin();
26 |
27 | }
28 |
29 | // the loop function runs over and over again forever
30 | void loop() {
31 |
32 | sensors_event_t event;
33 | bmp.getEvent(&event);
34 |
35 | if(event.pressure)
36 | {
37 | float temperature;
38 | bmp.getTemperature(&temperature);
39 |
40 | Serial.print("Temperature: ");
41 | Serial.print(temperature);
42 | Serial.println(" °C");
43 |
44 | Serial.print("Pressure: ");
45 | Serial.print(event.pressure);
46 | Serial.println(" hPa");
47 |
48 | }
49 | delay(1000); // wait one second
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/Design Files/Meteo-v3-ESP8266.csv:
--------------------------------------------------------------------------------
1 | Qty,Value,Device,Package,Parts,Description
2 | 2,,31-XX,B3F-31XX,"S1, S3",WEALTH METAL FACTORY TC-0203-X
3 | 1,,ESP12ESMD,ESP12E-SMD,ESP12E/ESP07/ESP08,ESP12E/ESP07/ESP08 Module
4 | 1,,M06LONGPADS,1X06_LONGPADS,JP1,Header 6
5 | 1,,MA03-1,MA03-1,SV1,PIN HEADER
6 | 2,,MA04-2,MA04-2,"SV3, SV4",PIN HEADER
7 | 1,,SJ,SJ,SJ1,SMD solder JUMPER
8 | 2,100R,R-EU_M1206,M1206,"R1, R2","RESISTOR, European symbol"
9 | 3,100n,C-EUC1206,C1206,"C2, C5, C8","CAPACITOR, European symbol"
10 | 1,100n,C-EUC1206,C1206,C4,"CAPACITOR, European symbol"
11 | 1,10u,CPOL-EUSMCB,SMC_B,C1,"POLARIZED CAPACITOR, European symbol"
12 | 5,1k,R-EU_M1206,M1206,"R3, R5, R7, R11, R13","RESISTOR, European symbol"
13 | 3,1u,C-EUC1206,C1206,"C3, C6, C9","CAPACITOR, European symbol"
14 | 2,4k7,R-EU_M1206,M1206,"R4, R8","RESISTOR, European symbol"
15 | 1,4k7,R-EU_M1206,M1206,R9,"RESISTOR, European symbol"
16 | 1,560R,R-EU_M1206,M1206,R6,"RESISTOR, European symbol"
17 | 2,FEMALE 2x3,CONN_03X2FEMALE,2X3,"SV2, SV5",Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections
18 | 2,JUMPER-SMT_2_NC_PASTE_SILK,JUMPER-SMT_2_NC_PASTE_SILK,SMT-JUMPER_2_NC_PASTE_SILK,"JP2, JP3",Normally closed solder jumper
19 | 1,LFDPAK,LFDPAK?C,DPAK,LF33CDT,LF??C - stabilizátory low-drop
20 | 1,POWER_JACKPTH,POWER_JACKPTH,POWER_JACK_PTH,J1,PC-GK2.1
21 | 1,RED,LEDCHIPLED_0805,CHIPLED_0805,LED1,LED
22 | 1,TBS,R-EU_M1206,M1206,R12,"RESISTOR, European symbol"
23 |
--------------------------------------------------------------------------------
/FW examples/Si7021+Serial.ino:
--------------------------------------------------------------------------------
1 | /**
2 | * Meteo-v3
3 | * Si7021 exmaple - connect Si7021 module to I2C connector and check the serial monitor
4 | *
5 | * made by chiptron.cz (2019)
6 | *
7 | * czech website www.chiptron.cz
8 | * english website www.time4ee.com
9 | *
10 | * Si7021 library - https://github.com/LowPowerLab/SI7021
11 | *
12 | */
13 |
14 | #include
15 | #include
16 | #include
17 |
18 | #define SDA 4 // GPIO4 on D2
19 | #define SCL 5 // GPIO5 on D1
20 |
21 | #define SLEEP_DELAY_IN_SECONDS 30
22 |
23 | SI7021 sensor;
24 |
25 | void setup() {
26 | Serial.begin(9600); // Open serial connection to report values to host
27 | delay(100);
28 |
29 | Serial.println("Weather station by chiptron.cz");
30 | Serial.println("www.chiptron.cz");
31 | Serial.println("www.time4ee.com");
32 | Serial.println("FW version: 0.1");
33 |
34 | sensor.begin(SDA,SCL);
35 |
36 | }
37 |
38 |
39 | void loop() {
40 | int temperature = sensor.getCelsiusHundredths();
41 | unsigned int humidity = sensor.getHumidityPercent();
42 |
43 | Serial.print("Temperature: ");
44 | Serial.print(String(temperature/100.0, 2));
45 | Serial.println(" °C");
46 | Serial.print("Humidity: ");
47 | Serial.print(humidity);
48 | Serial.println(" %");
49 |
50 | //if you want to use deep sleep, connect RST with D0 (GPIO16)
51 | //ESP.deepSleep(SLEEP_DELAY_IN_SECONDS * 1000000, WAKE_RF_DEFAULT);
52 | delay(10000);
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/FW examples/DS18B20+Serial.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Meteo-v3
3 | * 1-wire example - Temperature sensor DS18B20 is connected to GPIO0 (D3)
4 | * the temperature is sent to Serial Monitor
5 | * If you want to use parasitic mode of DS18B20, connect GND and VDD of
6 | * DS18B20 to GND of MeteoV3 and assembly R4 resistor from 3.3V to DATA pin
7 | * of DS18B20
8 | *
9 | * made by chiptron.cz (2019)
10 | *
11 | * czech website www.chiptron.cz
12 | * english website www.time4ee.com
13 | *
14 | * Based on example from https://github.com/milesburton/Arduino-Temperature-Control-Library
15 | * Library: https://github.com/milesburton/Arduino-Temperature-Control-Library
16 | */
17 |
18 | #include
19 | #include
20 |
21 | // Data wire is connected to GPIO0 - D3 of ESP8266
22 | #define ONE_WIRE_BUS 0
23 |
24 | // Set oneWire bus
25 | OneWire oneWire(ONE_WIRE_BUS);
26 |
27 | // Set oneWire bus for Dallas Temperature sensor
28 | DallasTemperature sensors(&oneWire);
29 |
30 | // the setup function runs once when you disconnect DTR pin or power the board
31 | void setup() {
32 | // Set Serial Com Port
33 | Serial.begin(9600);
34 |
35 | // Sensor begin
36 | sensors.begin();
37 | }
38 |
39 | // the loop function runs over and over again forever
40 | void loop() {
41 | // Temperature request, send command to get the temperatures
42 | sensors.requestTemperatures();
43 | Serial.print(" The temperature for the first device (index 0): ");
44 | Serial.print(sensors.getTempCByIndex(0));
45 | Serial.println(" °C");
46 | //Serial.print(" The temperature for the second device (index 1)");
47 | //Serial.print(sensors.getTempCByIndex(1));
48 | //Serial.println(" °C");
49 | delay(1000);
50 | }
51 |
--------------------------------------------------------------------------------
/FW examples/Si7021+OLED+Serial.ino:
--------------------------------------------------------------------------------
1 | /**
2 | * Meteo-v3
3 | * OLED and Si7021 - the OLED (0.96", SSD1306) and Si7021 are connected to I2C connectors
4 | * The temperature and humidity are shown on display and also in Serial Monitor
5 | *
6 | * made by chiptron.cz (2019)
7 | *
8 | * czech website www.chiptron.cz
9 | * english website www.time4ee.com
10 | *
11 | * Si7021 library - https://github.com/LowPowerLab/SI7021
12 | * 128x64px OLED display - http://www.adafruit.com/category/63_98
13 | * Add to Arduino IDE "Adafruit GFX Library" and "Adafruit SSD1306" library
14 | */
15 |
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 |
22 | #define SDA 4 // GPIO4 on D2
23 | #define SCL 5 // GPIO5 on D1
24 |
25 | // Type of display - only GND, VCC, SCL, SDA, no reset pin
26 | Adafruit_SSD1306 display(NULL);
27 |
28 | SI7021 sensor;
29 |
30 | void setup() {
31 |
32 | Serial.begin(9600); // Open serial connection to report values to host
33 | delay(10);
34 |
35 | sensor.begin(SDA,SCL);
36 |
37 | // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
38 | display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x64)
39 |
40 | delay(2000);
41 | display.clearDisplay();
42 |
43 | // text display tests
44 | display.setTextSize(1);
45 | display.setTextColor(WHITE);
46 | display.setCursor(0,0);
47 | display.println("chiptron.cz");
48 | display.setCursor(0,10);
49 | display.println("time4ee.com");
50 | display.setCursor(0,20);
51 | display.println("Meteo-v3");
52 | display.display();
53 | delay(2000);
54 | display.clearDisplay();
55 |
56 | display.setTextSize(2);
57 |
58 | }
59 |
60 |
61 | void loop() {
62 | int temperature = sensor.getCelsiusHundredths();
63 | unsigned int humidity = sensor.getHumidityPercent();
64 |
65 | Serial.print("Temperature: ");
66 | Serial.print(String(temperature/100.0, 2));
67 | Serial.println(" °C");
68 | Serial.print("Humidity: ");
69 | Serial.print(humidity);
70 | Serial.println(" %");
71 |
72 | display.clearDisplay();
73 | display.setCursor(0, 0);
74 | display.print(String(temperature/100.0, 2));
75 | display.println(" 'C");
76 | display.setCursor(0, 15);
77 | display.print(humidity);
78 | display.println(" %");
79 | display.display();
80 |
81 | delay(10000);
82 |
83 | }
84 |
--------------------------------------------------------------------------------
/FW examples/TSL2561+PWM.ino:
--------------------------------------------------------------------------------
1 | /************************************
2 | * *
3 | * FW is still in development *
4 | * *
5 | ************************************/
6 |
7 |
8 | /*
9 | * Meteo-v3
10 | * TSL2561 and PWM
11 | * TSL2561 module is connected to I2C connector.
12 | * The light intensity is measured and compared with requirements and based on
13 | * conditions is PWM controled.
14 | * Output PWM is GPIO 12.
15 | *
16 | * made by chiptron.cz (2019)
17 | *
18 | * czech website www.chiptron.cz
19 | * english website www.time4ee.com
20 | *
21 | * TSL2561 library - https://github.com/joba-1/Joba_Tsl2561
22 | */
23 | #include
24 | #include
25 |
26 | // Library for TSL2561
27 | #include
28 |
29 | // TSL2561
30 | Tsl2561 Tsl(Wire);
31 |
32 | int pwm = 0;
33 |
34 | #define SDA 4 // GPIO4 on D2
35 | #define SCL 5 // GPIO5 on D1
36 |
37 | // the setup function runs once when you disconnect DTR pin or power the board
38 | void setup() {
39 | Serial.begin(9600); // initialize Serial monitor with 9600
40 | pinMode(12, OUTPUT);
41 |
42 | Wire.begin(SDA, SCL);
43 | }
44 |
45 | // the loop function runs over and over again forever
46 | void loop() {
47 |
48 | Tsl.begin();
49 |
50 | if( Tsl.available() )
51 | {
52 | uint8_t id;
53 | uint16_t full, ir;
54 |
55 | Tsl.on();
56 |
57 | Tsl.setSensitivity(true, Tsl2561::EXP_14);
58 | delay(16);
59 |
60 | Tsl.id(id);
61 | Tsl.fullLuminosity(full);
62 | Tsl.irLuminosity(ir);
63 |
64 | Serial.print(full);
65 | Serial.println(" lux");
66 | Serial.print("PWM value: ");
67 | Serial.println(pwm);
68 |
69 | if(full < 40) // comparable value
70 | {
71 | if(pwm > 200)
72 | {
73 | // skip
74 | }
75 | else
76 | {
77 | pwm = pwm + 10;
78 | analogWrite(12, pwm);
79 | }
80 | }
81 | else
82 | {
83 | // do nothing
84 | }
85 |
86 | if(full > 45) // comparable value
87 | {
88 | if(pwm == 0)
89 | {
90 | //skip
91 | }
92 | else
93 | {
94 | pwm = pwm - 10;
95 | analogWrite(12, pwm);
96 | }
97 | }
98 | else
99 | {
100 | // do nothing
101 | }
102 | }
103 | else
104 | {
105 | Serial.print(format("No Tsl2561 found. Check wiring: SCL=%u, SDA=%u\n", TSL2561_SCL, TSL2561_SDA));
106 | }
107 |
108 | delay(200);
109 |
110 | }
111 |
--------------------------------------------------------------------------------
/Design Files/PowerShield_Meteo-v3.1/BOM:
--------------------------------------------------------------------------------
1 | Part Value Device Package Description
2 | C1 100n C-EUC1206 C1206 CAPACITOR, European symbol
3 | C2 100n C-EUC1206 C1206 CAPACITOR, European symbol
4 | C3 2u2 C-EUC1206 C1206 CAPACITOR, European symbol
5 | D1 1N4007 DIODE-GEN-PURPOSE-1KV-1A(DO-214AC) DO-214AC 304010013
6 | JP1 JUMPER-SMT_3_1-NC_PASTE_SILK JUMPER-SMT_3_1-NC_PASTE_SILK SMT-JUMPER_3_1-NC_PASTE_SILK Normally closed solder jumper (1 of 2 connections)
7 | JP2 JUMPER-SMT_2_NC_PASTE_SILK JUMPER-SMT_2_NC_PASTE_SILK SMT-JUMPER_2_NC_PASTE_SILK Normally closed solder jumper
8 | K1 ARK500/2 ARK500/2 ARK500/2 Svorkovnice - roztec 5mm - dvojita
9 | LFXX LFDPAK LFDPAK?C DPAK LF??C - stabilizátory low-drop
10 | Q1 IRLML2502 MOSFET-NCH-BSS138 SOT23-3 N-channel MOSFETs
11 | Q2 IRF520 MOSFET-NCH-FDD8780 DPAK N-channel MOSFETs
12 | R1 10k R-EU_R1206 R1206 RESISTOR, European symbol
13 | SV1 FEMALE 2x3 CONN_03X2FEMALE 2X3 Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections
14 | SV2 FEMALE 2x3 CONN_03X2FEMALE 2X3 Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections
15 | X1 332-02 332-02 332-02 2 Pin - 2mm Dual Row
16 |
--------------------------------------------------------------------------------
/FW examples/Si7021+TMEP.ino:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * Meteo-v3
4 | * Si7021 and TMEP.EU service example - The temperature and humidity are sent to tmep.cz (tmep.eu)
5 | *
6 | * made by chiptron.cz (2019)
7 | *
8 | * czech website www.chiptron.cz
9 | * english website www.time4ee.com
10 | *
11 | * Si7021 library - https://github.com/LowPowerLab/SI7021
12 | *
13 | */
14 |
15 | #include
16 | #include
17 | #include
18 |
19 | #define SDA 4 // GPIO4 on D2
20 | #define SCL 5 // GPIO5 on D1
21 |
22 | #define ARDUINO_ARCH_ESP8266
23 |
24 | #define SLEEP_DELAY_IN_SECONDS 30
25 |
26 | const char* ssid = "SSID";
27 | const char* password = "PASSWORD";
28 |
29 | const char* host = "HOSTNAME.tmep.cz"; // or HOSTNAME.tmep.eu
30 |
31 | SI7021 sensor;
32 |
33 | void setup() {
34 | unsigned int numberOfConnections= 0;
35 |
36 | Serial.begin(9600); // Open serial connection to report values to host
37 | delay(10);
38 |
39 | Serial.println();
40 | Serial.println();
41 |
42 | Serial.println("Made by chiptron.cz");
43 | Serial.println("http://chiptron.cz");
44 | Serial.println("http://time4ee.com");
45 | Serial.println("FW version: 1.3");
46 |
47 | Serial.print("Connecting to ");
48 | Serial.println(ssid);
49 |
50 | WiFi.begin(ssid, password);
51 |
52 | while (WiFi.status() != WL_CONNECTED) {
53 | delay(500);
54 | Serial.print(".");
55 | numberOfConnections++;
56 |
57 | Serial.println("Number Of Connections:");
58 | Serial.println(numberOfConnections);
59 |
60 | // if ESP12E can't connect to WiFi -> enable deep.sleep
61 | if (numberOfConnections > 10)
62 | {
63 | //if you want to use deep sleep, connect RST with D0 (GPIO16)
64 | //ESP.deepSleep(SLEEP_DELAY_IN_SECONDS * 1000000, WAKE_RF_DEFAULT);
65 | delay(1000);
66 | return;
67 | }
68 | }
69 |
70 | Serial.println("");
71 | Serial.println("WiFi connected");
72 | Serial.println("IP address: ");
73 | Serial.println(WiFi.localIP());
74 | sensor.begin(SDA,SCL);
75 |
76 | }
77 |
78 |
79 | void loop() {
80 | int temperature = sensor.getCelsiusHundredths();
81 | unsigned int humidity = sensor.getHumidityPercent();
82 |
83 | Serial.print("connecting to ");
84 | Serial.println(host);
85 | // Use WiFiClient class to create TCP connections
86 | WiFiClient client;
87 | const int httpPort = 80;
88 | if (!client.connect(host, httpPort))
89 | {
90 | Serial.println("connection failed");
91 | return;
92 | }
93 |
94 | // We now create a URI for the request
95 | String url = "/index.php?";
96 |
97 | Serial.print("Requesting URL: ");
98 | Serial.println(url);
99 |
100 | //temperatureH = String(temperature/100.0, 2);
101 |
102 | // This will send the request to the server
103 | client.print(String("GET ") + url + "tempC=" + String(temperature/100.0, 2) + "&humV=" + humidity + " HTTP/1.1\r\n" +
104 | "Host: " + host + "\r\n" +
105 | "Connection: close\r\n\r\n");
106 |
107 | delay(10);
108 |
109 | // Read all the lines of the reply from server and print them to Serial
110 | Serial.println("Respond:");
111 | while(client.available())
112 | {
113 | String line = client.readStringUntil('\r');
114 | Serial.print(line);
115 | }
116 |
117 | Serial.println();
118 | Serial.println("closing connection");
119 |
120 | //if you want to use deep sleep, connect RST with D0 (GPIO16)
121 | //ESP.deepSleep(SLEEP_DELAY_IN_SECONDS * 1000000, WAKE_RF_DEFAULT);
122 | delay(10000);
123 |
124 | }
125 |
--------------------------------------------------------------------------------
/FW examples/DS18B20+TMEP.ino:
--------------------------------------------------------------------------------
1 | /**
2 | * Meteo-v3
3 | * DS18B20 and TMEP.EU service example - The temperature is sent to tmep.cz (tmep.eu)
4 | * Temperature sensor DS18B20 is connected to GPIO0 (D3)
5 | * If you want to use parasitic mode of DS18B20, connect GND and VDD of
6 | * DS18B20 to GND of MeteoV3 and assembly R4 resistor from 3.3V to DATA pin
7 | * of DS18B20
8 | *
9 | * made by chiptron.cz (2019)
10 | *
11 | * czech website www.chiptron.cz
12 | * english website www.time4ee.com
13 | *
14 | * Based on example from https://github.com/milesburton/Arduino-Temperature-Control-Library
15 | * Library: https://github.com/milesburton/Arduino-Temperature-Control-Library
16 | *
17 | */
18 |
19 | #include
20 | #include
21 | #include
22 |
23 |
24 | // Data wire is connected to GPIO0 - D3 of ESP8266
25 | #define ONE_WIRE_BUS 0
26 |
27 | // Set oneWire bus
28 | OneWire oneWire(ONE_WIRE_BUS);
29 |
30 | #define ARDUINO_ARCH_ESP8266
31 |
32 | #define SLEEP_DELAY_IN_SECONDS 300
33 |
34 | const char* ssid = "SSID";
35 | const char* password = "PASSWORD";
36 |
37 | const char* host = "HOSTNAME.tmep.cz"; // or HOSTNAME.tmep.eu
38 |
39 | // Set oneWire bus for Dallas Temperature sensor
40 | DallasTemperature sensors(&oneWire);
41 |
42 | void setup() {
43 | unsigned int numberOfConnections= 0;
44 |
45 | Serial.begin(9600); // Open serial connection to report values to host
46 | delay(10);
47 |
48 | Serial.println();
49 | Serial.println();
50 |
51 | Serial.println("Made by chiptron.cz");
52 | Serial.println("http://chiptron.cz");
53 | Serial.println("http://time4ee.com");
54 | Serial.println("FW version: 1.3");
55 |
56 | Serial.print("Connecting to ");
57 | Serial.println(ssid);
58 |
59 | WiFi.begin(ssid, password);
60 |
61 | while (WiFi.status() != WL_CONNECTED) {
62 | delay(500);
63 | Serial.print(".");
64 | numberOfConnections++;
65 |
66 | Serial.println("Number Of Connections:");
67 | Serial.println(numberOfConnections);
68 |
69 | // if ESP12E can't connect to WiFi -> enable deep.sleep
70 | if (numberOfConnections > 10)
71 | {
72 | //if you want to use deep sleep, connect RST with D0 (GPIO16)
73 | //ESP.deepSleep(SLEEP_DELAY_IN_SECONDS * 1000000, WAKE_RF_DEFAULT);
74 | delay(1000);
75 | return;
76 | }
77 | }
78 |
79 | Serial.println("");
80 | Serial.println("WiFi connected");
81 | Serial.println("IP address: ");
82 | Serial.println(WiFi.localIP());
83 | // Sensor begin
84 | sensors.begin();
85 | }
86 |
87 |
88 | void loop() {
89 | sensors.requestTemperatures();
90 | sensors.setResolution(9);
91 | int temperature = sensors.getTempCByIndex(0);
92 |
93 | Serial.print("connecting to ");
94 | Serial.println(host);
95 | // Use WiFiClient class to create TCP connections
96 | WiFiClient client;
97 | const int httpPort = 80;
98 | if (!client.connect(host, httpPort))
99 | {
100 | Serial.println("connection failed");
101 | return;
102 | }
103 |
104 | // We now create a URI for the request
105 | String url = "/index.php?";
106 |
107 | Serial.print("Requesting URL: ");
108 | Serial.println(url);
109 |
110 | // This will send the request to the server
111 | client.print(String("GET ") + url + "tempC=" + String(temperature) + " HTTP/1.1\r\n" +
112 | "Host: " + host + "\r\n" +
113 | "Connection: close\r\n\r\n");
114 |
115 | delay(10);
116 |
117 | // Read all the lines of the reply from server and print them to Serial
118 | Serial.println("Respond:");
119 | while(client.available())
120 | {
121 | String line = client.readStringUntil('\r');
122 | Serial.print(line);
123 | }
124 |
125 | Serial.println();
126 | Serial.println("closing connection");
127 |
128 | //if you want to use deep sleep, connect RST with D0 (GPIO16)
129 | //ESP.deepSleep(SLEEP_DELAY_IN_SECONDS * 1000000, WAKE_RF_DEFAULT);
130 | delay(10000);
131 |
132 | }
133 |
--------------------------------------------------------------------------------
/FW examples/BigClown_Soil_Moisture+TMEP.ino:
--------------------------------------------------------------------------------
1 | /**
2 | * Meteo-v3
3 | * Soil Moisture sensor and TMEP.CZ service example - the current value is sent to tmep.cz (tmep.eu)
4 | *
5 | * made by chiptron.cz (2019)
6 | *
7 | * czech website www.chiptron.cz
8 | * english website www.time4ee.com
9 | *
10 | * Soil Moisture Arduino library:
11 | * https://github.com/podija/SoilSensor
12 | *
13 | * DS28B17:
14 | * https://github.com/podija/DS28E17
15 | *
16 | * Soil Moisture tutorial:
17 | * https://developers.bigclown.com/hardware/about-soil-moisture-sensor
18 | * https://developers.bigclown.com/firmware/how-to-soil-moisture-sensor
19 | *
20 | */
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | #define ARDUINO_ARCH_ESP8266
28 |
29 | #define SLEEP_DELAY_IN_SECONDS 300
30 |
31 | // Add a 4k7 pull-up resistor to this pin (R4 on MeteoV3)
32 | // 1-wire connector, DATA pin
33 | #define SOIL_SENSOR_PIN 0
34 |
35 | const char* ssid = "SSID";
36 | const char* password = "PASSWORD";
37 |
38 | const char* host = "HOSTNAME.tmep.cz"; // or HOSTNAME.tmep.eu
39 |
40 | OneWire oneWire(SOIL_SENSOR_PIN);
41 | SoilSensor soilSensor(&oneWire);
42 |
43 | void setup() {
44 | unsigned int numberOfConnections= 0;
45 |
46 | Serial.begin(9600); // Open serial connection to report values to host
47 | delay(10);
48 |
49 | Serial.println();
50 | Serial.println();
51 |
52 | Serial.print("Soil Moisture Sensor by BigClown and MeteoV3\n");
53 | Serial.print("http://chiptron.cz\n");
54 | Serial.print("http://time4ee.com\n");
55 |
56 | Serial.print("Connecting to ");
57 | Serial.println(ssid);
58 |
59 | WiFi.begin(ssid, password);
60 |
61 | while (WiFi.status() != WL_CONNECTED) {
62 | delay(500);
63 | Serial.print(".");
64 | numberOfConnections++;
65 |
66 | Serial.println("Number Of Connections:");
67 | Serial.println(numberOfConnections);
68 |
69 | // if ESP12E can't connect to WiFi -> enable deep.sleep
70 | if (numberOfConnections > 10)
71 | {
72 | //if you want to use deep sleep, connect RST with D0 (GPIO16)
73 | ESP.deepSleep(SLEEP_DELAY_IN_SECONDS * 1000000, WAKE_RF_DEFAULT);
74 | delay(1000);
75 | return;
76 | }
77 | }
78 |
79 | Serial.println("");
80 | Serial.println("WiFi connected");
81 | Serial.println("IP address: ");
82 | Serial.println(WiFi.localIP());
83 | soilSensor.begin();
84 |
85 | }
86 |
87 |
88 | void loop() {
89 | // wake-up Soil Sensor
90 | soilSensor.wakeUp();
91 | float temperature;
92 | uint8_t moisture;
93 |
94 | // measure temperature and soil moisture
95 | soilSensor.readTemperatureCelsius(&temperature);
96 | soilSensor.readMoisture(&moisture);
97 |
98 | Serial.println(temperature);
99 | Serial.println(moisture);
100 |
101 | // Sleep Soil Sensor
102 | soilSensor.sleep();
103 |
104 | Serial.print("connecting to ");
105 | Serial.println(host);
106 | // Use WiFiClient class to create TCP connections
107 | WiFiClient client;
108 | const int httpPort = 80;
109 | if (!client.connect(host, httpPort))
110 | {
111 | Serial.println("connection failed");
112 | return;
113 | }
114 |
115 | // We now create a URI for the request
116 | String url = "/index.php?";
117 |
118 | Serial.print("Requesting URL: ");
119 | Serial.println(url);
120 |
121 | // This will send the request to the server
122 | client.print(String("GET ") + url + "tempC=" + temperature + "&humV=" + moisture + " HTTP/1.1\r\n" +
123 | "Host: " + host + "\r\n" +
124 | "Connection: close\r\n\r\n");
125 |
126 | delay(10);
127 |
128 | // Read all the lines of the reply from server and print them to Serial
129 | Serial.println("Respond:");
130 | while(client.available())
131 | {
132 | String line = client.readStringUntil('\r');
133 | Serial.print(line);
134 | }
135 |
136 | Serial.println();
137 | Serial.println("closing connection");
138 |
139 | //if you want to use deep sleep, connect RST with D0 (GPIO16)
140 | ESP.deepSleep(SLEEP_DELAY_IN_SECONDS * 1000000, WAKE_RF_DEFAULT);
141 | delay(1000);
142 |
143 | }
144 |
--------------------------------------------------------------------------------
/FW examples/Si7021_SoilMoisture_IoTGuruCloud.ino:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * The project with MeteoV3.1 with ESP8266 and air temperature and humidity sensor Si7021
4 | * and temperature and soil moisture sensor made by hardwario
5 | * The data is sent to The IoT Guru cloud
6 | *
7 | * Made by chiptron.cz (7/2020)
8 | *
9 | */
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 |
16 | #define SOIL_SENSOR_PIN 0 //data pin of soil sensor
17 | #define SOIL_VCC_PIN 12 // pin which is used as power supply of soil sensor
18 | #define SDA 4 // GPIO4 on D2 - I2C
19 | #define SCL 5 // GPIO5 on D1 - I2C
20 |
21 | #define WakeUpDuration 900
22 |
23 | const char* ssid = "SSID";
24 | const char* password = "PASSWORD";
25 |
26 | String userShortId = "UserShortID";
27 | String deviceShortId = "DeviceShortID";
28 | String deviceKey = "DeviceKey";
29 | String nodeKey = "NodeKey";
30 | IoTGuru iotGuru = IoTGuru(userShortId, deviceShortId, deviceKey);
31 |
32 | OneWire oneWire(SOIL_SENSOR_PIN);
33 | SoilSensor soilSensor(&oneWire);
34 | SI7021 sensor;
35 |
36 | int count = 0;
37 |
38 | void setup()
39 | {
40 | WiFi.forceSleepBegin();
41 |
42 | Serial.begin(115200);
43 | delay(10);
44 |
45 | pinMode(SOIL_VCC_PIN, OUTPUT);
46 | pinMode(LED_BUILTIN, OUTPUT);
47 |
48 | digitalWrite(LED_BUILTIN, LOW);
49 | // Enable GPIO pin 12 as Vcc pin of Hardwario Soil Moisture sensor
50 | digitalWrite(SOIL_VCC_PIN, HIGH);
51 |
52 | // Initialize Si7021
53 | if(!sensor.begin(SDA,SCL))
54 | {
55 | Serial.println("Si7021 sensor is not connected");
56 | Serial.flush();
57 | digitalWrite(LED_BUILTIN, HIGH);
58 | delay(100);
59 | digitalWrite(LED_BUILTIN, LOW);
60 | delay(100);
61 | digitalWrite(LED_BUILTIN, HIGH);
62 | digitalWrite(SOIL_VCC_PIN, LOW);
63 | ESP.deepSleep(WakeUpDuration * 1000000, WAKE_RF_DEFAULT);
64 | }
65 | // Set heater for better precision
66 | sensor.setHeater(true);
67 | delay(5000);
68 | sensor.setHeater(false);
69 |
70 | // soil moisture sensor
71 | if(!soilSensor.begin())
72 | {
73 | Serial.println("Soil moisture sensor is not connected");
74 | Serial.flush();
75 | digitalWrite(LED_BUILTIN, HIGH);
76 | delay(100);
77 | digitalWrite(LED_BUILTIN, LOW);
78 | delay(100);
79 | digitalWrite(LED_BUILTIN, HIGH);
80 | digitalWrite(SOIL_VCC_PIN, LOW);
81 | ESP.deepSleep(WakeUpDuration * 1000000, WAKE_RF_DEFAULT);
82 | }
83 |
84 | // Switch to WiFi mode
85 | WiFi.begin(ssid, password);
86 | while (WiFi.status() != WL_CONNECTED) {
87 | delay(100);
88 | Serial.print(".");
89 | if(count >= 40)
90 | {
91 | Serial.println("SSID or Password is not valid");
92 | Serial.flush();
93 | digitalWrite(LED_BUILTIN, HIGH);
94 | delay(100);
95 | digitalWrite(LED_BUILTIN, LOW);
96 | delay(100);
97 | digitalWrite(LED_BUILTIN, HIGH);
98 | digitalWrite(SOIL_VCC_PIN, LOW);
99 | ESP.deepSleep(WakeUpDuration * 1000000, WAKE_RF_DEFAULT);
100 | }
101 | count++;
102 | }
103 | Serial.println("");
104 |
105 | //Set check in duration, the default is 60000 milliseconds.
106 | iotGuru.setCheckDuration(60000);
107 |
108 | //Set the debug printer.
109 | iotGuru.setDebugPrinter(&Serial);
110 |
111 | delay(100);
112 | }
113 |
114 | void loop()
115 | {
116 | iotGuru.check();
117 |
118 | float temperatureSoil;
119 | uint16_t moistureSoil;
120 |
121 | // Measure air temperature and humidity
122 | float temperatureSi = sensor.getCelsiusHundredths()/100;
123 | int humiditySi = sensor.getHumidityPercent();
124 |
125 | // Measure temperature and soil moisture
126 | soilSensor.readTemperatureCelsius(&temperatureSoil);
127 | soilSensor.readMoistureRaw(&moistureSoil);
128 |
129 | Serial.println(temperatureSoil);
130 | Serial.println(moistureSoil);
131 |
132 | iotGuru.sendHttpValue(nodeKey, "tempkytka1balkon", temperatureSoil);
133 | iotGuru.sendHttpValue(nodeKey, "humkytka1balkon", moistureSoil);
134 |
135 | Serial.println(temperatureSi);
136 | Serial.println(humiditySi);
137 |
138 | iotGuru.sendHttpValue(nodeKey, "tempbalkon", temperatureSi);
139 | iotGuru.sendHttpValue(nodeKey, "humbalkon", humiditySi);
140 |
141 | digitalWrite(SOIL_VCC_PIN, LOW);
142 | digitalWrite(LED_BUILTIN, HIGH);
143 | Serial.flush();
144 | ESP.deepSleep(WakeUpDuration * 1000000, WAKE_RF_DEFAULT);
145 |
146 | }
147 |
--------------------------------------------------------------------------------
/FW examples/Si7021+TMEP+OLED.ino:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * Meteo-v3
4 | * Si7021, OLED and TMEP.EU service example - The temperature and humidity are sent to tmep.cz (tmep.eu)
5 | * and shown on OLED (0.96", SSD1306).
6 | * If the WiFi network is not available, sending data through WiFi is skipped.
7 | *
8 | * made by chiptron.cz (2019)
9 | *
10 | * czech website www.chiptron.cz
11 | * english website www.time4ee.com
12 | *
13 | * Si7021 library - https://github.com/LowPowerLab/SI7021
14 | * Adafruit GFX library https://github.com/adafruit/Adafruit-GFX-Library
15 | * Adafruit SSD1306 library https://github.com/adafruit/Adafruit_SSD1306
16 | *
17 | */
18 |
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 |
25 | #define SDA 4 // GPIO4 on D2
26 | #define SCL 5 // GPIO5 on D1
27 | #define ARDUINO_ARCH_ESP8266
28 | #define SLEEP_DELAY_IN_SECONDS 300
29 |
30 | // Type of display - only GND, VCC, SCL, SDA, no reset pin
31 | Adafruit_SSD1306 display(NULL);
32 |
33 | const char* ssid = "SSID";
34 | const char* password = "PASSWORD";
35 | const char* host = "HOSTNAME.tmep.cz"; // or HOSTNAME.tmep.eu
36 |
37 | SI7021 sensor;
38 | int wifiEn = 1;
39 |
40 | void setup() {
41 | unsigned int numberOfConnection= 0;
42 |
43 | Serial.begin(9600); // Open serial connection to report values to host
44 | delay(10);
45 |
46 | Serial.println();
47 | Serial.println("Made by chiptron.cz");
48 | Serial.println("www.chiptron.cz");
49 | Serial.println("www.time4ee.com");
50 | // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
51 | display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x64)
52 | delay(100);
53 | display.clearDisplay();
54 | // text display tests
55 | display.setTextSize(1);
56 | display.setTextColor(WHITE);
57 | display.setCursor(0,0);
58 | display.println("chiptron.cz");
59 | display.setCursor(0,10);
60 | display.println("time4ee.com");
61 | display.setCursor(0,20);
62 | display.println("Meteo-v3");
63 | display.display();
64 | delay(2000);
65 |
66 | Serial.print("Connecting to ");
67 | Serial.println(ssid);
68 |
69 | WiFi.begin(ssid, password);
70 |
71 | while (WiFi.status() != WL_CONNECTED)
72 | {
73 | delay(1000);
74 | numberOfConnection++;
75 | Serial.println("Trials:");
76 | Serial.println(numberOfConnection);
77 | // if ESPxx can't connect to WiFi -> skip WiFi
78 | if (numberOfConnection > 9)
79 | {
80 | Serial.println("WiFi connection failed");
81 | display.clearDisplay();
82 | display.setCursor(0, 0);
83 | display.print("Connection ");
84 | display.println("failed");
85 | display.println("SSID");
86 | display.println(ssid);
87 | display.display();
88 | delay(3000);
89 |
90 | wifiEn = 0;
91 | return;
92 | }
93 | }
94 | if(wifiEn == 1)
95 | {
96 | Serial.println("");
97 | Serial.println("WiFi connected");
98 | Serial.println("IP address: ");
99 | Serial.println(WiFi.localIP());
100 | }
101 | sensor.begin(SDA,SCL);
102 | }
103 | void loop() {
104 | int temperature = sensor.getCelsiusHundredths();
105 | unsigned int humidity = sensor.getHumidityPercent();
106 |
107 | display.setTextSize(2);
108 | display.clearDisplay();
109 | display.setCursor(0, 0);
110 | display.print(String(temperature/100.0, 2));
111 | display.println(" 'C");
112 | display.setCursor(0, 15);
113 | display.print(humidity);
114 | display.println(" %");
115 | display.display();
116 |
117 | if(wifiEn == 1)
118 | {
119 | Serial.print("connecting to ");
120 | Serial.println(host);
121 | // Use WiFiClient class to create TCP connections
122 |
123 | WiFiClient client;
124 | const int httpPort = 80;
125 | if (!client.connect(host, httpPort))
126 | {
127 | Serial.println("connection failed");
128 | return;
129 | }
130 | // We now create a URI for the request
131 | String url = "/index.php?";
132 | Serial.print("Requesting URL: ");
133 | Serial.println(url);
134 | // This will send the request to the server
135 | client.print(String("GET ") + url + "tempC=" + String(temperature/100.0, 2) + "&humV=" + humidity + " HTTP/1.1\r\n" +
136 | "Host: " + host + "\r\n" +
137 | "Connection: close\r\n\r\n");
138 | delay(10);
139 | // Read all the lines of the reply from server and print them to Serial
140 | Serial.println("Respond:");
141 | while(client.available())
142 | {
143 | String line = client.readStringUntil('\r');
144 | Serial.print(line);
145 | }
146 | Serial.println();
147 | Serial.println("closing connection");
148 | }
149 |
150 | //if you want to use deep sleep, connect RST with D0 (GPIO16)
151 | //ESP.deepSleep(SLEEP_DELAY_IN_SECONDS * 1000000, WAKE_RF_DEFAULT);
152 | delay(60000);
153 |
154 | }
155 |
--------------------------------------------------------------------------------
/FW examples/OLED+Si7021+BMP180+DS18B20+TSL2561+Serial:
--------------------------------------------------------------------------------
1 | /**
2 | * Meteo-v3
3 | * OLED and Si7021, BMP180, DS18B20 and TSL2561 - the OLED (0.96", SSD1306) and Si7021,
4 | * BMP180, TSL2561 are connected to I2C connectors, DS18B20 to 1-Wire connector
5 | * The temperature, humidity and light are shown on display and also in Serial Monitor
6 | *
7 | * made by chiptron.cz (2019)
8 | *
9 | * czech website www.chiptron.cz
10 | * english website www.time4ee.com
11 | *
12 | * Si7021 library - https://github.com/LowPowerLab/SI7021
13 | * 128x64px OLED display - http://www.adafruit.com/category/63_98
14 | * Add to Arduino IDE "Adafruit GFX Library" https://github.com/adafruit/Adafruit-GFX-Library
15 | * "Adafruit SSD1306" library https://github.com/adafruit/Adafruit_SSD1306
16 | * "Adafruit Unified Sensor" library https://github.com/adafruit/Adafruit_Sensor
17 | * BMP180 library - https://github.com/adafruit/Adafruit-BMP085-Library (BMP180 is supported)
18 | * TSL2561 libray - https://github.com/adafruit/Adafruit_TSL2561
19 | * DS18B20 library - https://github.com/milesburton/Arduino-Temperature-Control-Library
20 | */
21 | #include "Arduino.h"
22 | #include "Esp.h"
23 |
24 | #include
25 | #include
26 |
27 | // Library for Si7021
28 | #include
29 |
30 | // Library for OLED
31 | #include
32 | #include
33 |
34 | // Library for DS18B20
35 | #include
36 | #include
37 |
38 | // Library for BMP180
39 | #include
40 |
41 | // Library for TSL2561
42 | #include
43 | #include
44 |
45 | // Data wire is connected to GPIO0 - D3 of ESP8266
46 | #define ONE_WIRE_BUS 0
47 |
48 | // Define I2C pins
49 | #define SDA 4 // GPIO4 on D2
50 | #define SCL 5 // GPIO5 on D1
51 |
52 | // OLED - OLED 0.96" from ebay (GND, VCC, SCL, SDA, no reset pin)
53 | Adafruit_SSD1306 display(NULL);
54 |
55 | // Si7021
56 | SI7021 Si7021;
57 |
58 | // Set oneWire bus
59 | OneWire oneWire(ONE_WIRE_BUS);
60 |
61 | // Set oneWire bus for Dallas Temperature sensor
62 | DallasTemperature DS18B20(&oneWire);
63 |
64 | // BMP180
65 | Adafruit_BMP085 BMP180;
66 |
67 | // TSL2561
68 | Adafruit_TSL2561_Unified TSL2561 = Adafruit_TSL2561_Unified(TSL2561_ADDR_FLOAT, 12345);
69 | sensor_t sensor;
70 |
71 | // OLED pages
72 | int page=1;
73 |
74 | void setup() {
75 |
76 | Serial.begin(9600); // Open serial connection to report values to host
77 | delay(10);
78 |
79 | // Si7021 initialization
80 | Si7021.begin(SDA, SCL);
81 |
82 | // DS18B20 initialization
83 | DS18B20.begin();
84 |
85 | // BMP180 initialization
86 | BMP180.begin();
87 |
88 | // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
89 | display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x64)
90 |
91 | delay(2000);
92 | display.clearDisplay();
93 |
94 | // text display tests
95 | display.setTextSize(1);
96 | display.setTextColor(WHITE);
97 | display.setCursor(0,0);
98 | display.println("chiptron.cz");
99 | display.setCursor(0,10);
100 | display.println("time4ee.com");
101 | display.setCursor(0,20);
102 | display.println("Meteo-v3");
103 | display.display();
104 | delay(2000);
105 | display.clearDisplay();
106 |
107 | }
108 |
109 |
110 | void loop() {
111 |
112 | if(page == 1)
113 | {
114 | int temperature = Si7021.getCelsiusHundredths();
115 | unsigned int humidity = Si7021.getHumidityPercent();
116 |
117 | Serial.print("Temperature: ");
118 | Serial.print(String(temperature/100.0, 2));
119 | Serial.println(" °C");
120 | Serial.print("Humidity: ");
121 | Serial.print(humidity);
122 | Serial.println(" %");
123 |
124 | display.setTextSize(1);
125 | display.setTextColor(WHITE);
126 | display.clearDisplay();
127 | display.setCursor(0, 0);
128 | display.println("Si7021");
129 | display.setCursor(0, 10);
130 | display.print(String(temperature/100.0, 2));
131 | display.println(" 'C");
132 | display.setCursor(0,20);
133 | display.print(humidity);
134 | display.println(" %");
135 | display.setCursor(100, 20);
136 | display.print(page);
137 | display.println("/4");
138 | display.display();
139 | }
140 | else if (page == 2)
141 | {
142 | DS18B20.requestTemperatures();
143 |
144 | Serial.print("Temperature: ");
145 | Serial.print(DS18B20.getTempCByIndex(0));
146 | Serial.println(" °C");
147 |
148 | display.setTextSize(1);
149 | display.setTextColor(WHITE);
150 | display.clearDisplay();
151 | display.setCursor(0, 0);
152 | display.println("DS18B20");
153 | display.setCursor(0, 10);
154 | display.print(DS18B20.getTempCByIndex(0));
155 | display.println(" 'C");
156 | display.setCursor(100, 20);
157 | display.print(page);
158 | display.println("/4");
159 | display.display();
160 | }
161 | else if (page == 3)
162 | {
163 | TSL2561.getSensor(&sensor);
164 |
165 | TSL2561.enableAutoRange(true);
166 |
167 | TSL2561.setIntegrationTime(TSL2561_INTEGRATIONTIME_13MS); /* fast but low resolution */
168 |
169 | sensors_event_t event;
170 | TSL2561.getEvent(&event);
171 |
172 | Serial.print(event.light);
173 | Serial.println(" lux");
174 |
175 | display.setTextSize(1);
176 | display.setTextColor(WHITE);
177 | display.clearDisplay();
178 | display.setCursor(0, 0);
179 | display.println("TSL2561");
180 | display.setCursor(0, 10);
181 | display.print(event.light);
182 | display.println(" lux");
183 | display.setCursor(100, 20);
184 | display.print(page);
185 | display.println("/4");
186 | display.display();
187 |
188 | }
189 |
190 | else if (page == 4)
191 | {
192 | int temperature = BMP180.readTemperature(); // read temperature
193 | int pressure = BMP180.readPressure(); // read pressure
194 |
195 | Serial.print("Temperature: ");
196 | Serial.print(temperature);
197 | Serial.println(" °C");
198 |
199 | display.setTextSize(1);
200 | display.setTextColor(WHITE);
201 | display.clearDisplay();
202 | display.setCursor(0, 0);
203 | display.println("BMP180");
204 | display.setCursor(0, 10);
205 | display.print(temperature);
206 | display.println(" 'C");
207 | display.setCursor(0,20);
208 | display.print(pressure);
209 | display.println(" hPa");
210 | display.setCursor(100, 20);
211 | display.print(page);
212 | display.println("/4");
213 | display.display();
214 | }
215 | else
216 | {
217 | // do nothing
218 | }
219 |
220 |
221 | if(page < 4)
222 | {
223 | page++;
224 | }
225 | else
226 | {
227 | page = 1;
228 | }
229 |
230 | delay(2000);
231 |
232 | }
233 |
--------------------------------------------------------------------------------
/FW examples/SensorTester.ino:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * *****************************************************************************************
4 | * FW still in development
5 | * *****************************************************************************************
6 | *
7 | * Meteo-v3
8 | * Testing FW for Meteo-v3, connect your device and write command to Serial terminal.
9 | * FW checks and reads sensor and write values.
10 | * Write "help" for available commands
11 | *
12 | * made by chiptron.cz (2019)
13 | *
14 | * czech website www.chiptron.cz
15 | * english website www.time4ee.com
16 | *
17 | * Si7021 library - https://github.com/LowPowerLab/SI7021
18 | * Adafruit Unified Sensor library https://github.com/adafruit/Adafruit_Sensor
19 | * BMP180 library - https://github.com/adafruit/Adafruit-BMP085-Library (BMP180 is supported)
20 | * TSL2561 libray - https://github.com/adafruit/Adafruit_TSL2561
21 | * DS18B20 library - https://github.com/milesburton/Arduino-Temperature-Control-Library
22 | */
23 |
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 |
33 | #define SDA 4 // GPIO4 on D2
34 | #define SCL 5 // GPIO5 on D1
35 |
36 | #define ONE_WIRE_BUS 0
37 |
38 | #define ARDUINO_ARCH_ESP8266
39 |
40 | String readString;
41 |
42 | void setup()
43 | {
44 | Serial.begin(9600); // Open serial connection to report values to host
45 | while(!Serial)
46 | {
47 | // waiting for opening of Serial
48 | }
49 |
50 | Serial.println("Serial is open");
51 | Serial.println("For Help - write 'help'");
52 |
53 | }
54 |
55 |
56 | void loop()
57 | {
58 | readString = Serial.readString();
59 |
60 | if (readString == "help")
61 | {
62 | Serial.println("*****HELP*****");
63 | Serial.println("Write 'i2cscanner' for scanning of I2C bus");
64 | Serial.println("Write 'si7021' for reading from Si7021");
65 | Serial.println("Write 'bmp180' for reading from BMP180");
66 | Serial.println("Write 'ds18b20' for reading from DS18B20");
67 | Serial.println("Write 'tsl2561' for reading from TSL2561");
68 | Serial.println("*****HELP*****");
69 |
70 | }
71 | else if (readString == "i2cscanner")
72 | {
73 | Serial.println("*****I2C Scanner*****");
74 | //code developed by https://playground.arduino.cc/Main/I2cScanner/
75 | byte error, address;
76 | int nDevices;
77 |
78 | Serial.println("Scanning...");
79 |
80 | nDevices = 0;
81 | for(address = 1; address < 127; address++ )
82 | {
83 | // The i2c_scanner uses the return value of
84 | // the Write.endTransmisstion to see if
85 | // a device did acknowledge to the address.
86 | Wire.beginTransmission(address);
87 | error = Wire.endTransmission();
88 |
89 | if (error == 0)
90 | {
91 | Serial.print("I2C device found at address 0x");
92 | if (address<16)
93 | Serial.print("0");
94 | Serial.print(address,HEX);
95 | Serial.println(" !");
96 |
97 | nDevices++;
98 | }
99 | else if (error==4)
100 | {
101 | Serial.print("Unknown error at address 0x");
102 | if (address<16)
103 | Serial.print("0");
104 | Serial.println(address,HEX);
105 | }
106 | }
107 | if (nDevices == 0)
108 | Serial.println("No I2C devices found\n");
109 | else
110 | Serial.println("done\n");
111 |
112 | Serial.println("*****I2C Scanner*****");
113 | }
114 | else if (readString == "si7021")
115 | {
116 | Serial.println("*****Si7021*****");
117 | Serial.println("Connect SDA to 4, SCL to 5");
118 |
119 | SI7021 sensor;
120 | sensor.begin(SDA,SCL);
121 |
122 | int temperature = sensor.getCelsiusHundredths();
123 | unsigned int humidity = sensor.getHumidityPercent();
124 |
125 | if((temperature == 12886) && (humidity == 118))
126 | {
127 | Serial.println("Sensor is not connected");
128 | }
129 | else
130 | {
131 | Serial.println("Temperature");
132 | Serial.print(String(temperature/100.0, 2));
133 | Serial.println(" °C");
134 | Serial.println("Humidity: ");
135 | Serial.print(humidity);
136 | Serial.println(" %");
137 | }
138 |
139 | Serial.println("*****Si7021*****");
140 | }
141 | else if (readString == "bmp180")
142 | {
143 | Serial.println("*****BMP180*****");
144 | Serial.println("Connect SDA to 4, SCL to 5");
145 |
146 | Adafruit_BMP085 bmp180;
147 | bmp180.begin();
148 |
149 | int temperature = bmp180.readTemperature(); // read temperature
150 | int pressure = bmp180.readPressure(); // read pressure
151 |
152 | if((temperature == 4) && (pressure == 100395))
153 | {
154 | Serial.println("Sensor is not connected.");
155 | }
156 | else
157 | {
158 | Serial.println("Temperature: ");
159 | Serial.print(temperature);
160 | Serial.println(" °C");
161 | Serial.println("Pressure: ");
162 | Serial.print(pressure);
163 | Serial.println(" Pa");
164 | }
165 |
166 | Serial.println("*****BMP180*****");
167 | }
168 | else if (readString == "tsl2561")
169 | {
170 | Serial.println("*****TSL2561*****");
171 | Serial.println("Connect SDA to 4, SCL to 5");
172 |
173 | Adafruit_TSL2561_Unified TSL2561 = Adafruit_TSL2561_Unified(TSL2561_ADDR_FLOAT, 12345);
174 | sensor_t sensor;
175 |
176 | TSL2561.getSensor(&sensor);
177 | TSL2561.enableAutoRange(true);
178 | TSL2561.setIntegrationTime(TSL2561_INTEGRATIONTIME_13MS); /* fast but low resolution */
179 | sensors_event_t event;
180 | TSL2561.getEvent(&event);
181 |
182 | if(event.light == 65536)
183 | {
184 | Serial.println("Sensor is not connected.");
185 | }
186 | else
187 | {
188 | Serial.println("Light");
189 | Serial.print(event.light);
190 | Serial.println(" lux");
191 | }
192 |
193 | Serial.println("*****TSL2561*****");
194 |
195 | }
196 | else if (readString == "ds18b20")
197 | {
198 | Serial.println("*****DS18B20*****");
199 | Serial.println("Connect DS18B20 Data to GPIO0 (D3)");
200 |
201 | OneWire oneWire(ONE_WIRE_BUS);
202 | DallasTemperature DS18B20(&oneWire);
203 | DS18B20.begin();
204 |
205 | DS18B20.requestTemperatures();
206 | int temperature = DS18B20.getTempCByIndex(0);
207 | if(temperature == -127.00)
208 | {
209 | Serial.println("Sensor is not connected.");
210 | }
211 | else
212 | {
213 | DS18B20.requestTemperatures();
214 | Serial.println("Temperature: ");
215 | Serial.print(temperature);
216 | Serial.println(" °C");
217 | }
218 |
219 | Serial.println("*****DS18B20*****");
220 | }
221 | else
222 | {
223 | // Serial.println("Unknown command");
224 | // Serial.println("Write 'help'");
225 | }
226 | Serial.flush();
227 | }
228 |
--------------------------------------------------------------------------------
/FW examples/ePaper+OpenWeatherMapAPI:
--------------------------------------------------------------------------------
1 | /*
2 | * Weather station with MeteoV3 and ePaper 4.3" with UART bus
3 | * https://chiptron.cz/articles.php?article_id=243
4 | *
5 | * Created by chiptron.cz
6 | * Board+PowerShield - MeteoV3 https://github.com/petus/Meteo-v3-ESP8266
7 | * ePaper - https://www.dfrobot.com/product-1312.html
8 | *
9 | * Libraries & Info:
10 | * OpenWeatherMap - https://github.com/sfrwmaker/openweathermap.org-ESP8266
11 | * JsonParser - https://github.com/squix78/json-streaming-parser
12 | * Json - https://arduinojson.org/
13 | * ePaper library example - Bitcoin E-Ink - USU Spaces
14 | * ePaper wiki - https://www.waveshare.com/wiki/4.3inch_e-Paper_UART_Module
15 | * Icons - https://www.iconfinder.com/iconsets/weather-413
16 | *
17 | */
18 |
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | #include //ePaper
28 |
29 | #define timezone 3
30 | #define SLEEP_DELAY_IN_SECONDS 1800 //time of delay, 1800 = 30mins
31 |
32 | const char *ow_key = "----"; // key of API of OpenWeatherMap
33 | const char *nodename = "----"; // varaible name
34 | const char *wifi_ssid = "----"; // WiFi SSID
35 | const char *wifi_passwd = "----"; // WiFi password
36 |
37 | OWMconditions owCC;
38 | OWMfiveForecast owF5;
39 |
40 | char buf[100] = {0}; // temporary buffer
41 |
42 | void connectWiFiInit(void)
43 | {
44 | WiFi.hostname(nodename);
45 | String ssid = wifi_ssid;
46 | String passwd = wifi_passwd;
47 | WiFi.begin(ssid.c_str(), passwd.c_str());
48 | while (WiFi.status() != WL_CONNECTED)
49 | {
50 | delay(500);
51 | Serial.print(".");
52 | }
53 | }
54 |
55 | String sunTime(String timestamp)
56 | {
57 | time_t ts = timestamp.toInt();
58 | char buff[30];
59 | sprintf(buff, "%2d:%02d", hour(ts)+timezone, minute(ts));
60 | return String(buff);
61 | }
62 | String dateTime(String timestamp)
63 | {
64 | time_t ts = timestamp.toInt();
65 | char buff[30];
66 | sprintf(buff, "%2d:%02d %02d-%02d-%4d", hour(ts)+timezone, minute(ts), day(ts), month(ts), year(ts));
67 | return String(buff);
68 | }
69 |
70 |
71 | void setup()
72 | {
73 | Serial.begin(115200);
74 |
75 | connectWiFiInit();
76 | pinMode(12, OUTPUT); // define GPIO for switching of ePaper - through PowerShield of MeteoV3
77 | }
78 |
79 | void loop()
80 | {
81 | MDNS.begin(nodename);
82 |
83 | /* Current weather */
84 | OWM_conditions *ow_cond = new OWM_conditions;
85 | owCC.updateConditions(ow_cond, ow_key, "cz", "Prague", "metric"); // update yours
86 |
87 | Serial.print("Latitude & Longtitude: ");
88 | Serial.print("<" + ow_cond->longtitude + " " + ow_cond->latitude + "> @" + dateTime(ow_cond->dt) + ": ");
89 | Serial.println("icon: " + ow_cond->icon + ", " + " temp.: " + ow_cond->temp + ", press.: " + ow_cond->pressure);
90 |
91 | /* Forecast */
92 | OWM_fiveForecast *ow_fcast5 = new OWM_fiveForecast[40];
93 | byte entries = owF5.updateForecast(ow_fcast5, 40, ow_key, "cz", "Prague", "metric"); // update yours
94 | Serial.print("Entries: "); Serial.println(entries+1);
95 | for (byte i = 0; i <= entries; ++i)
96 | {
97 | Serial.print(dateTime(ow_fcast5[i].dt) + ": icon: ");
98 | Serial.print(ow_fcast5[i].icon + ", temp.: [" + ow_fcast5[i].t_min + ", " + ow_fcast5[i].t_max + "], press.: " + ow_fcast5[i].pressure);
99 | Serial.println(", descr.: " + ow_fcast5[i].description + ":: " + ow_fcast5[i].cond + " " + ow_fcast5[i].cond_value);
100 | }
101 |
102 | digitalWrite(12, HIGH); // turn on the ePaper
103 | /*ePaper*/
104 | epd_clear(); // clear ePaper
105 | delay(3000);
106 |
107 | /*
108 | * ASCII 32
109 | */
110 | epd_set_color(BLACK, WHITE);
111 | epd_set_ch_font(GBK32);
112 | epd_set_en_font(ASCII32);
113 |
114 | /*right down labels*/
115 | /*
116 | * |--------------|--------------------|
117 | * |--------------|--------------------|
118 | * |______________|--------------------|
119 | * |--------------|--------------------|
120 | * |--------------|#######------###----|
121 | * |--------------|#######------#######|
122 | */
123 | epd_disp_string("Wind speed", 330, 370);
124 |
125 | epd_disp_string("Sunset", 610, 500);
126 | epd_disp_string("Sunrise", 330, 500);
127 |
128 | String sCond = "" + String(ow_cond->cond) + "";
129 | sCond.toCharArray(buf, 50);
130 | epd_disp_string(&buf, 610, 370);
131 |
132 | /*left labels*/
133 | /*
134 | * |-----##-------|--------------------|
135 | * |--------------|--------------------|
136 | * |______________|--------------------|
137 | * |-----##-------|--------------------|
138 | * |--------------|--------------------|
139 | * |--------------|--------------------|
140 | */
141 |
142 | /*left labels*/
143 | String s3hTime = "" + String(sunTime(ow_fcast5[0].dt)) + "";
144 | s3hTime.toCharArray(buf, 50);
145 | epd_disp_string(&buf, 150, 10);
146 |
147 | String s6hTime = "" + String(sunTime(ow_fcast5[1].dt)) + "";
148 | s6hTime.toCharArray(buf, 50);
149 | epd_disp_string(&buf, 150, 260);
150 |
151 | /*
152 | * |--------------|--------------------|
153 | * |#######--####-|--------------------|
154 | * |______________|--------------------|
155 | * |--------------|--------------------|
156 | * |#######--####-|--------------------|
157 | * |--------------|--------------------|
158 | */
159 | /*left up*/
160 | String sfWeather = "" + String(ow_fcast5[0].description) + "";
161 | sfWeather.toCharArray(buf, 50);
162 | epd_disp_string(&buf, 10, 190);
163 |
164 | /*left down*/
165 | sfWeather = "" + String(ow_fcast5[1].description) + "";
166 | sfWeather.toCharArray(buf, 50);
167 | epd_disp_string(&buf, 10, 440);
168 |
169 | /*time*/
170 | epd_disp_string("Time of data:", 30, 530);
171 |
172 | /*
173 | * |--------------|--------------------|
174 | * |--------------|--------------------|
175 | * |______________|--------------------|
176 | * |--------------|--------------------|
177 | * |--------------|--------------------|
178 | * |-############-|--------------------|
179 | */
180 | String sTime = "" + String(dateTime(ow_cond->dt));
181 | sTime.toCharArray(buf, 50);
182 | epd_disp_string(&buf, 30, 560);
183 |
184 | /*
185 | * ASCII 64
186 | */
187 | epd_set_ch_font(GBK64);
188 | epd_set_en_font(ASCII64);
189 |
190 | /*right*/
191 | /*
192 | * |--------------|--------------------|
193 | * |--------------|--#####-------------|
194 | * |______________|--#####-------------|
195 | * |--------------|--#####-------------|
196 | * |--------------|--------------------|
197 | * |--------------|--------------------|
198 | */
199 | String sIcon = "" + String(ow_cond->icon);
200 | epd_set_memory(1); // microSD card
201 |
202 | // choose Icon based on icon name from OpenWeatherMap API
203 | if(sIcon == "01d")
204 | epd_disp_bitmap("PIC01D.BMP", 380, 150);
205 | else if(sIcon == "01n")
206 | epd_disp_bitmap("PIC01N.BMP", 380, 150);
207 | else if(sIcon == "02d")
208 | epd_disp_bitmap("PIC02D.BMP", 380, 150);
209 | else if(sIcon == "02n")
210 | epd_disp_bitmap("PIC02N.BMP", 380, 150);
211 | else if(sIcon == "03d")
212 | epd_disp_bitmap("PIC03D.BMP", 380, 150);
213 | else if(sIcon == "03n")
214 | epd_disp_bitmap("PIC03N.BMP", 380, 150);
215 | else if(sIcon == "04d")
216 | epd_disp_bitmap("PIC04D.BMP", 380, 150);
217 | else if(sIcon == "04n")
218 | epd_disp_bitmap("PIC04N.BMP", 380, 150);
219 | else if(sIcon == "09d")
220 | epd_disp_bitmap("PIC09D.BMP", 380, 150);
221 | else if(sIcon == "09n")
222 | epd_disp_bitmap("PIC09N.BMP", 380, 150);
223 | else if(sIcon == "10d")
224 | epd_disp_bitmap("PIC10D.BMP", 380, 150);
225 | else if(sIcon == "10n")
226 | epd_disp_bitmap("PIC10N.BMP", 380, 150);
227 | else if(sIcon == "11d")
228 | epd_disp_bitmap("PIC11D.BMP", 380, 150);
229 | else if(sIcon == "11n")
230 | epd_disp_bitmap("PIC11N.BMP", 380, 150);
231 | else if(sIcon == "13d")
232 | epd_disp_bitmap("PIC13D.BMP", 380, 150);
233 | else if(sIcon == "13n")
234 | epd_disp_bitmap("PIC13N.BMP", 380, 150);
235 | else if(sIcon == "50d")
236 | epd_disp_bitmap("PIC50D.BMP", 380, 150);
237 | else if(sIcon == "50n")
238 | epd_disp_bitmap("PIC50N.BMP", 380, 150);
239 | else
240 | {
241 | ;
242 | }
243 |
244 | /*
245 | * |--------------|--------------------|
246 | * |--------------|-------------####---|
247 | * |______________|-------------####---|
248 | * |--------------|--------------------|
249 | * |--------------|--####----------##--|
250 | * |--------------|--------------------|
251 | */
252 |
253 | String sTemperature = "" + String(ow_cond->temp) + " 'C";
254 | sTemperature.toCharArray(buf, 50);
255 | epd_disp_string(&buf, 610, 130);
256 |
257 | String sHumidity = "" + String(ow_cond->humidity) + " %";
258 | sHumidity.toCharArray(buf, 50);
259 | epd_disp_string(&buf, 610, 200);
260 |
261 | String sWindSpeed = "" + String(ow_cond->w_speed) + " m/s";
262 | sWindSpeed.toCharArray(buf, 50);
263 | epd_disp_string(&buf, 330, 400);
264 |
265 | String sCondValue;
266 | if(sCond == "clouds")
267 | sCondValue = "" + String(ow_cond->cond_value) + " %";
268 | else
269 | sCondValue = "" + String(ow_cond->cond_value) + " mm";
270 |
271 | sCondValue.toCharArray(buf, 50);
272 | epd_disp_string(&buf, 610, 400);
273 |
274 | /*
275 | * ASCII 48
276 | */
277 | epd_set_ch_font(GBK48);
278 | epd_set_en_font(ASCII48);
279 |
280 | /*right*/
281 | /*
282 | * |--------------|--###########-------|
283 | * |--------------|--------------------|
284 | * |______________|--------------------|
285 | * |--------------|--------------------|
286 | * |--------------|--------------------|
287 | * |--------------|--######------#####-|
288 | */
289 | String sWeather = "" + ow_cond->description;
290 | sWeather.toCharArray(buf, 50);
291 | epd_disp_string(&buf, 330, 10);
292 |
293 | String sSunrise = "" + String(sunTime(ow_cond->sunrise));
294 | sSunrise.toCharArray(buf, 50);
295 | epd_disp_string(&buf, 330, 530);
296 |
297 | String sSunset = "" + String(sunTime(ow_cond->sunset));
298 | sSunset.toCharArray(buf, 50);
299 | epd_disp_string(&buf, 610, 530);
300 |
301 | /*left up*/
302 | /*
303 | * |-#####--------|--------------------|
304 | * |-#####--------|--------------------|
305 | * |_#####________|--------------------|
306 | * |--------------|--------------------|
307 | * |--------------|--------------------|
308 | * |--------------|--------------------|
309 | */
310 | String sfTemperature = "" + String(ow_fcast5[0].t_min) + " 'C";
311 | sfTemperature.toCharArray(buf, 50);
312 | epd_disp_string(&buf, 10, 40);
313 |
314 | String sfHumidity = "" + String(ow_fcast5[0].humidity) + " %";
315 | sfHumidity.toCharArray(buf, 50);
316 | epd_disp_string(&buf, 10, 90);
317 |
318 | String sfCondValue;
319 | if(ow_fcast5[0].cond == "clouds")
320 | sfCondValue = "" + String(ow_fcast5[0].cond) + ": " + String(ow_fcast5[0].cond_value) + " %";
321 | else
322 | sfCondValue = "" + String(ow_fcast5[0].cond) + ": " + String(ow_fcast5[0].cond_value) + " mm";
323 | sfCondValue.toCharArray(buf, 50);
324 | epd_disp_string(&buf, 10, 140);
325 |
326 | /*left down*/
327 | /*
328 | * |--------------|--------------------|
329 | * |--------------|--------------------|
330 | * |______________|--------------------|
331 | * |-####---------|--------------------|
332 | * |-####---------|--------------------|
333 | * |-####---------|--------------------|
334 | */
335 |
336 | sfTemperature = "" + String(ow_fcast5[1].t_min) + " 'C";
337 | sfTemperature.toCharArray(buf, 50);
338 | epd_disp_string(&buf, 10, 290);
339 |
340 | sfHumidity = "" + String(ow_fcast5[1].humidity) + " %";
341 | sfHumidity.toCharArray(buf, 50);
342 | epd_disp_string(&buf, 10, 340);
343 |
344 | if(ow_fcast5[1].cond == "clouds")
345 | sfCondValue = "" + String(ow_fcast5[1].cond) + ": " + String(ow_fcast5[1].cond_value) + " %";
346 | else
347 | sfCondValue = "" + String(ow_fcast5[1].cond) + ": " + String(ow_fcast5[1].cond_value) + " mm";
348 | sfCondValue.toCharArray(buf, 50);
349 | epd_disp_string(&buf, 10, 390);
350 |
351 | /*draw lines*/
352 | epd_draw_line(320, 0, 320, 600);
353 | epd_draw_line(321, 0, 321, 600);
354 | epd_draw_line(322, 0, 322, 600);
355 |
356 | epd_draw_line(0, 250, 320, 250);
357 |
358 | epd_draw_line(0, 520, 320, 520);
359 | epd_draw_line(0, 521, 320, 521);
360 | epd_draw_line(0, 522, 320, 522);
361 |
362 | epd_udpate(); // update the ePaper
363 |
364 | delay(4000);
365 |
366 | digitalWrite(12, LOW); // turn off the ePaper
367 | ESP.deepSleep(SLEEP_DELAY_IN_SECONDS * 1000000, WAKE_RF_DEFAULT);
368 | }
369 |
--------------------------------------------------------------------------------