Raspberry Pi RF Temperature Monitor

13,058

45

28

Introduction: Raspberry Pi RF Temperature Monitor

I have a friend that owns a business with 2 walk in coolers storing perishable ingredients she needs to use. Occasionally she has issues with the coolers getting warmer than they should due to mechanical breakdowns. On one occasion, the cooler broke down on the weekend when no one was around and she lost some of the food. I built a temperature monitoring and alarm system using off the shelf Acurite Freezer - Refrigerator temperature sensors with a Raspberry Pi set up to intercept the RF signal from the temperature sensors and send an email if the temperatures were out of bounds.

Step 1: What You Need

Here is the part list linked to Amazon if you would like to buy them there (cost around $105 total):

AcuRite 00986A2 Refrigerator/Freezer Wireless Digital Thermometer

Mini USB RTL-SDR, RTL2832U & ESD-Safe Antenna Input.

Raspberry Pi 3 with 2.5A Micro USB Power Supply (UL Listed)

Samsung 32GB EVO Plus Class 10 Micro SDHC with Adapter 80mb/s (MB-MC32DA/AM)

Raspberry Pi 3 case

There are a few websites that will guide you in setting up your RPi for the first time if needed.

Life Hacker

Raspberry Pi Org

I set mine up 'headless' and use VNC to connect to it. The links above show how to do this.

Step 2: Sensor Setup

Setup the Acurite temperature sensors according to the instructions provided with it.

You can use any other temperature measuring device that sends an RF signal. This project assumes it is sending the signal on 433mHz so you may need to adjust the software if using a device that sends on a different frequency.

  1. Install rtl-sdr using the add /remove software included in the RPi standard menu. I installed all 3 packages - tools, development files, and library.
  2. Get and build / install rtl_433 from https://github.com/merbanan/rtl_433 (may need to also install cmake). This package supports a fair number of sensors. I am using the Acurite 986 which is protocol 40. You may be able to substitute other sensors as indicated in the package documentation.

  3. At this point, with the sensors in place in the refrigerator and freezer, the RTL dongle plugged into the RPi, you should be able to open a terminal window and run 'rtl_433 -G' and see the Acurite 986 send measurements. (Note: you will also see any other devices that transmit at 433 mHz). The Acurite 986 sends measurements every couple of minutes so you will have to wait to see the results.
  4. Here is what my RPi reports when I run 'rtl_433 -G':

2017-02-28 10:50:26 Acurite 986 sensor 0x154c - 1R: 3.9 C 39 F

2017-02-28 10:50:39 : HIDEKI TS04 sensor Rolling Code: 9 Channel: 3 Battery: OK Temperature: 10.7 C Humidity: 34 %

2017-02-28 10:50:39 : HIDEKI TS04 sensor Rolling Code: 9 Channel: 3 Battery: OK Temperature: 10.7 C Humidity: 34 %

2017-02-28 10:50:39 : HIDEKI TS04 sensor Rolling Code: 9 Channel: 3 Battery: OK Temperature: 10.7 C Humidity: 34 %

^CSignal caught, exiting!

Step 3: Install Python Script to Capture Measurements

Create a folder for your project. I used /home/pi/Documents/FreezerProjects for mine. If you use a different folder you will need to update the python script to reflect that.

Download the record_986.py script attached and place in your folder.

This script does the following:

  • Starts up the rtl_433 service with parameters for using protocol 40 (Acurite 986), records in json format, and runs in quiet mode.
  • Waits for a measurement to be reported by the rtl_433 service. Updates the refrigerator or freezer .dat file as appropriate and appends the measurements to the Stats.csv file

The R.dat and F.dat files are read every 15 minutes by another python script described in the next step. The Stats.csv file is used on a weekly basis in the creation of a graph.

I set this script to run on every reboot. I use gnome-schedule to set cron jobs - use whatever you are comfortable with.

I installed gnome-scheduler via the Add / Remove software from the RPi menu -> Preferences.

