rangement : premier commit de l'appareil

- firmware/firmware.ino, compilé identique à l'original
- boitier : boîtier pour Pro Mini de sluebbert (Thingiverse 4015203, Creative Commons), copie des STL et de la source OpenSCAD
- 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:10:11 +01:00
co-authored by Claude Opus 5.5
commit b5d5b5057a
10 changed files with 5491 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
+45
View File
@@ -0,0 +1,45 @@
# pro-mini--ds18b20
Sonde de température MySensors à une DS18B20 : un ATmega328 en carte de type Pro Mini et une sonde DS18B20 sur un bus OneWire. Elle envoie la température et l'état de la batterie à 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 pour Pro Mini (modèle Thingiverse), STL et source OpenSCAD |
| [`docs/`](docs/) | Adresses de 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, une sonde DS18B20 (« Temperature »).
- Niveau de batterie (% et tension, mesurée par `hwCPUVoltage()`).
- Mesure toutes les 10 min (`UPDATE_INTERVAL = 600000` ; le commentaire du code dit 5 min), 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 `DS18B20x1` version `0.2`.
Compilation : carte MiniCore, ATmega328PB, 8 MHz interne, bootloader série (`uart0`), BOD désactivé :
```
MiniCore:avr:328:bootloader=uart0,eeprom=keep,variant=modelPB,BOD=disabled,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 relevées le 21.05.2023 (même relevé que pour le cumulus).
## Boîtier (`boitier/`)
Boîtier pour Arduino Pro Mini « Arduino Pro Mini Enclosure » de sluebbert sur Thingiverse (<https://www.thingiverse.com/thing:4015203>), sous licence Creative Commons (voir [`LICENSE-thingiverse.txt`](boitier/LICENSE-thingiverse.txt) et [`README-thingiverse.txt`](boitier/README-thingiverse.txt)). Copie des fichiers téléchargés le 21.05.2023 (l'original reste dans `3DPrinting/electronique/pro-mini_enclosure/`) :
- `enclosure.stl` : le corps, 97,3 × 32,1 × 17,1 mm ;
- `enclosureLid.stl` : le couvercle, 97,3 × 32,1 × 6,6 mm ;
- `enclosure.scad` : la source OpenSCAD.
**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 `pro-mini-DS18B20/` (croquis `pro-mini-DS18B20.ino`), qui n'était pas versionné : ce dépôt commence à cette date. Le firmware compilé est identique avant et après le rangement.
+1
View File
@@ -0,0 +1 @@
This thing was created by Thingiverse user sluebbert, and is licensed under cc.
+1
View File
@@ -0,0 +1 @@
Arduino Pro Mini Enclosure by sluebbert on Thingiverse: https://www.thingiverse.com/thing:4015203
+221
View File
@@ -0,0 +1,221 @@
wallThickness = 1.63;
voidSize = [94, 28.8, 15.5];
terminalThickness = 0.45;
terminalNotchThickness = 3.3;
terminalLength = 26.5;
terminalNotchWidth = terminalNotchThickness * .325;
prongDiameter = 7.5;
lidTolerance = 0.01;
batteryDiameter = 14.1;
batteryLength = 50.25;
arduinoSize = [34.3, 18.45, 4.15];
arudinoBoardThickness = 1.64;
arduinoBraceThickness = 1.75;
enclosure();
translate([0, voidSize[1] + 16, 0])
enclosureLid();
module enclosure()
{
endBraceThickness = 3;
centerBraceThickness = 3;
difference()
{
cube(size=[voidSize[0] + wallThickness * 2, voidSize[1] + wallThickness * 2, voidSize[2] + wallThickness]);
translate([wallThickness, wallThickness, wallThickness])
cube(size=[voidSize[0], voidSize[1], voidSize[2] + 0.4]);
}
// Rear Terminal Brace
translate([voidSize[0] + wallThickness - endBraceThickness, wallThickness, wallThickness])
{
difference()
{
// Terminal Brace
cube(size=[endBraceThickness, voidSize[1], 13]);
// Terminal slot
translate([endBraceThickness -terminalThickness, (voidSize[1] - terminalLength) / 2, 0])
{
cube([terminalThickness, terminalLength, voidSize[2] + 2]);
translate([-terminalNotchThickness / 2 + terminalNotchWidth - terminalThickness, 0, 0])
terminalNotch(voidSize[2] + 4);
translate([-terminalNotchThickness / 2 + terminalNotchWidth - terminalThickness, terminalLength - terminalNotchThickness, 0])
terminalNotch(voidSize[2] + 4);
// Prongs
translate([-3.5, 2.5, 2.5])
cube([endBraceThickness + 1, prongDiameter, voidSize[2] + 2]);
translate([-3.5, terminalLength - 2.5 - prongDiameter, 2.5])
cube([endBraceThickness + 1, prongDiameter, voidSize[2] + 2]);
}
}
}
// Battery Brace
translate([voidSize[0] * .7, voidSize[1] + 1.1, 7.5])
batteryBrace();
translate([voidSize[0] * .7, 1.2 + .98, 7.5])
mirror([0, 1, 0])
batteryBrace();
// Center Brace
translate([wallThickness + 36.4, wallThickness, wallThickness])
{
difference()
{
cube([centerBraceThickness, voidSize[1], 13]);
translate([-1, 3.2, 2.5])
cube([centerBraceThickness + 2, 8, 14]);
translate([-1, voidSize[1] - 8 - 3.2, 2.5])
cube([centerBraceThickness + 2, 8, 14]);
translate([(centerBraceThickness - terminalThickness) * 0.65, 0, 0])
cube([terminalThickness, voidSize[1], 14]);
}
translate([0, (voidSize[1] - 0.5) / 2, 0])
cube([centerBraceThickness, 0.5, 13]);
}
// Arduino Brace
translate([wallThickness, wallThickness + (voidSize[1] - (arduinoSize[1] + arduinoBraceThickness * 2)) / 2, wallThickness])
{
backOffset = 8;
difference()
{
lengthMultiplier = 1;
arduinoThreshold = 0;
cube([arduinoSize[0], arduinoSize[1] + arduinoBraceThickness * 2 - arduinoThreshold, arduinoSize[2] + 2]);
translate([0, arduinoBraceThickness - arduinoThreshold / 2, 0])
cube([arduinoSize[0] * lengthMultiplier + 1, arduinoSize[1], arduinoSize[2] + 5]);
translate([0, 0, 0])
cube([backOffset, arduinoSize[1] + arduinoBraceThickness * 2 - arduinoThreshold, 10]);
}
bumpHeight = 3;
bumpWidth = 1.5;
translate([arduinoSize[0] - 2.6, arduinoBraceThickness, 0])
{
translate([0, arduinoSize[1] - bumpWidth, 0])
cube([2.6, bumpWidth, bumpHeight]);
cube([2.6, bumpWidth, bumpHeight]);
}
translate([backOffset, arduinoBraceThickness, 0])
{
translate([0, arduinoSize[1] - bumpWidth, 0])
cube([2.6, bumpWidth, bumpHeight]);
cube([2.6, bumpWidth, bumpHeight]);
}
arudinoBoardThicknessAdjusted = arudinoBoardThickness * 0.85;
// Bridge brace
translate([arduinoSize[0] - arduinoBraceThickness, arduinoBraceThickness, bumpHeight + arudinoBoardThicknessAdjusted])
{
scale([arduinoBraceThickness, arduinoBraceThickness * 0.8, arduinoSize[2] + 2 - (bumpHeight + arudinoBoardThicknessAdjusted)])
difference()
{
cube([1, 1, 1]);
translate([-1 / 2, 1 / 2 + .9, -1 / 2 - .9])
rotate([45, 0, 0])
cube([2, 2, 2]);
}
translate([0, arduinoSize[1] - arduinoBraceThickness * 0.8, 0])
scale([arduinoBraceThickness, arduinoBraceThickness * 0.8, arduinoSize[2] + 2 - (bumpHeight + arudinoBoardThicknessAdjusted)])
difference()
{
cube([1, 1, 1]);
translate([-1 / 2, -1 / 2 + .1, -1 / 2 - .9])
rotate([45, 0, 0])
cube([2, 2, 2]);
}
}
}
}
module enclosureLid()
{
depth = 2.5;
difference()
{
cube([voidSize[0] + wallThickness * 2, voidSize[1] + wallThickness * 2, wallThickness]);
translate([0, ((voidSize[1] + wallThickness * 2) - 6) / 2, wallThickness / 2])
cube([wallThickness, 6, 1.5]);
translate([voidSize[0] + wallThickness, ((voidSize[1] + wallThickness * 2) - 6) / 2, wallThickness / 2])
cube([wallThickness, 6, 1.5]);
}
translate([wallThickness + lidTolerance, wallThickness + lidTolerance, wallThickness])
{
difference()
{
cube([voidSize[0] - lidTolerance * 2, voidSize[1] - lidTolerance * 2, depth]);
translate([wallThickness, wallThickness, 0])
cube([voidSize[0] - lidTolerance * 2 - wallThickness * 2, voidSize[1] - lidTolerance * 2 - wallThickness * 2, depth + 1]);
}
// Tabs
translate([0, 0, depth])
{
cube([wallThickness, wallThickness * 3, depth]);
cube([wallThickness * 3, wallThickness, depth]);
translate([0, voidSize[1] - lidTolerance * 2 - wallThickness, 0])
{
cube([wallThickness * 3, wallThickness, depth]);
translate([0, -wallThickness * 2, 0])
cube([wallThickness, wallThickness * 3, depth]);
}
translate([48 - wallThickness * 3, 0, 0])
{
cube([wallThickness * 3, wallThickness, depth]);
translate([0, voidSize[1] - lidTolerance * 2 - wallThickness, 0])
cube([wallThickness * 3, wallThickness, depth]);
}
translate([90 - wallThickness * 3, 0, 0])
{
cube([wallThickness * 3, wallThickness, depth]);
translate([0, voidSize[1] - lidTolerance * 2 - wallThickness, 0])
cube([wallThickness * 3, wallThickness, depth]);
}
}
}
}
module terminalNotch(height)
{
translate([terminalNotchThickness / 2, terminalNotchThickness / 2, 0])
difference()
{
cylinder(h = height, r = terminalNotchThickness / 2, $fn = 64);
translate([-terminalNotchThickness / 2 + terminalNotchWidth, - terminalNotchThickness, -1])
cube([terminalNotchThickness + 1.04, terminalNotchThickness * 2, height + 2]);
}
}
module battery()
{
translate([0, batteryDiameter / 2, batteryDiameter / 2])
rotate([0, 90, 0])
cylinder(h = batteryLength, r = batteryDiameter / 2, $fn = 128);
}
module batteryBrace()
{
translate([-5, .8 + .45, 0])
difference()
{
rotate([20, 0, 0])
cube([10, 3, 5]);
translate([-1, 0, 0])
cube([12, 10, 10]);
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+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: 95 KiB

+163
View File
@@ -0,0 +1,163 @@
#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
// 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);
// Addresses of 3 DS18B20s
// uint8_t sensor1[8] = { 0x28, 0xEA, 0x4F, 0x96, 0xF0, 0x01, 0x3C, 0xC2 };
static const uint64_t UPDATE_INTERVAL = 600000; // (5min * 60 seconds * 1000 milliseconds)
#define CHILD_ID_TEMP1 1
#define CHILD_ID_BAT 11
#define CHILD_ID_BATV 12
int numSensors=0;
bool metric = true;
float DTemp1;
float old_DTemp1;
int oldBatteryPcnt = 0;
#define FULL_BATTERY 3 // 3V for 2xAA alkaline. Adjust if you use a different battery setup.
MyMessage msgTemp1(CHILD_ID_TEMP1, V_TEMP);
MyMessage msgBat(CHILD_ID_BAT, V_VAR1);
MyMessage msgBatPrefix(CHILD_ID_BAT, V_UNIT_PREFIX); // Custom unit message.
MyMessage msgBatV(CHILD_ID_BATV, V_VAR2);
MyMessage msgBatVPrefix(CHILD_ID_BATV, V_UNIT_PREFIX); // Custom unit message.
// Sleep between sendings to preserve coin cell
void sleepForCoinCell() {
sleep(400);
}
void presentation()
{
#ifdef MY_DEBUG
Serial.println("- - - - - presentation - - - - -");
#endif
// Send the sketch version information to the gateway
sendSketchInfo("DS18B20x1", "0.2");
sleepForCoinCell();
// Fetch the number of attached temperature sensors
numSensors = sensors.getDeviceCount();
#ifdef MY_DEBUG
Serial.print(F("Sensor 1: "));
Serial.print(DTemp1);
Serial.println(F("C"));
#endif
// Register all sensors to gw (they will be created as child devices)
present(CHILD_ID_TEMP1, S_TEMP, "Temperature");
sleepForCoinCell();
present(CHILD_ID_BAT, S_CUSTOM, "Battery Percent");
sleepForCoinCell();
present(CHILD_ID_BATV, S_CUSTOM, "Battery Voltage");
sleepForCoinCell();
metric = getControllerConfig().isMetric;
sleepForCoinCell();
}
void setup(void)
{
#ifdef MY_DEBUG
Serial.println("- - - - - setup - - - - -");
#endif
sensors.begin();
}
void loop(void)
{
#ifdef MY_DEBUG
Serial.println("- - - - - loop - - - - -");
#endif
sensors.requestTemperatures();
old_DTemp1 = DTemp1;
// DTemp1 = sensors.getTempC(sensor1);
DTemp1 = sensors.getTempCByIndex(0);
#ifdef MY_DEBUG
Serial.print(F("Sensor 1: "));
Serial.print(DTemp1);
Serial.println(F("C"));
#endif
if (DTemp1 != old_DTemp1 && DTemp1 != -127)
{
send(msgTemp1.set(DTemp1, 1));
old_DTemp1 = DTemp1;
}
sleep(2000);
// get the battery Voltage
long batteryMillivolts = hwCPUVoltage();
float batteryVolts = batteryMillivolts / 1000.0;
int batteryPcnt = batteryMillivolts / FULL_BATTERY / 1000.0 * 100 + 0.5;
#ifdef MY_DEBUG
Serial.print("Battery voltage: ");
Serial.print(batteryVolts);
Serial.println("V");
Serial.print("Battery percent: ");
Serial.print(batteryPcnt);
Serial.println(" %");
#endif
if (oldBatteryPcnt != batteryPcnt) {
sendBatteryLevel(batteryPcnt);
oldBatteryPcnt = batteryPcnt;
send(msgBatPrefix.set("%")); // Set custom unit.
send(msgBat.set(batteryPcnt, 1));
send(msgBatVPrefix.set("V")); // Set custom unit.
send(msgBatV.set(batteryVolts, 1));
}
// Sleep for a while to save energy
sleep(UPDATE_INTERVAL);
}