Hello, I thought people here might be interested in a review of the 
serial-to-Ethernet adaptor I recently added to our Weewx configuration.

We started with a Davis Vantage Pro+ in 2003, and upgraded to Vantage Pro2+ 
in 2013.  We've been using Weewx since 2013 with the Davis serial 
interface, and we like it a lot.

I'll talk about (1) the adaptor; (2) a fix and (3) a workaround for 
problems I've seen; and (4) the reason for the move from serial to TCP/IP 
communication.


1. The serial-to-Ethernet adaptor

There are adaptors that are very inexpensive, but I decided I would prefer 
an industrial one.  A relatively low-cost option is the StarTech.com 
*NETRS2321POE* with one DB9 port and one RJ45 jack.  It comes with a wall 
wart, but a selling point for me was POE (power over Ethernet) so I don't 
need another wart near the Vantage console.

The adaptor has a very basic built-in web server for configuration.  See 
the attached screenshot for my configuration.  You need to be patient, and 
sometimes you need to login again and re-enter your changes, before they 
stick.  I've seen other firmware like that, unfortunately.  Once the 
configuration is set, the adaptor does retain the configuration across 
power cycles.

Of course there are security concerns.  All of this equipment sits inside a 
very restrictive firewall.  I would never allow this adaptor to be 
accessible from the Internet.


2. Fix for occasional timeouts

I did see occasional error messages from Weewx, but I found that adjusting 
time delays in weewx.conf cleared that up.  I'm grateful to this forum for 
providing the information I needed for this fix.

Summary of changes to weewx.conf for the adaptor:

   - Change *type* from *serial* to *ethernet* 
   - Change *host* to the IP address configured in the adaptor
   - If you see Weewx log messages "ip-read error: timed out":
      - Increase *tcp_send_delay* from 0.5, I settled on 1.8 (seconds)
      - Change *timeout* from 4 to 5 (seconds) ... not sure this one is 
      needed
   
That's it.


3.  Workaround for startup problem

I found that any time Weewx restarts, or the Linux server restarts, then 
Weewx and the Davis console will exchange messages, but Weewx will give up 
with an error exit.

The error messages in the system log are misleading.  Systemd says 
"status=4/NOPERMISSION" and Weewx self.socket.connect() says 
"socket.timeout: timed out".  But the Linux tcpdump utility, snooping 
packets on the Ethernet, shows several messages in both directions between 
computer and adaptor, while Weewx is trying to start.  One solution is easy 
-- just power-cycle the adaptor, and Weewx starts right up.  That's not a 
good solution.

I did not dig into this problem.  Instead I wrote a small Linux shell 
script that resets the adaptor.  Several weeks of experience showed that I 
need to call the script from weewx, just before the 'try' block where weewx 
establishes communication with the Davis weather station (in engine.py).  

Now weewx runs without errors, for months at a time.

I'll attach the script as a text file, in case anybody finds a use for it. 
 See the comments in the script for more details.


4. Why use a serial-to-Ethernet adaptor?

In two words:  Dropped characters.

Late last year, I upgraded our Linux server (3.2 GHz 'Haswell' Pentium, 8 
GiB memory) from an ancient 3.x kernel to a more modern 5.x kernel.  Not 
long after the upgrade, I saw dropped characters on several of the RS-232 
devices attached to this computer.  

I tried two different Linux distros, with the same problem.  We settled on 
Debian 11 with the 5.10 kernel.  I suspect an issue in the kernel -- 
perhaps in the Linux perf subsystem, and I have experimented with the 
/proc/sys/kernel/perf* parameters -- but I don't have time to do more 
troubleshooting.

So I went straight to TCP/IP over Ethernet, and that solved the problem for 
Weewx -- which is the most important application on this server.

For other devices, I bought 'Gearmo' USB-to-serial converters based on the 
FTDI chip.  They do help, but there are still occasional dropped characters.

--Old Guy Yelling At A Cloud

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/929fc176-d6a1-4e51-a2af-7da588833845n%40googlegroups.com.

Attachment: reset_netrs2321poe.sh.txt
Description: application/shellscript

Reply via email to