curiouscarbon
Science Penguin
- Joined
- Jun 29, 2020
- Messages
- 3,028
thank you for sharing this!
I checked out your work on GitHub and it truely looks amazing, especially your all in one board!In my setup the ESP queries the BMS for all its running statistics every few seconds, and then uploads the data to InfluxDB. It also operates the balancer relay if the necessary cell voltage conditions are met.
While this was coded to work online/while connected to WiFi, it'd be trivial to modify the code to remove this function such that in runs in an offline mode. If this is all you needed you could get away using a cheaper and simpler microcontroller without the WiFi capability.
I built a very simple serial multiplexer using a separate STM32. It allowed both the bluetooth adapter and ESP to communicate with the BMS at the same time, with the bluetooth interface taking precedence if it is connected.
If I get a bit of time this weekend I'll upload my code and notes.
I checked out your work on GitHub and it truely looks amazing, especially your all in one board!
I don't have wifi (living in rather remote and simple lodgings) so yes an offline mode is all i would need.
Simpler and cheaper is generally always preferable but wouldn't that be less trivial (cause more work) for you!?
Do you by chance have an esp01 and its relay board? This looked to me always like the ideal combo to control the balancer.
View attachment 137721
Didn't know that, well it shows smaller and simpler is not always better! Then better forget the esp01.I bought a couple similar to this a few weeks ago, however didn't end up using them. There's a few variants of these ESP01 relay boards, it's important to use the type that exposes the UART interface (TX, RX, GND) so you can connect it to the BMS.
View attachment 137740
I personally dislike working with the ESP01. Their excessively minimalistic design makes programming them a real pain, and they can be a bit unstable due to a lack of sufficient power decoupling capacitors.
That being said, it wouldn't take much effort to strip down my code to have one of these work in an offline, single purpose mode. If there's enough interest I could release another version for this purpose.
The STM32 would be well suited to the job by itself if you have no need for interaction with other systems. They're cheap, powerful and most importantly, 3.3v logic level to match the BMS.Didn't know that, well it shows smaller and simpler is not always better! Then better forget the esp01.
Forgive me my ignorance, suppose you would remove the esp from your all-in-one board, would the stm32 multiplexer board alone be able to do all it did before (allowing Bluetooth module to access to the uart) + control a relay in the way you described before (starting the balancer at 3.4v etc)?
Or what would be the easiest and most prefered way for an possible offline version be?
That sounds really great! Please if you find the time and muse to retrifit your code for an pure offline version, i would highly appreciate it!The STM32 would be well suited to the job by itself if you have no need for interaction with other systems. They're cheap, powerful and most importantly, 3.3v logic level to match the BMS.
That sounds really great! Please if you find the time and muse to retrifit your code for an pure offline version, i would highly appreciate it!
That is super kind of you!Because you asked so nicely, I've started porting the code over to the STM32.
It'll take a bit of time as it's quite different to the ESP, and several of the components and functions need to be modified. I'll also need to set up a test battery with my JBD BMS as it's no longer in use for my main solar system. My spare time is limited so it'll take a while to get it all up and running again.
The initial bill of materials (to be finalised):
- STM32F103 "blue pill" board (or clone)
- ST-Link v2 programmer (only if you don't have one already)
- ADUM1201 dual channel digital isolator
- AMS1117 voltage regulator module
- Optoisolated relay module
- ILI9341 SPI TFT screen (optional, but very useful)
- I noticed there are two different f103 boards, one that ends with c8t6 and the other one c6t6. Which one should i order?
- Asm1117, from which voltage to which? 12v to 3.3v?
- ADUM1201 ok clear
- Couldn't find the relay with your search words.. do you know its precise name or do you have a picture?
- the tft display info looks indeed enticing, would make accessing the app almost obsolete.
Speaking of which they have a new accessory released, similar to your tft but less info
https://a.aliexpress.com/_mPV71dG
Many thanks! That cleared things up.
- The the C8T6 and C6T6 are very similar and often interchangeable, however the STM32F103C8T6 is preferable. This is the one I will be developing and testing on. Note that most of the "STM32" boards shipping from China actually have a CS32F103 chip. These are a clone of the STM32, they work well, they just need a special command line switch to program them.
- The AMS1117 should be the 3.3v type. It will convert the voltage output from the BMS on the bluetooth port (which is around 14v) to power one side of the ADUM1201.
- I've attached a picture of the relays I prefer. They have an optocoupler which helps avoid any problems or interference from the inductive flyback when the relay opens. Cheaper relay modules without the optocoupler would also work, they just have a diode for the flyback and therefore less isolation.
I'm using the older style board with the micro-USB interface and the yellow jumpers, but I think either would work fine.
- Will order the STM32F103C8T6 and see what i get. They clearly list both (CS32F103 as well) so i hope they also send the stm32 if selected so (bit more expensive). It looks a bit different though... Is this a new version or should i get the one with the yellow jumpers?
- Optional 1.8" spi tft lcd without touch ili9488
Ok thanks for the clarification!I'm using the older style board with the micro-USB interface and the yellow jumpers, but I think either would work fine.
If you're buying a TFT, make sure you get the ILI9341 240*320 TFT screen with SPI interface (unless you want to alter the code to suit a different type, but that won't be easy).
Gosh already?... It will take 10days or so till the parts arrive from china.Quick update: I have the STM32 code version running, it's communicating with the BMS reliably and reporting on all the expected metrics. I've made some improvements to the code at the same time to better handle different battery sizes.
My BMS is currently running from a 5S1P test battery, which it isn't detecting properly so I haven't been able to test all features properly yet. Once I get this sorted out I'll post the code and start documenting how it all goes together.
@Vi s , what model of BMS are you using? I'm testing against a JBD AP21S001, I'm not sure if there's much protocol variation between different models.
A question on the side, you don't happen to know as much about electronics as coding? Since you mentioned "optocoupler" and you seem to know well what happens behind the curtain of electronics, do you by chance have a confident guess where mullerEnergy could have soldered their optocoupler so that its relay gets closed once the passive balancing circuit of the jbd bms gets energized? I somehow can't quite get their seemingly ingenious solution to switch the active balancer on and off out of my head. Too bad ? that i am also too ignorant in the hardware department...
- I've attached a picture of the relays I prefer. They have an optocoupler which helps avoid any problems or interference from the inductive flyback when the relay opens. Cheaper relay modules without the optocoupler would also work, they just have a diode/transistor combination and therefore less isolation.
I wouldn't expect to find a single point on the BMS that could be used to determine whether balancing is active, because logically this isn't necessary for the operation of the passive balancer. I suspect mullerEnergy have worked with JBD to produce a custom variant with an additional logic output for this purpose.A question on the side, you don't happen to know as much about electronics as coding? Since you mentioned "optocoupler" and you seem to know well what happens behind the curtain of electronics, do you by chance have a confident guess where mullerEnergy could have soldered their optocoupler so that its relay gets closed once the passive balancing circuit of the jbd bms gets energized? I somehow can't quite get their seemingly ingenious solution to switch the active balancer on and off out of my head. Too bad ? that i am also too ignorant in the hardware department...
Many thanks for your valuable input and evaluation!I wouldn't expect to find a single point on the BMS that could be used to determine whether balancing is active, because logically this isn't necessary for the operation of the passive balancer. I suspect mullerEnergy have worked with JBD to produce a custom variant with an additional logic output for this purpose.
If I was going to consider this, I'd look at using a 4072 "OR gate", the inputs of which could be placed across each of the balancing transistors to produce a single output indicating whether any of the balancing circuits are running. This would be possible for the smaller BMS (e.g. 4S or even 8S), however would become quite cumbersome for larger 16S systems. There's also a challenge of the base voltages for the transistors not being equal.
When considering the complexities of this approach, interfacing with the BMS over the UART port becomes a lot more appealing as you can do a lot more useful things with the information you receive than just switching a external balancer on and off.
I just got a delayed answer of the vendor where i ordered the ams1117 3.3V. i inquired about the input range.Quick update: I have the STM32 code version running,