Goal
					Build an environment quality monitor.
					
						Powered by FreeRTOS, a low power IOT device
					
				
				
					
						Global System Design
						
					
					
						ESP32
						
						
							- Low power, dual-core processor
 
							- C/C++ & FreeRTOS support
 
							- Wifi & BLE support
 
						
					
					
						Sensors
						
					
						
							- BM280: temperature, humidity & pressure
 
							- SGP40: Volatile Organic Compounds (VOC)
 
							- LTR390-UV-1: UV
 
							- TSL25911: ambient light (infrared & visible)
 
							- PMSA003I : particle concentration by size
 
						
					
					
						Touch E-ink Display
						
					
						
							- GT1151: Touch
 
							- Multiple views of live data
 
							- Low power consumption
 
							- User interaction
 
						
					
					
						Open Weather Map
						
					
						
							- Exterior realtime data source
 
							- Free API access
 
							- +200'000 cities
 
						
					
					
						Time-Series Database
						
						
							- Influx DB, open source database system
 
							- Time-Series optimized storage
 
							- Lightweight HTTP client
 
						
					
					
						Network Time Protocol
						
					
						
							- Get time from the network
 
							- Compute & display local time
 
							- Keep it up-to-date using internal RTC
 
						
					
				
				
					
						I2C
						
						
							- 2 wires: clock & data
 
							- Device have unique adress
 
							- Bi-directional, half-duplex
 
							- Simple protocol
 
						
					
					
						I2C protocol
						
						
							- Select device with R/W capability
 
							- Select register
 
							- Send/Read data
 
						
					
					
						Technical specs
						
							- 100kbps usually, up to multiple Mbps
 
							- 120 slave devices in 7 bit mode
 
							- Some devices have 10 bit adresses
 
							- Some devices have multi-byte register adresses
 
						
					
				
				
					
						SPI
						
						
							- 4 wires: clock, master-data, slave-data, chip-select
 
							- Device have unique adress
 
							- Bi-directional, full duplex
 
							- More complex protocol
 
						
					
					
						SPI protocol
						
							- Multiple configurations (direct or chained, data lines)
 
							- For the EPD, library is provided by constructor
 
						
					
					
						Technical specs
						
							- 1Mbps usually, ~2x the speed of I2C, up to hundreads of Mbps
 
							- Possibility for multiple data lines to increase bandwith further
 
							- Slave number limited by IO in direct configuration
 
							- Slave number limited by delay in chained configuration
 
						
					
				
				
					
						HTTPS
						
					
						
							- Manually imported certificates
 
							- GET from OWM (JSON)
 
							- POST to Telegram & DB (String)
 
							- JSON handled with arduinojson library
 
						
					
					
				
				
					
						ESP32 Configuration
						
					
					
						Internal Timer
						
						
							- Base clock runs at 80Mhz
 
							- We set the scaler to run at 1Mhz
 
							- We trigger IRQ every 1 second
 
						
					
					
						Core Configuration
						3 FreeRTOS core pinned tasks
						
						
							- Sensor read, network get & post (Core 0)
 
							- Touch screen IRQ polling & handling (Core 1)
 
							- E-Ink Display refresh & drawing (Core 1)
 
						
					
					
						Sleep Mode
						
						
							- After inactivity the device goes into sleep mode
 
							- Wakes up periodicaly to run measurements
 
							- Returns to standard mode on touch IRQ [WIP]
 
						
					
					
						Task Timing
						
						
							- List of functions with their run frequency
 
							- On minute tick check if any should have run since last tick
 
							- Not affected by function execution time
 
						
					
				
				
					
						Power Consumption
						
						
							
								
									| Device | 
									Default | 
									Sleep | 
								
							
							
								
									| ESP32 | 
									20-200 mA | 
									10-800 uA | 
								
								
									| EPD & Touch | 
									26 mA | 
									122 uA | 
								
								
									| Sensors | 
									104.7 mA | 
									245.4 uA | 
								
								
									 | 
									~330 mA (33mAh) | 
									~1.1 mA (1mAh) | 
								
							
						
					
				
				
					
						Case Design
						
					
					
						Case Design
						
					
				
				
					Future Features
					
						- Sleep between measurements (wake from touch/timer interupt)
 
						- Improved "Air quality" metric
 
						- More views & layouts to choose from
 
						- Support to controll IOT heating/cooling/ventilation