JTK – Notes and Ramblings Things we have found …

3/31/2020

Adding Lacrosse Weather to Garage Pi

Filed under: General,Home Automation,RTL-SDR — taing @ 6:54 pm

The sdr stick we are using is the NooElec R820T.

Following the instructions from https://morioh.com/p/fd9b47cbc020 :

# install dependencies
sudo apt-get install libtool libusb-1.0.0-dev librtlsdr-dev rtl-sdr cmake

# clone rtl_433 Git Repository
git clone https://github.com/merbanan/rtl_433.git

# change to directory
cd rtl_433/
# make build folder
mkdir build
cd build/
# compile
cmake ../
# make
make
# install
sudo make install
# test if rtl_433 was properly installed
rtl_433 -h

After this we copied the udev rules from https://github.com/osmocom/rtl-sdr/raw/master/rtl-sdr.rules to /etc/udev/rules.d/rel-sdr.rules. This resolves the permission issue access the dongle when not root.

A test of rtl_433 then see the LaCrosse Technologies TX145WSDTH remote temp/humidity/wind speed/wind direction sensorthat came with the S81120 base station.

rtl_433 -F mqtt:<host>:1883 is enough to get things going to the mqtt broker on the destination machine.

Sample Output as seen on the destination PC using mosquitto_sub -v -t '#' :

rtl_433/jtk-garage/events {"time":"2020-03-31 16:31:10","model":"LaCrosse-TX141W                                                                                                                                                             ","id":303173,"channel":0,"battery_ok":1,"temperature_C":5.1,"humidity":75,"test                                                                                                                                                             ":0,"mic":"CRC"}
rtl_433/jtk-garage/devices/LaCrosse-TX141W/0/303173/time 2020-03-31 16:31:10
rtl_433/jtk-garage/devices/LaCrosse-TX141W/0/303173/id 303173
rtl_433/jtk-garage/devices/LaCrosse-TX141W/0/303173/channel 0
rtl_433/jtk-garage/devices/LaCrosse-TX141W/0/303173/battery_ok 1
rtl_433/jtk-garage/devices/LaCrosse-TX141W/0/303173/temperature_C 5.1
rtl_433/jtk-garage/devices/LaCrosse-TX141W/0/303173/humidity 75
rtl_433/jtk-garage/devices/LaCrosse-TX141W/0/303173/test 0
rtl_433/jtk-garage/devices/LaCrosse-TX141W/0/303173/mic CRC
rtl_433/jtk-garage/events {"time":"2020-03-31 16:31:10","model":"LaCrosse-TX141W","id":303173,"channel":0,"battery_ok":1,"wind_avg_km_h":3.5,"wind_dir_deg":351,"test":0,"mic":"CRC"}
rtl_433/jtk-garage/devices/LaCrosse-TX141W/0/303173/time 2020-03-31 16:31:10
rtl_433/jtk-garage/devices/LaCrosse-TX141W/0/303173/id 303173
rtl_433/jtk-garage/devices/LaCrosse-TX141W/0/303173/channel 0
rtl_433/jtk-garage/devices/LaCrosse-TX141W/0/303173/battery_ok 1
rtl_433/jtk-garage/devices/LaCrosse-TX141W/0/303173/wind_avg_km_h 3.5
rtl_433/jtk-garage/devices/LaCrosse-TX141W/0/303173/wind_dir_deg 351
rtl_433/jtk-garage/devices/LaCrosse-TX141W/0/303173/test 0
rtl_433/jtk-garage/devices/LaCrosse-TX141W/0/303173/mic CRC

Now we can edit the openhab files to make use of this info…

3/29/2020

Updating Garage Pi

Filed under: General,Home Automation — taing @ 9:58 pm

The original garage pi was a model 1 – 26 pin GPIO, 2 USB A, composite video, full size SD card. It served admirably for many years but I was looking to add to its responsibilities. So a Raspberry Pi 3 is replacing it.

The Pi 3 had been in the drawer for a year or so with raspian from late 2018. A full sudo apt-get update/upgrade/dist-upgrade later and we are ready to start.

sudo apt-get install mosquitto mosquitto-clients libmosquitto-dev gets MQTT ready to go.

The outdoor i2c temp sensor will need the library from https://bitbucket.org/loblik/libam2315/src/master/ . So wget https://bitbucket.org/loblik/libam2315/get/701be2837287.zip downloads the archive, a quick unzip and we are ready to install.

sudo make install is the magic for installing the AM2315 library we will need for the sensor.

Using the gateway C code we long ago modified from the original RFM69 Gateway Pi port, we compile with first gcc -lam2315 am2315-get.c -o am2315-get and then gcc piGateway.c -o piGateway -lwiringPi -lmosquitto -lam2315 -DRASPBERRY -DDEBUG.

A simple shell script to start things and we are done with the temp/humidity sensor. sudo ~/piGateway2/piGateway /dev/i2c-1

For clarity – the connection to the sensor uses the Pi I2C connection:

  • Pin 4 – Vcc (5v) [orange & orange/white]
  • Pin 6 – GND [brown & brown/white]
  • Pin 3 – SDA1 (GPIO2) [green]
  • Pin 5 – SCL1 (GPIO3) [green/white]

Update: So all of that is brilliant but the real reason for the upgrade was to use the RTL-SDR – well the reception is very poor from the garage so we are back to the original Pi 1 Model B V 2.0.

Powered by WordPress