diy solar

diy solar

Interfacing with Valence built in monitoring

Ive run into an issue when is anyone can help, seems after a while my ESP32 just stops Communicating or the Comms shutdown maybe with the batteries and the batteries go back to sleep. but if I close the Serial monitor and then reopen it again it starts communicating again or if I just power the device off and on again.

I wonder if it related to the invalid read. on my breadboard version, I only had an invalid read on SOC but volts and temp were fine. on my perfboard final version, I'm no getting an invalid read from everything, the batteries are still waking up but then after a while the comms seem to stop.

any ideas?
 

Attachments

  • IMG_9375.jpg
    IMG_9375.jpg
    80.8 KB · Views: 18
It has been a while since I have messed with an ESP board but my guess is some kind of serial conflict. It looks like you are hooked up to serial 0 on the ESP through pins 13 and 15? If this is the case you have to very careful the Serial.swap command is used after Serial.begin. You might even need to use that with other serial commands if you are using those two pins. You could try using pins 1 and 3 which should be the same serial on the ESP (but does not need the Serial.swap commands). Does the ESP use one of the hardware serials for the WiFi? If so you would have to disable it when you are using two serial connections (one for the batteries and one for the computer). I also have a question about your battery cable hookup. I assume the silver USB cable heads to your batteries? If so what do you have on the other end? I am just making sure you don't have another rs485 converter and that it is just strait through connections.
 
Last edited:
It has been a while since I have messed with an ESP board but my guess is some kind of serial conflict. It looks like you are hooked up to serial 0 on the ESP through pins 13 and 15? You could try using pins 1 and 3 which should be the same serial on the ESP. Does the ESP use one of the hardware serials for the WiFi? If so you would have to disable it when you are using two serial connections (one for the batteries and one for the computer). I also have a question about your battery cable hookup. I assume the silver USB cable heads to your batteries? If so what do you have on the other end? I am just making sure you don't have another rs485 converter and that it is just strait through connections.

Using Pin 16 ( TX ) & 17 ( RX ) on the ESP32 board which is Serial2, Using a ESP32 wroon 32 Dev kit C, which does have a different pinout to some of the Esp32 boards. This Arduino based BMS is the first time I've ever attempted anything like this so forgive me for missing anything obvious.

Something I need to experiment with and is probably is an issue I realised today Is I'm using a MAX485 which is 5V, Whilst the pin tolerance on ESP32 is only 3.3v So the Esp32 is Receiving 5V logic from the MAX485. Which might explain why transmitting is fine but receiving is not, Or at least why not all information is being received. Ordered a different board which can put out 3.3v logic to the ESP32

Ah yes I thought my USB port in there might raise some eyebrows. USB port wise Im just a through connector as I had some usb terminal block. no conversion going on or anything.

I made temporary naughty fix as Im only really after the Internal slave BMS to be kept awake for the Active cell Balancing to be able to function when appropriate. Things like low temperature charge cut off and low voltage cut up are managed elsewhere in my system.

but getting it working fully and being able to see the cell voltages and so on would be nice. but primarily I'm after the BMS wake-up Command being sent. so my fix currently is probably abusing the deep-sleep mode and awake timer on the ESP32. on boot my Temporary fix is to wait five seconds after the ESP32 sends the Battery BMS wake up Command batteries, then enter deep sleep mode for 1 minute ( Which shutdowns almost everything on the ESP32 ) then wake up after that minute via a 1 minute timer. Waking up for Deep sleep mode the EPS32, Basically, restarts it and Void Setup runs again which then send the Battery BMS wake up Command, waits 5 seconds and then returns to deep sleep. Basically a one minute loop. Since the BMS inside the batteries goes to sleep 120 seconds after the last BMS wake up Command / last Contact from the master BMS. since the ESP32 Wakes up every minute and resend the command the batteries stay awake permanently. ( Side-effect it's super low power consumption )
 
