diy solar

diy solar

Laying out and ordering PCBs

It's very tempting but I checked and one network (I would need 2 + still need some of the single 100 k resistors for other things on the board) cost more than what all the 100 k (29x) cost on that board. Of course they are 0.05 % while those networks are twice better, but they would triple the total cost for the 100 k resistors.

My goal was single digit accuracy for cell voltages and I'm already here, even in the worst of worst cases. But I'll keep that ref on a corner of my notes as I'm sure it will be useful for a future version (maybe for the 8s one?), thanks a lot ;)
Makes sense. Are you going to sell yours on Tindie or something?
 
I have no idea yet on how I'll sell them, well I have a few ideas but I need to gather more infos about that before selling ;)
 
I already have a -12 V but that's too low and as I'm using an op-amp for 8 cells leaving some margin on the op-amps supplies would mean 2 additional DC/DC converters (they take space and aren't cheap) for 16s as I already power them from 9 cells so I'm not near the rail on one side at least. But the main problem would be the total supply voltage: it's fine for LFP and LTO but with NMC I'm already at the 36 V limit of the op-amp.

But the OPAx991 are fine right to the rail anyway so it's not an issue in the end.
 
I already have a -12 V but that's too low and as I'm using an op-amp for 8 cells leaving some margin on the op-amps supplies would mean 2 additional DC/DC converters (they take space and aren't cheap)...
The negative converters above make -3V from the +5V and cost only 1.5$.
That is perfect to feed op amps, so that they process shunt voltages accurately around the Gnd potential.

On the other side, specialized chips like the INA226 work with capacitive charge transfers and can process accurately a sub mV resolution between -0.6V and +36V, largely off-rails.
Their "current" measuring feature can also be used to measure voltages, if you replace the shunt by a voltage divider.
I am using them to measure the 0..1V analog output from sound level meters that is almost always provided with a biased Gnd.
 
Last edited:
On the other side, specialized chips like the INA226 work with capacitive charge transfers and can process accurately a sub mV resolution between -0.6V and +36V, largely off-rails.
It's worth noting that folded-cascode input pairs can also sense roughly 600mV below ground, so you don't necessarily need a negative supply rail if you pick your op-amp correctly. Simplified example is below. Also, if you have resistors in front of the op-amp input (like we do for all these cell-sensing circuits we're discussing in this thread), then the op-amp doesn't see as big of a voltage swing at its input nodes, and you often don't need rail-to-rail input swing capabilities.

1619113658008.png
 
I have close to 50 years experience in electronics, 40 years owning my own company designing and servicing electronic equipment.

I can say even for me that designing and building my own BMS would be a huge undertaking. Even though I could do it, the cost and frustration level would not be worth the reward of "I did it myself because I can!". I'm new here I see there is an open-source project available above and myself I would go in that direction.

That said, when I design a new project, I start with a list of functions it needs to do. Then under each function I list the information and inputs/outputs I need to access to preform that function.

After I have a layout of all the steps, then on paper I sketch out a block diagram of the circuit. From there I start with the schematic... I used Eagle PCB because that is what I have used for 20+ years. Its not as fancy as some but I have not updated it in a few years, but it does autorouting of the PCB and I like that.

Once I have the schematic done and I've gone over all the processes in my mind, I layout the board and send it off to a PCB supplier for prototype service. Warning, you will find issues and will go through this process a few times. Be prepaired to spend a few hundred dollars on boards with errors. Now if I am making something simple and one-off for myself, I lay it out on a breadboard and get the circuit working. Then move the circuit onto a breadboard PCB.
Checkout oshpark.com if u havent already.. I use Eagle 9.6.2 too.. upload the .brd and in seconds u can see what it will be..sweet..KC7ON over under and out..
 
Another interesting approach, since you are always measuring something with a large, fixed polarity (2.5V - 3.65V) would be to "subtract out" a reference voltage, allowing you to gain up the remaining difference and get higher signal before you saturate your ADC. Basically it would allow you to use your ADC's input range more fully by "zooming in" on the voltage range of interest, not wasting range on the first ~2.5V which is always present in LiFePO4 batteries.

There are quite a few non conventional approaches that offer some intriguing possibilities here.

My preferred method is to use a voltage to frequency converter for measuring cell voltages.

Then just make a completely digital frequency measurement.
If you require a completely floating voltmeter for cell voltage measurement, data transfer requires only one opto isolator for the frequency.

I have thirty cells and over a hundred volts across the battery stack, so any kind of off the shelf multiplexer chip is not an option. But that may not be a problem you have... But this voltage to frequency system offers a lot of other advantages as well.

If the VCO frequency is kept fairly high, and the frequency measurement sampling period suitably long, you can get very high resolution, as many bits as you want.
Any noise on the cell voltage created by inverter ripple current, just creates frequency modulation. That all averages out over the frequency measurement period.
By allowing the frequency counter to overflow, or just ignoring the most significant bit or bits, you can subtract out a major portion of the measurement scale such as half or three quarters. Or if you play with the numbers, any other proportion as suggested in the above quotation^.

If the frequency measurement period is very closely tied to the 100/120Hz inverter ripple frequency, so it closely matches a whole integer number of half inverter cycles, inverter noise rejection will be even better. It does not need to be phase or frequency locked, just fairly close, easily achievable with a quartz crystal reference.

Absolute accuracy is not really required, if 3.45 volts is actually out by several millivolts its not a big deal. But cell to cell voltage differences need to have suitably high resolution, and be very repeatable and noise free.

Slow temperature drift is not going to be a problem, but wide band system noise certainly will be. Slowing down measurements with restricted bandwidth does not work.

If it takes 30 seconds between readings to reach 1mV final settling accuracy, its all going to be far too slow to measure really small cell voltage differences with a large number of cells. If it all responds fairly fast, its going to be noisy where there may be several different high power solar controller pwm systems hanging off the battery as well as the inverter.

You need to be a bit sneaky how you get around the noise problem. The voltage to frequency method has turned out vastly better than any other system so far. I have tried quite a few different approaches to this over the years.
Its possible to very easily get 1mV or 2mV per bit completely noise free without any subsequent averaging in software, scanning at one cell per second rate.
 
Last edited:
Interesting approach ? I have a few questions:

- what's the typical linearity of the proposed V/F converter?
- what's the cost per cell roughly?
- why not use a ADC per cell and have them communicate on a data bus?

If the frequency measurement period is very closely tied to the 100/120Hz inverter ripple frequency, so it closely matches a whole integer number of half inverter cycles, inverter noise rejection will be even better. It does not need to be phase or frequency locked, just fairly close, easily achievable with a quartz crystal reference.

That's actually a very bad idea as you'll alias like crazy as you would pretty much land all the time on the same part of the ripple.
 
Last edited:
I used a cheap AD654.
https://www.analog.com/media/en/technical-documentation/data-sheets/AD654.pdf

Linearity specified as typically 0.05% (page six)
Not sure how to answer the cost per cell question.
One ADC per cell is the very worst approach.

What we need is the ability to measure very small cell to cell voltage differences with high resolution and excellent repeatability in the presence of a lot of noise.
Best way to do that is to use THE SAME voltmeter to measure all cells.
If every cell has a completely independent voltmeter it requires incredibly high absolute accuracy of every voltmeter.
A very difficult and expensive exercise to do sufficiently well where there are a large number of cells.

Using the same voltmeter and switching every cell onto a common measurement bus with optically isolated mos switches such as LAA127 solves a lot of problems, especially where there are a large number of cells and the dc battery voltage is high.
https://www.ixysic.com/home/pdfs.nsf/www/LAA127.pdf/$file/LAA127.pdf

Main limitation of the whole scheme is slow temperature drift which only effects absolute overall accuracy, not cell to cell accuracy. Temperature drift just about all comes from the capacitor associated with the oscillator. Easy to test with a hot air gun and freeze spray. Best capacitors to use are either 1% polystyrene, or military spec silver mica. With a bit of testing and experimentation its possible to get excellent temperature stability.
 
Last edited:
That's actually a very bad idea as you'll alias like crazy as you would pretty much land all the time on the same part of the ripple.
No its the other way around.

Frequency measurement is not a snapshot, there can be no aliasing.
We are measuring "cycles per second" in other words count the incoming cycles over a defined measurement period.

If the frequency is going up and down over the measurement period, you end up measuring the averaged frequency over the measurement period.
It averages out any frequency modulation.

If the measurement period exactly coincides with the inverter ripple frequency, it does not matter where it starts in the cycle, it always starts and ends in the exact same spot on the ripple waveform, thus perfectly averaging over an exact ripple cycle. It does work wonderfully well.

A similar effect can be had with a dual slope integrating analog to digital converter. No aliasing effects there either.

Aliasing only occurs when you take a very short sample of a varying waveform, such as many different types of fast a/d converters usually do.
 
I used a cheap AD654.
https://www.analog.com/media/en/technical-documentation/data-sheets/AD654.pdf

Linearity specified as typically 0.05% (page six)
Not sure how to answer the cost per cell question.

Cheap?!! it costs around 13 USD in /10 quantities so just for a 16s battery that would be more than 200 USD, and that's only for the V/F chips... That must be the most expensive solution I've seen to do cell voltage measurement.


One ADC per cell is the very worst approach.

What we need is the ability to measure very small cell to cell voltage differences with high resolution and excellent repeatability in the presence of a lot of noise.
Best way to do that is to use THE SAME voltmeter to measure all cells.
If every cell has a completely independent voltmeter it requires incredibly high absolute accuracy of every voltmeter.
A very difficult and expensive exercise to do sufficiently well where there are a large number of cells.

What's the requirements you're using? because we don't need more than a few mV accuracy at most.

There's also the solution of using a standard mux plus one ADC per group of 4 or 8 cells. Then you can easily have isolated com with the ADCs and muxes. That's probably the most sensible solution regarding the accuracy, complexity and cost (all that is actually why I chose a very similar solution to this one).


No its the other way around.

Frequency measurement is not a snapshot, there can be no aliasing.
We are measuring "cycles per second" in other words count the incoming cycles over a defined measurement period.

If the frequency is going up and down over the measurement period, you end up measuring the averaged frequency over the measurement period.
It averages out any frequency modulation.

If the measurement period exactly coincides with the inverter ripple frequency, it does not matter where it starts in the cycle, it always starts and ends in the exact same spot on the ripple waveform, thus perfectly averaging over an exact ripple cycle. It does work wonderfully well.

A similar effect can be had with a dual slope integrating analog to digital converter. No aliasing effects there either.

Aliasing only occurs when you take a very short sample of a varying waveform, such as many different types of fast a/d converters usually do.

Oh ok, I thought you were doing discrete sampling, not continuous sampling. But how do you do continuous sampling with multiple cells and only one frequency counting input?
 
Cheap?!! it costs around 13 USD in /10 quantities so just for a 16s battery that would be more than 200 USD, and that's only for the V/F chips... That must be the most expensive solution I've seen to do cell voltage measurement.
Its not too bad, you only require one voltage to frequency converter for any number of cells.
The cell selection can be either by the usual analog multiplexer chip for batteries up to 45v, or as I do it with optically isolated solid state switches for much higher voltage operation, possibly up to around a 200v battery with the switches I am using.

A few millivolts accuracy ? Lets say +/- 5mV reading accuracy between cells which is barely adequate in my opinion.
That requires individual cell voltage measurement accuracy within 2.5mV for every cell.

So the accuracy of the voltage reference required to do that would be 2.5mV/3.6v (full scale) or 0.07%
Two identical cells could show up to 5mV difference either way which is not a good result even with an 0.07% voltage reference.

But if you use the exact same voltmeter and cycle through and measure every cell in sequence, there should not be any difference between the readings if all the cells were in fact at identical voltages. The multiplexer or switches add nothing in the way of voltage errors from cell to cell.
So the cell to cell voltage error is effectively zero.

As I said earlier I have built quite a few of these over the years and have learned the hard way what works and what does not work.
Using a single voltmeter there will be better than 1mV repeatability between all thirty cells with a fairly simple voltage to frequency chip.
No jumping around between subsequent readings.
And the noise rejection is excellent, as it absolutely must be.

I am not speculating. All this has been built and tested and has been running successfully for over two years.
 
Oh ok, I thought you were doing discrete sampling, not continuous sampling. But how do you do continuous sampling with multiple cells and only one frequency counting input?
Easy, the sequence goes like this:
The voltage to frequency converter is running continuously while all this is going on.

Switch the appropriate cell onto the common measuring bus.
Wait while the switches fully turn on (a few milliseconds, as they are slow).
Reset the frequency counter to zero, release the reset and it starts accumulating counts.
At the end of the measurement period, latch the accumulated counts to freeze the result.
Read the result in the latch, possibly ignoring some of the most significant bits, and some of the least significant bits.
Switch the next cell onto the measurement bus
Rinse and repeat.

Ignoring some of the most significant bits zooms in to only the upper part of the total measurement range.
We might only be interested in for example measuring between 3.0 volts to 3.5 volts with nine bits (500 out of 512) with 1mV resolution.

We might also ignore some of the least significant bits, to at the very least remove the one digit ambiguity of frequency measurement.
Its also possible to ignore even more lower bits to enhance noise rejection even further

If we cycle slowly between cells, say one cell per second and we can count for almost a full second, its possible with a high enough frequency to end up with a count of hundreds of thousands, maybe seventeen bits or more. We really only require nine bits to have 1mV resolution over 0.5v of scale.
So there is plenty of scope for tweaking all the actual individual measurement parameters of this to get any desired range or resolution. It just needs a bit of serious thought and planning to get the results you require. In my case I was limited to 512 lines of vertical resolution in my histogram video display, so half a volt of measurement range fitted very nicely into that.
 
I can understand that. I'm at a bit different orientation. I took an early retirement from electronics some 23 years ago to peruse camping and mountain biking the best trails in the western US. I'm now at an age where my body doesn't respond well to steep mountain climbs. Some of my (new) spare time is now taken up with Arduino projects. What an amazing product! Wish it was around 50 years ago.

Yeah, it's a lot cheaper to purchase a BMS. I'm currently using a Chargery BMS. I like the Chargery concept, but feel performance can be improved. Guess you can call it a new hobby; to build a better BMS. Hobbies are never cheap.

@rin67630 I'm using a ESP32 in order to use WiFi. That's another great advancement for processors. The processor plugs into the breadboard on top of the level shifters. The two multiplexers and ADC that are used need a 5V signal; hence the level shifters.

What if I want to install the level shifter modules in the new circuit board? Will the schematic generating program have this part listed or do I need to create a "custom" part?
You can start with easyEDA , it available online and offline. Simple to use and come with a very very large components library. With no experience it takes me 1 day to be able to do a 4 layers board. I did plan to switch to kicad but it so practical to have easyEDA connected lcsc catalog.
 
Its not too bad, you only require one voltage to frequency converter for any number of cells.
The cell selection can be either by the usual analog multiplexer chip for batteries up to 45v, or as I do it with optically isolated solid state switches for much higher voltage operation, possibly up to around a 200v battery with the switches I am using.

Ok but then why the V/F chip? I thought the concept was to have one V/F converter per cell so you can easily isolate the signal unlike an analog one. But if you follow the same topology as I described (mux + converter for X cells) you might as well use an ADC which will be cheaper than the V/F converter.


A few millivolts accuracy ? Lets say +/- 5mV reading accuracy between cells which is barely adequate in my opinion.
That requires individual cell voltage measurement accuracy within 2.5mV for every cell.

So the accuracy of the voltage reference required to do that would be 2.5mV/3.6v (full scale) or 0.07%
Two identical cells could show up to 5mV difference either way which is not a good result even with an 0.07% voltage reference.

But if you use the exact same voltmeter and cycle through and measure every cell in sequence, there should not be any difference between the readings if all the cells were in fact at identical voltages. The multiplexer or switches add nothing in the way of voltage errors from cell to cell.
So the cell to cell voltage error is effectively zero.

Actually we don't need a super accurate Vref, it only needs to be stable with time and temp, the initial offset is easily calibrated away.


As I said earlier I have built quite a few of these over the years and have learned the hard way what works and what does not work.
Using a single voltmeter there will be better than 1mV repeatability between all thirty cells with a fairly simple voltage to frequency chip.
No jumping around between subsequent readings.
And the noise rejection is excellent, as it absolutely must be.

I am not speculating. All this has been built and tested and has been running successfully for over two years.

I know you know what you're talking about, that's why I wanted more details. Sorry if I somehow implied it wouldn't work, that wasn't my goal at all.


Easy, the sequence goes like this:
The voltage to frequency converter is running continuously while all this is going on.

Switch the appropriate cell onto the common measuring bus.
Wait while the switches fully turn on (a few milliseconds, as they are slow).
Reset the frequency counter to zero, release the reset and it starts accumulating counts.
At the end of the measurement period, latch the accumulated counts to freeze the result.
Read the result in the latch, possibly ignoring some of the most significant bits, and some of the least significant bits.
Switch the next cell onto the measurement bus
Rinse and repeat.

Ok, that seems solid. And the fact that it does oversampling + averaging intrinsically is quite nice.
 
Ok but then why the V/F chip? I thought the concept was to have one V/F converter per cell so you can easily isolate the signal unlike an analog one. But if you follow the same topology as I described (mux + converter for X cells) you might as well use an ADC which will be cheaper than the V/F converter.
The V/F chip offers vastly better noise performance than any A/D chip.
An A/D chip takes a snapshot of voltage and your readings will always be DC +instantaneous noise voltage.
If you take many samples of the same cell you get many different readings, and those must all be averaged in software somehow.
Its very difficult to make steady repeatable readings that way.
Believe me I tried for a very long time.

The key to success is noise cancelling by continuous long term averaging right at the source, and making the measurement period exact multiples of the inverter ripple frequency.

Once you start down this path, you will very quickly discover noise is a much bigger problem to solve than just building in accuracy or resolution.
Readings that jump around all over the place make it very difficult to do anything worthwhile with the data.
Its dead easy to get good results from a battery that is not connected to anything.

Some people here are talking about running inverters that draw a highly pulsing current of a hundred amps or more from the battery.
No matter how accurate or how many bits your A/D it will be pumping out some random numbers.

Cheaper, probably.... But something really crude and horrible can always be made cheaper. I don't think absolute cheapness is a worthy final goal for home construction. Buying cheap Chinese is a lot easier and a lot less work. But then you get what you pay for (sometimes).

I wanted something that was the very best I could possibly do, something truly unique that I can really be proud of.
That is why development of many different prototypes and ideas went on, trying one brain storm after another and learning something from the results.

I just thought some here might be slightly interested in some of the theory and philosophy of something that finally works especially well.
 
Last edited:
Back
Top