Author Topic: ipwx-raspi-weewx station setup questions  (Read 18519 times)

0 Members and 1 Guest are viewing this topic.

Offline mikez104

  • Member
  • *
  • Posts: 41
Re: ipwx-raspi-weewx station setup questions
« Reply #50 on: May 06, 2015, 08:21:11 PM »
I was looking through the parser program and trying to figure out how that works.  It looks pretty straight forward.  I also was looking at the data that comes in from the listener. I can understand most of it.  Seems like the values of the readings are prefixed with an A ans some of them have a lot af extra 00s at the end.  Delimited with a &.  And you spell out the compass rose weirdness with the hex and the wind in cm/sec but what the heck is going on with the pressure?  Looking at the raw data, I just don't get how you can get anything from that.  How did you figure that one out?  Or am i missing something.

Offline nincehelser

  • Forecaster
  • *****
  • Posts: 3337
Re: ipwx-raspi-weewx station setup questions
« Reply #51 on: May 06, 2015, 08:37:39 PM »
I was looking through the parser program and trying to figure out how that works.  It looks pretty straight forward.  I also was looking at the data that comes in from the listener. I can understand most of it.  Seems like the values of the readings are prefixed with an A ans some of them have a lot af extra 00s at the end.  Delimited with a &.  And you spell out the compass rose weirdness with the hex and the wind in cm/sec but what the heck is going on with the pressure?  Looking at the raw data, I just don't get how you can get anything from that.  How did you figure that one out?  Or am i missing something.

Figuring out the the pressure data took a little bit of detective work and educated guessing.  I started searching data sheets for baro sensors that had similar characteristics.  It didn't take too long to find one where the number and names of the variables matched up.  I ran the numbers through the equations on the data sheet and found the results matched up perfectly.  A bit later another hacker disassembled their bridge and visually verified that the sensor and data sheet lined up.

http://www.hoperf.com/upload/sensor/HP03S.pdf

Offline aweatherguy

  • Senior Contributor
  • ****
  • Posts: 288
    • Weather Station Data Logger
Re: ipwx-raspi-weewx station setup questions
« Reply #52 on: May 18, 2015, 02:29:33 AM »
Others have done the RF signal decode. Try an internet search for "acurite 5n1 rf decode" to find some of them.

The rain is indeed just a counter that increments by one for every bucket tip. It is probably 13-bits wide so would count from zero to 8192 (or 81.92 inches of rain) before rolling over.


Offline nincehelser

  • Forecaster
  • *****
  • Posts: 3337
Re: ipwx-raspi-weewx station setup questions
« Reply #53 on: May 18, 2015, 07:36:25 AM »
Others have done the RF signal decode. Try an internet search for "acurite 5n1 rf decode" to find some of them.

The rain is indeed just a counter that increments by one for every bucket tip. It is probably 13-bits wide so would count from zero to 8192 (or 81.92 inches of rain) before rolling over.

Unfortunately that is not how the data comes out of the Acurite Bridge.

Offline aweatherguy

  • Senior Contributor
  • ****
  • Posts: 288
    • Weather Station Data Logger
Re: ipwx-raspi-weewx station setup questions
« Reply #54 on: May 18, 2015, 09:30:31 PM »
Sorry, just trying to help. Earlier in this thread you said:

The big question is what data the 5n1 is actually sending out the radio link.  I don't know of anyone who has decoded it that far.  Basically the 5n1 has a counter to count the bucket tips. 


And I knew the radio link has been figured out so was trying to provide that info.

Offline mikez104

  • Member
  • *
  • Posts: 41
Re: ipwx-raspi-weewx station setup questions
« Reply #55 on: May 18, 2015, 09:56:10 PM »
I tried to pull my 5n1 off the pole today to experiment with the rain buckets.  When I tried to unscrew the screw I put in to to fix the 5n1 to the pole, I snapped the head off.  :?
Yup, stainless stud sticking out of the pole securely fixing the plastic base in place.  I didn't feel like drilling it out as we were thunderstorms were on the way.  We ended up getting almost an inch and a half of rain.  Anyway, here is the question.

