Notifications
Clear all

Voltage Readings

12 Posts
3 Users
5 Likes
1,142 Views
(@jimterry2000)
Member
Joined: 2 years ago
Posts: 10
Topic starter  

Hello there i have been messing around with an ESP32 trying to read two separate car battery voltage readings using two external ADC  ADS1115 to help . Our Voltage range is 0-32 volts.

We are trying to achieve a very accurate reading on both can you help , as we are getting one accurate reading but not so good on the other. 


   
Quote
Inst-Tech
(@inst-tech)
Member
Joined: 2 years ago
Posts: 554
 

(@jimterry2000), Hi, if you could be a little more specific on exactly what problems you are experiencing would help..A connection drawing , schematic , a photo of how you are connecting the ADS1115 to the ESP32 would be a great help.  Also include the code you are using to read the ADS1115 on your ESP32.

Good luck with your project,

regards,

LouisR

LouisR


   
Inq reacted
ReplyQuote
(@jimterry2000)
Member
Joined: 2 years ago
Posts: 10
Topic starter  

Thanks Louise i am very very new to this , so please can you give me a bit of time to get the info you need ready. 

 

Jim


   
Inst-Tech reacted
ReplyQuote
Inq
 Inq
(@inq)
Member
Joined: 2 years ago
Posts: 1900
 

I completely agree with @inst-tech.  There could be a hundred things wrong... hardware, wiring, using wrong pins, software program.  Without the details of what you have done, we'd be shooting in the dark. 

It seemed kind of strange to me why the range is 0-32V.  A lead-acid car battery even being charged only goes up to 14.5V.  You could set the range 0 to 16V and double your voltage resolution.

I read the details on the ADS1115.  It sounds like an impressive (if a little pricy) ADC.   I see it uses I2C (IIC) for communicating...

  1. Are you familiar with using I2C?
  2. It allows for multiple boards being used. 
  3. You can have both ADS1115's on the same two logic wires, but you must change the address on one of them.  Did you do that?
  4. image
  5. OR... You can have ADS115's on two separate I2C busses by using another pair of logic wires.
  6. image
  7. We'd need to see the software, and the wiring diagram (or photo)
  8. You can also run a I2C scanner sketch on the ESP32 and it will spit out what it detects your wiring is.
  9. https://github.com/jainrk/i2c_port_address_scanner/blob/master/i2c_port_address_scanner/i2c_port_address_scanner.ino

 

That's all I got with the limited information supplied.

 

"https://www.amazon.com/ADS1115-16-Bit-ADC-Programmable-Amplifier/dp/B00QIW4MGW/"

https://www.amazon.com/ADS1115-16-Bit-ADC-Programmable-Amplifier/dp/B00QIW4MGW/

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
Inst-Tech reacted
ReplyQuote
Inq
 Inq
(@inq)
Member
Joined: 2 years ago
Posts: 1900
 
Posted by: @jimterry2000

Thanks Louise i am very very new to this , so please can you give me a bit of time to get the info you need ready. 

 

Jim

Ships passing in the night - Missed your reply while I was writing my previous one.

Anyway...

I also see that one ADS1115 board can take 4 readings.  Since you only mention two batteries, I'm wondering why you have two boards... are you planning to take readings on 8 batteries eventually?

Good luck.

VBR,

Inq

 

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
Inst-Tech reacted
ReplyQuote
(@jimterry2000)
Member
Joined: 2 years ago
Posts: 10
Topic starter  

@inq Hello thanks for your reply

The reason our range is 0-32v is we are trying to use it on 24volt systems as well as 12v.

 

Yes we are using the same logic wires there is two resisters for voltage dividing 

Also this code is from a library of wolfgang a german guy.

 

Here is our coding 

 

ADS1115_WE adc_1 = ADS1115_WE(I2C_ADDRESS_1);

ADS1115_WE adc_2 = ADS1115_WE(I2C_ADDRESS_2);

 

