Skip to content

Commit 92e0955

Browse files
author
OSi (Ondrej Sienczak)
committed
Added support for TTGO T5-4.7
1 parent 950647e commit 92e0955

File tree

1,410 files changed

+3127
-760
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,410 files changed

+3127
-760
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/simulator/hotspot.txt
1414
/simulator/onecall.json
1515
/simulator/reset_cause.txt
16-
/simulator/*.json
16+
/simulator/cfg
1717
/simulator/var
1818
/simulator/bitmaps/*.bin
1919

README.md

Lines changed: 226 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
# Meteoink
22

33
![EPD 5.65 ACEP inch meteostation](graphics/doc/meteostation_acep.jpeg "EPD 5.65 ACEP inch meteostation")
4-
![EPD 4.2 inch meteostation](graphics/doc/meteostation.jpeg "EPD 4.2 inch meteostation")
54

65

76
## What Meteoink is
87

9-
Meteoink is home meteostation based on [4.2 inch dual color E-Ink display](https://www.waveshare.com/4.2inch-e-paper-module-c.htm) (BWY variant)
10-
or [5.65 inch 7 colors E-Ink display](https://www.waveshare.com/5.65inch-e-paper-module-f.htm) (ACEP variant),
11-
[TTGO-T8-ESP32](https://github.com/LilyGO/TTGO-T8-ESP32) and [micropython 1.20](https://micropython.org/). Meteostation
12-
is connected to your home WiFi and uses data from [OpenWeatherMap](https://openweathermap.org/) project for obtaining
13-
weather forecast. It also uses [DHT22](https://github.com/semestrinis/Arduino/wiki/DHT22-temperature-humidity-sensor)
8+
Meteoink is home meteostation based on several variants of E-Ink displays such as
9+
[5.65inch 7-color (F) E-Ink display](https://www.waveshare.com/wiki/5.65inch_e-Paper_Module_(F)_Manual) (variant `acep`),
10+
[4.2 inch dual color E-Ink display](https://www.waveshare.com/4.2inch-e-paper-module-c.htm) (variant `bwy`) or
11+
[T5-4.7 Inch E-paper](https://www.lilygo.cc/products/t5-4-7-inch-e-paper) (variant `epd47`). Platform running this meteostation is [micropython 1.20](https://micropython.org/) runningt on [TTGO-T8-ESP32](https://github.com/LilyGO/TTGO-T8-ESP32/tree/master)
12+
compatible board.
13+
14+
Meteostation is connected to your home WiFi and uses data from [OpenWeatherMap](https://openweathermap.org/).
15+
It also uses [DHT22](https://github.com/semestrinis/Arduino/wiki/DHT22-temperature-humidity-sensor)
1416
sensor for measuring indoor temperature and humidity. Whole system is powered from one
1517
[18650 Li-On battery](https://en.wikipedia.org/wiki/List_of_battery_sizes#Lithium-ion_batteries_(rechargeable))
1618
charged through the USB on ESP board. Meteostation is usually operating half a year when refresh time is set to
17-
20 minutes and there is good internet WiFi access.
19+
20 minutes and there is good WiFi access to internet (depends on used battery capacity - also note that showing
20+
the radar data on `acep` variant shorten this time 3-times).
1821

1922

2023
## Wiring
@@ -26,6 +29,9 @@ Some pins can be moved to another position by changing config file [pins.py](htt
2629
but keep in mind that not all pins are available for any operation (some are not capable of ADC, some are not capable of SPI, ...).
2730
Also battery is not displayed in wiring as it has its own connector so its connection is obvious.
2831

32+
Just note that variant `epd47` ([T5-4.7 Inch E-paper](https://www.lilygo.cc/products/t5-4-7-inch-e-paper))
33+
does not need to be wired as all i present on board.
34+
2935

3036
## Box
3137

@@ -50,31 +56,154 @@ outside the box). When you glue it, apply glue very carefully as it shall not pa
5056
![3D printed frame](graphics/doc/frame13.jpeg "3D printed frame")
5157
![3D printed frame](graphics/doc/frame14.jpeg "3D printed frame")
5258

59+
### EPD47 (EPD 4.7)
60+
61+
Just note thatthere is many of possible frames e.g. on [Thingiverse](https://www.thingiverse.com/search?q=T5-4.7&page=1&type=things&sort=relevant) for this model of display.
5362

5463
## Micropython
5564

5665
To make software running on ESP32, you have to install Micropython first on it. You shall use
57-
[custom built of Micropython](https://github.com/ondiiik/meteoink/blob/master/esp32/micropython.bin)
58-
according to [this tutorial](https://docs.micropython.org/en/latest/esp32/tutorial/intro.html#deploying-the-firmware).
59-
The reason for custom build is, that startup of meteostation is then way faster. This significantly reduce battery consumption.
60-
You can also use [thonny IDE](https://randomnerdtutorials.com/getting-started-thonny-micropython-python-ide-esp32-esp8266/) to do
61-
this job for you.
66+
[custom built of Micropython](https://github.com/ondiiik/meteoink/blob/master/esp32/micropython.bin) which contains
67+
all necessary, including required python code. This also allow meteostation to startup way faster, what significantly
68+
reduce battery consumption.
69+
70+
### Flashing of micropython
71+
72+
All necessary files and upload script can be found in repository folder [esp32](https://github.com/ondiiik/meteoink/tree/master/esp32).
73+
Basically this 3 files are required:
74+
75+
- [micropython.bin](https://github.com/ondiiik/meteoink/raw/master/esp32/micropython.bin)
76+
- [bootloader.bin](https://github.com/ondiiik/meteoink/raw/master/esp32/bootloader.bin)
77+
- [partition-table.bin](https://github.com/ondiiik/meteoink/raw/master/esp32/partition-table.bin)
78+
79+
To flash firmware to your ESP32 board you can use [flash.sh](https://github.com/ondiiik/meteoink/raw/master/esp32/flash.sh)
80+
shell script. Just note that you will need to have installed [python interpreter](https://www.python.org/downloads/) first.
81+
You also need to have [esptool](https://pypi.org/project/esptool/) installed in your `python`. Once you have `python` installed
82+
on your PC you can install `esptool` by following command:
83+
84+
```
85+
pip install esptool
86+
```
87+
88+
Then you can run [flash.sh](https://github.com/ondiiik/meteoink/raw/master/esp32/flash.sh) script to flash firmware into your
89+
ESP32 board. You can use first argument to specify custom USB UART port where board is connected (otherwise `/dev/ttyUSB0`
90+
is used by default). Just note that this script will erase flash on ESP32 including file system, so you can be sure that
91+
your previous data will be definitely lost (good idea to backup them before flashing).
6292

6393

6494
## Upload binary files
6595

66-
The last step is to upload required binary files into device file sytem. This binaries are located in repository folder
67-
[esp32/micropython](https://github.com/ondiiik/meteoink/tree/master/esp32/micropython) for each variant of display. There is [esp32/micropython/bwy](https://github.com/ondiiik/meteoink/tree/master/esp32/micropython/bwy)
68-
folder for 4.2 inch Black/White/Yellow display, or [esp32/micropython/acep](https://github.com/ondiiik/meteoink/tree/master/esp32/micropython/acep)
69-
folder for 5.65 7-color ACEP display. All files from selected folder shall be copied into board.
70-
For this purpose REPL based file access engine such as [ampy](https://techtutorialsx.com/2017/06/04/esp32-esp8266-micropython-uploading-files-to-the-file-system/) or
71-
[thonny IDE](https://randomnerdtutorials.com/getting-started-thonny-micropython-python-ide-esp32-esp8266/) can be used for writing files into file system.
72-
Just keep in mind that you shall be disconnected from console otherwise this tools will not work properly.
96+
Each meteostation variant needs to upload also files with web content and binaries with graphics. This binaries are located in repository folder [esp32/micropython](https://github.com/ondiiik/meteoink/tree/master/esp32/micropython) for each variant of
97+
display. There shall be also uploaded file `hw.json` into `cfg` describing in which mode and with which pins the meteostation
98+
will work.
99+
100+
Once you have installed `python` on your PC you can use [ampy](https://techtutorialsx.com/2017/06/04/esp32-esp8266-micropython-uploading-files-to-the-file-system/) or
101+
[Thonny IDE](https://randomnerdtutorials.com/getting-started-thonny-micropython-python-ide-esp32-esp8266/) to do this job for you.
102+
Following files needs to be copied according to variant you use:
103+
104+
#### Files for variant ACEP
73105

106+
![EPD 5.65 ACEP inch meteostation](graphics/doc/meteostation_acep.jpeg "EPD 5.65 ACEP inch meteostation")
107+
108+
- all files from folder [esp32/micropython/acep](https://github.com/ondiiik/meteoink/tree/master/esp32/micropython/acep).
109+
- following `JSON` file into `cfg/hw.json` (this is also created automatically by default when this file is missing).
110+
111+
```
112+
{
113+
"variant": "acep",
114+
"pins": {
115+
"sck": 13,
116+
"mosi": 14,
117+
"miso": 12,
118+
"cs": 15,
119+
"dc": 27,
120+
"rst": 26,
121+
"busy": 25,
122+
"dht": 22,
123+
"led": 21,
124+
"vbat": 35,
125+
"buzzer": 33
126+
},
127+
"buttons": {
128+
"hotspot": 32,
129+
"alert": -1,
130+
"sleep": -1
131+
}
132+
}
133+
```
134+
135+
#### Files for variant BWY
74136

75-
## Configuration - first run
137+
![EPD 4.2 inch meteostation](graphics/doc/meteostation.jpeg "EPD 4.2 inch meteostation")
76138

77-
With first run the metostation automatically switch to WiFi AP mode. You can use QR codes displayed on screen to setup your mobile phone WiFi and open suitable WEB page.
139+
- all files from folder [esp32/micropython/acep](https://github.com/ondiiik/meteoink/tree/master/esp32/micropython/bwy).
140+
- following `JSON` file into `cfg/hw.json`.
141+
142+
```
143+
{
144+
"variant": "bwy",
145+
"pins": {
146+
"sck": 13,
147+
"mosi": 14,
148+
"miso": 12,
149+
"cs": 15,
150+
"dc": 27,
151+
"rst": 26,
152+
"busy": 25,
153+
"dht": 22,
154+
"led": 21,
155+
"vbat": 35,
156+
"buzzer": 33
157+
},
158+
"buttons": {
159+
"hotspot": 32,
160+
"alert": -1,
161+
"sleep": -1
162+
}
163+
}
164+
```
165+
166+
#### Files for variant EPD47
167+
168+
![EPD 4.7 inch meteostation](graphics/doc/meteostation_epd47.jpeg "EPD 4.7 inch meteostation")
169+
170+
- all files from folder [esp32/micropython/acep](https://github.com/ondiiik/meteoink/tree/master/esp32/micropython/gs).
171+
- following `JSON` file into `cfg/hw.json`.
172+
173+
```
174+
{
175+
"variant": "lilygo_epd47",
176+
"pins": {
177+
"sck": 13,
178+
"mosi": 14,
179+
"miso": 12,
180+
"cs": 15,
181+
"dc": 27,
182+
"rst": 26,
183+
"busy": 25,
184+
"dht": 22,
185+
"led": 21,
186+
"vbat": 35,
187+
"buzzer": 33
188+
},
189+
"buttons": {
190+
"hotspot": 32,
191+
"alert": -1,
192+
"sleep": -1
193+
}
194+
}
195+
```
196+
197+
Just note that whenvariant `"lilygo_epd47"` is detected in config file after startup, firmware automatically set-up all pins
198+
for you and switch variant to `"epd47"`.
199+
200+
201+
## Initial configuration
202+
203+
When all files are uploaded and meteostation restarted, it creates all missing `JSON` files in folder `cfg`. However
204+
this initial data are missing some important data (API key, WiFi setup, location, ...). This causes that metostation
205+
automatically switch to WiFi AP mode. You can use QR codes displayed on screen to setup your mobile phone WiFi to attach
206+
to meteostation AP and open suitable WEB page.
78207

79208
![Initial screen](graphics/doc/initial.png "Initial screen")
80209

@@ -112,36 +241,100 @@ displayed (it may take about one minute)
112241

113242
## Reconfiguration
114243

115-
If you want to get into setup WEB page again, then you have restart meteostation and immediately hold **config**
116-
button, till beep (it may take even half minute). Then QR codes appears on screen and configuration web server will be ready after next beep.
244+
If you want to get into setup WEB page again, then you have restart meteostation when holding **config**
245+
button, till beep (it may take a few seconds) and meteostation became to start to hotspot mode again.
246+
Then QR codes appears on screen and configuration web server will be ready after next beep.
247+
248+
Just note that this is **bit more complicated with EPD47 variant** which needs to do one more reboot after
249+
display is repainted (rebooting will happen automatically). In this case you have to hold **config** button
250+
whole time till you hear short ascending melody signalizes that WEB server is running.
117251

118252

119253
## Manual configuration
120254

121255
All items configured by WEB interface are at the end stored in [JSON](https://cs.wikipedia.org/wiki/JavaScript_Object_Notation) files
122-
in root of internal file storage. If this files are missing, they are created automatically after first start of meteostation. This files
123-
can be also edited manually, and are then used after restart. However be careful when editing them, especially files `connection.json`
124-
and `location.json`, where `connection.json` which uses index to `location.json` as reference and is easy to break binding between
125-
them.
256+
in `cfg` folder on device. If this files are missing, they are created automatically after first start of meteostation. This files
257+
can be also edited manually (e.g. using [Thonny IDE](https://randomnerdtutorials.com/getting-started-thonny-micropython-python-ide-esp32-esp8266/)),
258+
and they are then used after restart. However be careful when editing them, especially files `connection.json`
259+
and `location.json`, where `connection.json` which uses index to `location.json` as reference and is easy to break binding between them.
260+
261+
Items in some of this files are described here:
262+
263+
### hw.json
264+
265+
```
266+
{
267+
"variant": "acep",
268+
"pins": {
269+
"sck": 13,
270+
"mosi": 14,
271+
"miso": 12,
272+
"cs": 15,
273+
"dc": 27,
274+
"rst": 26,
275+
"busy": 25,
276+
"dht": 22,
277+
"led": 21,
278+
"vbat": 35,
279+
"buzzer": 33
280+
},
281+
"buttons": {
282+
"hotspot": 32,
283+
"alert": -1,
284+
"sleep": -1
285+
}
286+
}
287+
```
288+
289+
- `"variant"` - Variant of used board. Can be one of `"acep"`, `"bwy"` or `"epd47"`
290+
(or `"lilygo_epd47"` which forces auto-setup of pins after reboot).
291+
- `"pins"` - Configurations of pins used for communication with peripheries.
292+
- `"buttons"` - Configurations of pins used for connecting of control buttons.
126293

127-
Some of this files are described here:
128294

129295
### api.json
130296

297+
```
298+
{
299+
"apikey": "",
300+
"units": "metric",
301+
"language": "en",
302+
"variant": 4
303+
}
304+
```
305+
306+
- `"apikey"` - `apikey` obtained from [OpenWeatherMap](https://home.openweathermap.org/users/sign_up) used to download forecast.
131307
- `"units"` - Which units shall be used (`"metric"` or `"imperial"`).
132308
- `"language"` - Which language shall be used (`"cz"` or `"en"`).
133309
- `"variant"` - How much days shall be displayed in forecast (number in range from 2 to 5, where 2 uses more detailed variant of forecast).
134-
- `"apikey"` - `apikey` obtained from [OpenWeatherMap](https://home.openweathermap.org/users/sign_up) used to download forecast.
310+
135311

136312
### beep.json
137313

314+
```
315+
{
316+
"temp_balanced": false,
317+
"error_beep": false
318+
}
319+
```
320+
138321
- `"temp_balanced"` - Boolean telling if outdoor and indoor temperatures are balanced (so you can open window and start cooling your house).
139322
- `"error_beep"` - Boolean telling if station shell you notify by beeping when some software error occur (goot for long time testing).
140323

141-
### spot.json
142324

143-
- `"ssid"` - Boolean telling if outdoor and indoor temperatures are balanced (so you can open window and start cooling your house).
144-
- `"error_beep"` - Boolean telling if station shell you notify by beeping when some software error occur (goot for long time testing).
325+
### sys.json
326+
327+
```
328+
{
329+
"exception_dump": 0,
330+
"log_level": "info",
331+
"led_enabled": false,
332+
}
333+
```
334+
335+
- `"exception_dump"` - Says how much bytes can be stored as exceptions dump into file system. Use 0 to disable this dumps.
336+
- `"log_level"` - Verbosity of logging on UART terminal. Use one of `"debug"`, `"info"`, `"warning"`, `"error"` or `"critical"`.
337+
- `"led_enabled"` - Tells if LED diode shall be used to report state of station (disable to safe a bit of battery juice).
145338

146339

147340
## Others
@@ -150,7 +343,7 @@ Some of this files are described here:
150343

151344
Currently supported languages are English and Czech, however any support for translation to another language is welcommed.
152345
If someone wants to add the new language, it can be done in folder [lang](https://github.com/ondiiik/meteoink/tree/master/simulator/lang).
153-
Translation is always a dictionary where the key is english sentense and the value is its translation.
346+
Translation is always a dictionary where the key is English sentence and the value is its translation.
154347

155348
If some additional characters needs to be added, this shall be done in file [font2png.py](https://github.com/ondiiik/meteoink/blob/master/graphics/font2png.py).
156349
There is a line just like following containing supported characters:

esp32/bootloader.bin

21.2 KB
Binary file not shown.

esp32/build.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class Builder:
1414
def __init__(self, dst, variant):
1515
self.cwd = root.joinpath("..", "micropython").resolve()
1616
self.dwd = root.joinpath(dst, variant).resolve()
17+
print(self.cwd, "->", self.dwd)
1718
self.fw = root.joinpath("meteoink.fw")
1819
self.mpc = str(root.joinpath("mpy-cross")) + " -v -march=xtensawin"
1920
self.repo = git.Repo(search_parent_directories=True)
@@ -34,12 +35,15 @@ def build_cleanup(self, cleanup):
3435
self.command(f"mkdir {self.dwd}")
3536

3637
def build_copy(self):
37-
self.copy("web/www")
38+
self.copy("www")
3839

3940
if self.variant == "acep":
40-
self.copy("bitmaps/wind.bin")
41-
self.copy("bitmaps/fonts.bin")
42-
self.copy("bitmaps/bmp.bin")
41+
self.copy("bitmaps/acep/wind.bin")
42+
self.copy("bitmaps/acep/fonts.bin")
43+
self.copy("bitmaps/acep/bmp.bin")
44+
elif self.variant == "gs":
45+
self.copy("bitmaps/gs/fonts.bin")
46+
self.copy("bitmaps/gs/bmp.bin")
4347
else:
4448
with open(f"{self.dwd}/bitmaps", "w"):
4549
...
@@ -82,3 +86,6 @@ def copy(self, p):
8286

8387
builder_acep = Builder("micropython", "acep")
8488
builder_acep(cleanup=True)
89+
90+
builder_acep = Builder("micropython", "gs")
91+
builder_acep(cleanup=True)

0 commit comments

Comments
 (0)