Do you think there is a way to read an additional sensor in the parser program?  The windspeed from my 5n1 is too low.  It is not that high up and there are trees all around.  I still have a Davis anemometer on my roof from my old system.  It still spins and is unobstructed and is 40ish feet above ground.  I got hold of the wire from the thing and spliced it to an arduino.  It reads the closures of the switch and counts them and calculates a wind speed.  The guy who came up with the program had it sending the windspeed and temp to an LCD.  I got rid of the temp code he had in there and changed it to write to the serial port instead of the LCD.  I hooked that up and can see the data on the Raspi by doing a cat /dev/ttyACM0.  Right now I have it outputting "Windspeed is XX" but could change that to anything.  The Arduino script counts the pulses for 3 seconds then averages and gives the speed. 

The readings I was getting with the Davis unit were almost twice as the 5n1 and they also were very close to the guy up on the hill behind my house.  He has a weewx site also and uses a Davis Vantage Pro2. 

So, not sure how much would be involved in adding that.  Let me know what ya think.

Thanks
Mike

Offline nincehelser

  • Forecaster
  • *****
  • Posts: 3337
Re: ipwx-raspi-weewx station setup questions
« Reply #56 on: May 18, 2015, 10:14:58 PM »
I tried to pull my 5n1 off the pole today to experiment with the rain buckets.  When I tried to unscrew the screw I put in to to fix the 5n1 to the pole, I snapped the head off.  :?
Yup, stainless stud sticking out of the pole securely fixing the plastic base in place.  I didn't feel like drilling it out as we were thunderstorms were on the way.  We ended up getting almost an inch and a half of rain.  Anyway, here is the question.

Do you think there is a way to read an additional sensor in the parser program?  The windspeed from my 5n1 is too low.  It is not that high up and there are trees all around.  I still have a Davis anemometer on my roof from my old system.  It still spins and is unobstructed and is 40ish feet above ground.  I got hold of the wire from the thing and spliced it to an arduino.  It reads the closures of the switch and counts them and calculates a wind speed.  The guy who came up with the program had it sending the windspeed and temp to an LCD.  I got rid of the temp code he had in there and changed it to write to the serial port instead of the LCD.  I hooked that up and can see the data on the Raspi by doing a cat /dev/ttyACM0.  Right now I have it outputting "Windspeed is XX" but could change that to anything.  The Arduino script counts the pulses for 3 seconds then averages and gives the speed. 

The readings I was getting with the Davis unit were almost twice as the 5n1 and they also were very close to the guy up on the hill behind my house.  He has a weewx site also and uses a Davis Vantage Pro2. 

So, not sure how much would be involved in adding that.  Let me know what ya think.

Thanks
Mike

That shouldn't be too hard. 

Quick and dirty, just before the wxdata file is written, I'd read the windspeed using /dev/ttyACM0 as the input and write that value to wxdata instead of the value from the 5n1.

Offline mikez104

  • Member
  • *
  • Posts: 41
Re: ipwx-raspi-weewx station setup questions
« Reply #57 on: May 19, 2015, 06:16:23 PM »
One would think that would be easy...  and it may be if you know how to program.  Unfortunatly I do not.  I looked around for some code and found some that works but it reads the usb port forever and never moves on to write the file.  Here is what I have.  I added this to the top and it seems to work fine.
Code: [Select]
use Device::SerialPort;

my $port = Device::SerialPort->new("/dev/ttyACM0");
$port->databits(8);
$port->baudrate(9600);
$port->parity("none");
$port->stopbits(1);

But here is where I am stuck.  The original code reads like this, and it loops forever.
Code: [Select]
while(1) {
  my $byte=$port->read(1);
  print "$byte";
}

If I try this, it just errors out and I'm not sure where to go from here.
Code: [Select]
  my $byte=$port->read(1);
$windspeed = $byte


Offline mikez104

  • Member
  • *
  • Posts: 41
Re: ipwx-raspi-weewx station setup questions
« Reply #58 on: June 06, 2015, 01:53:42 PM »
Hey George, Have you ever run into this one?  My raspberry pi was unresponsive this morning so I power cycled it and when it came back up it looked at the syslog and this is what it is doing when it tries to start weewx.