Last edited:
I like your workaround... very smart. I was trying to figure out what exact ESP board you have (must be the ESP32)...I misunderstood your previous post. That one does have 3 serial ports. Some of the ESP boards have a serial that is transmit only and cannot receive. That may be the case with your serial2 but I don't think so. I think the bigger issue is the 5v tolerance. It is very likely you fried that serial sending 5 volts into it. You need a logic level converter to change the 5v logic from the MAX485 to 3.3v. You might be able to get one and then just use a different serial port. This might also explain the batteries not responding as 3.3v may not be enough to trigger 5v logic in some cases.
 
Last edited:
I like your workaround... very smart. I was trying to figure out what exact ESP board you have (must be the ESP32)...I misunderstood your previous post. That one does have 3 serial ports. Some of the ESP boards have a serial that is transmit only and cannot receive. That may be the case with your serial2 but I don't think so. I think the bigger issue is the 5v tolerance. It is very likely you fried that serial sending 5 volts into it. You need a logic level converter to change the 5v logic from the MAX485 to 3.3v. You might be able to get one and then just use a different serial port. This might also explain the batteries not responding as 3.3v may not be enough to trigger 5v logic in some cases.

Much appreciated I'm quite happy the workaround worked what I needed to in the end, Fun learning process. I think that was part of my issue when trying to get it ESP8266 D1 mini to work. that one only had 2 Serial ports. on that I think Serial is the USB and Serial1 was Transmit only, I tried to figure out the Software serial swap. Couldn't get my head around it and switch to ESP32 board I another member here I saw had it working on one.

Yeah that I may have fried the pin was in the back of my mind. All a learning process for me and at least it only a £7 board. I was originally using a Wemos D1 mini / ESP8266 which are 5v Tolerant, but switched to the ESP32 But in my ignorance didn't realise those pins only 3.3V. I got a board coming tomorrow would should work for 3.3v
 
I have been using my Raspberry Pi-based code for a year now, and it works flawless.
Been driving 5000km with the car and charging it every single day.

But I have an issue with SOC-status. 8 of my 11 batteries now show constantly 16% SOC, hex 1004. Any one else who have this issue?
 
I have been using my Raspberry Pi-based code for a year now, and it works flawless.
Been driving 5000km with the car and charging it every single day.

But I have an issue with SOC-status. 8 of my 11 batteries now show constantly 16% SOC, hex 1004. Any one else who have this issue?
The amp meters in many of these batteries are not accurate therefore pretending to charge or discharge affecting its state of charge meter. You can recalibrate it to 100% by getting a full charge and completing top balance. The state of charge will drift over time again if you don't complete a balance charge often. But I sure wish there was a way to actually zero out the built-in amp meter so we wouldn't have this problem anymore. I assume there's a way but we are not privileged with the software tools required.
 
I made it work guys! I will upload the code once finish implementing the MQTT part for all the values per battery if someone is interested.

Hello aguerrejoaquin,

I have set this with your code using a ESP32 / logic level / Max485 when I connect it I get

Wake up batteries / Initialise comms
Battery 1 Invalid readVolts response: 0 bytes received
Battery 2 Invalid readVolts response: 0 bytes received

I have everything connected correct connecting into the female end of the battery not sure if that makes any difference
 
So, I've having a lot of fun and success with OpenXPBMS running in my Lance camper. At this point, (I do realize) I'm the actual BMS since I monitor it regularly remotely and while the camper is in use. Just back from another boon-docking weekend where I'm judging the Valence behavior as an ongoing effort. I've not come close to any limits and the battery (I talk to it) seems very happy. Main idea was to allow the internal balance to do it's thing while keeping the stats updated.

Curses has been a mixed blessing. Not sure I'll stick with it but it works for now.
Things to add -
Color changes for status to include cell imbalance and voltage/current limits.
Wiring the battery percentage LEDs in the camper control panel to read SOC from the Pi. Why? Why not. It'll be more accurate that the tank levels.
Or maybe a small OLED screen mounted somewhere.

Wife says when she can run the microwave without the generator, she's happy. That is a 100% achieved goal.

