I have code running on my Arduino Uno to get the information from LTC2944 over I2C, but when I port the code to Particle Electron, my readings are 240 (or 1111 0000 in binary).
Do you guys have any idea why I am getting that response?
I have 4.7k I2C pull-ups.
I ran the I2C scanner and I get the response that “I2C device found at address 0x64”, which is good.
I am utilizing the Wire library and the LTC2944 library from here. https://www.analog.com/en/products/ltc2944.html#product-tools
Looking at the application sheet the pull-ups recommended are 2K to 3.3V. You only mentioned 4.7K pull-ups but not what voltage to.
I don’t understand why you need the Wire.setSpeed() and Wire.stretchClock().
If you look in the Particle Community Library you will find a driver for a LTC2943 https://build.particle.io/libs/LTC2943/1.0.0 I imagine the LTC2943 is close to the 2944. This has been written in a different way than I would - C instead of C++? Typically these drivers have an object constructor and (destructor) with an initialiser (.begin) method that stores mode, pin connections and I2C address in private variables.
Serial.println(batteryState.voltage_V)? rather than voltage_measurement?
I tried using 2k to 3.3V just now, without any luck.
I removed those commands. I think I originally used them because I thought they were mandatory (misread the Wire (I2C) in the Particle’s Reference docs).
I am using the LTC2944 library which seems to be pretty close to the LTC2943 library and I think I use it properly because the code works with Arduino.
The result is 0.26V (converted).
Using Arduino I get 24425 (raw reading) and 26.09 V (converted), which is within 0.05V or so of the real value. From what I’ve been seeing there is clearly something wrong with my setup of the Particle.
I also had to copy the read and write commands from LTC2943 to LTC2944 because the original read and write commands from LTC2944 are not compatible with the Particle Electron.
P.S. The reason why I did not use the LTC2943 library is because the conversion factors are different for the two chips.
I don’t see how your original code was storing the result value, but judging by the values you considered valid I’d assume 16bit return values and hence the difference in endianness between Arduino and Particle devices might be part of your previous problem.
I am using LTC2943 IC to measure the battery voltage. I am getting the voltage value but it doesn’t seem to be perfect.
For an example, If my battery voltage is 7.45V then It will show 7.2V. It always shows the voltage lesser than it actually is. Strangely, The difference always remains 0.2V.
I am using Android 7.1 SDK and I have downloaded the ltc2943 driver from official site.
Everything else seems to be all right.
Due to double posting the same question as dedicated thread here
this topic gets closed and the discussion should continue over there.
@Parth9731, double posting is not appreciated as it will just scatter the discussion, tie up resources multiple times and not really bring any extra benefit.