Update to to Brymen 867/9 charging cable #2

The #1 product on my Tindie store in the Brymen 867/869 interface cable. The first version was based on an ATtiny45, but I then switched to STM32L0, mostly because ATtiny’s were more expensive and L0s can be reprogrammed via UART. This new version (which I called 2.0) sold out relatively quickly in the middle of 2021, so I went to order new parts and… no L0’s were available. Nowhere. Well I just thought that with a little bit of patience, some will show up somewhere. Well some did, but their price was more than the cost of the cable itself.

Anyways, after about 9 months, I’ve given up and redesigned the cable again to use the STM32G030. Now there are a couple of reasons why I didn’t do this earlier – the G0 is not available in TSSOP14, it has no internal EEPROM and generally it is a huge overkill for this project. But I had no other option, so here is the schematic for version 2.1:

The G0 acts as the MCU, USB-UART conversion is handled by the HT42B534, which is a USB-UART converter similator to the CH330/340. But this one doesn’t require a crystal (some version of the CH3x0 don’t either), doesn’t require additional drivers and it’s 3.3 V output can source more than 70 mA (albeit with relatively poor accuracy). So the HT42 also acts as a 3.3 V source for the MCU.

A much bigger challenge was the EEPROM, which is used to store the last settings, and theoretically could also be used to log data. The internal flash could be used, but it’s flash – so you need to manipulate whole pages, the number of write cycles is limited, etc. Not wanting to abandon the EEPROM idea, I had to add an external I2C EEPROM in a relatively small SOT23-5 package.

Regarding software – this time, I used ST’s HAL. Mostly because I feel like this might allow some people to modify this more to their needs, and also I wanted to try my hand on it. It still feels clumsy and huge (the UART IRQ handler takes 1,5 kB of flash with callbacks disabled!), but the performance isn’t bad even with -zero optimization and CPU frequency of 8 MHz.

How to use

  1. Plug the cable into a USB port and open a serial monitor (baud 115200, no parity, 8 data bits, 1 stop bit). After powerup, the red LED should blink 3 times.
  2. Connect the cable to the multimeter – there is only one way it fits, so it shouldn’t be a problem.
  3. Turn the multimeter on. By default, a dataread is sent every second.
  4. Use the serial console to send commands to the cable. All commands are single letter, internally it uses idle line detection, so line endings etc. don’t matter. List of commands (there should be confirmation message after each command):
    • H as Help – displays a list of available commands, as well as firmware version.
    • F as Five hertz – sends data at full rate, usually about 5 Hz with only value only on the main display, about 0,5 Hz when data is displayed both on the main and auxiliary displays.
    • O as One hertz – send data at approx. 1 Hz or less. Default mode.
    • S as Stop – stops automatically sending data.
    • D as Data – gets a single reading, used in stop mode.
    • E as Eeprom – saved the current mode & raw data setting to eeprom.
    • R as Raw – switches between sending raw and decoded data.

Updating firmware

  • Hold down the exposed button with a pencil or a nail or something.
  • Plug the USB cable in.
  • Use STM32CubeProgrammer in UART mode with a proper COM port to upload new elf file.

Link to the Github repository.

Link to the Tindie listing.

3 Replies to “Update to to Brymen 867/9 charging cable #2”

  1. Hi,

    I have 2 of your cables and they are really well made. Thank you.

    Have you used yours to export CSV for graphing in Excel or similar?

    No matter what I try the MAIN and AUX values are sent out as one large string, only the timestamp is comma seperated.

    I am using the STM32G0 library in IDE for serial plotting as a workaround and works as expected.

    Just interested to hear what you have done for spreadsheet graphing ( if you have done this ).

    Kind regards

    Stuart

  2. Hey Martin, really like your work. I especially appreciate your dedication to open hardware/software.

    I’m planning on getting a BM867s in the coming months, and I was wondering if you were planning in restocking this item on your tindie store?

    It looks like it’s very popular, based on how quickly you’ve sold out. Personally, I wouldn’t mind a price increase if inflation as of late has made the project unviable at the previous price.

Leave a Reply

Your email address will not be published. Required fields are marked *