This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:domotique:garagebox [2025/02/11 16:30] – [Parts selection] kodein | en:domotique:garagebox [2025/02/18 14:21] (current) – [Résultats] kodein | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | FIXME **This page is not fully translated, yet. Please help completing the translation.**\\ //(remove this paragraph once the translation is finished)// | ||
- | |||
====== Why I want home automation for my separate garages too ====== | ====== Why I want home automation for my separate garages too ====== | ||
As William would say : //"Why not ?"// LOL | As William would say : //"Why not ?"// LOL | ||
Line 65: | Line 63: | ||
GPIO is the only language it talks. | GPIO is the only language it talks. | ||
- | ====== | + | ====== |
- | J'ai acheté | + | I bought |
- | * 5 ESP32 " | + | * 5 ESP32 |
* 1 ESP32-C6 (zigbee) | * 1 ESP32-C6 (zigbee) | ||
* 1 ESP32-H2 (zigbee) | * 1 ESP32-H2 (zigbee) | ||
* 2 LD2420 (radar) | * 2 LD2420 (radar) | ||
- | * 1 LTR390 (lumière) | + | * 1 LTR390 (light) |
* 2 BME280 (t°) | * 2 BME280 (t°) | ||
- | * 5 relais avec optocoupleurs | + | * 5 relays |
- | * 2 kits solaires avec un porte li-ion | + | * 2 solar kits with 18650 socket |
- | * 1 DC-DC converter | + | * 1 DC-DC converter |
- | Ça devrait me permettre de réaliser quelques essais sans trop me prendre le choux. | + | |
===== Test001 ESPHome ===== | ===== Test001 ESPHome ===== | ||
- | Autant débuter par un truc simple sans faire non plus dans le simpliste (j'ai pas envie de juste lire/écrire des GPIO), donc récupérer les données d'un capteur de t° et les remonter au central domotique. | + | I'll start directly trying to use I²C bus. I don't want to loose time trying to read/write GPIO since it's too easy. So I'll try to plug a BME280 on the ESP32. |
- | Si j'arrive déjà à faire ça, ça veut dire que le esp32 parle via I²C au capteur et transmet les valeurs via wifi au serveur domotique. | + | |
- | Le tout sera alimenté directement par un chargeur | + | If I get that to work most of the hardest work will be done. |
+ | |||
+ | I'll directly power the whole thing using ESP32' | ||
==== Firmware ==== | ==== Firmware ==== | ||
- | Le plus complexe pour moi, c'est faire le programme. N' | + | I never used ESPHome |
- | === Initialiser le core === | + | |
- | Dans un premier temps, je suis passé par l' | + | === Initialise the ESP === |
- | Ce qui a permis d' | + | At first I used ESPHome Device Builder's GUI from my Home Assistant |
- | Mais dès que le code s'est étoffé, le raspi s'est retrouvé à bout de souffle pendant la compilation. | + | But as soon as I added some bus and sensor definitions, the rapberry pi running Home Assistant gave up on life while trying to compile code. xD |
- | Pour soulager ce pauvre raspi il a fallu installer les outils CLI ESPHome | + | To fix this, I installed |
- | === Voyons ce code === | + | === Let's take a peek at the code === |
<code yaml> | <code yaml> | ||
name: test001 | name: test001 | ||
Line 129: | Line 128: | ||
- platform: homeassistant | - platform: homeassistant | ||
id: homeassistant_time</ | id: homeassistant_time</ | ||
- | Ici on a tout le setup de base du module ESPHome, j'y ai ajouté une sync avec l' | + | We have here the basic setup of the ESP32. I added time sync because I may add some (local) automation using time of the day. And it's easy to add syncing with HA server. |
<code yaml> | <code yaml> | ||
sda: GPIO21 | sda: GPIO21 | ||
Line 136: | Line 135: | ||
id: bus_a | id: bus_a | ||
</ | </ | ||
- | On initialise le bus I²C sur les pins 21 pour SDL et 22 pour SDA et on le désigne par l' | + | Initialising the I²C bus, getting it all sweet and ready to talk with some peripherals. |
<code yaml> | <code yaml> | ||
sensor: | sensor: | ||
Line 147: | Line 146: | ||
humidity: | humidity: | ||
name: " | name: " | ||
- | On définit d' | + | We first define the kind of sensor, here a BME280 |
- | Ensuite, petite subtilité, mon capteur n'était pas détecté par l'ESP. J'ai poussé un sketch | + | Then I had to define the 0x76 address because the default one is 0x77 so the ESP couldn't establish the connection to the BME. I had to use an address sniffer |
- | Puis les différentes valeurs à remonter au serveur et le nom sous lequel les afficher. J'ai laissé les noms par défauts donnés sur le site ESPHome parce que c'est avant tout un proto, il n'est pas destiné à être utilisé tel quel. | + | Finally we define the names that will be shown in Home Assistant for the various readings made by the sensor.\\ |
==== Hardware ==== | ==== Hardware ==== | ||
- | C'est très simple de câbler un capteur | + | Wiring |
- | * GND sur GND | + | * GND on GND |
- | * 3.3V sur 3.3V | + | * 3.3V on 3.3V |
- | * SDA sur gpio 21 | + | * SDA on gpio 21 |
- | * SCL sur gpio 22 | + | * SCL on gpio 22 |
- | <gallery center& | + | <gallery center& |
==== Résultats ==== | ==== Résultats ==== | ||
- | Dans un premier temps je n'avais que ça : | + | As I said earlier the default I²C address wasn't the one used by my BME so at first I had that result |
- | <gallery center& | + | <gallery center& |
- | Après avoir corrigé l' | + | After using the right address |
- | <gallery center& | + | <gallery center& |
- | C'est officiellement un grand succès! | + | Huge success! (I'm making a note here) |
- | ==== Améliorations ==== | ||
- | Il va être nécessaire d' | ||
- | ==== Ajout LTR390 ==== | + | |
- | Ajouter le capteur lumière et UV est vraiment | + | ==== Adding a LTR390 ==== |
+ | It's quite trivial | ||
<code yaml> | <code yaml> | ||
uv_index: | uv_index: | ||
Line 181: | Line 179: | ||
name: "Light Sensor Counts" | name: "Light Sensor Counts" | ||
</ | </ | ||
- | <gallery center& | + | <gallery center& |
- | Et ça fonctionne directement. | + | And it just works. |
+ | <gallery center& | ||
+ | ==== Addind a LD2420 ==== | ||
+ | This radar isn't harder to wire than the previous two devices : | ||
+ | * 3.3V on 3.3V | ||
+ | * GND on GND | ||
+ | * RX on TX0 ESP | ||
+ | * OT1 on RX0 ESP (on older LD2420 firmware TX may be on OT2) | ||
- | + | Then you need to initialize the UART. Since we already use an UART for logs, you have to keep them from mixing up. | |
- | ==== Ajout LD2420 ==== | + | <code yaml>logger: |
- | Le radar à ondes millimétriques est assez simple à raccorder physiquement, | + | id: logz |
- | * 3.3V sur 3.3V | + | […] |
- | * GND sur GND | + | uart: |
- | * RX sur TX0 coté ESP | + | tx_pin: |
- | * OT2 ou OT1 (en fonction de la version de firmware) sur RX0 coté ESP | + | rx_pin: |
- | Si on rajoute un cinquième fil, on peut avoir le retour sur GPIO de la présence détectée ou non et éventuellement pouvoir utiliser des modes plus économes en énergie sur l'ESP avec le GPIO qui vient le réveiller. Dans mon cas, pas très utile, le montage ne tournant pas sur batterie. | + | |
- | + | ||
- | Il faut d' | + | |
- | <code yaml> | + | |
- | tx_pin: | + | |
- | rx_pin: | + | |
baud_rate: 115200 | baud_rate: 115200 | ||
+ | id: radar | ||
</ | </ | ||
- | Ensuite, le code pour le module n'est pas extrêmement complexe (c'est principalement attribuer à des variables | + | That prevents from getting logs on the sensor channel and inversely.\\ |
- | <code yaml> | + | I' |
- | text_sensor: | + | The rest of the code isn't complex but there are a lot of parameters so it's quite lengthier than the previous devices. Moreover it's the default code I found on ESPHome website I did no change on it. So as of now, I'll only put what I change in the code to prevent having boring large slabs of code everywhere. |
- | - platform: ld2420 | + | |
- | fw_version: | + | |
- | name: LD2420 Firmware | + | |
- | sensor: | + | So, with all this the sensor |
- | - platform: ld2420 | + | I guess in an open space like in front of the garage and with a well calibrated sensor it should return more accurate readings. |
- | moving_distance: | + | |
- | name : Moving Distance | + | |
- | binary_sensor: | + | ==== Automation ==== |
- | - platform: ld2420 | + | |
- | has_target: | + | |
- | name: Presence | + | |
- | select: | + | ===== Now the same using zigbee ===== |
- | - platform: ld2420 | + | I want to evaluate how harder it would be to make the same device using " |
- | operating_mode: | + | Because most of my current devices are using that radio communications, so it would be great to keep going with it. |
- | name: Operating Mode | + | |
- | number: | + | |
- | - platform: ld2420 | + | |
- | presence_timeout: | + | |
- | name: Detection Presence Timeout | + | |
- | min_gate_distance: | + | |
- | name: Detection Gate Minimum | + | |
- | max_gate_distance: | + | |
- | name: Detection Gate Maximum | + | |
- | + | ||
- | gate_select: | + | |
- | name: Select Gate to Set | + | |
- | still_threshold: | + | |
- | name: Set Still Threshold Value | + | |
- | move_threshold: | + | |
- | name: Set Move Threshold Value | + | |
- | + | ||
- | gate_move_sensitivity: | + | |
- | name: Move Calibration Sensitivity Factor | + | |
- | gate_still_sensitivity: | + | |
- | name: Still Calibration Sensitivity Factor | + | |
- | </ | + | |
- | ===== On garde globalement les mêmes, mais en zigbee ===== | + | |
- | Ouais, pour tester et comparer le rapport emmerdement/ | + | |
- | J' | + |