Skip to content
Manos1966 edited this page Sep 9, 2024 · 76 revisions

Huawei R4850G2 power supply

The Huawei Rxxxx lineup is a series of industrial grade power rectifier modules for professional usage. Their naming scheme is pretty straightforward:

  • R -> Rectifier
  • first two digits, e.g. 48 -> nominal voltage
  • next two digits, e.g. 50 -> maximum current
  • single letter -> Model line? There is at least G and N, from what I could find
  • last digit -> Generation number, e.g. 2

The R4850G2 model in particular became a favorite of some internet communities (like this one :-)) due to its high efficiency, the flexible (and really high current) CAN controllable output as well as the availability and price point (currently ~70-90€ for used units and around 120-150€ for new "old stock" ones from Aliexpress or Ebay/Kleinanzeigen). Only real downside is the internal cooling fan, which is temperature/load controlled, but still somewhat noisy (so, like most server room equipment, belongs to a rack in a separate room).

Warning: This power supply can output over 50A at most voltages, which will most definitely be a lot more than most batteries can handle! So double check your settings. Also, even though the output side is relatively low voltage, these are serious currents, so make sure that

  1. you understand, what you are doing
  2. appropriate circuit breakers, wiring and connectors are used
  3. the input side is also capable of delivering the corresponding AC power over numerous hours (a C13/C14 connector is only good for <10A!)
  4. enough air circulation/heat dissipation is possible
  5. additional measures are present to detect a malfunction, e.g. external monitoring (remember, this is all home-brew stuff, which might fail, hang or simply not work as expected anytime soon)

This being said, the Huawei unit itself was meant to work in network environments 24/7 for many many years, so it features high quality internal components, many internal monitoring circuits and several official certifications. In my opinion, this makes it a way better and safer option than most, if not any of the generic china-made power supplies available.

Operation modes

openDTU-onBattery supports three operation modes for the Huawei PSU:

  1. Fully manual - In this mode the PSU needs to be turned on/off externally using MQTT and voltage and current limits need to be provided. See MQTT Documentation for details on these commands

  2. Manual with auto power on / off - In this mode the PSU is turned on when a current limit > 1A is set. If the current limit is < 1A for some time the PSU is turned off. Current and voltage limits need to be provided externally using MQTT. See MQTT Documentation for details on these commands.

  3. Automatic - In this mode the PSU power is controlled by the Power Meter and information provided in the web-interface. If excess power is present the PSU is turned on. The voltage limit is set as per web-interface and the current limit is set so that the maximum PSU output power equals the Power Meter value. Minium and maximum PSU power levels as configured in the web-interface are respected in this process. The PSU is turned off if the output current is limited and the output power drops below the minimum power level. This will disable automatic mode until the battery is discharged below the start voltage level (set in the web-interface). This mode can be enabled using the web-interface and MQTT. See MQTT Documentation

CANbus communication with OpenDTU

For OpenDTU communication, a MCP2515/TJA1050 CAN shield is needed. This CAN bus operates at 125kbit/s.

The module is connected via SPI and currently requires a separate SPI bus. If you want to use the Huawei AC charger make sure to get an ESP which supports 2 SPI busses. Currently the SPI bus host is hardcoded to number 2. Please note: Using the Huawei AC charger in combination with the CMT2300A radio board is not supported at the moment, this will change soon (stand Aug.2024), see test version

Please note that the smaller/cheaper 4-pin shields (SN65HVD230) used for Pylontech battery communication will not work!

MCP2515 CAN-Bus-Modul 2 - Copy

Since the ESP generally operates at 3.3V power level, these boards also need to be modified in order to output a 5V signal. This can be done by cutting through a circuit path at the back of the board, as documented in this discussion (more details here). Please be careful not to scratch the surrounding area, otherwise you risk a short circuit to ground.

If the above is too complicated, a (more expensive) version of this with two voltage inputs is also available, the Joy-IT SBC-CAN01 (available at AMAZON, Conrad, Reichelt and other online shops).

IMPORTANT UPDATE: There are two versions of the Joy-IT SBC-CAN01 on the market. One has 8MHz clock and the other 16MHz clock.

Energy Geek from Akkudoktor Forum tested the 16Mhz version and reported OpenDTUonBattery versions before November 2023 are only working with 8MHz versions. Newer versions work with both 8MHz/16MHz (you have to manually select the MHz speed in the setup menu).

Solved 8-16MHz

Why does it make a difference whether it clocks at 16 instead of 8MHz? It directly affects the baud rate. The MCP2515 chip only knows relative timing, i.e., its input clock. If that clock doubles while all else is the same, then it "speaks" at double the speed. The prescaler needs to be adjusted (doubled) for the 16MHz model. Probably the CAN driver can already be configured (be told what the quarz frequency is) such that the correct prescaler is set. Probably 8MHz is hardcoded somewhere in OpenDTU-OnBattery.

The pictures show a 16MHz quarz and a 8MHz quarz. There should either be an integer followed by M on the quarz (first picture), or a floating point number, which is in MHz as well (second picture).

a - Copy 8MHz A

After connecting the 5 pins to the ESPs GPIO, the mapping needs to be set. Easiest way is using a pin_mapping.json like this (updated to default values Oct.2023):

