Generic Battery + Arduino = Happy Solo

Thanks for your research.

From the list of registers i have found there is no information on the 0x2a location. The standard current is 0x0a and is an signed integer (2 bytes).

http://sbs-forum.org/specs/sbdat110.pdf

Since the Solo is using I2C rather than SMBus and the Arduino is using I2C i don't think the issue is there, it may just be my arrangement of the return bytes and the bytes used in the calculation of the PEC. I will do some more work on that. I have found several versions of the protocol and they are all the same but none of them have the master sending a PEC with a read request, maybe that is for a write and read back request?

I am currently in the process of upgrading the solo board to 3.7 dev or Open Solo 4 but ran into some problems with that..... Once i have that done i will see how things go as the new version does a block read for the 4 cell voltages rather than total voltage. This is the main thing to get going as this will allow a standard battery to be used on the Solo and have a RTL option when the voltage drops too low.
 
  • Like
Reactions: jimloss
I think 0x28 and 0x2a are specific implementations by the 3dr battery manufactor, they are not standards:

for me read_block of 0x28 should wait for 8 bytes (4 floats) for 4 cell-voltages in mV.
and read_block of 0x2a should wait 4 bytes for 4 int values in mA.

I will give a try with these two cmds...
 
I don't have everything in front of me at work at the moment but from memory, 0x2a requires 4 bytes to make a 32bit float, i would assume it would be in mA. The cell voltages are in mV and each is an unsigned int, 2 bytes.

I just need to get my solo updated to the later version and i can try the individual voltages. this will make the arduino reading voltages easier as they will come through individually from each cell anyway. Since they are under 5V i can read them directly without a voltage divider etc.
 
Here is the code that i currently have working using a Solo board running 3.7.0-dev. I am using Arduino IDE 1.8.9.

This code generates a voltage, current and capacity which is returned to the Solo as requested. The voltage and current change each second and the remaining capacity is calculated based on the the total voltage 12V = 0% and 16.8V = 100% based on 4 lipo cells from 3V to 4.2 fully charged.

I have tested this by running the Arduino connected to the Arduino's and Solo's SDA & SCL lines while running the Solo board via the USB. I have then used mission planner to view the data and have attached a video of it running.

The next step is to connect an actual 4s Lipo battery to the Arduino's analogue pins and take the reading of each cell (via the balance plug). I will also connect up a current reader to a pin as well then the data transmitted will be real.

If there are any suggestion or other ideas please let me know. Also i am happy to have improvements made to my code.
 

Attachments

  • I2C_Slave_PEC_3_7_dev.zip
    3.2 KB · Views: 29
  • Mission Planner Video.zip
    143.3 KB · Views: 22
HOLY. Freakin. WOW.

This could be the life extender for the Solo that was needed.

Nice work chaps. Nice work.
 
Thanks for that. Now the work begins to try it with a real battery....

Since i will use an Arduino Mini Pro or similar there will be a few digital I/O available so i will look to make an LED indicator showing capacity (like the Solo battery). I can also maybe use a few to allow the serial number to be set by dip switches so you can change it for each battery like Solex uses.
 
  • Like
Reactions: DJMc
I started to setup the analogue measuring of each cell using the balance but ran into an issue. The readings from the balance plug is the difference between each cell so they don't have a common reference. I will need to produce a voltage dividing circuit and then do some math.

Below is the circuit i have tested with my multi meter and it gives the results i expect.

10120

(Arduino analogue inputs converts 0-5V into 0-1023 which I will convert back to 0 to 5000mV).....

Now for the math
Ain 0 is fine as it is referenced to 0V and is Cell 1's reading.
Ain 1 is 1/2 of the total of (cell 1 + cell 2) so math is needed. Cell 2 = (Ain 1 * 2) - Cell 1.
Ain 2 is 1/3 of the total of (cell 1 + cell 2 + cell 3) so again math is needed. Cell 3 = (Ain 2 * 3) - Cell 1 - Cell 2.
Ain 3 is 1/4 of the total of (cell 1 + cell 2 + cell 3 + cell 4) so again math is needed. Cell 4 = (Ain3 * 4) - Cell 1 - Cell 2 - Cell 3.
Also Ain 3 * 4 is the total pack voltage.

I have checked my math in excel and it works as expected and now i just need to write the code and connect it the Arduino and give it a spin....

If there is anything about that i have missed please let me know.

I have also connected up a 8 LED NeoPixel to use as the capacity indicator, it starts off all green and drops LED's as the voltage drops and changes to orange and then red as the voltage reduces further.
 
I have soldered up a test board and constructed a test program.
10121

I only have working 3S, 5S and 6S battery packs so have tested it with 3 cells and it is working. I will make an adapter for my 5S so i can get 4 cells working. I will then combine the test program with my working Solo one and see if i can get the real values through along with the NeoPix indicator.
 
  • Like
Reactions: Wetstone
You could and have the voltage divider return 10/11 of the voltage. 10k and 1k.

If I design a prototype board I can include that.
 
Really interesting, appreciate you sharing your progression with the visual aids. Much more educational for us slower learners...
 
I started to setup the analogue measuring of each cell using the balance but ran into an issue. The readings from the balance plug is the difference between each cell so they don't have a common reference. I will need to produce a voltage dividing circuit and then do some math.

Below is the circuit i have tested with my multi meter and it gives the results i expect.

View attachment 10120

