Skip to content

Instantly share code, notes, and snippets.

@rosterloh

rosterloh/m5cam.yaml

Last active Oct 13, 2020
Embed
What would you like to do?
ESPHome for m5cam
esphome:
name: m5cam
platform: ESP32
board: m5stack-core-esp32
wifi:
ssid: "ssid"
password: "password"
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
binary_sensor:
- platform: status
name: "M5Cam Status"
# https://esphome.io/components/esp32_camera.html
esp32_camera:
name: M5CAM
external_clock:
pin: GPIO27
frequency: 20MHz
i2c_pins:
sda: GPIO25
scl: GPIO23
data_pins: [GPIO17, GPIO35, GPIO34, GPIO5, GPIO39, GPIO18, GPIO36, GPIO19]
vsync_pin: GPIO22
href_pin: GPIO26
pixel_clock_pin: GPIO21
reset_pin: GPIO15
idle_framerate: 0.05 fps
resolution: 640x480
jpeg_quality: 10
# Grove I2C
i2c:
sda: GPIO13
scl: GPIO4
scan: True
status_led:
pin: GPIO16
sensor:
- platform: bmp280
temperature:
name: "M5Cam Temperature"
oversampling: 16x
id: bmp280_temperature
pressure:
name: "M5Cam Pressure"
id: bmp280_pressure
address: 0x76
update_interval: 15s
- platform: dht12
temperature:
name: "DHT12 Temperature"
id: dht12_temperature
humidity:
name: "M5Cam Relative Humidity"
id: dht12_humidity
update_interval: 15s
- platform: template
name: "Altitude"
lambda: |-
const float STANDARD_SEA_LEVEL_PRESSURE = 1013.25; //in hPa, see note
return ((id(bmp280_temperature).state + 273.15) / 0.0065) *
(powf((STANDARD_SEA_LEVEL_PRESSURE / id(bmp280_pressure).state), 0.190234) - 1); // in meter
update_interval: 15s
- platform: template
name: "Absolute Humidity"
lambda: |-
const float mw = 18.01534; // molar mass of water g/mol
const float r = 8.31447215; // Universal gas constant J/mol/K
return (6.112 * powf(2.718281828, (17.67 * id(bmp280_temperature).state) /
(id(bmp280_temperature).state + 243.5)) * id(dht12_humidity).state * mw) /
((273.15 + id(bmp280_temperature).state) * r); // in grams/m^3
accuracy_decimals: 2
update_interval: 15s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment