NEW Firmware for ESP32 to manage a BST900 Converter remotely using MQTT over WiFi is now available
This is a fork of B3603 originally by baruch and later forked by iafilius and frmaioli This fork extends the code to support the BST900 and BST400 boost converters from MingHe. The object of the BST900 alternative firmware is to allow control of the boost converter over a serial interface. In my case this is to control the charge current of my home battery system
The plugin top board of BST900 has a convenient unused serial socket (3.3V logic levels), which can be easily connected to a suitable controller. (In my case an ESP8266). BST900 and BST400 have a different architecture to the original B3603. They use a UCC3803 Current Mode PWM controller on their bottom boards, but they use the same STM8 based microcontroller top board albeit running slightly different firmware.
The project is fully functional. A binary file can be found in the releases folder. It has been tested with BST900, but not with BST400. To compile for BST400 edit the #define in the main.h file.
The firmware may be loaded onto a BST900 top board, but because the stock firmware is read protected it is not possible to save the stock firmware and revert back to it later. However it is possible to load the firmware onto an STM8 development board, and by hooking up the appropriate pins to the connector, run the firmware without the seven segment display or push buttons. The firmware can thereby be evaluated without making any irreversible choices.
There is another way to control the current delivered by a BST900 without having to change the firmware. It is possible to set the constant current limit using either an analogue or digital potentiometer.
Looking at the BST900. The fourth pin down on the left hand row is the pin used to control the Constant Current limit of UCC38803. This pin carries a digital PWM signal from the top board. However the UCC3803 will work equally well with an analogue voltage on this pin.
- Put the top board on long pin header sockets to raise it up.
- Bend Pin 4 of the left hand header out so this pin is open circuited.
- Insert a wire into Pin 4 of the socket on the lower board and connect to the wiper of a 10k Potentiometer (or Digipot)
- Connect one side of the potentiometer to GND which is found 2nd terminal on the left in the row of 4 immediately to the left of the buttons.
- Connect the other side of the potentiometer to +3.3V via a resistor of 15-20k. 3.3V is found at the right hand terminal of the row of 4.
That's it. Hopefully it will not blow up! It is probably a good idea to feed the BST900 with a constant current source while testing it out.
BST900 is based on the UCC3803 Current Mode PWM Controller from TI. It boosts voltages up to 120V and operates at currents up to 15A. The output voltage is controlled by a PWM signal on pin5 of the upper board in exactly the same way as B3603. Pin4 carries a PWM signal whose width determines the Constant Current limit.
- Implement control for the cooling fan. - Done (Default threshold is 2.5A)
- Rework Constant Current control to suit BST900. - Done (Now uses closed loop feedback. Requires no PWM calibration)
- Implement a start at power on feature to suit my application for charging a home battery system. - Done (added Command DEFAULT <0|1> )
- Recalibrate all measurements and PWM to suit BST900 - Done
- Rework code to use a 10mV voltage resolution to allow voltages above 65535mV - Done
- Add command ECHO <0|1> to provide positive confirmation of commands - Done
- BST900 -- The unit being reprogrammed
- STM8 Development board -- Enables firmware to be tried without losing the stock firmware.
- FT232RL -- A usb-to-serial TTL-level
- STLink V2 -- programmer for the STM8S microcontroller
- [SDCC v 3.7.0] sudo apt install sdcc
- stm8flash -- STM8 flasher
While the manufacturer specifies the BST900 as operating at up to 15A looking at the size of the supplied heatsink I was not too hopeful about it actually working for long at that current. It is fairly easy to uprate the cooling by removing the MOSFET and diode pair and mounting them on the lower side of the PCB with a much larger heat sink (use spacers to ensure no short circuit between the heatsink and PCB traces, and make sure the Mosfet leads go to the correct places). BST900 also has an unused socket for a second diode pair. Adding a second diode will more than halve the heat dissipation of each diode since the lower current will mean the diode is operating at a lower forward voltage. If adding a diode make sure they are both of the same type.
These were done by flex, the discussion can be seen in the EEVBlog forum (link at the bottom).
Top board schematics:
Lets name the different pinout components, left and right are as seen looking at the top board with the 7-segment display up:
- MCU
- Left connector -- 8 pins left side, analogue and digital signals
- Right connector -- 8 pins right side +5V power and analogue and digital Ground.
- Serial connector -- 4 pins at left most side. 3.3V logic level
- SWIM connector -- 4 pins at the bottom, just left of the buttons. Used to programme the STM8 chip
MCU pin | MCU Function | Board Connector | Board Connector Pin | Board Connector Name |
---|---|---|---|---|
Pin 1 | UART1_CK/TIM2_CH1/BEEP/(HS) PD4 | 74HC595 | Pin 3 | DS |
Pin 2 | UART1_TX | Serial connector | Pin 2 | TX |
Pin 3 | UART1_RX | Serial connector | Pin 4 | RX |
Pin 4 | NRST | SWIM | Pin 1 | SWIM NRST |
Pin 5 | OSCIN/PA1 | 74HC595 | Pin 11 | SHCP |
Pin 6 | OSCOUT/PA2 | 74HC595 | Pin 12 | STCP |
Pin 7 | Vss (GND) | |||
Pin 8 | Vcap | |||
Pin 9 | Vdd | |||
Pin 10 | SPI_NSS / TIM2_CH3 / PA3 (HS) | CV/CC leds | CV/CC leds | |
Pin 11 | PB5 (T) / I2C_SDA / TIM1_BKIN | Left connector | Pin 7 | CV/CC status |
Pin 12 | PB4 (T) / I2C_SCL / ADC_ETR | Left connector | Pin 6 | Enable Output + Red (ON) led |
Pin 13 | PC3 (HS) / TIM1_CH3 [TLI] [TIM1_CH1N] | Left Connector | Pin 8 | Fan Control |
Pin 14 | PC4 (HS) / TIM1_CH4 / CLK_CCO / AIN2 / TIM1_CH2N | Left connector | Pin 1 | Iout sense 16*(0.01V + Iout*0.05) |
Pin 15 | PC5 (HS) / SPI_SCK / TIM2_CH1 | Left connector | Pin 5 | Vout set |
Pin 16 | PC6 (HS) / SPI_MOSI / TIM1_CH1 | Left connector | Pin 4 | Iout set |
Pin 17 | PC7 (HS) / SPI_MISO / TIM1_CH2 | Button | Buttons | |
Pin 18 | PD1 (HS) / SWIM | SWIM | Pin 3 | SWIM & Buttons |
Pin 19 | PD2 (HS) / AIN3 / TIM2_CH3 | Left connector | Pin 2 | Vout sense |
Pin 20 | PD3 (HS) / AIN4 / TIM2_CH2 / ADC_ETR | Left connector | Pin 3 | Vin sense (Vin/16) |