Code: [Select]
Jun  6 13:47:01 weatherpi /USR/SBIN/CRON[2775]: (root) CMD (/home/ipwx/./watchdog)
Jun  6 13:47:02 weatherpi weewx[2793]: engine: Initializing weewx version 3.1.0
Jun  6 13:47:02 weatherpi weewx[2793]: engine: Using Python 2.7.3 (default, Mar 18 2014, 05:13:23) #012[GCC 4.6.3]
Jun  6 13:47:02 weatherpi weewx[2793]: engine: pid file is /var/run/weewx.pid
Jun  6 13:47:02 weatherpi weewx[2795]: engine: Using configuration file /etc/weewx/weewx.conf
Jun  6 13:47:02 weatherpi weewx[2795]: engine: Loading station type Simulator (weewx.drivers.simulator)
Jun  6 13:47:02 weatherpi weewx[2795]: engine: StdConvert target unit is 0x1
Jun  6 13:47:02 weatherpi /USR/SBIN/CRON[2774]: (CRON) info (No MTA installed, discarding output)
Jun  6 13:47:02 weatherpi weewx[2795]: engine: Archive will use data binding wx_binding
Jun  6 13:47:02 weatherpi weewx[2795]: engine: Record generation will be attempted in 'hardware'
Jun  6 13:47:02 weatherpi weewx[2795]: engine: Using archive interval of 60 seconds
Jun  6 13:47:02 weatherpi weewx[2795]: engine: Caught unrecoverable exception in engine:
Jun  6 13:47:02 weatherpi weewx[2795]:     ****  database disk image is malformed
Jun  6 13:47:02 weatherpi weewx[2795]:     ****  Traceback (most recent call last):
Jun  6 13:47:02 weatherpi weewx[2795]:     ****    File "/usr/share/weewx/weewx/engine.py", line 831, in main
Jun  6 13:47:02 weatherpi weewx[2795]:     ****      engine = EngineClass(config_dict)
Jun  6 13:47:02 weatherpi weewx[2795]:     ****    File "/usr/share/weewx/weewx/engine.py", line 77, in __init__
Jun  6 13:47:02 weatherpi weewx[2795]:     ****      self.loadServices(config_dict)
Jun  6 13:47:02 weatherpi weewx[2795]:     ****    File "/usr/share/weewx/weewx/engine.py", line 141, in loadServices
Jun  6 13:47:02 weatherpi weewx[2795]:     ****      self.service_obj.append(weeutil.weeutil._get_object(svc)(self, config_dict))
Jun  6 13:47:02 weatherpi weewx[2795]:     ****    File "/usr/share/weewx/weewx/engine.py", line 504, in __init__
Jun  6 13:47:02 weatherpi weewx[2795]:     ****      self.setup_database(config_dict)
Jun  6 13:47:02 weatherpi weewx[2795]:     ****    File "/usr/share/weewx/weewx/engine.py", line 602, in setup_database
Jun  6 13:47:02 weatherpi weewx[2795]:     ****      dbmanager = self.engine.db_binder.get_manager(self.data_binding, initialize=True)
Jun  6 13:47:02 weatherpi weewx[2795]:     ****    File "/usr/share/weewx/weewx/manager.py", line 833, in get_manager
Jun  6 13:47:02 weatherpi weewx[2795]:     ****      self.manager_cache[data_binding] = open_manager(manager_dict, initialize)
Jun  6 13:47:02 weatherpi weewx[2795]:     ****    File "/usr/share/weewx/weewx/manager.py", line 915, in open_manager
Jun  6 13:47:02 weatherpi weewx[2795]:     ****      manager_dict['schema'])
Jun  6 13:47:02 weatherpi weewx[2795]:     ****    File "/usr/share/weewx/weewx/manager.py", line 139, in open_with_create
Jun  6 13:47:02 weatherpi weewx[2795]:     ****      dbmanager = cls(connection, table_name=table_name, schema=schema)
Jun  6 13:47:02 weatherpi weewx[2795]:     ****    File "/usr/share/weewx/weewx/manager.py", line 1052, in __init__
Jun  6 13:47:02 weatherpi weewx[2795]:     ****      super(DaySummaryManager, self).__init__(connection, table_name, schema)
Jun  6 13:47:02 weatherpi weewx[2795]:     ****    File "/usr/share/weewx/weewx/manager.py", line 71, in __init__
Jun  6 13:47:02 weatherpi weewx[2795]:     ****      self.sqlkeys = self.connection.columnsOf(self.table_name)
Jun  6 13:47:02 weatherpi weewx[2795]:     ****    File "/usr/share/weewx/weedb/sqlite.py", line 151, in columnsOf
Jun  6 13:47:02 weatherpi weewx[2795]:     ****      column_list = [row[1] for row in self.genSchemaOf(table)]
Jun  6 13:47:02 weatherpi weewx[2795]:     ****    File "/usr/share/weewx/weedb/sqlite.py", line 140, in genSchemaOf
Jun  6 13:47:02 weatherpi weewx[2795]:     ****      for row in self.connection.execute("""PRAGMA table_info(%s);""" % table):
Jun  6 13:47:02 weatherpi weewx[2795]:     ****  DatabaseError: database disk image is malformed
Jun  6 13:47:02 weatherpi weewx[2795]:     ****  Exiting.

