How to Sniff binary data using ESP32

dumprec4@gmail.com
Posts: 1
Joined: Thu Apr 08, 2021 12:16 pm

How to Sniff binary data using ESP32

Postby dumprec4@gmail.com » Thu Apr 08, 2021 12:28 pm

Hi.
I have a Samsung ducted AC, with it's indoor unit installed in the roof void of house.
Then there is a wired controller on my wall that sends signals to the AC indoor unit over two wires (F3,F4).

I want to replace this wired controller and use ESP32 to send wired signals to the AC indoor unit using digital outputs.

So, I want to have an app in my android phone that will tell ESP32 (over wi-fi) how to control the AC (over the wired cables).
Phone ----------(wifi)------> ESP32 ----------(wired)--------->AC indoor unit.

However before that can be done, I will have to know what binary signals the existing wired controller sends to the AC.
Is there any way to first use ESP32 to sniff the signals sent by wired controller? (may be by connecting ESP32 Digital inputs to existing wired controller F3,F4 wires and sniff various binary codes (e.g. for temperature decrease, increase, On, Off, Fan On, Fan Off etc.)?

Is that possible, or did I got it all wrong?

Thanks.

Samsung Duct S Air conditioner details:
Indoor unit: AC120HBHFKH/SA
Outdoor unit: AC120HCAFKH/SA
Wired Remote Control: MWR-WE10

User avatar
fasani
Posts: 196
Joined: Wed Jan 30, 2019 12:00 pm
Location: Barcelona
Contact:

Re: How to Sniff binary data using ESP32

Postby fasani » Tue Aug 17, 2021 8:41 am

It sounds doable.
But IMHO the best way to "sniff" this will be using a logic analyzer and connect it directly to the USB of your computer.

I've sniffed some time ago SPI using ESP32 as an slave: https://github.com/martinberlin/esp32-spi-slave

Bu I'm not sure if that will help. I would get a 10 $ logic analyzer and go the safe road. Another thing will be to get what is the protocol for that device and also to check if there is some existing library to control it.
epdiy collaborator | http://fasani.de Fan of Espressif MCUs and electronic design

ESP_Sprite
Posts: 9708
Joined: Thu Nov 26, 2015 4:08 am

Re: How to Sniff binary data using ESP32

Postby ESP_Sprite » Wed Aug 18, 2021 1:08 am

Note that these signals tend to be 'something' superimposed on the 12VDC that feeds the remote controller, so connecting it directly to an ESP will make things go boom quick-fast-in-a-hurry. I've happened to do some research into aircos (I have an old Mitsubishi here) and what I've seen is 12V with pulses going up and down layered on top (HomeBus, same as Daikin uses), 12V with a superimposed 50KHz OOK-modulated serial signal, as well as 12V with a superimposed 41KHz remote-control like (1/4th on + 3/4th off = 0, 3/4th on + 1/4th off = 1) signal. All these mean you need to have some kind of interface before you feed things into your ESP: either a specialized interface chip or a simple analog signal to demodulate OOK signals.

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: How to Sniff binary data using ESP32

Postby rudi ;-) » Tue Sep 21, 2021 9:33 pm

dumprec4@gmail.com wrote:
Thu Apr 08, 2021 12:28 pm
I will have to know what binary signals the existing wired controller sends to the AC.

Samsung Duct S Air conditioner details:
Indoor unit: AC120HBHFKH/SA
Outdoor unit: AC120HCAFKH/SA
Wired Remote Control: MWR-WE10

Wired Remote Control: MWR-WE10 ?

The wired remote control is the master, the indoor units are the slaves.
The wired remote control send commands as a message of 14 bytes.
The units respond with a similar message with the same length.
The protocol can be described as follows:
<start> <src> <dst> <cmd> <data: 8 bytes> <chksum> <end>

With:
Byte Identifier Comments
----------------------------
1 Start : start of message (0x32)
2 Src : Source address
3 Dst : Destination address
4 Cmd : Command byte
5-12 Data : Data is always 8 bytes in length, unused bytes will be zero
13 Chksum : Checksum of message which is the XOR of bytes 2-12
14 End : end of message (0x34)
In an example case the address of the wired remote control is 0x84, the address of example 2 indoor units are 0x20 and 0x21.
The master sends a command to a slave, the slave responds to the master.
An example communication can look like this (all values are hex and xx represent any value):
Command:
32 84 20 53 xx xx xx xx xx xx xx xx xx 34
Reply:
32 20 84 53 xx xx xx xx xx xx xx xx xx 34
That's the easy part of the communication sniffing.
The difficult part is to find out the meaning of all commands and the meaning of al bytes for each command/response.
Command Tables...
Perhabs this helps

