Serial to MQTT

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
sheppy
Normal user
Posts: 49
Joined: 28 Jun 2016, 05:53

Serial to MQTT

#1 Post by sheppy » 30 Aug 2016, 23:29

Is it possible to use ESP Easy to send a serial input from an Arduino onto MQTT? I see that it has a serial server option, but also that it may not be stable?

User avatar
nonflammable
Normal user
Posts: 42
Joined: 09 Mar 2016, 22:19
Location: Poland

Re: Serial to MQTT

#2 Post by nonflammable » 30 Aug 2016, 23:44

just use serial command

Code: Select all

Publish <topic>, <value> 

sheppy
Normal user
Posts: 49
Joined: 28 Jun 2016, 05:53

Re: Serial to MQTT

#3 Post by sheppy » 30 Aug 2016, 23:46

nonflammable wrote:just use serial command

Code: Select all

Publish <topic>, <value> 
Is that in the sketch that I upload to the ESP?

User avatar
nonflammable
Normal user
Posts: 42
Joined: 09 Mar 2016, 22:19
Location: Poland

Re: Serial to MQTT

#4 Post by nonflammable » 30 Aug 2016, 23:53

First configure MQTT on Config tab -> Protocol. Submit.
On Tools tab write Publish with arguments in Command field and Submit.
If it works then configure communication with Arduino - Tools tab -> Advanced.
Enable serial port: - Yes
Serial log Level: 2 or 1 or 0
Baud Rate: 9600 or your Arduino serial speed
Submit :)
Try to send from Arduino serial command Publish with arguments.
Last edited by nonflammable on 31 Aug 2016, 00:01, edited 1 time in total.

sheppy
Normal user
Posts: 49
Joined: 28 Jun 2016, 05:53

Re: Serial to MQTT

#5 Post by sheppy » 31 Aug 2016, 00:00

I've just looked at one of my working devices.
nonflammable wrote:From computer connected to ESP try to send Publish command with arguments by serial console.
Do you have an example of the Publish Command? For example

"Publish Sensor/NumberOne, 234"

I just need to send this command to the serial port and it will be sent to MQTT with no extra work? :D

User avatar
nonflammable
Normal user
Posts: 42
Joined: 09 Mar 2016, 22:19
Location: Poland

Re: Serial to MQTT

#6 Post by nonflammable » 31 Aug 2016, 00:05

Code: Select all

Publish TestValue, 10
?
You can send this on Tools tab. Write Publish with arguments in Command field and Submit.

User avatar
nonflammable
Normal user
Posts: 42
Joined: 09 Mar 2016, 22:19
Location: Poland

Re: Serial to MQTT

#7 Post by nonflammable » 31 Aug 2016, 00:07

sheppy wrote: I just need to send this command to the serial port and it will be sent to MQTT with no extra work? :D
Yes, it should work.

sheppy
Normal user
Posts: 49
Joined: 28 Jun 2016, 05:53

Re: Serial to MQTT

#8 Post by sheppy » 31 Aug 2016, 00:11

nonflammable wrote:
sheppy wrote: I just need to send this command to the serial port and it will be sent to MQTT with no extra work? :D
Yes, it should work.
Too easy - thanks!

User avatar
nonflammable
Normal user
Posts: 42
Joined: 09 Mar 2016, 22:19
Location: Poland

Re: Serial to MQTT

#9 Post by nonflammable » 31 Aug 2016, 00:16

be aware to use Serial.println or Serial.print/write with CR
Publish (and other commands) without CR may not work.

sheppy
Normal user
Posts: 49
Joined: 28 Jun 2016, 05:53

Re: Serial to MQTT

#10 Post by sheppy » 31 Aug 2016, 00:28

Since writing the post above I've flashed 2 new Huzzah's with V120 and I have them on test, if I send a command from the web interface
Publish Test 10
it works,
AND
using a different terminal program (Termite) instead of the serial monitor shipped with the Arduino IDE the publish command works from the serial port too.
It also works from the Arduino using "println"
Thanks for your help, and to everyone involved with ESP Easy for making such a great product!

sheppy
Normal user
Posts: 49
Joined: 28 Jun 2016, 05:53

Re: Serial to MQTT

#11 Post by sheppy » 09 Sep 2016, 08:20

The 2 Huzzahs have worked flawlessly for 7 days now. All I have connected is the RX and 0V pins and despite being USB equipped modules powered using the USB port from standard USB power supplies it works a charm.
Thanks to the team for writing and supporting ESP Easy

Post Reply

Who is online

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