For all, which want to see the values sent by a real DTSU666 or see the vlues sent by this program e.g. at the other end of the RS485 line, this repository contains a simple Modbus sniffer program. It displays the power values on a 1602 serial LCD.
Modbus reply sending at 9600 baud is done by SoftwareSerialTX.
This enables the usage of the Arduino Serial for monitoring and debugging.
Modbus receiving at 9600 baud is done by standard Arduino Serial at 9600 baud.
Monitoring output is done by switching Arduino Serial baudrate to 115200 baud,
send data, flush it and reset Arduino Serial baudrate back to 9600 baud.
During monitoring output, receiving of modbus requests is therefore disturbed!
We assume, that voltage waveform of the 3 phases are equal and negative and positive values are symmetric, so we take only one half wave as voltage reference.
Phase A is reference (the one, which supplies the voltage and which can be negative), phase B has a delay of 6.6 ms / 120 ° and C a delay of 13.3 ms / 240 °.
The Deye inverter sends a 9600 baud modbus request 01 03 15 1E 00 06 A1 C2 every 100 ms to 120 ms.
We send the reply at pin 2 with software serial at a 80 ms raster.
This means, around every 400 ms we have one loop where we do not need to reply and can update the LCD instead.
Sometimes the Deye sends the request, while we do a reply.
My installation | Display and buttons |
---|---|
Breadboard detail | Automatic brightness |
Split-core current transformers used | Deye settings |
DTSU666ModbusSniffer | |
Also usable as connection schematic.
Power page | Energy page |
---|---|
Time for Energy page | Period page |
Reference phase - positive half wave | Reference phase - negative half wave |
---|---|
6.6 ms / 120 ° delayed phase | 13.2 ms / 240 ° delayed phase |
6.6 ms / 120 ° without low-pass | 13.2 ms / 240 ° without low-pass |
Implemented with 3 x 30A split-core current transformers.
2. order low pass 1600 Hz, to suppressthe high frequency modulation of current as seen above.
____ ____ _____
o---|____|---o---|____|---o---|_____|---o-----> A1 (A2, A3)
| 1k | 1k | 10k |
Split- > | | |
core < --- --- | Schottky diode
coil > --- 100 nF --- 100 nF o-|<|-o
< | | |
__|____________|____________|___________________|__ GND
Grid voltage divider for full range (1.1 V) at 400 V.
HIGH VOLTAGE - DANGER - use heat-shrink tubing
____ ____ ____ _____
230V~ L1 >--|____|---|____|---|____|---|_____|---o-----o-----> A0
1M 1M 1M 630 k | |
_ |
| | | Schottky diode
| | o-|<|-o
|_| |
| |
__|___________|__ N (GND)
# Automatic brightness control for 1602 LCD
5V O------o------o
| |
_ |
| | |
LDR | | |
|_| |
| |/
o----|
|>
|
O To anode of LCD backlight
Download and extract the repository. In the Arduino IDE open the sketch with File -> Open... and select the Arduino-DTSU666H_PowerMeter folder.
All libraries, especially the modified ones, are included in this project.
This program uses the following libraries, which are already included in this repository:
EasyButtonAtInt01 for LCD page switching button.
See also here.
START ../src/Arduino-DTSU666H_PowerMeter.cpp
Version 1.0 from Sep 19 2023_
If you connect periodically print pin A4 to ground, Serial plotter data is printed every 2000 ms
Power correction + pin is 5
Power correction - pin is 4
LCD data is printed every (8 * 80) ms
Reference line, which can be negative is 2
Line, with 6.6 ms delay is 1
Line, with 13.3 ms delay is 3
Waiting for requests to ID MODBUS_SLAVE_ADDR with _9600_ baud at pin RX. Reply / TX is on pin 2
First waiting for voltage at line2
Power correction is 100 %