Many thanks to all that contributed with the data decoding -


OpenXPBMS.jpeg
 
Hi, I recently bought some p40-24, xp27-36 and higher voltage Valence batteries. Has anyone made an attempt to communicate with those?
Thanks.
Hi,

I bought as well 10 U27-36XP with intend to build 5S2P HV house pack.

Unfortunately :

- Valence Diag software is able to wake, modify Ids and Scan but it do not want to Read!
Since only 6 cell banks are provided on screen and "Module Type" do not appears, I guess it may be compatible up to 18XP...
1623020762634.png

- I guess codes I found at OpenXPBMS (great Thanks!) are only matching 12XP which is most popular
I am jumping in Python as a beginner but I guess I can go forward to make a lit bit of reverse since some returned values are quite close to cell voltage or temperatures.

- sniffing communication will not be possible since this communication is not provided with Diag software...
Only way would be to setup a configuration with a Valence BMS and sniffer in between communication : I guess it will be a high skill I would hardly affort (I guess Cogito44 did some but seems to be as well with 12XP)

Is there someone to help for this module type?

To bring my very little contribution, I handle activation of 12XP parallel packs by just adding internal modified boards which make a reset every 120s leading to remain in awaken status and balancing :
- buy infinite cycle module in 5V (to lower power consumption) for 3USD
- remove LDO 5V>3.3V if existing (to lower power consumption)
- supply it at 3.3V internal
- remove relay and connect its transistor to pull down reset pin which is easy access on battery board
- use external communication cable to supply, or not when disconnected, this "cycle reset board"

Thanks!
 
Hi @lift35 , what you are sharing at the end is interesting for me - do you mind sharing BOM and schematic for what you did for the reset board?
I have a set of these batteries (1st revision, black) and for whatever reason one of them makes them all go in storage mode, once connected to the BMS comms line.
 
Hi @lift35 , what you are sharing at the end is interesting for me - do you mind sharing BOM and schematic for what you did for the reset board?
I have a set of these batteries (1st revision, black) and for whatever reason one of them makes them all go in storage mode, once connected to the BMS comms line.

Hi marin,

What I did was on a green U27-12XP but I guess it may be done on any Valence battery internal board.

For information :
- cycling reset intend to take benefit of the 120s activated waiting time at turn on of internal board or last communication from BMS
- I guess RESET counter is incremented internally (data value in Valence Diag software) and may cycle as well... I have 2 batteries which are cycling since 2 years without any issue.
- when RESET, LED are flashing RED and GREEN for several seconds : it is therefore easy to check cycling is activated (GREEN flashing every 5s and RED/GREEN flashing every ~120s) or not (GREEN flashing every 20s)
- when internal balancing is activated, it only take care of single battery itself : this will not make inter module balancing and is recommended for single string module (several in parallel are ok)
- even optimized, consumption of cycling reset is 10 to 20mA, hence 3.3V : I do recommend an external way to it switch off when battery is let out of any charger for more than 6 monthes
- simple switch to 3.3V and GND : both since RESET pin is pulled up and may draw some current as well...
- in my case, I cut communication wires to let (or not) GND and 3.3V supply Reset board, meaning both male/female plugs must be plugged together to activate RESET board (no switch, but no communication anymore...)
- internal Valence board is varnished : it must scratched locally before soldering
- RESET board must be tested and tuned on the table before
- RESET board must bed carefully rubber taped and may be placed back toward internal Valence board
- Indeed, breaking warranty tapes will be needed to access to internal board (remove rubber caps with a flat screwdriver to get access to screws...) and I do not endorse responsability for these modification : do it carefully since short circuit may be dangerous even for low voltage.
- infinite loop board I used (5V) : https://fr.aliexpress.com/item/4001...xp_id=112458e1-4ad5-40d9-b654-ef8f7f9b632e-51
- RESET board configuration jumpers may be touched (I did it 2 years ago...).

