Fixing Aliexpress RS485 Modbus to Ethernet Gateway

On AliExpress you’ll find many interesting solutions to enhance you smart-home installation without spending too much money.

On one of my journeys, I stumbled across a little module, that will connect a RS485-Modbus installation to Ethernet. Together with a range of digital and analog I/O-modules from the same seller that can all be mounted to DIN-rail, this sounded like a nice solution to get my magnetic window contacts into Home-Assistant.

There are many different products that solve the same issue. The one I bought is based on the GT1001 Ethernet-to-TTL server. Vendor “eltechsup” combines it with a RS485 converter an a PCB with “ET69C02” written on it. You can get it in a nice DIN-rail mount enclosure.

eltechsup ET69C02 Modbus-to-Ethernet gateway

More details about the GT1001: http://gkwiki.cn/doku.php?id=gt1001 (Chinese, use Google translate!)

The tricky part of the Modbus RTU protocol

RS485 Half-Duplex communication uses a differential pair of data lines for both sending and receiving. This requires the transceivers to switch between sending and receiving, which is usually done with a dedicated “TX-enable” pin.
Modbus-RTU specifies the time between two packets to be “minimum 3.5 bit times”. So, after [3.5 / baudrate] seconds, you have to expect to receive an answer from a slave.
Latest after that time, the “TX-enable” pin should be inactive again, as the connected transceiver will otherwise drive against the other transceiver that just wants to send an answer.

The issue with the GT1001

Unfortunately, I always had communication issues using the ET69C02 / GT1001 module. I found it to be caused by the GT1001 firmware not correctly implementing the TX-enable pin.

I have the system configured for 9600 baud. An answer can therefore be expected after 365µs. But the GT1001 holds TX-enable high for almost 2ms!

TX: Output of GT1001; A+: Output of ET69C02; RX: Input into GT1001; TXEN: TX-enable pin of GT1001

As can be seen in the screenshot above, the first two bytes sent by the slave are messed-up. (I didn’t have a second analog channel to measure the RS485 “B” signal). The decoded RX shows the first byte is missing completely and the second is corrupted.

Possible solution: Firmware update

The best solution would be to update the firmware of the GT1001. At that time, the website linke above provided firmware version V1.15, but an update didn’t solve the issue. Thefore, I contacted the e-mail listed on the website and promptly got a new version V1.16. (Wow, thanks!)

Upgrade procedure: To do an upgrade, you need to take the module out of the enclosure and pull the CFG pin low during power-up. CFG is pin 15 of the GT1001 module and is right next to the pin labeled TXD on that separate 3-pin header. You may need to try multiple times as pulling it low for too long didn’t seem to work for me. You are successful, if the red and green LEDs are continuously blinking alternately.

After that, go to the IP address 192.168.0.10, and you’ll get an upload-form to provide your binary file for the firmware-upgrade. (As well as for the initial setup, you may need to change your computers IP address to 192.168.0.1 in order to do so.)

But even this update to V1.16 didn’t solve the issue.

My hardware fix

My solution: Hardware fix

As I didn’t get any more answer after firmware V1.16 still did not work, I searched for alternatives and found an almost pin-compatible RS485 transceiver that support auto-direction: Texas Instruments THVD1406. I replaced the existing WS3085 IC with the THVD1406. (I lifted the SHDN pin up and did not solder it).

And: Tah-dah! Works right away! 🙂

Equinox Clock

Full view of the diamond shaped Equinox draft

For some time now, I had the idea of building a clock made of 60 leds behind a milk-glass pane, showing the time with light.
Talking about this to some friends, I got the hint to search for the “Equinox Clock”.
And yes, I found it and was fascinated of this design mady by Bram Knaapen, see it here: Equinox Clock.
Unfortunately every detail in his great design exceeded our own ideas, so that we finally decided to build a clock copying his design, together with some fellow students.
(‘Copying’ is always such a bad word, but yeah its true.. 😉 )

So this will be a report showing how we rebuild something based on the images and videos shown here.
What did we do until now?

Continue reading “Equinox Clock”