Sending a serial command from ESPeasy to Arduino

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
EDsteve
Normal user
Posts: 61
Joined: 11 May 2018, 21:13

Sending a serial command from ESPeasy to Arduino

#1 Post by EDsteve » 28 Jun 2018, 21:43

Hi,

I want to control an Arduino from a Wemos D1 via TX/RX commands.
So i have to generate a serial command first from the Wemos side. The Arduino is connected to the Tx/Rx pins and should receive the commands.
According to the wiki: https://www.letscontrolit.com/wiki/inde ... _Reference it seems simple to generate a serial command. So my rules look like this:

Code: Select all

on wemosUP#State do
if [wemosUP#Switch]=1
<TurnOn>
endif
endon
But when the wemosUP switch becomes 1. Nothing happens. Shouldn't i see the <TurnOn> in the Log?

Hope someone can point out my mistake.

Cheers
ED

P.S.: Is there another way to send commands to an Anrduino besides the serial communication?

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Sending a serial command from ESPeasy to Arduino

#2 Post by grovkillen » 28 Jun 2018, 21:54

The wiki tells you that you can talk to the ESP using commands. And yes if you send serial "TurnOn" it would be seen in the log of the ESP.

To send serial data you would need to use Ser2Net: https://www.letscontrolit.com/wiki/index.php/Ser2Net
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

wim16
Normal user
Posts: 88
Joined: 01 May 2017, 20:35

Re: Sending a serial command from ESPeasy to Arduino

#3 Post by wim16 » 28 Jun 2018, 21:56

The wiki page you refer to is about sending commands to ESPEasy.
I think in your case you should use a serial server device. Do not have any experience with that myself but you may find some info on the forum.

User avatar
EDsteve
Normal user
Posts: 61
Joined: 11 May 2018, 21:13

Re: Sending a serial command from ESPeasy to Arduino

#4 Post by EDsteve » 28 Jun 2018, 22:43

Thanks for the info. I didn't expect it will become that complicated.
Hmm. In my case it's easier to just write my own code before i start compiling a new ESPeas bin file.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Sending a serial command from ESPeasy to Arduino

#5 Post by grovkillen » 28 Jun 2018, 23:22

Just use the plugin "Communication - Serial Server" as I suggested.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

User avatar
EDsteve
Normal user
Posts: 61
Joined: 11 May 2018, 21:13

Re: Sending a serial command from ESPeasy to Arduino

#6 Post by EDsteve » 29 Jun 2018, 00:55

Oh. I was blind before... there it is. Already installed plugin.

Thanks a lot for writing again

User avatar
EDsteve
Normal user
Posts: 61
Joined: 11 May 2018, 21:13

Re: Sending a serial command from ESPeasy to Arduino

#7 Post by EDsteve » 29 Jun 2018, 13:21

Without proper documentation that Serial Server doesn't help much. I spend a good hour to get it running... nothing.
Here my settings if someone actually knows how to use it:

Rules (I know it's publishing a MQTT... but that should work according to the few examples i found which mostly didn't work either):

Code: Select all

on SerialRAW do
if [wemosUP#Switch]=1
Do something
publish /123 test
endif
endon
serial.PNG
serial.PNG (22.34 KiB) Viewed 19217 times

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Sending a serial command from ESPeasy to Arduino

#8 Post by grovkillen » 29 Jun 2018, 13:57

Try lower bit rate and the "Do something" is not actually in you rule right? And the Publish command is missing a comma.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

User avatar
EDsteve
Normal user
Posts: 61
Joined: 11 May 2018, 21:13

Re: Sending a serial command from ESPeasy to Arduino

#9 Post by EDsteve » 29 Jun 2018, 15:11

Thanks for the comma. I also lowered the bit rate to 4 and the rules look like this now:

Code: Select all

on SerialRAW do
if [wemosUP#Switch]=1
publish /123, test
endif
endon
But nothing is happening in the Log...
It only shows this when i turn the switch to 1:
EVENT: wemosUP#Switch=1.00

If i want to send TurnOn to serial (which is my aim). What is the command for it? Isn't there something like "serialsend" or so?

Does anybody has a working example i can take a look at? Or is there a documentation somewhere?

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Sending a serial command from ESPeasy to Arduino

#10 Post by grovkillen » 29 Jun 2018, 16:33

The serial server is not being taken care of for a long time. I will think we need to revamp it a bit before I start to document it.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

User avatar
EDsteve
Normal user
Posts: 61
Joined: 11 May 2018, 21:13

Re: Sending a serial command from ESPeasy to Arduino

#11 Post by EDsteve » 29 Jun 2018, 17:37

Hmm. Guess there is not much demand for it :(

I am not much of a coder, but good in testing :)
If i can do something for it. Let me know.

So for now i will go back to my own code. Thanks for your support though

wim16
Normal user
Posts: 88
Joined: 01 May 2017, 20:35

Re: Sending a serial command from ESPeasy to Arduino

#12 Post by wim16 » 30 Jun 2018, 10:38

If you want a rule to execute when the switch changes state you must use that as the on condition instead of serial#raw
So:

Code: Select all

on [wemosUP#Switch]=1
publish /123, test
endon

User avatar
EDsteve
Normal user
Posts: 61
Joined: 11 May 2018, 21:13

Re: Sending a serial command from ESPeasy to Arduino

#13 Post by EDsteve » 01 Jul 2018, 13:18

And how is the rule to send data over serial? That is the question of this thread.

raceboy
New user
Posts: 9
Joined: 20 Jun 2017, 18:16

Re: Sending a serial command from ESPeasy to Arduino

#14 Post by raceboy » 18 Jul 2019, 19:40

did you figure it out ? i need also to send serial tx/rx from ESPEasy to another device without ESPEasy.

greyser
New user
Posts: 2
Joined: 14 Jan 2020, 08:59

Re: Sending a serial command from ESPeasy to Arduino

#15 Post by greyser » 14 Jan 2020, 09:11

Hello! I want to make a gateway from my BSFrance LoRa module to WIFI using Serial2Net plugin. LoRa module has Rx and Tx pins which I connected to ESP crossover like (Rx-Tx, Tx-Rx). Also i Have MH-Z19B and BME280 connected on the same ESP. After starting ESP in log I get message: BME: no chipID detected. Also, I can't see any serial info from LoRa on a specified TCP server port. What am I doing wrong?
2-433-LoRa32u4-Ra02-LoRa-WiFi.jpg_960x960.jpg
2-433-LoRa32u4-Ra02-LoRa-WiFi.jpg_960x960.jpg (163.81 KiB) Viewed 14450 times

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Sending a serial command from ESPeasy to Arduino

#16 Post by TD-er » 16 Jan 2020, 09:15

I don't really know what you connected where.
But the BME280 is I2C, so that one should be connected to the pins you have assigned as I2C pins (default is pin 4 and 5 of the ESP)
I don't know what sketch you are running on the LoRa module, so it is hard to guess what will be output there.
If data is being sent to the standard serial port, then it will be considered as commands (like when you connect to it via a terminal program like Putty)
Also you should check the baudrate of both ports.
What pins does the CO2 sensor use? The same pins?

greyser
New user
Posts: 2
Joined: 14 Jan 2020, 08:59

Re: Sending a serial command from ESPeasy to Arduino

#17 Post by greyser » 20 Jan 2020, 14:19

TD-er wrote: 16 Jan 2020, 09:15 I don't really know what you connected where.
But the BME280 is I2C, so that one should be connected to the pins you have assigned as I2C pins (default is pin 4 and 5 of the ESP)
I don't know what sketch you are running on the LoRa module, so it is hard to guess what will be output there.
If data is being sent to the standard serial port, then it will be considered as commands (like when you connect to it via a terminal program like Putty)
Also you should check the baudrate of both ports.
What pins does the CO2 sensor use? The same pins?
I used another blank ESP as well. And it works now. In my LoRa module I use SoftwareSerial on 10, 11 pins and connect them to RX, TX of ESP. Thank you for your feedback

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 24 guests