Note: script assumes you have sys, subprocess, threading and datetime python modules installed. You can check to see installed python modules by opening a python shell and typing help('modules'). If any are missing, use pip to add them. (see https://packaging.python.org/installing).

crontab setting:

@reboot python /home/pi/Documents/FreezerProjects/record_986.py > t986.log &

Step 4: Install Python Script to Monitor Temperature Readings

Add the attached file temp4sensor.py to your folder.

This script does the following:

  • Reads a configuration file with the temperature range to check, along with email and text message addresses to use for alerts.
  • When it executes, it reads the R.dat and F.dat files updated by the record_986.py script to see if they are in the range specified in the configuration file.
  • If either reading is out of range, the script sends an email and text message.
  • The script uses a gmail account to send the messages from. There are other methods to send messages if this doesn't work for you.
  • If a message is sent, the script will modify a file save.dat with a '1' to prevent continuously sending a message. I reset this file every day a 8:00 am with a small cron job.

Script assumes the following python modules are installed:

time, decimal, smtplib, email.mime.text, time, sleep, threading, json, pickle

I set this up to execute every 15 minutes - you can adjust it in your crontab.

crontab setting:

*/15 * * * * python /home/pi/Documents/FreezerProjects/temp4sensor.py > Mtemp.log

In your project folder create a text file named t4sensorjson.cfg with the following contents:

{
"S1_Low" : "32",

"S1_High": "47",

"S2_Low" : "-7",

"S2_High": "29",

"TextID" : "NNNNNNNNNN@vtext.com",

"EmailID": ["person1@comcast.net", "person2@gmail.com"]

}

S1 is the refrigerator settings, S2 is the freezer settings - set to whatever you like. textID is the phone number to text using the required format for the phone service provider (e.g., @vtext.com for Verizon cellphones).

EmailID is an array of multiple email addresses as needed.

At this point, you should have a working temperature monitoring and alerting application!

The following steps are enhancements I built to add value to the basic application.

Step 5: Daily File Reset

Download the attached file and save it in your project folder.

Set a crontab entry to run this script every day at 8:00 to reset the text message sent flag file.

crontab setting:

0 8 * * * python /home/pi/Documents/FreezerProjects/onceperday.py

Step 6: Create and Email Weekly Graph

Create an executable shell script file with the following content:

#!/bin/sh
# produce graph file, email the graph, and reset the collection files

> t986.log

> Mtemp.log

cd /home/pi/Documents/FreezerProjects

cp Stats.csv Stats.bak

cp messages.csv messages.bak

python graph2.py && python test_mail.py

> messages.csv

> Stats.csv

echo 'DateTime,Sensor,Value' > Stats.csv

Download and save the attached files in your project folder. Update test_mail.py with your email account settings.

The shell script will zero out the t986 and Mtemp logs so they do not grow too large. Then it will back up the Stats.csv and messages,csv files in case you need to use them for trouble shooting.

Next the shell script will execute the graph2 python script to create the graph file - image attached to this step - and then email it to the email addresses set up earlier in the configuration file.

Finally the shell script will reset the messages and Stats files to initial states.

Python script requires these modules: csv, dateutil, subprocess, pandas, matplotlib, matplotlib.pyplot, json.

I set this up to run every Monday morning at 9:00 AM.

crontab settings: 0 9 * * 7 /home/pi/Documents/FreezerProjects/graph.sh

Step 7: Use IBM Watson-IOT and Node-Red to Create a Dashboard (optional)

The Raspberry Pi 3 with the NOOBS basic Debian OS comes with Node-Red pre-installed. I already had an IBM Bluemix account and so it was fairly easy to set up the dashboard.

  1. If you don't already have one, set up a free 30 day trial account on IBM Bluemix. IBM Bluemix Signup
  2. After 30 days, you can upgrade your account. I set the memory for the application to 256MB and do not get charged for usage as IBM currently allows the first 375GB-hours at no charge (.25 GB X 24 hrs/day X 31 days/month = 186 GB-hours/month).
  3. Follow the directions on IBM Bluemix to get your RPi communicating with the Bluemix platform and Node-Red. Here is a link: https://developer.ibm.com/recipes/tutorials/deploy-watson-iot-node-on-raspberry-pi/
  4. Refer to the picture of the Raspberry Pi Node-Red Flow 1 and create the nodes and connect them as shown.
    1. Create 2 Watch nodes to watch the timestamps of the R1 and F1 dat files. Once a reading is received by the python script, the .dat file will have the latest temperature value and trigger the Node-Red flow.
    2. For each watch node, create a change node to move msg.payload to msg.filename
    3. For each change node, create a file node to read the temperature values. Output as utf8.
    4. For each file node, create a function node with the appropriate function:
      1. msg.payload = {"d":{"Rtemp":msg.payload.replace("t=","").replace("'C\n","")}};
        return msg;

      2. msg.payload = {"d":{"Ftemp":msg.payload.replace("t=","").replace("'C\n","")}};
        return msg;

    5. Connect both function outputs to the Watson IoT node.
    6. Add any debug messages if you wish.
  5. You will need to enable the node-red-dashboard if it is not in your node-red starter IBM Bluemix application. This can be accomplished by enabling the continuous delivery and have a tool chain. Add node-red-dashboard to your project dependencies in the package.json file and deploy. Now when you open up your node-red flow editor, you should see 'dashboard' in your palette.
  6. We will also need node-red-contrib-moment added to package.json if it is missing from the palette as we will use this to format the update date time in the dashboard.
  7. Refer to the picture of IBM Bluemix Node-Red flows and connect them as shown.
    1. There should already be a connection from the starter code to begin. This node receives the temperature values from the RPi node-red flow.
    2. Create 2 switch nodes to separate the R temp and the F temp into separate flows.
      1. SplitRefrigFreeze "Property msg.payload.d.Ftemp is not null" for the freezer flow and

      2. "Property msg.payload.d.Rtemp is not null" for the refrigerator flow

    3. For each switch node, create a function node to read the temperature value.
      1. return {payload:msg.payload.d.Ftemp} and

      2. return {payload:msg.payload.d.Rtemp}

    4. For each switch node, create a function node to record the date-time a reading was received.
      1. msg.timestamp = new Date().toISOString()
        return msg;

    5. Create a moment node to format the date time to your timezone and preference. I am using "llll" for my format.
    6. Next create gauges, charts and text and connect up the temperatures and moment output as shown. Use the dashboard sidebar tab to manage the widget layout. See https://github.com/node-red/node-red-dashboard

Step 8: Remote Access (optional)

Since this will be located in a store, I ended up using TeamViewer on my home PC and Raspberry Pi. There is a beta version for the RPi and it appears to work pretty well.

Sometimes the RPi TeamViewer would 'hang' so I set a crontab to reboot it every other day at 2:00 am so I could still get to it remotely without having to have someone "unplug - plug it back in" onsite.

https://www.teamviewer.com/en/

RPi beta:

https://pages.teamviewer.com/published/raspberrypi/


Step 9: Remote Reboot Using Node-Red (optional)

Sometimes I may want to reboot my Raspberry Pi remotely. I created an additional flow in my IBM Bluemix Node-Red app to send a reboot command to the RPi.

On the Raspberry Pi create the following Flow 2:

  1. See the RPi Node-Red reboot flow picture for the connections.
    1. Create a watson iot input node and fill it in with the appropriate credentials to communicate with watson iot.
    2. Create a delay node and set it for 15 seconds (optional)
    3. Create a exec node with 'sudo reboot' command
    4. Add any debug messages if you want

On the Bluemix Node-Red application, create the following Flow 2:

  1. See the IBM Bluemix Node-Red reboot flow picture for the connections
    1. Create an injector node to kick off the flow
    2. Connect the injector node to a function node with this function:
      1. msg.payload = '{"delay": 2}'
        return msg;

    3. Create a json node
    4. Create a watson iot output node and fill it in with the appropriate credentials to connect to the Raspberry Pi.
Sensors Contest 2017

Participated in the
Sensors Contest 2017

Be the First to Share

    Recommendations

    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge

    28 Discussions

    0
    ChrisB1017
    ChrisB1017

    Question 1 year ago

    I am trying to get this to run and I am rusty on my programming... I am using a sensor I had on hand and can get rtl_433 to find the info. It is a LaCrosse sensor. It is listed on the rtl_433 page. This is the output recorded by rtl_433:

    time : 2019-11-21 13:31:54
    model : LaCrosse TX141-Bv2 sensor Sensor ID : c5
    Channel : 01 Temperature: -11.50 C Battery : OK
    Test? : No
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    time : 2019-11-21 13:32:00
    model : LaCrosse TX141-Bv2 sensor Sensor ID : c8
    Channel : 02 Temperature: 21.10 C Battery : OK
    Test? : No

    In python I am getting this error:

    Traceback (most recent call last):
    File "/home/pi/Documents/FreezerProjects/record_986.py", line 72, in <module>
    if ( line.find( 'LaCrosse') != -1):
    TypeError: argument should be integer or bytes-like object, not 'str'

    Any help would be appreciated!

    0
    JohnV81
    JohnV81

    Answer 1 year ago

    Hi ChrisB1017 - I have not tested this solution with a LaCrosse sensor, one quick question though, did you change the line around line 23 in record_986.py = "cmd = [ '/usr/local/bin/rtl_433', '-q', '-F', 'json', '-R', '41']" to replace the '41' which means 'Accurite' to I think '73' which means LaCrosse TX141-Bv2? If you have, then maybe you can add a line to print 'line' and see if it is indeed a string...
    Let me know - I am glad to help you out!

    0
    ChrisB1017
    ChrisB1017

    Reply 1 year ago

    I did change that line. Here is the direct output from the sensor that is being inputed to json:

    {"time" : "2019-11-23 08:27:27", "model" : "LaCrosse TX141-Bv2 sensor", "id" : 197, "channel" : 1, "temperature_C" : -13.200, "battery" : "OK", "test" : "No"}

    I am not very python literate. I understand that the lines below are pulling the data from json.

    try:
    src, line = q.get(timeout = 1)
    except Empty:
    pulse += 1
    else: # got line
    pulse -= 1
    # See if the data is something we need to act on...
    if ( line.find( 'LaCrosse') != -1):
    #sys.stdout.write('This is the raw data: ' + line + '\n')
    dt = line[0:19] # pull out date time
    tm = line.find(": ",20) # find end of sensor description
    sens = line[20:tm] # pull out sensor description
    tv =line.find("C") # find F temp start
    ft =line[tv+1:len(line)-2] # pull F temp
    ct =line[tm+1:tv] # pull C temp
    rorf = sens[len(sens)-1] # pull R for sensor 1, F for sensor 2
    sys.stdout.write('These are the fields: \n' + dt +'\n' + sens +'\n' + ft + '\n' + ct + '\n' + rorf + '\n')

    Because of my illiteracy in python, I only basically understand that it is looking at the line outputted from RTL_433 to JSON and looking at a certain part of that line and outputting it to the R and F files respectively. I don't understand enough to know what I need to change.

    I am getting an F1.dat output file and a stats.csv file. I am not getting an R1.dat and I think this also has to do with the determining which sensor is which in the code above. I am getting data from both sensors in the stats.csv file. The data is listed below:

    {"time" : "2019-11-, ,rosse TX141-Bv2 sensor", "id" : 197, "channel" : 1, "temperature_C" : -11.600, "battery" : "OK", "test" : "No"
    {"time" : "2019-11-, ,rosse TX141-Bv2 sensor", "id" : 200, "channel" : 2, "temperature_C" : 21.900, "battery" : "OK", "test" : "No"

    While I am asking for help on this, I would also benefit from having the new code explained.

    Again, thanks for this write up on your project and your support.

    Chris

    0
    JohnV81
    JohnV81

    Reply 1 year ago

    Hi Chris - thanks for the details - I think I can help you resolve this - you are very close!
    The Accurite sensors send different data so you are correct that you will need to 'remap' the values.

    You could try changing this code block:
    dt = line[0:19] # pull out date time
    tm = line.find(": ",20) # find end of sensor description
    sens = line[20:tm] # pull out sensor description
    tv =line.find("C") # find F temp start
    ft =line[tv+1:len(line)-2] # pull F temp
    ct =line[tm+1:tv] # pull C temp
    rorf = sens[len(sens)-1] # pull R for sensor 1, F for sensor 2

    And convert the line to the json string and then operate on it as a python dictionary (see https://docs.python.org/3.7/tutorial/datastructures.html if you are not familiar with python dictionaries)

    line = json.loads(line) # convert to json object
    print(line) #see what it looks like to map
    dt = line['time'] # pull out date time
    sens = line['model'] # pull out sensor description
    ft = str(line['temperature_C']) # pull C temp and convert to string or
    ft = str(line['temperature_C'] * 9 / 5 + 32) # pull C temp and convert to F and stringify
    bt = line['battery'] # pull battery condition (if you want to add code to check on low battery...)
    if line['channel'] == 1: # pull R for sensor 1, F for sensor 2; assume from your data that channel 1 is the colder one...
    rorf = 'F'
    else:
    rorf = 'R'

    Hope that helps! Let me know if you need more information...

    0
    ChrisB1017
    ChrisB1017

    Reply 1 year ago

    Ok, I am lost. I changed the code you sent and it killed the output I was getting. I am using Thonny to play around with the code. Maybe this isn't the best thing to use... I understand that the code is pulling the data from the JSON data that RTL_433 is generating. Where is that JSON data stored? What I can find online is that it is stored in STDOUT. Is there a way to look directly at the JSON data? Is there a way to debug the code line by line(step through it and see what it is doing)? I do understand that the code imports the data from JSON and puts into Python dictionaries. Then it looks at the sensor data and decides to put the data in R or F based on the channel.

    Maybe this was too deep of a project for my first time playing with Python and a Pi.

    Again, thanks for the help.
    Chris

    0
    ChrisB1017
    ChrisB1017

    Reply 1 year ago

    Ok, I was able to dig around and start switching stuff line by line to see what fails. This is the failure I am getting when I add in this code and remark out the old.

    Traceback (most recent call last):
    File "/home/pi/Documents/FreezerProjects/record_986.py", line 78, in <module>
    dt = line['time'] # NEW pull out date time
    TypeError: string indices must be integers, not str

    This is line 77 and 78 respectively:

    #dt = line[0:19] # pull out date time
    dt = line['time'] # NEW pull out date time

    Thanks,
    Chris

    0
    JohnV81
    JohnV81

    Reply 1 year ago

    Hi Chris,
    I think that type error means line is not a dictionary. You can check it with print(type(line)) and see. Does thonny have any kind of console you can use? If not, run the program from a command window/ terminal session so you can see the print output.
    You did include the line: line=JSON.loads(line) right?
    Thanks.
    John V

    0
    ChrisB1017
    ChrisB1017

    Reply 1 year ago

    When I put the line=json.loads(line) in the code, I get this error running it in terminal:

    Traceback (most recent call last):
    File "/home/pi/Documents/FreezerProjects/record_986.py", line 75, in <module>
    line = json.loads(line) # convert to json object
    NameError: name 'json' is not defined

    When I leave the print(line) in the code and execute it in terminal I get this output.

    {"time" : "2019-11-23 15:52:05", "model" : "LaCrosse TX141-Bv2 sensor", "id" : 197, "channel" : 1, "temperature_C" : -13.800, "battery" : "OK", "test" : "No"}

    These are the fields:
    {"time" : "2019-11-
    3 15:52:05", "model"
    rosse TX141-Bv2 sensor", "id" : 197, "channel" : 1, "temperature_C" : -13.800, "battery" : "OK", "test" : "No"
    "La

    When I take the print(line) out, I only get this:

    These are the fields:
    {"time" : "2019-11-
    3 15:52:05", "model"
    rosse TX141-Bv2 sensor", "id" : 197, "channel" : 1, "temperature_C" : -13.800, "battery" : "OK", "test" : "No"
    "La

    Something looks like it is breaking up the data and dropping part of the date, the semi-colon after "model" and moving that down a line in the output. I think this is where the breakdown may be.

    Thanks,
    Chris


    0
    JohnV81
    JohnV81

    Reply 1 year ago

    Hi Chris, sorry, I forgot to mention to make sure you put 'import json' at the top of the program...here is what I have:

    import sys
    from subprocess import PIPE, Popen, STDOUT
    from threading import Thread
    import json
    import datetime

    Thanks,
    John V.

    0
    ChrisB1017
    ChrisB1017

    Reply 1 year ago

    Thanks for your help. That worked. Now on to seeing if I can get the battery levels to work.

    0
    JohnV81
    JohnV81

    Reply 1 year ago

    Perfect! Glad you got it working...

    1
    davistw
    davistw

    1 year ago

    I am attaching the changes I had to make to work with a new pi load and a new sesor

    0
    JohnV81
    JohnV81

    Reply 1 year ago

    Thanks!

    0
    reliant_turbo
    reliant_turbo

    Question 1 year ago

    im still having issues getting this to work as advertised :)

    i tried some more things today and got a little further but still not working properly.

    i changed all the directories in the scripts because i had files/logs being saved in /home/pi/ and all the other stuff was in /Documents/FreezerProjects/ so i changed them all to /Home/Pi/ and rebooted so everything is now in the same directory.

    then i disabled the cron scheduled tasks so i could run everything in a terminal window and watch what is happening.

    record_986.py seems to work just fine. it does its initial stuff and then displays sensor output regularly.

    however, only F1.dat is generated, and no R1.dat is nowhere to be found.

    so then i opened another terminal window and ran temp4sensor.py. it errored out immediately looking for a save.dat so i created an empty file called save.dat.

    then i ran it again. it errored out again but this time im stuck but i took a screenshot. see attached.

    has anyone got this to work on a 3b+ with updated raspbian lately?

    any ideas?

    thanks

    Brian

    2019-08-05-103121_1366x768_scrot.png
    0
    JohnV81
    JohnV81

    Answer 1 year ago

    Hi Brian, for the temp4sensor.py error: I assume you created the save.dat file using the touch command? That created an empty file so that is the pickle error you are getting. You can fix this by using pickle.dump( 0, open( base_dir + "save.dat", "wb" ) ) from a python interpreter prompt. (terminal -> python -> import pickle...). This will seed the file with a 0 and then the temp4sensor.py will run.
    As far as the R1.dat and F1.dat errors, I am not sure as I can not recreate your error.
    I believe you may have updated record_986.py since your screenshot shows a different writeout (json?). I suspect that 'rorf' is not picking up the 'R'. The logic looks for 'rorf' with 'R' and if it doesn't find it just defaults to 'F' which would explain not seeing a R1.dat file.
    HTH.
    John V.

    0
    reliant_turbo
    reliant_turbo

    Question 1 year ago on Step 3

    EDIT...... I had to set the protocol to 41. unfortunately it still is not sending emails.

    im not sure why. i do know that when i set up the crontabs, gnome-schedule was warning me something about starting in home/pi/ and that some of the logs are in home/pi/ and some are in the FreezerProjects directory. not sure if thats the issue.

    i also still have not determined if the python module 'email' contains 'email.mime.text' that i cant seem to get installed. same with the python module 'sleep'... is this included with 'time'? i saw references to 'time.sleep' online but im no python expert.

    i also can only find a F1.dat and not an R.dat.

    im wondering if enough stuff has changed with python and whats included with the current RPi image that this instructable cannot be implemented without a code rework... which is not my strong suit.

    ORIGINAL QUESTION .....im trying to set this freezer alarm up. step 2 is working perfectly.

    i have my files in the same directory as the instructable.

    i believe i have the crontabs setup correctly in gnome-schedule.

    upon reboot, i can look up what processes load and i see python and then rtl_433 and in /home/pi i can see mtemp.log and t986.log are updated but mtemp has nothing in it and t986.log stops at:

    "2019-06-04 18:25:27 - stderr: rtl_433 version unknown inputs file rtl_tcp RTL-SDR
    2019-06-04 18:25:27 - stderr: Trying conf file at "rtl_433.conf"...
    2019-06-04 18:25:27 - stderr: Trying conf file at "/home/pi/.config/rtl_433/rtl_433.conf"...
    2019-06-04 18:25:27 - stderr: Trying conf file at "/usr/local/etc/rtl_433/rtl_433.conf"...
    2019-06-04 18:25:27 - stderr: Trying conf file at "/etc/rtl_433/rtl_433.conf"...
    2019-06-04 18:25:27 - stderr: quiet option (-q) is default and deprecated. See -v to increase verbosity
    2019-06-04 18:25:27 - stderr:
    2019-06-04 18:25:27 - stderr: Consider using "-M newmodel" to transition to new model keys. This will become the default someday.
    2019-06-04 18:25:27 - stderr: A table of changes and discussion is at https://github.com/merbanan/rtl_433/pull/986.
    2019-06-04 18:25:27 - stderr:
    2019-06-04 18:25:27 - stderr: Registered 1 out of 126 device decoding protocols [ 40 ]
    2019-06-04 18:25:27 - stderr: Detached kernel driver
    2019-06-04 18:25:28 - stderr: Found Rafael Micro R820T tuner
    2019-06-04 18:25:28 - stderr: Exact sample rate is: 250000.000414 Hz
    2019-06-04 18:25:28 - stderr: [R82XX] PLL not locked!
    2019-06-04 18:25:28 - stderr: Sample rate set to 250000 S/s.
    2019-06-04 18:25:28 - stderr: Tuner gain set to Auto.
    2019-06-04 18:25:28 - stderr: Tuned to 433.920MHz."

    with nothing after it.

    also, with the python modules sleep and email.mime.text, i tried to install them with "python -m pip install sleep" and "python -m pip install email.mime.text" but it cant find those modules to install them. the raspberry pi is using python 2.7

    any idea what im doing wrong?

    thanks,

    Brian

    0
    JohnV81
    JohnV81

    Answer 1 year ago

    Hi Brian, as far as email is concerned, it is 'built-in' to Python so there is nothing to install. As long as the import statement is in the code, email should work. Are you using your gmail account? Correct username and password? You can write a separate program or use the python interpreter to try basic emailing. See the documentation for examples. Here is the link for version 2.7 email https://docs.python.org/2/library/email-examples.h...

    And yes, code 41 is correct so the log should be looking better....

    Hope that helps...

    0
    Zetman
    Zetman

    2 years ago

    Hey John, great job on your site. Is it easy for you to edit this stage of the instructions to include some extra tips? I noticed a few things that you might want to call out in this stage of the instructable because of things I bet have changed in the past year in the underlying packages:
    1. When using python3 to execute your script, I get datatyping errors. Backtracking to python2 resolved them. I was too lazy to fix the datatypes to make Python3 work, but we could perhaps post a version for version 2 and 3.
    2. I notice in your instructions you filter your rtl command with parameter "40" for the Acurite 986, when in my version, the 986 is mapped to parameter "41". Indeed, my bet is you are running older versions where this indeed works, but we may want to give this as a warning so people don't need to debug like I did.

    Once again, you made my life so much easier, I'm totally happy to continue to feedback new improvements if you are open to them! Thanks Andrew

    0
    JohnV81
    JohnV81

    Reply 2 years ago

    Hi Andrew, thanks for the feedback!
    I am planning on updating to the newer versions of packages and adding an enhancement for 'spurious' signals. I have been seeing an occasional 'spike' in temp reading and the log shows that it is actually coming from a different sensor. It could be an older sensor that is just laying around the shop, but anyway, I think I should add some logic to NOT alarm unless the increase is 'steady'.
    Probably a couple of weeks before I have the time to work on this...

    0
    Zetman
    Zetman

    Reply 2 years ago

    Hey John, get this -- I also was seeing spurious signals that were always on the "rising side". I think i root caused it! I "think" when running on batteries, the micro has a quick running reset, and after that - the temperature shows a spike in value - but quickly goes back down to the freezer temperature. The reason I think this -- is I've slowly started replacing the batteries in my sensors with DC power supplies (i don't want to have to deal with batteries), and since the replacement of the power source to a DC supply - no more spurious spikes in temp value.