Weewx and Arduino emulating Davis VP2 serial

631 views
Skip to first unread message

Hugo Valentim

unread,
Apr 30, 2015, 5:39:19 AM4/30/15
to weewx...@googlegroups.com

I am trying to use Weewx with WeatherDuino Pro  which is basically a custom built system around an Arduino Nano v3 using Davis VP2 serial emulation as far as communication is concerned.

I am facing some issues and knowing nothing about Python I was wondering if someone could please help me understand the nature of the problem I am facing so as to perhaps persuade the author to make some changes or tweak a Weewx driver,

This is what I know: once connected the console shows up properly as a /dev/ttyUSB0 using CH341.ko and usbserial.

A connection with minicom --baudrate 19200 --device /dev/ttyUSB0 allows to successfully issue and obtain response to a number of commands such as TEST, LOOP etc.

Once I issue a wee_config_device –info I get the following response:

Using configuration file /etc/weewx/weewx.conf
Using Vantage driver version 3.0 (weewx.drivers.vantage)
Querying...
Davis Vantage EEPROM settings:

    CONSOLE TYPE:                   VantagePro2

    CONSOLE FIRMWARE:
      Date:                         Sep 29 2009
      Version:                      1.90

    CONSOLE SETTINGS:
      Archive interval:             0 (seconds)
      Altitude:                     0 (foot)
      Wind cup type:                small
      Rain bucket type:             0.01 inches
      Rain year start:              0
      Onboard time:                 2015-04-29 22:54:39

    CONSOLE DISPLAY UNITS:
      Barometer:                    inHg
      Temperature:                  degree_F
      Rain:                         inch
      Wind:                         mile_per_hour

    CONSOLE STATION INFO:
      Latitude (onboard):           +0.0
      Longitude (onboard):          +0.0
      Use manual or auto DST?       AUTO
      DST setting:                  N/A
      Use GMT offset or zone code?  ZONE_CODE
      Time zone code:               0
      GMT offset:                   N/A

    TRANSMITTERS:
      Channel 1:                    iss
      Channel 2:                    iss
      Channel 3:                    iss
      Channel 4:                    iss
      Channel 5:                    iss
      Channel 6:                    iss
      Channel 7:                    iss
      Channel 8:                    iss

Traceback (most recent call last):
  File "/usr/bin/wee_config_device", line 43, in <module>
    main()
  File "/usr/bin/wee_config_device", line 40, in main
    device.configure(config_dict)
  File "/usr/share/weewx/weewx/drivers/__init__.py", line 65, in configure
    self.do_options(options, parser, config_dict, prompt)
  File "/usr/share/weewx/weewx/drivers/vantage.py", line 1747, in do_options
    self.show_info(station)
  File "/usr/share/weewx/weewx/drivers/vantage.py", line 1909, in show_info
    Outside Humidity:             %(outHumid)+.0f%%""" % calibration_dict
TypeError: format requires a mapping

When I try to start Weewx (service weewx start) I get this in the /var/log/syslog:

****    File "/usr/share/weewx/weewx/engine.py", line 631, in _catchup
Apr 29 22:55:59 Cloud weewx[9492]:     ****      for record in generator(lastgood_ts):
Apr 29 22:55:59 Cloud weewx[9492]:     ****    File "/usr/share/weewx/weewx/drivers/vantage.py", line 543, in genArchiveRecords
Apr 29 22:55:59 Cloud weewx[9492]:     ****      _record = self._unpackArchivePacket(_record_string)
Apr 29 22:55:59 Cloud weewx[9492]:     ****    File "/usr/share/weewx/weewx/drivers/vantage.py", line 1295, in _unpackArchivePacket
Apr 29 22:55:59 Cloud weewx[9492]:     ****      self.iss_id, raw_archive_packet['number_of_wind_samples'])
Apr 29 22:55:59 Cloud weewx[9492]:     ****    File "/usr/share/weewx/weewx/drivers/vantage.py", line 1384, in _rxcheck
Apr 29 22:55:59 Cloud weewx[9492]:     ****      _frac = number_of_wind_samples * 100.0 / _expected_packets
Apr 29 22:55:59 Cloud weewx[9492]:     ****  ZeroDivisionError: float division by zero
Apr 29 22:55:59 Cloud weewx[9492]:     ****  Exiting.

Thanks in advance for any help. 


Thomas Keffer

unread,
Apr 30, 2015, 8:50:27 AM4/30/15
to weewx-user
I had no idea the WeatherDuino existed before! Interesting project.

It looks like the author's emulation of a Vantage is not quite complete.

For the first error ("format requires a mapping"), I suspect he did not properly emulate the EEPROM values, if at all. The driver includes a check that two values are 1's complement of each other. If the author did not get that right, it would fail.

The second problem is similar. The driver was calculating the quality of the wireless reception, which requires the archive interval, which is also held in EEPROM. If you note the results of your wee_config_device --info query, a zero was returned, resulting in the division by zero error.

I'm not surprised these values are missing. Completely emulating a Vantage would be a big project. Not as big as weewx, but close!

-tk


--
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+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Werk_AG

unread,
May 1, 2015, 9:55:56 PM5/1/15
to weewx...@googlegroups.com
The WeatherDuino Pro2 weather station work with WeewX.
After some investigation, it seems that the problem could be the linux CH340 driver. On the RX unit I replaced the Arduino with the CH340 chipset by another with an FTDI chipset and it seems to solve the communications problems reported by  H. Valentim.
It even download the data from the logger without any problem.


wee_config_device --info
Using configuration file /etc/weewx/weewx.conf
Using Vantage version 3.0 (weewx.drivers.vantage)

Querying...
Davis Vantage EEPROM settings:
   
    CONSOLE TYPE
:                   VantagePro2
   
    CONSOLE FIRMWARE
:
     
Date:                         Sep 29 2009
     
Version:                      1.90
   
    CONSOLE SETTINGS
:

     
Archive interval:             300 (seconds)
     
Altitude:                     406 (meter)
     
Wind cup type:                small
     
Rain bucket type:             0.2 MM
     
Rain year start:              1
     
Onboard time:                 2015-05-02 02:25:15
     
    CONSOLE DISPLAY UNITS
:
     
Barometer:                    hPa
     
Temperature:                  degree_10F
     
Rain:                         mm
     
Wind:                         mile_per_hour
     
    CONSOLE STATION INFO
:
     
Latitude (onboard):           +39.2
     
Longitude (onboard):          -8.9
     
Use manual or auto DST?       MANUAL
      DST setting
:                  OFF
     
Use GMT offset or zone code?  ZONE_CODE
     
Time zone code:               0

      GMT offset
:                   N/A
       
    TRANSMITTERS
:
     
Channel 1:                    iss
     
Channel 2:                    iss
     
Channel 3:                    iss
     
Channel 4:                    iss
     
Channel 5:                    iss
     
Channel 6:                    iss
     
Channel 7:                    iss
     
Channel 8:                    iss



Werk_AG

Thomas Keffer

unread,
May 1, 2015, 10:01:38 PM5/1/15
to weewx-user
That is very cool! Love to build me one of those!

-tk

Hugo Valentim

unread,
May 2, 2015, 4:28:59 PM5/2/15
to weewx...@googlegroups.com
This is the tricky hardware part: Device ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

Problems with Linux are well know and  it may improve, eventually E.g.: 

[possible fix] HL-340 USB don't work correctly (ch340 based usb-rs232 adapter)


For now the lesson seems to be: if you are choosing and Arduino to use with Linux better pay a few extra bucks and get one with an original FTDI chip. 

It's worth mentioning tough that with Mono based programs one seems nevertheless able to get a solid performance out of these adapters. Same Kernel. Same driver.

Hugo Valentim

unread,
May 29, 2015, 5:15:43 AM5/29/15
to weewx...@googlegroups.com
Just to update this matter should anyone stumble on this in the future.

In the end the decisive factor to track this matter down proved to be an Real Time Clock module featuring an eeprom with a non standard device address. Hence "zeros" were in fact being returned because the eeprom was not being found and nothing was being read from it.

Once changed the address in Arduino libraries the problem was solved and WeatherDuino is in fact compatible with Weewx's Vantage drive, give or take a couple of small details the author is improving.
Reply all
Reply to author
Forward
0 new messages