I saw someone said you may be able to fix this by using sqlite to dump to a text file then reimporting.  I tryed that but it would bnot dump.  Here's what I got.  Any clue how to repair this db?  Or what may have caused the corruption in the first place?  It happened this morning at about 6:30.  No power hits or anything, the box just locked up at that time. 

Code: [Select]
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
/****** CORRUPTION ERROR *******/
/****** database disk image is malformed ******/
/****** ERROR: database disk image is malformed ******/
/**** ERROR: (11) database disk image is malformed *****/
ROLLBACK; -- due to errors

Offline nincehelser

  • Forecaster
  • *****
  • Posts: 3337
Re: ipwx-raspi-weewx station setup questions
« Reply #59 on: June 06, 2015, 02:47:15 PM »
I haven't had that happen before.  If the Pi was completely locked up, I suspect something went wrong when writing to the SD card.

Be sure your Pi's power adapter can supply plenty of power.  The only crashes I have had were due to a wimpy adapter I was trying to use (only .5 Amp).

You might try the weewx users group for ideas on repairing the database file. 

Offline mikez104

  • Member
  • *
  • Posts: 41
Re: ipwx-raspi-weewx station setup questions
« Reply #60 on: June 11, 2015, 11:17:54 PM »
maybe it it the card, idk.  It went weird on me again tonight.  It has done this before.  Apache stops responding, I can't ssh in and things get weird.  I was able to blindly hook up a keyboard and gracefully shut it down and reboot.  I swapped the power supply for a 3 amp unit.  We'll see what happens...

Offline mikez104

  • Member
  • *
  • Posts: 41
Re: ipwx-raspi-weewx station setup questions
« Reply #61 on: June 11, 2015, 11:19:04 PM »
BTW, that turtle in your signature thing looks like it would take your hand off!

Offline nincehelser

  • Forecaster
  • *****
  • Posts: 3337
Re: ipwx-raspi-weewx station setup questions
« Reply #62 on: June 11, 2015, 11:28:12 PM »
BTW, that turtle in your signature thing looks like it would take your hand off!

It almost did!

It lunged out at my iPhone right after I took that shot.  Knocked it clean out of my hands and put a good gouge in the case!

But now no one should mess with my phone again!

« Last Edit: June 12, 2015, 12:33:11 AM by nincehelser »

Offline yahtah

  • Forecaster
  • *****
  • Posts: 463
  • Too soon old, too late smart.
Re: ipwx-raspi-weewx station setup questions
« Reply #63 on: September 12, 2015, 11:42:20 PM »
Turtle Soup?
-Lee

Davis VP2, Meteostick, RPi Meteohub, KCACALIF33
working on an RPi webcam and a 30 ft. flagpole...