Serial communication between 2 D1 Minis

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Rob73
Normal user
Posts: 31
Joined: 25 May 2022, 15:05

Serial communication between 2 D1 Minis

#1 Post by Rob73 » 12 Sep 2023, 23:29

I am wanting to learn how to use the serial port to communicate between some devices with ESPEASY. I setup 2 d1 minis to test and learn how to do it. I attached an image of my setup. I have done a lot of reading and searching and I am confused on how to make it work. I am not having any luck receiving any data.

Will this setup work to communicate using the serial server device?
I have each d1 mini setup to have 1 device Communication - Serial Server with port HW Serial0 with the appropriate gpios for rx and tx.
I have changed it from HW serial0, HW serial1, SW Serial & I dont think they are communicating. But, to be honest, I am not sure, I dont really know what I am doing. I have tried sending commands from the tools tab, like serialsend,("Output"). I am assuming if I had it set up correctly, I would see this Output come in under values on the device tab on the device Serial Server. It gives me an OK when I issue the command, but I am guessing that just mean the command is a valid command and the syntax is correct. I have disabled the serial port console on the tools tab, enabled process events without a client.. Baud rates match at 9600, serial configs match at 8/n/1.

I want in the end to attach a d1 mini, my favorite device to use, to a rs232-ttl adapter and do some listening on the rs232 port, but I need to get the basics down first.
Can anyone point me in the right direction?

I have some experience with ESP-EASY and devices. I am using about 10 D1 Minis & ESP32-S3s with i2c devices and switches for projects. I am not totally new to it but I am just able to do simple stuff, basic sensor & switch reading & sending data to MQTT broker. I did my own coding through Arduino IDE since 2014 or so, once I stumbled upon ESP-Easy a few years back, wow it is awesome!

I have the latest build loaded on both the D1 minis that I am testing with.
Attachments
IMG_5838.jpg
IMG_5838.jpg (615.83 KiB) Viewed 1505 times

Rob73
Normal user
Posts: 31
Joined: 25 May 2022, 15:05

Re: Serial communication between 2 D1 Minis

#2 Post by Rob73 » 13 Sep 2023, 07:07

After more testing, I was able to see the serial data come in on the logging from the tools tab. So, I do know the connections are right and the setup is apparently ok. At the start, I was expecting it to show some data on the device tab, where it shows values of sensors and things. Now I am thinking serial data does not get displayed there.

Rob

User avatar
Ath
Normal user
Posts: 3521
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Serial communication between 2 D1 Minis

#3 Post by Ath » 13 Sep 2023, 08:47

Rob73 wrote: 13 Sep 2023, 07:07 After more testing, I was able to see the serial data come in on the logging from the tools tab. So, I do know the connections are right and the setup is apparently ok.
Ah, yes, but having both the SerialServer and logging enabled on the same port (see Tools/Advanced) won't really work, you'll have to disable the serial logging setting there, on both units. You can still view the logs via the web UI.
Rob73 wrote: 13 Sep 2023, 07:07 At the start, I was expecting it to show some data on the device tab, where it shows values of sensors and things. Now I am thinking serial data does not get displayed there.
Serial data is a string, by nature, and as ESPEasy doesn't really process string data yet, other than via Rules, you won't see that on the Devices page.
/Ton (PayPal.me)

Rob73
Normal user
Posts: 31
Joined: 25 May 2022, 15:05

Re: Serial communication between 2 D1 Minis

#4 Post by Rob73 » 13 Sep 2023, 17:13

A quick test with my setup, I enabled the serial port console and rebooted the receiving unit and I can still receive the Hello World message on that unit. If I have the Communication - Serial Server device enabled box checked on the devices tab, it disables my ability to connect to it through the serial port with putty but does not "appear" to interfere with the serial messages being received. So, my experience so far, the check box under serial port console doesnt seem to matter much.

What seems to be the deciding factor on whether I get serial data and can/cannot connect to the serial console with putty is having the Serial Server device enabled over on the devices tab.
If the device is enabled, I get serial data over on the web log, and the serial port wont send data to putty. Putty will connect to the device but shows no communication back and forth.
If the device is disabled, I wont get serial data to the web log and I can communicate with putty. No reboots required either way and it doesnt care what the serial console box says over on tools-advanced.
I am not saying its a good practice to not disable the serial port console though.
I may not understand what you mean when you state "disable the serial logging setting there, on both units"... Is that the Enable Serial Port Console box? or one menu item up in Log Settings? There is a Serial Log Level there that can be set to none.

I have some more tinkering to do.

Rob

User avatar
Ath
Normal user
Posts: 3521
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Serial communication between 2 D1 Minis

#5 Post by Ath » 13 Sep 2023, 20:15

Rob73 wrote: 13 Sep 2023, 17:13 A quick test with my setup, I enabled the serial port console and rebooted the receiving unit and I can still receive the Hello World message on that unit. If I have the Communication - Serial Server device enabled box checked on the devices tab, it disables my ability to connect to it through the serial port with putty but does not "appear" to interfere with the serial messages being received. So, my experience so far, the check box under serial port console doesnt seem to matter much.
That was what I was trying to say: If you have the checkbox "Enable Serial Port Console:" enabled, then, any plugin that tries to use that same serial port, will block either the logging output via serial, or won't be able to send/receive via that port. So when configuring any plugin for serial communication on the port configured for serial logging, the serial logging port must be disabled (or configured differently) for the plugin to work correctly. Disabling the logging level for the serial port still claims that port for use by logging!
Rob73 wrote: 13 Sep 2023, 17:13 What seems to be the deciding factor on whether I get serial data and can/cannot connect to the serial console with putty is having the Serial Server device enabled over on the devices tab.
That is by design. Any plugin not enabled should not use any resources.
Rob73 wrote: 13 Sep 2023, 17:13 If the device is enabled, I get serial data over on the web log, and the serial port wont send data to putty. Putty will connect to the device but shows no communication back and forth.
If the device is disabled, I wont get serial data to the web log and I can communicate with putty. No reboots required either way and it doesnt care what the serial console box says over on tools-advanced.
I am not saying its a good practice to not disable the serial port console though.
It's a bit more than good practice, it's required, as explained above.
The log channels are processed as separate logging entities, each channel gets the logs supplied based on the level configured, and, based on available resources (serial port, a web client reading the web log, a syslog server, SD-card etc.), will process the output as implemented.
Rob73 wrote: 13 Sep 2023, 17:13 I may not understand what you mean when you state "disable the serial logging setting there, on both units"... Is that the Enable Serial Port Console box? or one menu item up in Log Settings? There is a Serial Log Level there that can be set to none.

I have some more tinkering to do.
See above.

You can use the Software Serial configuration, using GPIO pins not used for the hardware serial port, to communicate between 2 ESPEasy devices and still have logging available via USB serial. But it's similar to riding a bike, only one person is driving at a certain moment in time, it doesn't do 'multiplexing' of 2 separate channels, because it wasn't designed for that.
/Ton (PayPal.me)

Rob73
Normal user
Posts: 31
Joined: 25 May 2022, 15:05

Re: Serial communication between 2 D1 Minis

#6 Post by Rob73 » 14 Sep 2023, 02:09

Ah, I see.....

Thank you for your replies and explanations! I think I have a good enough understanding to get a good start on my project.

Thank you again!

Rob

Post Reply

Who is online

Users browsing this forum: No registered users and 28 guests