Serial connection in place of wifi, challenges

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
oisisi
Normal user
Posts: 47
Joined: 06 Jul 2016, 13:47

Serial connection in place of wifi, challenges

#1 Post by oisisi » 04 Mar 2020, 15:49

I have a Wemos d1 mini module that is struggling with wifi connectivity. There is a Raspberry Pi next to it which is doing fine. I thought I could simply hook up the Wemos to one of the Pi's USB ports and parse the serial output. I direct GPIO/UART connection does not work in my environment. I would like to use the USB connection for power and communication. This leads to two challenges:

- It seems that each plugin logs data differently. Is there a more standard way? I looked at rules to translate sensor input put it seems there is no way to write to serial. (I already use rules to create nice JSON MQTT payloads.)

- It seems the Raspberries I tried it with (with the latest buster, a tad older stretch) can't communicate with the CH340 chip. It is recognized but minicom shows no chatter. Do we still need to compile drivers or am I missing something?

Any constructive input is welcome.

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

Re: Serial connection in place of wifi, challenges

#2 Post by TD-er » 04 Mar 2020, 16:01

The logs were never meant to output data, but more for diagnostic needs.
But I guess what you're looking for is a new kind of controller that can output data to serial in some formatted way.

Something like this:
tasknr, pluginID, nr_values, val1, val2, val3, val4

And then either in CSV notation (e.g. ; as separator), or some other format.

oisisi
Normal user
Posts: 47
Joined: 06 Jul 2016, 13:47

Re: Serial connection in place of wifi, challenges

#3 Post by oisisi » 04 Mar 2020, 16:10

Yes, CSV or JSON would work. I'm ready to write something that can parse the output of my three sensors so standardized output has less priority for me. I haven't checked yet if CMDs for my RGB LED are read from the serial input but that is also something I can work around.

The bigger challenge is that serial communication via USB doesn't seem to be working with the Wemos's chip.

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

Re: Serial connection in place of wifi, challenges

#4 Post by TD-er » 04 Mar 2020, 20:09

oisisi wrote:
04 Mar 2020, 16:10
[...]
The bigger challenge is that serial communication via USB doesn't seem to be working with the Wemos's chip.
If you try to power the ESP from an USB port on a Raspberry Pi, then I would not be surprised about it.
Try to use a powered USB hub.
The ESP may take quite a big power surge when connecting to WiFi. Wouldn't be surprised if that would set the Pi into some error state.

User avatar
ThomasB
Normal user
Posts: 614
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Serial connection in place of wifi, challenges

#5 Post by ThomasB » 05 Mar 2020, 01:22

I have a Wemos d1 mini module that is struggling with wifi connectivity.
Any chance your Wemos WiFi shows a reasonable RSSI value, but it's experiencing browser access problems (slow page loading and/or timeouts)? Or too many disconnect/reconnects?

If the answer is yes, then see the tail end of this discussion:
viewtopic.php?f=6&t=7474#p42805

- Thomas

oisisi
Normal user
Posts: 47
Joined: 06 Jul 2016, 13:47

Re: Serial connection in place of wifi, challenges

#6 Post by oisisi » 05 Mar 2020, 09:22

ThomasB wrote:
05 Mar 2020, 01:22
Any chance your Wemos WiFi shows a reasonable RSSI value, but it's experiencing browser access problems (slow page loading and/or timeouts)? Or too many disconnect/reconnects?
Thanks for the hint but I don't think this applies. The module was working fine for several months. I now changed my wifi setup and it seems that now the signal is not strong enough. A serial connection would also help with troubleshooting

oisisi
Normal user
Posts: 47
Joined: 06 Jul 2016, 13:47

Re: Serial connection in place of wifi, challenges

#7 Post by oisisi » 05 Mar 2020, 09:38

TD-er wrote:
04 Mar 2020, 20:09
The ESP may take quite a big power surge when connecting to WiFi. Wouldn't be surprised if that would set the Pi into some error state.
Thanks for the remark. I measured it, the Pi supplies enough power for the module. I have the suspicion that it is the USB/serial interface which is causing issues.

Regrettably, I can not use a recent default image since I am using an IR sensor the plugin for which is not in the default images with the temperature and light sensors and the RGB LED I am also using. I compiled my own image in the past but my build environment abandoned me together with the hard drive it resided on. It will be a while until I can build a new one. Then I plan to use a Wemos d1 pro which should have better connectivity with its ceramic antenna.

oisisi
Normal user
Posts: 47
Joined: 06 Jul 2016, 13:47

Re: Serial connection in place of wifi, challenges [SOLVED]

#8 Post by oisisi » 05 Mar 2020, 11:25

I figured it out. It was rather simple. I used minicom for serial communication and one flag made the difference. I wrongly used '-d /dev/ttyUSB0' rather than '-D /dev/ttyUSB0'. Next: writing a parser and disabling wifi.

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests