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 a545dafef3
10 changed files with 5666 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
+38
View File
@@ -0,0 +1,38 @@
# pro-mini--cumulus--ds18b20x10
Capteur MySensors de températures du cumulus (chauffe-eau) : un Arduino Pro Mini et dix sondes DS18B20 sur un bus OneWire. Il envoie les mesures 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 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 ; dix sondes DS18B20 adressées une par une (adresses écrites en dur dans le croquis), présentées comme « Temperature Cumulus 1 » à « 10 ».
- Niveau de batterie (% et tension) envoyé quand il change.
- 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.
- Le croquis s'annonce comme `Cumulus DS18B20x10` version `0.2`.
Compilation : carte `arduino:avr:pro`, `cpu=16MHzatmega328` (Pro Mini 5 V, 16 MHz). 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 des sondes, relevées le 21.05.2023.
## 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--cumulus-DS18B20/` (croquis `pro-mini--cumulus-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

+345
View File
@@ -0,0 +1,345 @@
// #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 };
uint8_t sensor2[8] = { 0x28, 0xDE, 0x8D, 0x96, 0xF0, 0x01, 0x3C, 0x52 };
uint8_t sensor3[8] = { 0x28, 0xCC, 0x0B, 0x81, 0xE3, 0xE1, 0x3C, 0x55 };
uint8_t sensor4[8] = { 0x28, 0x77, 0xCD, 0x96, 0xF0, 0x01, 0x3C, 0x71 };
uint8_t sensor5[8] = { 0x28, 0x6E, 0x54, 0x48, 0xF6, 0xA4, 0x3C, 0x2C };
uint8_t sensor6[8] = { 0x28, 0x57, 0x2C, 0x49, 0xF6, 0x0D, 0x3C, 0xD7 };
uint8_t sensor7[8] = { 0x28, 0x17, 0xA8, 0x96, 0xF0, 0x01, 0x3C, 0x71 };
uint8_t sensor8[8] = { 0x28, 0x72, 0x9C, 0x96, 0xF0, 0x01, 0x3C, 0xC2 };
uint8_t sensor9[8] = { 0x28, 0x9D, 0xC7, 0x49, 0xF6, 0x91, 0x3C, 0xA3 };
uint8_t sensor10[8] = { 0x28, 0x70, 0xCB, 0x96, 0xF0, 0x01, 0x3C, 0x68 };
static const uint64_t UPDATE_INTERVAL = 600000; // (5min * 60 seconds * 1000 milliseconds)
#define CHILD_ID_TEMP1 1
#define CHILD_ID_TEMP2 2
#define CHILD_ID_TEMP3 3
#define CHILD_ID_TEMP4 4
#define CHILD_ID_TEMP5 5
#define CHILD_ID_TEMP6 6
#define CHILD_ID_TEMP7 7
#define CHILD_ID_TEMP8 8
#define CHILD_ID_TEMP9 9
#define CHILD_ID_TEMP10 10
#define CHILD_ID_BAT 11
#define CHILD_ID_BATV 12
bool metric = true;
float DTemp1;
float DTemp2;
float DTemp3;
float DTemp4;
float DTemp5;
float DTemp6;
float DTemp7;
float DTemp8;
float DTemp9;
float DTemp10;
float old_DTemp1;
float old_DTemp2;
float old_DTemp3;
float old_DTemp4;
float old_DTemp5;
float old_DTemp6;
float old_DTemp7;
float old_DTemp8;
float old_DTemp9;
float old_DTemp10;
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 msgTemp2(CHILD_ID_TEMP2, V_TEMP);
MyMessage msgTemp3(CHILD_ID_TEMP3, V_TEMP);
MyMessage msgTemp4(CHILD_ID_TEMP4, V_TEMP);
MyMessage msgTemp5(CHILD_ID_TEMP5, V_TEMP);
MyMessage msgTemp6(CHILD_ID_TEMP6, V_TEMP);
MyMessage msgTemp7(CHILD_ID_TEMP7, V_TEMP);
MyMessage msgTemp8(CHILD_ID_TEMP8, V_TEMP);
MyMessage msgTemp9(CHILD_ID_TEMP9, V_TEMP);
MyMessage msgTemp10(CHILD_ID_TEMP10, 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("Cumulus DS18B20x10", "0.2");
sleepForCoinCell();
// Register all sensors to gw (they will be created as child devices)
present(CHILD_ID_TEMP1, S_TEMP, "Temperature Cumulus 1");
sleepForCoinCell();
present(CHILD_ID_TEMP2, S_TEMP, "Temperature Cumulus 2");
sleepForCoinCell();
present(CHILD_ID_TEMP3, S_TEMP, "Temperature Cumulus 3");
sleepForCoinCell();
present(CHILD_ID_TEMP4, S_TEMP, "Temperature Cumulus 4");
sleepForCoinCell();
present(CHILD_ID_TEMP5, S_TEMP, "Temperature Cumulus 5");
sleepForCoinCell();
present(CHILD_ID_TEMP6, S_TEMP, "Temperature Cumulus 6");
sleepForCoinCell();
present(CHILD_ID_TEMP7, S_TEMP, "Temperature Cumulus 7");
sleepForCoinCell();
present(CHILD_ID_TEMP8, S_TEMP, "Temperature Cumulus 8");
sleepForCoinCell();
present(CHILD_ID_TEMP9, S_TEMP, "Temperature Cumulus 9");
sleepForCoinCell();
present(CHILD_ID_TEMP10, S_TEMP, "Temperature Cumulus 10");
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)
{
sensors.begin();
}
void loop(void)
{
sensors.requestTemperatures();
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(2000);
old_DTemp3 = DTemp3;
DTemp3 = sensors.getTempC(sensor3);
#ifdef MY_DEBUG
Serial.print(F("Sensor 3: "));
Serial.print(DTemp3);
Serial.println(F("C"));
#endif
if (DTemp3 != old_DTemp3)
{
send(msgTemp3.set(DTemp3, 1));
old_DTemp3 = DTemp3;
}
sleep(2000);
old_DTemp4 = DTemp4;
DTemp4 = sensors.getTempC(sensor4);
#ifdef MY_DEBUG
Serial.print(F("Sensor 4: "));
Serial.print(DTemp4);
Serial.println(F("C"));
#endif
if (DTemp4 != old_DTemp4)
{
send(msgTemp4.set(DTemp4, 1));
old_DTemp4 = DTemp4;
}
sleep(2000);
old_DTemp5 = DTemp5;
DTemp5 = sensors.getTempC(sensor5);
#ifdef MY_DEBUG
Serial.print(F("Sensor 5: "));
Serial.print(DTemp5);
Serial.println(F("C"));
#endif
if (DTemp5 != old_DTemp5)
{
send(msgTemp5.set(DTemp5, 1));
old_DTemp5 = DTemp5;
}
sleep(2000);
old_DTemp6 = DTemp6;
DTemp6 = sensors.getTempC(sensor6);
#ifdef MY_DEBUG
Serial.print(F("Sensor 6: "));
Serial.print(DTemp6);
Serial.println(F("C"));
#endif
if (DTemp6 != old_DTemp6)
{
send(msgTemp6.set(DTemp6, 1));
old_DTemp6 = DTemp6;
}
sleep(2000);
old_DTemp7 = DTemp7;
DTemp7 = sensors.getTempC(sensor7);
#ifdef MY_DEBUG
Serial.print(F("Sensor 7: "));
Serial.print(DTemp7);
Serial.println(F("C"));
#endif
if (DTemp7 != old_DTemp7)
{
send(msgTemp7.set(DTemp7, 1));
old_DTemp7 = DTemp7;
}
sleep(2000);
old_DTemp8 = DTemp8;
DTemp8 = sensors.getTempC(sensor8);
#ifdef MY_DEBUG
Serial.print(F("Sensor 8: "));
Serial.print(DTemp8);
Serial.println(F("C"));
#endif
if (DTemp8 != old_DTemp8)
{
send(msgTemp8.set(DTemp8, 1));
old_DTemp8 = DTemp8;
}
sleep(2000);
old_DTemp9 = DTemp9;
DTemp9 = sensors.getTempC(sensor9);
#ifdef MY_DEBUG
Serial.print(F("Sensor 9: "));
Serial.print(DTemp9);
Serial.println(F("C"));
#endif
if (DTemp9 != old_DTemp9)
{
send(msgTemp9.set(DTemp9, 1));
old_DTemp9 = DTemp9;
}
sleep(2000);
old_DTemp10 = DTemp10;
DTemp10 = sensors.getTempC(sensor10);
#ifdef MY_DEBUG
Serial.print(F("Sensor 10: "));
Serial.print(DTemp10);
Serial.println(F("C"));
#endif
if (DTemp10 != old_DTemp10)
{
send(msgTemp10.set(DTemp10, 1));
old_DTemp10 = DTemp10;
}
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);
}
void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
Serial.print(tempC);
Serial.print((char)176);
Serial.println("C");
// Serial.print(DallasTemperature::toFahrenheit(tempC));
// Serial.print((char)176);
// Serial.println("F");
}