rangement : premier commit de l'appareil

- firmware/firmware.ino (depuis congelo-DS18B20x2/pro-mini--congelo-DS18B20x2), compilé identique
- boitier : boîtier FreeCAD et STL
- docs : adresses des sondes DS18B20, rendu du boîtier
- README, .gitignore

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-29 23:09:13 +01:00
co-authored by Claude Opus 5.5
commit 2668747504
8 changed files with 244 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
# Éditeur et fichiers générés
.vscode/
*.html
*.lst
# KiCad : sauvegardes automatiques, caches, verrous, réglages locaux
*-backups/
fp-info-cache
*.lck
_autosave-*
*.kicad_prl
# Gerber décompressés (les .zip sont versionnés)
pcb/*/*.gerber/
# FreeCAD : copies de sauvegarde
*.FCStd1
# Les Gerber zippés sont à versionner (le .gitignore global ignore *.zip)
!pcb/*/*.gerber.zip
+43
View File
@@ -0,0 +1,43 @@
# pro-mini--congelo--ds18b20x2
Capteur MySensors de température pour congélateurs : un ATmega328 en carte de type Pro Mini et des sondes DS18B20 sur un bus OneWire. Il envoie les températures à Home Assistant par la passerelle MySensors (canal 14). Pas de carte KiCad : montage sur carte du commerce.
| Dossier | Contenu |
|---|---|
| [`firmware/`](firmware/) | Croquis Arduino `firmware.ino` |
| [`boitier/`](boitier/) | Boîtier FreeCAD imprimé en 3D, avec STL |
| [`docs/`](docs/) | Adresses des sondes DS18B20, rendu du boîtier |
## Firmware (`firmware/firmware.ino`)
- MySensors, radio `MY_RADIO_RF24`, canal 14, puissance `RF24_PA_HIGH`.
- Bus OneWire sur D3, jusqu'à 16 sondes DS18B20 détectées ; une mesure (child `S_TEMP`) par sonde.
- Mesure toutes les 10 min (`UPDATE_INTERVAL = 600000` ; le commentaire du code dit 5 min, c'est la valeur qui compte), le nœud dormant entre deux mesures.
- Réglages pour pile : pas de vérification de liaison montante, attente du réseau limitée à 5 s, recherche de la passerelle limitée à 2 s avant la mise en veille.
- `MY_DEBUG` est activé.
- Le croquis s'annonce comme `Congelos DS18B20x2` version `0.1`.
Compilation : carte MiniCore, ATmega328PB, 8 MHz interne, bootloader série (`uart0`), BOD 2,7 V :
```
MiniCore:avr:328:bootloader=uart0,eeprom=keep,variant=modelPB,BOD=2v7,LTO=Os_flto,clock=8MHz_internal
```
Bibliothèques nécessaires : MySensors, OneWire, DallasTemperature. La configuration VS Code (`.vscode/arduino.json`, croquis `firmware/firmware.ino`) n'est pas versionnée.
[`docs/DS18B20-addresses.txt`](docs/DS18B20-addresses.txt) : adresses OneWire de sondes DS18B20 relevées le 21.05.2023 (le même relevé existe dans les dossiers des sondes du cumulus).
## Boîtier (`boitier/`)
`boitier temp congelos.FCStd` (18.04.2024) :
- `boitier (Meshed).stl` : le corps, 74 × 54 × 30 mm ;
- `couvercle (Meshed).stl` : le couvercle, 78,5 × 58,5 × 17 mm.
**Rendu 3D** : corps à gauche, couvercle à droite (rendu `f3d` des STL).
![Rendu 3D du boîtier](docs/images/boitier.png)
## Historique
Rangé le 29.11.2026 depuis `congelo-DS18B20x2/` (croquis `pro-mini--congelo-DS18B20x2.ino`), qui n'était pas versionné : ce dépôt commence à cette date. Le firmware compilé est identique avant et après le rangement.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+11
View File
@@ -0,0 +1,11 @@
0: 0x28, 0xEA, 0x4F, 0x96, 0xF0, 0x01, 0x3C, 0xC2
1: 0x28, 0xDE, 0x8D, 0x96, 0xF0, 0x01, 0x3C, 0x52
2: 0x28, 0xCC, 0x0B, 0x81, 0xE3, 0xE1, 0x3C, 0x55
3: 0x28, 0x77, 0xCD, 0x96, 0xF0, 0x01, 0x3C, 0x71
4: 0x28, 0x6E, 0x54, 0x48, 0xF6, 0xA4, 0x3C, 0x2C
5: 0x28, 0x57, 0x2C, 0x49, 0xF6, 0x0D, 0x3C, 0xD7
6: 0x28, 0x17, 0xA8, 0x96, 0xF0, 0x01, 0x3C, 0x71
7: 0x28, 0x72, 0x9C, 0x96, 0xF0, 0x01, 0x3C, 0xC2
8: 0x28, 0x70, 0xCB, 0x96, 0xF0, 0x01, 0x3C, 0x68
9: 0x28, 0x9D, 0xC7, 0x49, 0xF6, 0x91, 0x3C, 0xA3
Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

+171
View File
@@ -0,0 +1,171 @@
#define MY_DEBUG
// Enable and select radio type attached
#define MY_RADIO_RF24
// #define MY_RF24_PA_LEVEL RF24_PA_MIN
// #define MY_RF24_PA_LEVEL RF24_PA_LOW
#define MY_RF24_PA_LEVEL RF24_PA_HIGH
//#define MY_RF24_PA_LEVEL RF24_PA_MAX
#define MY_RF24_CHANNEL 14
// INFO coincell optimization
// https://www.openhardware.io/view/398/NModule-Temperature-Humidity-Light-Door-sensor-shield#tabs-source
#define MY_TRANSPORT_UPLINK_CHECK_DISABLED
// Timeout for transport to be ready during initialization, after this duration, even if it didn't manage to enable transport the node will enter the loop() method
// For battery powered nodes, I set this to 5000 so after 5 seconds it will stop eating the battery
// 5s is long enough to connect to gateway so you should connect your node back to your computer and check the log if your node cannot connect
#define MY_TRANSPORT_WAIT_READY_MS 5000 // no more than 5 seconds of waiting for transport to be ready
// Reduce maximum delay before going to sleep, as we do not want to kill the battery if gateway is not available
// Before going to sleep MySensors will make sure we don't have a connection problem to MySensors network
// If this value is too high and you have connection problem, MySensors will never go to sleep and bye bye battery ...
// If using AA/AAA batteries you can set a longer duration like 5000ms
#define MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS 2000
// #define MY_SIGNING_SIMPLE_PASSWD "C@KptBi1L@5op?8!"
// #define MY_SECURITY_SIMPLE_PASSWD "C@KptBi1L@5op?8!"
#include <SPI.h>
#include <MySensors.h>
// https://lastminuteengineers.com/multiple-ds18b20-arduino-tutorial/
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into port 3 on the Arduino
#define ONE_WIRE_BUS 3
#define MAX_ATTACHED_DS18B20 16
#define COMPARE_TEMP false
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
static const uint64_t UPDATE_INTERVAL = 600000; // (5min * 60 seconds * 1000 milliseconds)
// Addresses of 3 DS18B20s
// uint8_t sensor1[8] = { 0x28, 0xEA, 0x4F, 0x96, 0xF0, 0x01, 0x3C, 0xC2 };
// uint8_t sensor2[8] = { 0x28, 0xDE, 0x8D, 0x96, 0xF0, 0x01, 0x3C, 0x52 };;
// #define CHILD_ID_TEMP1 1
// #define CHILD_ID_TEMP2 2
// float DTemp1;
// float DTemp2;
// float old_DTemp1;
// float old_DTemp2;
// Initialize temperature message
// MyMessage msgTemp1(CHILD_ID_TEMP1, V_TEMP);
// MyMessage msgTemp2(CHILD_ID_TEMP2, V_TEMP);
MyMessage msg(0,V_TEMP);
bool metric = true;
float lastTemperature[MAX_ATTACHED_DS18B20];
int numSensors=0;
bool receivedConfig = false;
void presentation()
{
#ifdef MY_DEBUG
Serial.println("- - - - - presentation - - - - -");
#endif
// Send the sketch version information to the gateway
sendSketchInfo("Congelos DS18B20x2", "0.1");
// Register all sensors to gw (they will be created as child devices)
// present(CHILD_ID_TEMP1, S_TEMP, "Temperature Cumulus 1");
// present(CHILD_ID_TEMP2, S_TEMP, "Temperature Cumulus 2");
// Fetch the number of attached temperature sensors
numSensors = sensors.getDeviceCount();
// Present all sensors to controller
for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
present(i, S_TEMP);
}
metric = getControllerConfig().isMetric;
}
void before()
{
// Startup up the OneWire library
sensors.begin();
}
void setup(void)
{
// sensors.begin();
// requestTemperatures() will not block current thread
sensors.setWaitForConversion(false);
}
void loop(void)
{
sensors.requestTemperatures();
// query conversion time and sleep until conversion completed
int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution());
// sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
sleep(conversionTime);
// Read temperatures and send them to controller
for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
// Fetch and round temperature to one decimal
float temperature = static_cast<float>(static_cast<int>((getControllerConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
#ifdef MY_DEBUG
Serial.print("temperature ");
Serial.println(i);
Serial.println(temperature);
#endif
// Only send data if temperature has changed and no error
#if COMPARE_TEMP == 1
if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) {
#else
if (temperature != -127.00 && temperature != 85.00) {
#endif
// Send in the new temperature
send(msg.setSensor(i).set(temperature,1));
// Save new temperatures for next compare
lastTemperature[i]=temperature;
}
}
// old_DTemp1 = DTemp1;
// DTemp1 = sensors.getTempC(sensor1);
// #ifdef MY_DEBUG
// Serial.print(F("Sensor 1: "));
// Serial.print(DTemp1);
// Serial.println(F("C"));
// #endif
// if (DTemp1 != old_DTemp1)
// {
// send(msgTemp1.set(DTemp1, 1));
// old_DTemp1 = DTemp1;
// }
// sleep(2000);
// old_DTemp2 = DTemp2;
// DTemp2 = sensors.getTempC(sensor2);
// #ifdef MY_DEBUG
// Serial.print(F("Sensor 2: "));
// Serial.print(DTemp2);
// Serial.println(F("C"));
// #endif
// if (DTemp2 != old_DTemp2)
// {
// send(msgTemp2.set(DTemp2, 1));
// old_DTemp2 = DTemp2;
// }
// Sleep for a while to save energy
sleep(UPDATE_INTERVAL);
}