:mrgreen:

back to your question:

yes you can -
Danny makes it with Raspberry Pi and a RS485 -> TTL convertor
You can use ESP32 same way - check the 5V lines - cause esp is not 5V line tolerant
you can use an voltage divider in rx line ( esp side ) example
voltage divider 5v auf 3 3v.png
voltage divider 5v auf 3 3v.png (8.65 KiB) Viewed 26560 times
but not the only possible - TTL RS485 Adapter 485 UART Seriell 3.3V 5 Volt Level Konverter Modul Arduino

hope this helps
best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: How to Sniff binary data using ESP32

Postby rudi ;-) » Tue Sep 21, 2021 10:01 pm

dumprec4@gmail.com wrote:
Thu Apr 08, 2021 12:28 pm

However before that can be done, I will have to know what binary signals the existing wired controller sends to the AC.
Is there any way to first use ESP32 to sniff the signals sent by wired controller? (may be by connecting ESP32 Digital inputs to existing wired controller F3,F4 wires and sniff various binary codes (e.g. for temperature decrease, increase, On, Off, Fan On, Fan Off etc.)?

Is that possible, or did I got it all wrong?

Samsung Duct S Air conditioner details:
Indoor unit: AC120HBHFKH/SA
Outdoor unit: AC120HCAFKH/SA
Wired Remote Control: MWR-WE10
Hi
Back to your Question.
firstly you should check what power supply the lines are, so g**g*e bring many things to the MWR-WE10
Handbooks divers language
Service Manual with Errorcodes, PCB, Wiring Diagram, Shematics..

you see on PCB S.34 the protocoll type 485 on F3, F4
inside_485_F3_F4.png
inside_485_F3_F4.png (1.32 MiB) Viewed 26547 times

on the PCB S.35, you can see the 485 TTL to the F3, F4
485_ttl.png
485_ttl.png (81.47 KiB) Viewed 26547 times


From the PCB ( VCC 5V 485 ) should F3,F4 Modbus be 5V.
All what you have to do is
-first check this V5 right?
-use 5V TTL Modbus Converter to ESP32
- sniff the Data with it
( How to make MODBUS work with ESP32 - Arduino - RS485 - Part 1)
use Logic Analyzer for 10 USD for the protokoll on USB / PC and you can listen to the commands and make your own data sniff protokoll which you then use for the communciation between ESP32 and Modbus 485 F3, F4 over 5V-3.3V Level Shifter ..

Hope this helps.
Try by self -you learn more at this point

best wishes
and happy coding
rudi ;-)
Attachments
SAMSUNG-MWR-WE10-BACKLIT-CONTROLLER-DUCTED.pdf
Service Manual
with PCB,Wiring Diagram,Shematic
(10.68 MiB) Downloaded 465 times
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
fasani
Posts: 196
Joined: Wed Jan 30, 2019 12:00 pm
Location: Barcelona
Contact:

Re: How to Sniff binary data using ESP32

Postby fasani » Wed Sep 22, 2021 5:48 am

Wow Rudi, what a good detailed answer (takes his hat off)
epdiy collaborator | http://fasani.de Fan of Espressif MCUs and electronic design

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: How to Sniff binary data using ESP32

Postby rudi ;-) » Fri Sep 24, 2021 3:28 pm

fasani wrote:
Wed Sep 22, 2021 5:48 am
Wow Rudi, what a good detailed answer (takes his hat off)
..i did forget the TOQ ( thread-opener-question ) :D
How to Sniff binary data using ESP32?
possible to use esp32 as an Logic Analyzer it self:

https://www.esp32.com/viewtopic.php?t=3995#p18041
viewtopic.php?t=14135
https://github.com/EUA/ESP32_LogicAnalyzer
https://specific.solutions.limited/proj ... c-analyzer
https://www.pschatzmann.ch/home/2021/04 ... the-esp32/

nice weekend!
(g'sund bleib'n)

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

Who is online

Users browsing this forum: No registered users and 11 guests