This repository has been archived on 2026-11-30. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
atmega328p--e01c-ml01s--bme…/firmware/firmware.ino
T
bachirandClaude Opus 5.5 4318e0de69 rangement : pcb/, firmware/, docs/
- pcb/bme280 : projet KiCad renommé atmega328p--e01c-ml01s--bme280--cr2032 (carte identique, netlist identique), Gerber zippés ; titre du schéma corrigé (368P -> 328P)
- firmware/firmware.ino, compilé identique
- anciens fichiers KiCad 5, export PDF et netlist retirés ; Gerber décompressés, cache et réglages locaux plus suivis
- docs/images : schéma, faces, rendus 3D ; README, .gitignore

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 23:17:16 +01:00

139 lines
3.8 KiB
Arduino

/**
* The MySensors Arduino library handles the wireless radio link and protocol
* between your home built sensors/actuators and HA controller of choice.
* The sensors forms a self healing radio network with optional repeaters. Each
* repeater and gateway builds a routing tables in EEPROM which keeps track of the
* network topology allowing messages to be routed to nodes.
*
* Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
* Copyright (C) 2013-2015 Sensnology AB
* Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
*
* Documentation: http://www.mysensors.org
* Support Forum: http://forum.mysensors.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
*******************************
*
* REVISION HISTORY
* Version 1.0: Henrik EKblad
* Version 1.1 - 2016-07-20: Converted to MySensors v2.0 and added various improvements - Torben Woltjen (mozzbozz)
*
* DESCRIPTION
* This sketch provides an example of how to implement a humidity/temperature
* sensor using a DHT11/DHT-22.
*
* For more information, please visit:
* http://www.mysensors.org/build/humidity
*
*/
// Enable debug prints
#define MY_DEBUG
// Enable and select radio type attached
#define MY_RADIO_RF24
//#define MY_RADIO_RFM69
//#define MY_RS485
#define MY_RF24_PA_LEVEL RF24_PA_HIGH
// signing
#define MY_SIGNING_SIMPLE_PASSWD "C@KptBi1L@5op?8!"
#define MY_RF24_CHANNEL 14
#include <SPI.h>
#include <MySensors.h>
// Set this offset if the sensor has a permanent small offset to the real temperatures.
// In Celsius degrees (as measured by the device)
#define SENSOR_TEMP_OFFSET 0
// Sleep time between sensor updates (in milliseconds)
// Must be >1000ms for DHT22 and >2000ms for DHT11
static const uint64_t UPDATE_INTERVAL = 5000;
// Force sending an update of the temperature after n sensor reads, so a controller showing the
// timestamp of the last update doesn't show something like 3 hours in the unlikely case, that
// the value didn't change since;
// i.e. the sensor would force sending an update every UPDATE_INTERVAL*FORCE_UPDATE_N_READS [ms]
static const uint8_t FORCE_UPDATE_N_READS = 10;
#define CHILD_ID_TEMP 0
#define CHILD_ID_HUM 1
#define CHILD_ID_PRES 2
// float lastTemp;
// float lastHum;
// uint8_t nNoUpdatesTemp;
// uint8_t nNoUpdatesHum;
bool metric = true;
MyMessage msgHum(CHILD_ID_HUM, V_HUM);
MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
MyMessage msgPres(CHILD_ID_PRES, V_PRESSURE);
void presentation()
{
// Send the sketch version information to the gateway
sendSketchInfo("BME280", "0.1");
// Register all sensors to gw (they will be created as child devices)
present(CHILD_ID_TEMP, S_TEMP);
present(CHILD_ID_HUM, S_HUM);
present(CHILD_ID_PRES, S_BARO);
metric = getControllerConfig().isMetric;
}
void setup()
{
Serial.println("- - - - - setup - - - - -");
}
void loop()
{
#ifdef MY_DEBUG
Serial.println("getting humidity, temperature and pressure");
#endif
// static float humi = sensor.getRH();
// static float temp = metric ? sensor.getTemp() : sensor.getTempF();
// static float pres = sensor.getP();
static float humi = 80;
static float temp = 10;
static float pres = 700;
#ifdef MY_DEBUG
Serial.print("Humidity: ");
Serial.print(humi, 2);
Serial.print("\tTemperature: ");
Serial.println(temp, 2);
Serial.print("\tPressure: ");
Serial.println(pres, 2);
#endif
static MyMessage msgHum( CHILD_ID_HUM, V_HUM );
static MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
static MyMessage msgPres(CHILD_ID_PRES, V_PRESSURE);
send(msgTemp.set(temp, 2));
send(msgHum.set(humi, 2));
send(msgPres.set(pres, 2));
// Sleep for a while to save energy
sleep(UPDATE_INTERVAL);
}