Your internal board may not be same as U27-12XP, therefore you will have to find RESET pin of the Main Controler Unit (MCU).
A "RST" is written on test connectors at back side so it was quite easy for me to find RESET pin.
If you get difficulties to find it out, post high resolution pictures of both sides and I may help you as Dr Watson :)
You can try as well to get MCU datasheet for RESET pinout.

Unfortunaly, I do not have that much time to make a step by step wiki with pictures but I guess it may be enough if you already handled electronic soldering.

Feel free to ask for help!
 

Attachments

  • U27-12XP RESET.jpg
    U27-12XP RESET.jpg
    1.2 MB · Views: 30
  • RESET board.jpg
    RESET board.jpg
    229 KB · Views: 28
I have access to more than one smith electric vehicle with valence systems and a working ubms , would anyone have interest in me posting a rs485 log while inter module balancing occurs ?
 
I have access to more than one smith electric vehicle with valence systems and a working ubms , would anyone have interest in me posting a rs485 log while inter module balancing occurs ?
That's exactly what those who have been working on this have already done. You're definitely on the right track. But ultimately what I've decided to do is let the ubms do its job. I've added a logging device device on its CANbus.
Inside the ubms there's a lot of thinking and calculations going on. Making it a slave to the logging device I accomplish anything in addition to the ubms parameters while all at the same time retaining the reliability of the original system.
 

Attachments

  • 20210815_191622.jpg
    20210815_191622.jpg
    312.4 KB · Views: 22
  • Screenshot_20210412-154955_Chrome.jpg
    Screenshot_20210412-154955_Chrome.jpg
    128.3 KB · Views: 20
I have access to more than one smith electric vehicle with valence systems and a working ubms , would anyone have interest in me posting a rs485 log while inter module balancing occurs ?
I would much appreciate such a log!
 
So, I've having a lot of fun and success with OpenXPBMS running in my Lance camper. At this point, (I do realize) I'm the actual BMS since I monitor it regularly remotely and while the camper is in use. Just back from another boon-docking weekend where I'm judging the Valence behavior as an ongoing effort. I've not come close to any limits and the battery (I talk to it) seems very happy. Main idea was to allow the internal balance to do it's thing while keeping the stats updated.

Curses has been a mixed blessing. Not sure I'll stick with it but it works for now.
Things to add -
Color changes for status to include cell imbalance and voltage/current limits.
Wiring the battery percentage LEDs in the camper control panel to read SOC from the Pi. Why? Why not. It'll be more accurate that the tank levels.
Or maybe a small OLED screen mounted somewhere.

Wife says when she can run the microwave without the generator, she's happy. That is a 100% achieved goal.

Many thanks to all that contributed with the data decoding -


View attachment 48381
Nice to see someone using my code ? i agree with the curses opinion. I actually have a branch where the stats are displyed on a i2c oled display.

Its still in development, but feel free to use it as a template for your needs. It uses pillow library, which was much easier to develop for.

I use this display:
 
I am hoping to do a firmware dump from the two ubms units I have and then use them to figure out how the xml hash works and then just use the config and monitoring tool to config the ubms. Anyone else have xml files to aid in in this endeavour ?
 
I am hoping to do a firmware dump from the two ubms units I have and then use them to figure out how the xml hash works and then just use the config and monitoring tool to config the ubms. Anyone else have xml files to aid in in this endeavour ?
I have multiple xmls I could share, wouldnt mind being able to reconfigure my ubms as well, but I am very interested in the rs485 logs as well since I have more applications than ubmses!
 
Currently I have the example ubms xml , yeah the logs should be useful as my pack setups are 22s1p and 22s2p so should be easier to spot differences and xml hash calculation logic. Can you share the xml here or by pm?
 
Currently I have the example ubms xml , yeah the logs should be useful as my pack setups are 22s1p and 22s2p so should be easier to spot differences and xml hash calculation logic. Can you share the xml here or by pm?
If you guys need a different configuration for your BMS I can send you the config file. As long as it's for your own use as I'm not trying to create a competitor for myself.
 
Back
Top