(Arduino analogue inputs converts 0-5V into 0-1023 which I will convert back to 0 to 5000mV).....

Now for the math
Ain 0 is fine as it is referenced to 0V and is Cell 1's reading.
Ain 1 is 1/2 of the total of (cell 1 + cell 2) so math is needed. Cell 2 = (Ain 1 * 2) - Cell 1.
Ain 2 is 1/3 of the total of (cell 1 + cell 2 + cell 3) so again math is needed. Cell 3 = (Ain 2 * 3) - Cell 1 - Cell 2.
Ain 3 is 1/4 of the total of (cell 1 + cell 2 + cell 3 + cell 4) so again math is needed. Cell 4 = (Ain3 * 4) - Cell 1 - Cell 2 - Cell 3.
Also Ain 3 * 4 is the total pack voltage.

I have checked my math in excel and it works as expected and now i just need to write the code and connect it the Arduino and give it a spin....

If there is anything about that i have missed please let me know.

I have also connected up a 8 LED NeoPixel to use as the capacity indicator, it starts off all green and drops LED's as the voltage drops and changes to orange and then red as the voltage reduces further.

Thanks for all the work. This is very helpful.

Subtracting each prior cells voltage works and is accurate, but is there a reason not to measure the voltage of each cell directly? I'm attaching a diagram (not very fancy - sorry) of the internals of a Solo battery pack. The voltage of Cell 1 can be measured across A1N and A1P, Cell 2 across A1P and A2P, Cell 3 across A2P and A3P, and Cell 4 across A3P and P+.
SoloBatteryWiring.png
 
Hi RichWest, glad i can contribute something back to the community and i have got a lot out of it so far.

Hi jimloss. That is what i thought originally but the Arduino needs to measure all cells in reference to 1 common point. I bet you could measure cell 2 by using cell 1 + terminal as the GND reference for cell 2 but when you went to measure cell 3 you would need to set cell 2's + terminal as the GND reference for cell 3. You could have a set of relays or similar that switch the GND reference point as you read each cell. I think there are IC's out there and there is also Op-amps too for dong this but i have a ready supply of resistors. Another issue will come when powering the Arduino from the battery as it will connect to the -ve terminal of the pack which is also Cell 1 -ve terminal so the arduino will then have that as its GND reference for any measurement it makes.
 
  • Like
Reactions: Wetstone
I have designed a simple PCB (using EasyEDA - Online PCB design & circuit simulator) to use standard resistors (from Jaycar) and a JST XH balance plug from RS Components (820-1598 JST XH S5B, 2.5mm Pitch, 5 Way, 1 Row, Right Angle PCB Header). The other 2 plugs are either for a plug or direct soldering of wires to the Arduino (5 pins) and a 5V regulator to power the Arduino and NeoPixel lights from the battery.
10130

The circuit uses the following resistors
2k + 18k for cell 1 (as suggested by looninho)
10k + 10k for cell 1 + cell 2
10k + 20k for cell 1 + cell 2 + cell 3
10k + 30k for cell 1 + cell 2 + cell 3 + cell 4

Attached is the Gerber file. This can be viewer using an online viewer Online Gerber Viewer

I plan to try and make the board using my CNC machine so will see how that goes. Another option is to get them made but could also use SMC to make the board smaller.

I have opened up a dead battery to extract the plug and will fix it along with my board and an Arduino Pro Mini back into the case so it can be inserted and locked in place like a regular solo battery. I will cut away some of the top so a generic 4s battery can be place inside and connected to a XT60 (or similar) plug and the balance plug connected for voltage readings.

I have also ordered a ACS758LCB-050B from eBay to measure the current so will add that in when it arrives. I have also ordered the 100A version as well.

My theory is now starting to turn into a reality. I just need to get a 4 cell battery now for testing.
 

Attachments

  • Voltage PCB.zip
    6.2 KB · Views: 19
Last edited:
Personally, I wouldn't make 12 volts (3.0/cell) be 0%. The battery will be destroyed and copter a smoking hole in the ground before reaching that point. IMO, I would make 0% be no less than 3.3/cell or 13.2 volts, which is truly just before it drops from the sky.
 
I can certainly change the range for the remaining capacity %. I was also thinking about lookup table to generate the capacity remaining as the voltage drop isn't linear. Would you set the solo RTL based on capacity % or just a voltage level, either cell or total?
 
ArduCopter will trigger the low voltage failsafes based on MAH remaining or total voltage or both. If this is not going to provide MAH, then it would have to be based only on total volts (mah parameters set for 0). On the Solo, the defaults are 520mah remaining or 14 volts.
 
Depending on the manufacturer, the point of no return (=permanent loss of capacity) of a lipo cell is between 3.0 and 3.3V/cell.

If you trigger failsafe at 13.2V for the entire pack it’s almost guaranteed that one of the 4 cells will drift and go below critical voltage during RTH. Also 14V for the entire pack is too low. I would bet that this is the main cause for dead Solo batteries.

In my RC models and DIY drones I am using battery monitors to control each individual cell and to trigger action once one of the cells goes below 3.6V under load. That’s giving enough of an emergency reserve to return home or to land at a safe place and to keep your batteries alive for many years.

For Solo you can monitor the individual cell voltage in Solex but not trigger a failsafe action. It would be nice if you could add to your project!
 

New Posts

Members online

No members online now.

Forum statistics

Threads
13,094
Messages
147,748
Members
16,057
Latest member
Motoxxx1986