Page 1 of 1

measure 10..15V DC and send it to Domoticz?

Posted: Wednesday 15 February 2017 22:56
by renerene
Is is possible to (build a system that) measure(s) the voltage of a 12V lead cell and make the result visible as a device within domoticz?

Re: measure 10..15V DC and send it to Domoticz?

Posted: Wednesday 15 February 2017 23:26
by SweetPants
Everything is possible if you are not afraid to build some hardware yourself.

Re: measure 10..15V DC and send it to Domoticz?

Posted: Thursday 16 February 2017 22:54
by Domosapiens

Re: measure 10..15V DC and send it to Domoticz?

Posted: Sunday 19 February 2017 9:17
by MattLittle
Yep, real easy.
I have one in my tunnelhouse, you need a voltage divider conntected to A0. I dont remember the values I used for the resistors however you need to convert your MAX anticipated voltage (I used 14.8V I think) to 1.1V. A pot would work well.
Here is some cut/pasted code from my sketch to give you an idea, I got this from the mysensors battery sensor page.
It wont run by itself rather just give you an idea
https://www.mysensors.org/build/battery...
This will send battery voltage as a trackable/graphable value by domoticz

Code: Select all

send(msgBat.set(Vbat, 2))
as well as a value you can read under devices

Code: Select all

sendBatteryLevel(batteryPcnt)
.

Code: Select all

#define VMIN 11                                  //  Vmin (radio Min Volt)=11
#define VMAX 14.5                                  //  Vmax = (2xAA bat)=14.5
int batteryPcnt = 0;                              // Calc value for battery %
int BATTERY_SENSE_PIN = A0;                       // select the input pin for the battery sense point


void setup() {
  analogReference(INTERNAL);
  }


void presentation()  
{   
  // Send the sketch version information to the gateway and Controller
  sendSketchInfo("BATLEVEL", "1.0");
      present(CHILD_ID_BAT, S_MULTIMETER);
  
}


void loop() 
{
 
  int sensorValue = analogRead(BATTERY_SENSE_PIN);
  float Vbat  = sensorValue * 0.0139644;
  int batteryPcnt = static_cast<int>(((Vbat-VMIN)/(VMAX-VMIN))*100.);
  sendBatteryLevel(batteryPcnt);
  send(msgBat.set(Vbat, 2));
  /*Serial.print("VBat");
  Serial.print(Vbat);
  Serial.print("SensorValue");
  Serial.print(sensorValue);*/
  wait(SLEEP_TIME); 
}