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

Moderator: leecollings

Post Reply
renerene
Posts: 350
Joined: Wednesday 03 August 2016 11:36
Target OS: -
Domoticz version:
Contact:

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

Post 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?
SweetPants

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

Post by SweetPants »

Everything is possible if you are not afraid to build some hardware yourself.
User avatar
Domosapiens
Posts: 232
Joined: Wednesday 20 August 2014 12:08
Target OS: Windows
Domoticz version: V3.5981
Location: NL
Contact:

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

Post by Domosapiens »

Win Vista&7; 1#Aeon Z-Stick S2; 1#Aeotec Z-Sick Gen5, 6#Fib.FGBS001; 24#DS18B20; 8#Everspr.AN158-2; 3#Philio PAN04; 1#Philio PAN06, 1#YouLess El; 1#Fib.FGWPE; 1#ZME_RC2; 2#FAK_ZWS230, 2#Quib.ZMNHCDx, 1#Quib.ZMNHDD1, 7#EM6555
MattLittle
Posts: 14
Joined: Wednesday 10 February 2016 22:06
Target OS: Linux
Domoticz version:
Contact:

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

Post 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); 
}
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests