Gate controller with Battery Checker
-
final bug
when i try to compile the following code
i Get this error
exit status 1
call of overloaded 'set(double&)' is ambiguous googling tells me that my msg need to be defined better for the purpose but im not sure, as i can see in my void that i have declared it as double, but for some reason it doesnt understant that when i go to send my messagevoid batM() { int Pin; // 0-1023 I/P double Vin; Pin = analogRead(A0); // Probe Input Vin = Pin * (5.0*11 / 1023); // Pin to Vin (Reduction Factor 11) Serial.print(Vin); Serial.println(" VOLT DC ");\ send(power.set(Vin)); } -
final bug
when i try to compile the following code
i Get this error
exit status 1
call of overloaded 'set(double&)' is ambiguous googling tells me that my msg need to be defined better for the purpose but im not sure, as i can see in my void that i have declared it as double, but for some reason it doesnt understant that when i go to send my messagevoid batM() { int Pin; // 0-1023 I/P double Vin; Pin = analogRead(A0); // Probe Input Vin = Pin * (5.0*11 / 1023); // Pin to Vin (Reduction Factor 11) Serial.print(Vin); Serial.println(" VOLT DC ");\ send(power.set(Vin)); } -
@mfalkvidd cheers
ive added that instead but still get the following
call of overloaded 'set(float&)' is ambiguous
-
@mfalkvidd cheers
ive added that instead but still get the following
call of overloaded 'set(float&)' is ambiguous
-
now compiles beautifully...
but am getting weird voltage readings... ive just connected a double set of AA batteires and am getting a reading of 11.8-11.9
im using a 100k and a 10k resistor as per this guide.... obviously i stuffed up something in my math....
this always seems to be my way :)
source for voltage reader code
https://www.codrey.com/arduino-projects/nano-digital-volt-meter/ -
@markjgabb sorry. I forgot we need to set the number of decimals. Like this:
send(power.set(Vin, 2));I think you can change it back to double if you like.
@mfalkvidd you are correct you can do double and it works
-
Is anyone able to confirm if the calculations in this image are correct? I would need to multiply the result by 6 to get accurate numbers
I'm just currently stuggling with acuracy on my current design and figure bringing the max reading down would help
It's a 24v battery with solar cut off of 28.4v so it will never go over 30 anyway
-
Is anyone able to confirm if the calculations in this image are correct? I would need to multiply the result by 6 to get accurate numbers
I'm just currently stuggling with acuracy on my current design and figure bringing the max reading down would help
It's a 24v battery with solar cut off of 28.4v so it will never go over 30 anyway
@markjgabb yes it is correct.
What Arduino are you using? Most Arduinos return 1023 for max voltage, but some (Zero, Due and more) return 4095 for max voltage.
Is the Arduino 5V or 3.3V?
Are you using 100k+10k or 50k+10k resistor? (One early post says 100k, your latest post says 50k.)Edit: Zero, Due default to 1023 so they should be fine anyway. Reference: https://www.arduino.cc/reference/en/language/functions/zero-due-mkr-family/analogreadresolution/