void setup() {

  Wire.begin();

  Serial.begin(115200);

 

  if(!adc_1.init()){

    Serial.print("ADS1115 No 1 not connected!");

  }

  adc_1.setVoltageRange_mV(ADS1115_RANGE_6144);

  adc_1.setMeasureMode(ADS1115_CONTINUOUS);

  adc_1.setCompareChannels(ADS1115_COMP_0_GND);

 

  if(!adc_2.init()){

    Serial.print("ADS1115 No 2 not connected!");

  }

  adc_2.setVoltageRange_mV(ADS1115_RANGE_6144);

  adc_2.setMeasureMode(ADS1115_CONTINUOUS);

  adc_2.setCompareChannels(ADS1115_COMP_0_GND);

}

 

void loop() {

  float voltage = 0.0;

 

  voltage = adc_1.getResult_V();

  Serial.println("Voltage ,Main Battery 1: ");

  Serial.println(voltage);

 

  voltage = adc_2.getResult_V();

  Serial.println("Voltage ,Aux Battery 2: ");

  Serial.println(voltage);

 

  Serial.println("--------------------------- "); 

  delay(2000);

}


   
ReplyQuote
(@jimterry2000)
Member
Joined: 2 years ago
Posts: 10
Topic starter  

@inq I did not know know how to use only one ADS1115 .


   
ReplyQuote
(@jimterry2000)
Member
Joined: 2 years ago
Posts: 10
Topic starter  

Would it possible for you guys to help with a script so i can only use 1 ADS1115 in this project

Thanks


   
ReplyQuote
Inq
 Inq
(@inq)
Member
Joined: 2 years ago
Posts: 1900
 
Posted by: @jimterry2000

The reason our range is 0-32v is we are trying to use it on 24volt systems as well as 12v.

Interesting... I've always wondered how to do that.  I have a small boat, it only has a 12V system, but I see a lot of advantages/writings to running a higher 24V/48V system, and I always wondered how to handle a dual voltage wiring efficiently.

Posted by: @jimterry2000

Also this code is from a library of wolfgang a german guy.

I'm guessing this one: https://www.arduino.cc/reference/en/libraries/ads1115_we/ .  Have you gone through any of the examples in it? 

image

He also has a nice reference page:  https://wolles-elektronikkiste.de/en/ads1115-a-d-converter-with-amplifier

I've re-worked his picture off that page to do two batteries off one ADS1115.  BUT - I'm not a hardware guy.  Better let someone else check my work!!!! 🤣  Especially since I don't know the voltage tolerance of the board (I didn't see it for some reason) AND you wanted to measure each battery and the combined.  I'm sure there is some wiring that will achieve that with one, but it's above my pay-grade.

 

EDIT - Removed image as it was WRONG and don't want to FUBAR someone!

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
ReplyQuote
(@jimterry2000)
Member
Joined: 2 years ago
Posts: 10
Topic starter  

No problem thanks for your answer

we think we have a problem with our voltage dividing as when we take a voltage reading without the divider its very accurate .

 

Will send more info tomorrow if you can help 

 

Thanks all


   
ReplyQuote
Inq
 Inq
(@inq)
Member
Joined: 2 years ago
Posts: 1900
 

If you understand voltage

Posted by: @jimterry2000

we think we have a problem with our voltage dividing as when we take a voltage reading without the divider its very accurate .

If you understand voltage dividers and you have one working correctly, I don't see the issue... just repeat what you have with the other battery.  Otherwise, we can't go any further without a wiring diagram.

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
Inst-Tech reacted
ReplyQuote
(@jimterry2000)
Member
Joined: 2 years ago
Posts: 10
Topic starter  

Hello everyone , 

i have now managed to get a very accurate reading on both batteries which is great.

But my next problem is how do i send my battery voltages to a website that can display through an App  where we can have multiple users sending their own readings . what is the cheapest way of doing it.

 


   
ReplyQuote