[
    {
        "name": "Huawei+Battery",
        "nrf24": {
            "miso": 19,
            "mosi": 23,
            "clk": 18,
            "irq": 16,
            "en": 4,
            "cs": 5
        },
        "huawei": {
            "miso": 12,
            "mosi": 13,
            "clk": 26,
            "irq": 25,
            "power": 33,
            "cs": 15
        },
        "victron": {
            "rx": 22,
            "tx": 21
        },
        "eth": {
            "enabled": false
        },
        "battery": {
            "rx": 27,
            "tx": 14
        }
    }
]

Note: Even if you do not plan to use it, the huawei.power needs to be set to an unused GPIO pin, otherwise communication won't work.
Also, the terminating resistor (jumper next to the CANH/CANL output) needs to be set.
The physical connection to the power supply CAN terminal can be done using simple twisted wire ("Klingeldraht"), as long as the distance isn't too long.

Wiring_ESP32_HUWAI ONLY - 5V3 3V

As mentioned previously the Joy-IT SBC-CAN01 has two power inputs, VCC1 and VCC The manual shows a voltage differentiation when connecting the board to a RaspberryPi vs Arduino

Difference Arduino Raspberry - Copy

  • VCC1 is the power of the board and the CAN controller (always 5V).
  • VCC is Input/Output power of the Boards.
  1. Since the RaspberryPi uses a 3.3V-basierter SoC, it should handle only 3.3V on its Pins (MISO, MOSI, etc.).
  2. Arduino-Boards on the other side, work with 5V logic.
  3. Subsequently, the ESP32 board should imitate the RaspberryPi configuration. Tests have shown that, temporarily VCC can work with 5V, althouhg it is not advisable long term.

Starting/Stopping the Huawei AC PSU

Turn PSU on - No Precharge

So, the easiest way is:
You can do a solution yourself but, there are ready-made "connectors" to plug into the back of the R4850. There are two versions, only difference is the AC connection, here is an example
Huawei R4850 Connector
Connect to start

Note: If you use a connector mentionned above, you will also need one male and one female JST SM 2Pin connector, here is an example
Huawei R4850 JST SM 2PIN

This of course makes the fan keep turning and it is noisy... (the guy who designed this fan should be barred from entering Paradise... On the other side this is an industrial 24/7 system not designed for home use so do not complain).

Another option is to use a Relais 3.3V or 5V (5V probably with Optocoupler?) and let OpenDTU control it through Power PIN (default is PIN 33)

Relais 3 3V   5V - Copy

bf4ed's short and precise explanation:

Example bf3ed - Copy

  • Big Blue cable minus (-48V) goes to COM (COMmon)

  • Small Blue and small orange cables SlotDetect1 and SlotDetect2 go to NO (Normally Open)

Relais NO (Normally Open) / NC (Normally Closed) / High/low level trigger

CaCu15 was kind enough to write some explanations: It is important whether you connect the two SlotDetect lines to NC or NO.

This decides how the relay establishes a connection:

  • If you connect them to NC (normally closed), then there is a connection between COM (-48V) and the two SlotDetects when there is NO voltage at the signal PIN. If then the ESP applies a voltage to the SignalPIN, then the relay switches and then COM (-48V) is no longer connected to the SlotDetects.

  • If you connect the SlotDetect to NO (normally open), then it is the other way round: If there is no voltage at the SignalPIN, then there is no connection between COM (-48V) and the SlotDetects. Only if the ESP applies a voltage at the SignalPIN, then the relay switches and establishes a connection.

This behavior is controlled by a jumper at many relays - in the pictures above, this is the case for the red relay. The jumper "High//Low Level Trigger Selection" controls when the relay closes. "High" means that the relay closes (i.e. makes a connection from COM to NC) when there is a voltage difference between signal and GND/Minus.

IMPORTANT: The example below shows an older ESP32 Version with 4MB Flash memory. Since the second quarter of 2024 we strongly recommend to new users to procure the new version ESP32-S3 which has 8/16/32 MB Flash (many models available) because soon the OpenDTU-OnBattery Firmware will exceed the memory capacity of the normal ESP32 4MB boards. The GPIOs of ESP32-S3 boards can have differences compared to the ESP32 board graphic below. For example, on some ESP32-S3 boards, GPIO 22 and 27 are not available (or used internally). IF you allocate Pins that are not available on your ESP32-S3, your board will *FREEZE* when you activate the corresponding option

Wiring_ESP32_Symbol - Victr1Victr2PylontechHuaweiRelaisCMT2300updRJ45

Other observations:

  • When disconnecting from AC power, the PSU will spin the fan at full speed for several seconds. Don't be afraid!
  • When CAN communication is lost, the warning LED on the front flashes and the PSU will use customizable fallback ("offline") output values, so if you set these to 0 amps, it will stop charging altogether
  • Using the Huawei AC charger in combination with the CMT2300A radio board is not supported at the moment. This will change very soon (stand: Aug.2024) but, in the meantime:
  • Even if AC power is lost, the CAN communication will be fed from DC if a power source is connected there. This is nice if additional control is present, e.g. using a Tasmota switch to shutdown the PSU during no load scenarios (helps with idle consumption and fan noise at night). Power consumption in this situation (Huawei is switched-off via slot-detect) is around 15W. This means your battery will discharge at approx. 0,35kWh per day.

Blog / Forum references:


Clone this wiki locally