Reporting Battery Level
-
How to add to sketch this feature? I use Domoticz controller and serial gateway. Nodes is Arduino mini pro 3,3V with batteries. Today i use door open/close sensor, elecricity meter, moisture sensor.
-
* 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. * ******************************* * * DESCRIPTION * * Simple binary switch example * Connect button or door/window reed switch between * digitial I/O pin 3 (BUTTON_PIN below) and GND. * http://www.mysensors.org/build/binary */ #include <MySensor.h> #include <SPI.h> #include <Bounce2.h> #include <Vcc.h> #define CHILD_ID 3 #define BUTTON_PIN 3 // Arduino Digital I/O pin for button/reed switch MySensor gw; Bounce debouncer = Bounce(); int oldValue=-1; // Change to V_LIGHT if you use S_LIGHT in presentation below MyMessage msg(CHILD_ID,V_TRIPPED); //battery voltage const float VccExpected = 3.0; const float VccCorrection = 2.860/2.92; // Measured Vcc by multimeter divided by reported Vcc Vcc vcc(VccCorrection); static int oldBatteryPcnt = 0; void setup() { gw.begin(); // Setup the button pinMode(BUTTON_PIN,INPUT); // Activate internal pull-up digitalWrite(BUTTON_PIN,HIGH); // After setting up the button, setup debouncer debouncer.attach(BUTTON_PIN); debouncer.interval(5); // Register binary input sensor to gw (they will be created as child devices) // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. // If S_LIGHT is used, remember to update variable type you send in. See "msg" above. gw.present(CHILD_ID, S_DOOR); } // Check if digital input has changed and send in new value void loop() { debouncer.update(); // Get the update value int value = debouncer.read(); if (value != oldValue) { // Send in the new value gw.send(msg.set(value==HIGH ? 1 : 0)); oldValue = value; } { int batteryPcnt = (int)vcc.Read_Perc(VccExpected); if (oldBatteryPcnt != batteryPcnt) { gw.sendBatteryLevel(batteryPcnt); oldBatteryPcnt = batteryPcnt; } } }''' -
https://codebender.cc/sketch:337094 This is modified electricity meter sketch with battery level .
-
https://codebender.cc/sketch:337094 This is modified electricity meter sketch with battery level .
-
I bought 2AA batteries. Working.Domoticz devices page report battery level 3. How to see battery level graph ?
@Fat-Fly to report battery voltage you have to create a S_MULTIMETER sensor and send the voltage with V_VOLTAGE.
Sendbatterylevel only changes the battery level in Domoticz in % and can not be shown separate.
Tot use your arduino with low voltages you need to change the fuse settings (BOD) with an ISP programmer.
-
@Fat-Fly "Estonia: Between East, West and the World" ;-)
These are the lines of code which should do the trick... you need to put them in the right spot yourself
#define VOLTAGE_CHILD_ID 5 MyMessage voltageMsg(VOLTAGE_CHILD_ID, V_VOLTAGE); // Node voltage gw.present(VOLTAGE_CHILD_ID, S_MULTIMETER, "Battery " ); float voltage = vcc.Read_Volts() ; gw.send(voltageMsg.set(voltage,2)); //send battery in Volt -
@Fat-Fly I am not sure how you intend to arrange your electricity pulse meter reading, but in my case I had to wire Pro Mini 5V to mains or otherwise recharge a battery every 5-7 days. I think you can do the total kWh and putting Pro Mini to sleep, but you cannot have total consumption kWh and current consumption kW with sleeping.
-
Yesterday this not working. KW reader is too away from gateway.My house is lenght is 22m. Electricity meter is one end of house and gateway is center house. can i use repeater on something other. I use for this nrf with antenna.
-
Yesterday this not working. KW reader is too away from gateway.My house is lenght is 22m. Electricity meter is one end of house and gateway is center house. can i use repeater on something other. I use for this nrf with antenna.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login