Page 1 of 1
How to use a serial port in a custom plugin? (for new RESOL plugin)
Posted: 28 Apr 2016, 14:13
by chunter1
I would like to write a plugin for a solar collector controller from RESOL. (DeltaSol Pro)
The controller has a serial port and sends temperature and status data periodically.
What i need is an advice how to correctly implement a serial port in an ESPEasy plugin that receives data also in the background.
I found a plugin using "#include <SoftwareSerial.h>" but i am not sure if it can be used to capture data arriving periodically?
Re: How to use a serial port in a custom plugin? (for new RESOL plugin)
Posted: 28 Apr 2016, 20:47
by miim
Hi chunter1
you should use SoftwareSerial.h
only if you need a
second serial port on the esp8266: it simulates a software serial port with a gpio.
It works very well for me, but it is not robust to interferences/glitches...
e.g.
http://www.esp8266.nu/forum/viewtopic.p ... 1087#p5915
If you need only one serial port, just use Serial.begin
e.g.
https://github.com/ESP8266nu/ESPEasy/bl ... Serial.ino
https://github.com/ESP8266nu/ESPEasy/bl ... er2Net.ino
b.r.
miim
Re: How to use a serial port in a custom plugin? (for new RESOL plugin)
Posted: 29 Apr 2016, 00:57
by chunter1
Is it correct, that with your plugin i can connect the serial output of a device to a ESP8266 pin and the data will be available in a terminal that connects to the espeasy onthe specified TCP port?
What terminal do you recommend for testing?
I tried putty using telnet and the specified port - however there is no data coming in.
I guess telnet is the wrong thing to use?
Re: How to use a serial port in a custom plugin? (for new RESOL plugin)
Posted: 29 Apr 2016, 19:51
by miim
Hi chunter1
as I wrote before, do not use my plugin _P030_swser.ino with SoftwareSerial, which is not trivial.
Use the standard ser2net plugin, which is not mine.
https://github.com/ESP8266nu/ESPEasy/bl ... er2Net.ino
It is much easier and more stable; use my plugin only if you need 2 serial ports at the same time.
You set the port at which you want to connect e.g. 1234, then you connect with telnet, or what you want to the port
e.g.
if you have a unix laptop and you are receiving hex code
for _P020_Ser2Net.ino use IO01(D10) and IO03(D9)
for my _P030_swser.ino use IO14(D5) and IO12(D6)