Teardown of this energy meter from AliExpress.
This looks like a very nice and full featured circuit breaker/energy meter called "HiDANCE".
The build quality is excellent, and the screen looks very nice, and it has a complete set of features.
Opening the device is simple, just 2 screws, except these are torx T10 screws... just for something different!
I also had to cut the sticker on the side with a blade.
Construction is very nice. The daughter board is conveniently connected with some pins, power electronics are arranged nicely, and this device even has a little beeper speaker thing to make audible alert noises!
The logic board is interesting. It seems to be using TuyaMCU, except it's using an extremely small SMD chip in a square package, connecting to the CB3S by UART as usual.
There appears to be some unpopulated components; a rather large 8-pin chip is missing, and very strangely, there is a second wifi antenna printed on the daughter board beside the main antenna for the wifi module.
I couldn't see the LCD driver chip, I think it's stuck under the display, but that's kinda glued down with some adhesive foam, and I didn't want to destroy it.
Now the bad news...
Trying to flash this device looks very challenging... the TX/RX tracks disappear under the wifi module, and lead directly to the tiny microcontroller. In order to flash this, the TX/RX lines will need to be cut somewhere... but where?
The microcontroller is MUCH too small to attack with a soldering iron, and removing the wifi module completely is very difficult with a soldering iron; much easier with a hot air station!
Sadly, it gets worse.
I turned it on to try and capture the MCU comms. As with other power metering devices, they always seem to detect that the mains power is disconnected, and the software just says "OFF" or something to that effect and there is no interesting comms.
I figured I'd have to capture the comms while on mains power.
To do this, I broke out TX/RX and connected the RX pin on the wifi module to the RX pin on my USB UART module to snoop comms from the Tuya->wifi... the instant I connected the wire, *POP*, the wifi module is very dead, there is now a short circuit from 3.3V to GND across the wifi module.
It also destroyed my USB TTL device, and the USB bus in my monitor! >_<
Thankfully it didn't destroy the USB bus in my PC which the monitor was connected to.
So, that sucks! I guess there was a huge voltage difference between the UART pins of the 2 devices. I've sniffed several devices this way before, normally works. I'm not sure how the voltages could be so hugely different between the 2 devices?
It raises an important question... what is the proper way to do this? I've never really liked snooping comms from devices while connected to mains, but I couldn't think of another way. How can I connect a device to mains and snoop the UART bus safely without blowing anything else up?
I'm tempted to buy another one of these and try again because I really like the device... but it seems like a particularly tricky device to modify, and probably not one to recommend to people who are not experts.
Since many TuyaMCU devices make it particularly difficult to flash, I'd suggest that maybe it should be considered a recommended approach to flash these devices using SPI instead of RS232? I successfully flashed another device using SPI, although it was difficult because the process is not clearly documented. It works, so maybe it should be promoted and the process improved? It feels bad to recommend people cut traces, or remove small SMD components when most people have very little soldering experience. It's not a good look for the ecosystem.
Breaking out the SPI pins is much simpler and less error-prone, it should be recommended in these cases so users are less likely to destroy their equipment.
![[BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter [BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter](https://obrazki.elektroda.pl/9822362400_1672753372_thumb.jpg)
![[BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter [BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter](https://obrazki.elektroda.pl/1460484700_1672753391_thumb.jpg)
This looks like a very nice and full featured circuit breaker/energy meter called "HiDANCE".
The build quality is excellent, and the screen looks very nice, and it has a complete set of features.
![[BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter [BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter](https://obrazki.elektroda.pl/6113538300_1672753164_thumb.jpg)
![[BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter [BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter](https://obrazki.elektroda.pl/3005576300_1672753193_thumb.jpg)
Opening the device is simple, just 2 screws, except these are torx T10 screws... just for something different!
I also had to cut the sticker on the side with a blade.
![[BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter [BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter](https://obrazki.elektroda.pl/4476915400_1672753931_thumb.jpg)
![[BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter [BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter](https://obrazki.elektroda.pl/7424330700_1672753957_thumb.jpg)
Construction is very nice. The daughter board is conveniently connected with some pins, power electronics are arranged nicely, and this device even has a little beeper speaker thing to make audible alert noises!
![[BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter [BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter](https://obrazki.elektroda.pl/7551506400_1672753996_thumb.jpg)
![[BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter [BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter](https://obrazki.elektroda.pl/3100808100_1672754115_thumb.jpg)
![[BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter [BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter](https://obrazki.elektroda.pl/5345523600_1672754131_thumb.jpg)
The logic board is interesting. It seems to be using TuyaMCU, except it's using an extremely small SMD chip in a square package, connecting to the CB3S by UART as usual.
There appears to be some unpopulated components; a rather large 8-pin chip is missing, and very strangely, there is a second wifi antenna printed on the daughter board beside the main antenna for the wifi module.
![[BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter [BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter](https://obrazki.elektroda.pl/5452641700_1672754432_thumb.jpg)
![[BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter [BK7231N / CB3S] HiDANCE AT2P - "HD Color Screen" DIN-rail relay/energy meter](https://obrazki.elektroda.pl/1398185300_1672754451_thumb.jpg)
I couldn't see the LCD driver chip, I think it's stuck under the display, but that's kinda glued down with some adhesive foam, and I didn't want to destroy it.
Now the bad news...
Trying to flash this device looks very challenging... the TX/RX tracks disappear under the wifi module, and lead directly to the tiny microcontroller. In order to flash this, the TX/RX lines will need to be cut somewhere... but where?
The microcontroller is MUCH too small to attack with a soldering iron, and removing the wifi module completely is very difficult with a soldering iron; much easier with a hot air station!
Sadly, it gets worse.
I turned it on to try and capture the MCU comms. As with other power metering devices, they always seem to detect that the mains power is disconnected, and the software just says "OFF" or something to that effect and there is no interesting comms.
I figured I'd have to capture the comms while on mains power.
To do this, I broke out TX/RX and connected the RX pin on the wifi module to the RX pin on my USB UART module to snoop comms from the Tuya->wifi... the instant I connected the wire, *POP*, the wifi module is very dead, there is now a short circuit from 3.3V to GND across the wifi module.
It also destroyed my USB TTL device, and the USB bus in my monitor! >_<
Thankfully it didn't destroy the USB bus in my PC which the monitor was connected to.
So, that sucks! I guess there was a huge voltage difference between the UART pins of the 2 devices. I've sniffed several devices this way before, normally works. I'm not sure how the voltages could be so hugely different between the 2 devices?
It raises an important question... what is the proper way to do this? I've never really liked snooping comms from devices while connected to mains, but I couldn't think of another way. How can I connect a device to mains and snoop the UART bus safely without blowing anything else up?
I'm tempted to buy another one of these and try again because I really like the device... but it seems like a particularly tricky device to modify, and probably not one to recommend to people who are not experts.
Since many TuyaMCU devices make it particularly difficult to flash, I'd suggest that maybe it should be considered a recommended approach to flash these devices using SPI instead of RS232? I successfully flashed another device using SPI, although it was difficult because the process is not clearly documented. It works, so maybe it should be promoted and the process improved? It feels bad to recommend people cut traces, or remove small SMD components when most people have very little soldering experience. It's not a good look for the ecosystem.
Breaking out the SPI pins is much simpler and less error-prone, it should be recommended in these cases so users are less likely to destroy their equipment.