Most likely the path in the cronjob is incorrect. Make sure that the file really exists in the path you provide. Copy and paste the whole line (remove * symbols etc) and see what happens.
Start editing a page that will display the graph. The icon you need to click is here:   black_sun
First make sure that everything is wired correctly. Take a look at the wiring pictures and double check. Afterwards run the script manually and check if any readings are taken. Double check the plugin shortcode. Check if the readings are stored in the database. Do that by typing mysql -u root -p and then type in your mysql password. Type in show databases;which will display all databases, select the WordPress database. In my case it is named WordPressDB, I can select it with use WordPressDB;.  The table that stores all the readings is named temperatures. Display everything in it with select * from temperatures;. It should display all the readings taken. If all of the above works, it is very likely that you have a faulty sensor.

You can email me at . Alternatively, you can use the comment section below to write a public comment. I will do my best to help you out with any problems you might encounter. Do not hesitate to contact me, together we can fix any problems you might run into.

  • Everything went smooth following the tutorial until I had to install the MySQL-python module. this is what I am getting:

    easy_install MySQL-python
    Traceback (most recent call last):
    File “/usr/local/bin/easy_install”, line 9, in
    load_entry_point(‘distribute’, ‘console_scripts’, ‘easy_install’)()
    File “/usr/local/lib/python2.7/dist-packages/setuptools-11.3.1-py2.7.egg/pkg_resources/”, line 519, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
    File “/usr/local/lib/python2.7/dist-packages/setuptools-11.3.1-py2.7.egg/pkg_resources/”, line 2629, in load_entry_point
    raise ImportError(“Entry point %r not found” % ((group, name),))
    ImportError: Entry point (‘console_scripts’, ‘easy_install’) not found

    I am not proficient in Python setup on Linux, so am dead in the water.

    The weather station I am setting up extends what you have by adding an atmospheric pressure sensor and an anemometer. I will send you the details of the new hardware setup and the tweaks to the code to add them to new tables.

    Thanks in advance if you have any idea of how to fix my little snafu.


    • peterk

      We have managed to resolve this issue via email. If anyone else runs into such problems try the following:

      Check your /usr/bin and /usr/local/bin for easy_install installations and remove any old script:

      sudo rm -f /usr/bin/easy_install*

      sudo rm -f /usr/local/bin/easy_install*

      Download and run distribute:

      curl -O

      sudo python

      sudo rm

      Try again, and enjoy. E.g.:

      sudo easy_install pip

  • David


    This is an incredible post that I’m trying to do, but I need a one spec more (if is possible) my programming level is 0 and i want to do is that, when the temperature exceeds a x degrees, the Rasp, sends me an email notification, is possible to do?

    A lot of thanks

    • peterk

      Hi there David,

      sure it is possible. If you managed to get the station up and running you need to do two things. One is to set up the email – follow the tutorial
      Afterwards you only need to put an if clause which checks if the temperature is above X degrees. If true, then send an email.

      Give it a try and contact me if you’re having problems – we will solve them together! Good luck!

  • Steve


    I’ve unpacked the phpmyadmin files but when it says to login with your details i don’t know what to type in.

  • Christian


    can you please Write a German Tutorial ? My English is not so good.

    Best Regards, Chris

  • Kristian

    [email protected]:/var/www# wget
    –2015-10-29 19:42:31–
    Resolving (…
    Connecting to (||:80… connected.
    HTTP request sent, awaiting response… 404 Not Found
    2015-10-29 19:42:32 ERROR 404: Not Found.

  • Kristian


    when i try to get the phpMyadmin.

    it just say this ?
    what did i do wrong ?
    im lvl 0 too 🙂

    can u help me out ?

  • Kristian

    ok now it work.

    it need to be with BIG letters as u write 🙂

    thx the help 😀

    love this projekt !!

    • peterk

      Glad to hear that! Thanks, hope you finish the whole process 🙂

      • Kristian

        hi again.

        can u add me on skype ?

        as i think i need some more help.

        and dont want to fill this hole site ?

        i sent a invite to u ? :/

  • First of all I would like to thank you for such a clear step by step procedure for setting up this station.
    I am able to get as far as pasting my IP and PHP Admin to my browser but I get a 404 along with this message..
    Apache/2.2.22 (Debian) Server at Port 80
    I cannot see any SQL info other than a table setup. If I try to set up WordPress I get an error message.

    • peterk

      Hi Terry!

      There is just too much problems with phpMyAdmin, so I’ve decided to take another route.
      For anyone else having difficulties – now it should be much easier to create a database without phpMyAdmin.

  • Hi I have gone though the setup of your weather pi system. All is working.

    In want to add more than one temperature sensor. I have hacked Perl for year but this is my first python hack. do setup the array to access more than one sensor? also were is the code that places it in the data base. I am going to have to add fields to the db etc to accommodate that..

    I know that there are a lot of changes to be made in the wp module as well to read more than one value..

    Great project

    Thanks for the help.

    • peterk

      Hi Shanta, very glad to hear that everything is working fine! Also thank you for your kind words.

      The table for storing temperatures is stored in the same folder as the script that reads the temperature/humidity. You can modify it all you want, its very basic.

      Yes, you can add multiple sensors, but I do not cover that part at the moment. Which sensor are you using?

  • Michiel

    just setup you great tutorial and now have the weatherstation working.
    since i have a bmp180 i wanted to add the presure too.
    mad this work by testing the scripts by hand.
    however when using the forked raspberry-weather scripts from /root/temp/Raspberry-weather i get the messag no WordPressDB available….

  • Jason Borneman

    How much change to these instructions and hardware needs is there to support the newer Raspberry Pi 3 Model Bs?

    • peterk

      Absolutely none! This site is running on a Raspberry Pi 3 and all is working fine.

  • conception

    Every time I want to test the python script, to see if the wiring is ok it just shows this:
    [email protected]:~/Raspberry-Weather/production# python
    Traceback (most recent call last):
    File “”, line 9, in
    import MySQLdb as mdb
    ImportError: No module named MySQLdb

    • peterk

      You need to install it by typing in easy_install MySQL-python. It should work afterwards.

  • MRC

    With the recent update (Jessie?), I’m stuck.
    This no longer works: /etc/apache2/sites-available/default….only 000-default.conf and default-ssl.conf and those don’t have the same lines. Only apache2/apache2.conf has syntax that resembles the instructions.

  • I am getting a “NameError: name ‘root’ is not defined” when I run sudo python I followed the tutorial and the DB username was set to root (I logged in to MySQL with it successfully).

    • peterk

      Hmmm…. So you are able to log in mysql via terminal, but not by using the script? Did you do any changes to the script, apart from setting the root password?

      • No, I didn’t change anything. What does ROOT#!/usr/bin/python define? Just where python is? The error is at line 1, which would be this part of the code. Thanks.

        • peterk

          Please add me to peterslo85 on skype, it will go faster 🙂

  • John Paul

    When setting up the crontab, i put in 0,30 * * * * /usr/bin/python/root/Raspberry-Weather/production/
    and the graph on my website didn’t display anything. I went into my pi and that directory doesn’t exist.

    • peterk

      You need to create that folder first. Afterwards make sure that it contains all the needed files that take the readings and store them in the database.

  • John Paul

    Now the problem is the crontab. it’s not updating like it should be. I have the correct code in there. Any ideas?

    • peterk

      Can you please copy&paste the crontab? Also make sure that it points to the right path (file exists)

      • John Paul

        Got it figured out. The crontab wanted “python” inserted in between the code for time and the code for the directory.

        0,30 * * * * python /directory_example/

  • MRC

    Last paragraph of /raspberry-pi-as-webserver…
    configuration of apache2.conf different than indicated.
    The first two “AllowOverride” are:

    Options FollowSymLinks
    AllowOverride None
    Require all denied

    AllowOverride None
    Require all granted

    the provided image on your site says to change:


    which are the first and third lines. will try that and see if it works…

  • MRC

    On “create your own wordpress site”
    Everything goes fine until I try to install wordpress installation wizard on the IP of my RasPi. I get the Apache2 Debian Default Page “It works!” but the wordpress wizard is not there

    • peterk

      We’ll solve both problems via email.
      My first guess would be that you probably forgot to unzip the WordPress files to /var/www.

  • Chris Okeefe


    Excited to start this tutorial and build my own PWS!


    What would be needed to make this run off solar?

    Can this build include the PI camera?

    How much difficulty would the above add to this build for a noob.

    Email response is preffered. And thank you for such awesome content!

    Thank you!

    • peterk

      Replied on your mail.

      In case anyone else is interested – you could easily run it on a solar panel.
      It’s also possible to include a camera, why not. It would take some modifications of the plugin if you wanted to display the pictures on the site. The code is opensource, so anyone can edit it.

    • peterk

      Replied on your mail.

      In case anyone else is interested – you could easily run it on a solar panel.
      It’s also possible to include a camera, why not. It would take some modifications of the plugin if you wanted to display the pictures on the site. The code is opensource, so anyone can edit it.

  • Hello again Peter. I’m not getting the humidity output on my graph. It looks to me like the plugin code is checking for both in the DB but I am only getting temperature.

    • peterk

      Hi Suzanne,


      Are you using the sensor that records humidity?
      If you run the script, does it display the humidity and is it stored in the database?

      Lets start at these three questions and see where they take us.

      • Yes to all.

        • peterk

          Okay, so it has to be something with the plugin. Can you please check the shortcode? Especiall the following part: display=”Both”

          • Suzanne

            That was it – thank you! I’ve finally got the project completely up and running!

          • peterk

            Awesome, very glad to hear it!

  • pakoR

    Hi, amazing tutorial!, I managed to run all the project on my oldest raspberry pi B 256mb and seems to run fine, but I can’t find the Quick Cache plugin on the search of WordPress, it’s still available?

    • peterk

      Hi! So glad to hear that! 🙂

      Looks like Quick Cache got renamed to ZenCache. I have not tried it so far, but I’m guessing it should work.

  • JR

    Great plugin. How do I get the yesterday graph to work as the examples on your page? Is it only to change the “day=”Today”” ? Do you have any more examples of the plugin?

    • peterk

      Yes, its that simple. Change it to yesterday. If I remember correctly you can also put in a date and it should work.

      • JR

        Thanks and for a month?

        • peterk

          Sorry, it is not possible to display monthly readings. I should do that someday….

  • Arthur

    Nice work! Thanks to you I learn so much things about weather and how to measure it!
    I managed to get the python code working including pressure, and it populates the sql database for 3 days now.

    But here is my problem:
    in WordPress, when creating a new page or post, I click on the addon icon to add the shortcode, I save and publish the page/post, and … nothing appears, no graphs, no text, nothing at all :/

    Any suggestions ? (I’m new to WordPress thing by the way, but managed to get all your setup instruction working)

    • peterk

      Great to hear that Arthur!

      Are you using any caching plugins by any chance? Also, try reinstalling the plugin and disabling all other plugins and try again.

      • Arthur

        Yes, I installed CometCache (actual QuickCache name).
        After reading you, I removed plugins, reboot the Pi and reinstall only raspberryweather plugin: same result, nothing to show.
        There is a blanck space corresponding to the chart size, without any data in it.
        By the way, I forgot to mention I changed the sql database name prefix, as I wanted to create multi wordpress site to learn side by side how to use it…
        Then I tried to adapt all variable calls in the script to the right prefix, but still blanck space showing up.

        • peterk

          Anything apart from QuickCache will definitively cause problems.

          Is the table named Temperatures in the same database as WordPress database? If its not then it’s not going to work.

          What if you reinstall WordPress completely and test the plugin first? 🙂

  • As I was doing your “basic settings” step I updated the pi per the commands, and rebooted.

    Reboot appeared to start fine, with the 4 Pi symbols at the top as it booted. Then the screen went black with the cursor in the top left corner, and the screen would not stop blinking.

    This is on a Pi 3 B from Adafruit. Used the pre-installed Raspbian Jessie that comes with their kit.

    • peterk

      That’s too bad Barry. I can’t give you a definitive solution for this, lots of things could be wrong.
      Can you start fresh by downloading NOOBS from You’re at the beginning so it’s not going to be too much work.

  • GD

    I tried loading the pressure plug in and loaded it but when I try and activate it there is a error saying there is a new version and when I install the update it says that plugin files does not exist.
    Thanks Gary

    • peterk

      Try completely removing the plugin and install it again. It should help.

      • GD

        Thanks that did it ! Now I want to find the kitchen sink to click on and display the dummy data ? By the way great tutorial and thanks for all the help !
        Thanks Gary

        • peterk

          No problem Gary, glad to help especially now that you’re so close!

          Take a look at the third FAQ it shows where the icon is.

  • I had to tweek the code to get the readings but now I get this error message Would you explain what I am doing wrong so I can learn please ?

    Pressure = 93556.90 Pa
    Pressure2 = 27.63 In Hg
    Temp = 85.7 Deg F
    Temp2 = 29.8 Deg C
    Humidity = 63 %
    Traceback (most recent call last):
    File “”, line 100, in
    File “”, line 53, in readInfo
    output = subprocess.check_output([“/root/Raspberry-Weather/Adafruit_DHT”, “2302”, “4”]);
    File “/usr/lib/python2.7/”, line 566, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
    File “/usr/lib/python2.7/”, line 710, in __init__
    errread, errwrite)
    File “/usr/lib/python2.7/”, line 1335, in _execute_child
    raise child_exception
    OSError: [Errno 2] No such file or directory

    • peterk

      The last line says that the file or directory does not exist.

      A few lines above you can see a path, /root/Raspberry-Weather/Adafruit_DHT. Does it exist?

  • GD

    I did not mention that I am only using the BMP280 sensor to get my measurements.

  • JP

    I don’t know enough about programming to do this myself, but I would like to upload to for pws. they have requirements as displayed on this site. what code would it take to get readings and send it off?

    • peterk

      Took a quick look at the wiki. You would have to modify the script that gets the readings. After they are saved you would need to build a URL according to their specification. Afterwards you’d have to call the URL.

      Sounds easy, but it might take some time to figure everything out.

    • peterk

      Open the file. On the very first line paste:
      import requests

      Scroll down to the line that says:
      print “Saved temperature”

      Below that line paste the following:


      You have to register to get the username and password.

      • JP

        Thanks a lot peter. this is great!

      • JP

        tried that and this is what i’m getting

        File “”, line 37

        SyntaxError: EOL while scanning string literal

        • peterk

          You did not paste the whole line. Compare it with mine. It has some other text after the question mark and ends with “).
          Paste it again, make sure that it’s whole and on one line.

  • Josh

    Hi! Your tutorial seems awesome. My programming skills is a level 0. I’m about to start the project, but before I do I was wondering if it was possible if there was a way to incorporate an anemometer like this one: it would be awesome if it was possible but I would not know how to do it at all.

    Thanks. Josh

    • peterk

      Hi Josh,

      thanks, it means a lot to me 🙂

      I’m not sure because I haven’t ever tried using this sensor. Alesssandro started a similar thing and modified my code to display pressure, but he did not do the wind sensor yet – more info

      • Josh

        Yeah I’m definitely adding that too. If someone can get that working then it would be almost a fully equalized station. I would totally do it if I knew how. Like I said my coding skills are a complete 0. But I appreciate everyone’s work on this. It’s awesome that everyone wants to share their work and knowledge on all of this. Thanks again!

  • Tommy

    Hi, just to say my device isn’t 28* and appears as 10-*
    It’s a DS18S20+ from farnell # 2519401
    temperature is read fine.

    [email protected]:/sys/bus/w1/devices/10-000802e88a5c $ ls
    driver id name subsystem uevent w1_slave

    • peterk

      Thanks for that Tommy. I did not know that. Looks like I’ll have to update the site a little bit in the following days.

  • Josh

    Hi Peter, After I install apache I need to remove the default index. But when I paste the command it says no such file or directory. Is there another command I need to run to get into the directories first?

    [email protected]:~ $ rm /var/www/index.html
    rm: cannot remove ‘/var/www/index.html’: No such file or directory
    [email protected]:~ $ sudo rm /var/www/index.html
    rm: cannot remove ‘/var/www/index.html’: No such file or directory
    [email protected]:~ $ [email protected]:~ $ rm /var/www/index.html
    -bash: [email protected]:~: command not found

  • Josh

    Never mind I figured it out the actual directory is /var/www/html/index.html

    • peterk

      Glad you sorted it out yourself 🙂

  • Dave

    Hi Peter,

    Just a small note – you change the database name slightly in between your code and the site. The code uses “WordPressDB” and the site says “WordPressDB”. I don’t know if case is important as I made the changes on the way through to keep it consistent.

    Thank you for all your hard work on this site and software!



    • Dave

      Sorry for this second post, but in my previous comment the first mention of “WordPressDB” was automatically capitalised for me! I did not type it this way. Perhaps this is what has happened elsewhere 🙂

      I am typing the following in all lowercase to see what happens: “wordpressdb”.

      • peterk

        Thanks for the warning. I’ll fix it so its consistent over the site.

  • Anthony

    Hi, I am a little confused with the wordpress database setup at as I have created the database using CREATE DATABASE WordPressDB; however there are no instructions for table & field names. Therefore following the instructions at when i type select * from temperatures; i get TABLE WordPressDB.tempratures does not exist.

    • peterk

      The tables are created automatically, when you run the python script for reading temperatures. You need to run in the first time, before checking if the readings are stored.

  • A tutorial guide on how to push data to a local MS SQL Server would be super useful…I managed to do so after a few hours of research and programming.

    • peterk

      Hi Bradley,
      I did not write a how to for storing readings, because it is done automatically. When the python plugin is run, it takes a reading and stores it by itself.

  • Hi, how adapter sensor BMP280? Thank you!

  • Qukoyk

    Hello Peter,

    Thanks for your awesome tutorial.
    I built it successfully, everything runs perfect except the auto-runing, eh, the part of cronjob.
    Nothing wrong with directory which I can run the manually and saved to the database successfully. The code in crontab are as same as the tutorial, unfortunately it didn’t work.

    I need your help!


    • peterk

      Hi Qukoyk,

      please copy the whole line (skip the * etc) and run it in the terminal. Does it save the readings?
      I’ve seen cases, where the cron job had an incorrect path – the file itself did not exist.

      • Qukoyk

        This is the code in crontab:

        0,30 * * * * /usr/bin/python /root/Raspberry-Weather/production/

        I can run “python /root/Raspberry-Weather/production/” successfully. It save to database.

        But cron job didn’t save readings.

        • peterk

          You are 100% sure that if you run the following command manually:
          /usr/bin/python /root/Raspberry-Weather/production/

          that the data is stored?

          What if you remove the TZ line and see if that helps.

          • Qukoyk

            I run that command with sudo successfully and the data was stored too. Also when I “sudo su” first, turn “$” to “#”, the command worked too.
            But if I removed sudo, it said “[Errno 13] Permission denied”.

            After removed the TZ line it still not work……

            I think maybe the problem was caused by permission.

          • Qukoyk

            By the way, I’ve tried to search some solutions of “cron didn’t run” on the internet.
            Most answer said checking the log of cron will be useful such like

            “cat /var/log/cron”

            or check the “system mail sent to root administrator”
            but it seems raspbian don’t have that “mail”
            Also after “ls /var/log/”, but there’re no log files about cron.

          • peterk

            Type in sudo crontab -e and then paste the whole line starting with 0,30 etc.
            That has to work.

          • Qukoyk



            It’s fun that if I added the TZ line in it, the time in graph will turn to GMT; but if I removed the TZ line, time in graph shows in GMT+9(Tokyo). Maybe there’re some conflcts between command TZ line and WordPress TZ setting (or maybe system TZ setting?).

            Thank you very much!

          • peterk


  • Zig


    I am very interested in setting this up for myself and sharing this project with others. I am planning to use the DS18B20 sensor since it will be used outside and planning to enclose all the contents in a plastic coffee container. I am really wanting to use the pressure expansion (BMP 180) with this, but I read that only the DHT22 can coeexist with the BMP 180. Is that is the case, do you think the DHT22 would read correctly being in an enclosed box? How are other people doing this, since the DHT22 may not be water resistant?

    I am also not seeing anything regarding adding a Wind sensor (Anemometer) Is there a tutorial around that will show how to setup the DHT22, BMP 180, and an Anemometer on the same breadboard? Is that even something that is possible?

    Thanks for all of the information, by the way. I am really excited about this.

    • peterk

      Hi Zig!

      Sounds really interesting and much more advanced than this tutorial.
      I’ve never used the pressure and wind sensors. But you could try .

      It should be possible, but the WordPress graph and android application support only the DHT22 or DS18B20 sensors.

  • Wigwam

    I was interested in setting this up however when I came to run the program I had the problem that I have not got the exact same sensor as in the tutorial (I have a non-Adafruit DH11 that i got off amazon). And it had trouble importing Adafruit DHT (it said line 3, full error below.) I was wondering if there was an easy fix to this problem that anyone knows.

    Traceback (most recent call last):
    File “”, line 3, in
    import Adafruit_DHT
    ImportError: No module named Adafruit_DHT

  • Bill Kunkle

    Hello and many thanks for the excellent guide to set up the Raspberry Pi weather graph. Initially I tried to use the DHT22 sensor to monitor the outside temperature. This required a +/- 10 meter long wire to get outside. Because of the distance, the sensor gave intermittent and inaccurate readings using 3 volts or 5 volts. I switched to the DS18B20 and now the readings are consistent and accurate. This is a great project for the Raspberry Pi.

    Thanks again,


    • Peter

      Bill thanks for you input! I’ve never tried such long sensors, but your information might come in handy for other tinkerers that are building their own weather station.

  • Maciej Bartczak

    When it comes to sudo python i am getting this error:

    Traceback (most recent call last):
    File “”, line 78, in
    status=readInfo() #get the readings
    File “”, line 42, in readInfo
    print “Temperature: %.1f C” % temperature
    TypeError: float argument required, not NoneType

    How can i fix this?

    • Peter

      Hi Maciej,

      can you verify that the sensor is wired correctly? I have just searched my email and so far I had one person contact me for the exact same error. Turns out that his sensor was broken.

      • Maciej Bartczak

        I just tested the sensor with my arduino and it is indeed broken. Thanks for help.

        • Peter

          Too bad… Buy one off from ebay, they’re cheap 🙂

          • Maciej Bartczak

            I had DHT11 around, i tried running the code for DHT22 with it and at least i got some readings but i definitely don’t have 460 degrees Celsius in my room 🙂
            Is there a way to make it work with DHT11?

          • Maciej Bartczak

            Oh, never mind i just saw the “sensor=” in, it works fine now

  • Angelo Serra


    awesome project – wired up mybtemp sensor and getting good data in the database. One thing I run into is that the graph on the WP site will revert to only show the default data and not what is in the database. Any ideas on what I can do to troubleshoot? I am new to WP so K am not sure where to start.


    P.S. – just received my BMP180 in the mail. Can’t wait to wire it up!

    • Peter

      Hi Angelo, thanks!

      Please take a look at the FAQ above. Third FAQ tells you how to check if the readings are stored in your database. You could also try disabling all plugins except Raspberry weather. It has helped others before.

      • Angelo Serra

        Thank you for the info. The data is being stored, so I went ahead and restarted the PI and that seemed to clear it up.

        • Peter

          A good old “restart everything” is always a good idea to try out :).

  • I have a Lacrosse wifi thermometer on the North side of a tree outside. Is there any way I could capture and use its data in your weather system?
    As well, my old Raspberry Pi-II B currently has a LAMP server installed. (Apache-II, PHP5.5) I just use it as a webserver for testing web apps. Is there any way I could incorporate your stuff into this instead of starting from scratch?

    • Peter

      Hi Tony,

      I’ve never used this type of thermometer. It might be possible, check if this thermometer has a way of accessing its readings via an API or something like that. If that’s possible you’d also have to change the existing python script to get readings.

      • Thanx- there ARE some wifi devices that read the stuff. I’ll check into them. O/W I’ll get the one suggested by you.

        Can I keep my present Raspian (phpinfo below) and its webserver and just add your stuff?
        System Linux raspberrypi 4.1.19+ #858 Tue Mar 15 15:52:03 GMT 2016 armv6l
        Build Date Dec 16 2016 23:42:51
        Server API Apache 2.0 Handler
        Virtual Directory Support disabled
        Configuration File (php.ini) Path /etc/php5/apache2
        Loaded Configuration File /etc/php5/apache2/php.ini
        Apache Version Apache/2.2.22 (Debian)
        Apache API Version 20051115
        Server Administrator [email protected]
        Hostname:Port pi:80
        MySQL Support enabled
        Active Persistent Links 0
        Active Links 0
        Client API version 5.5.54

        • Peter

          Sure, you have already done most of the hard work. You can keep your current configuration.

  • Angelo Serra Peter – Just finalized wiring up the BMP sensor and I have a question regarding the location.

    “Get the latter with git clone -b PressureWind ”

    After I do the git, where should the “Raspberry-Weather” folder reside? Mine is at /home/pi/Raspberry-Weather. The reason I ask is that when I sudo I have a few errors throw as if the script does not know where to find other dependencies (see pic)

  • icommentonstupidity

    Is it possible to reference a database outside the wordpress database? If so how? I already have a database storing temperatures gathered every 15 minute period using my raspberry pi as a mqtt broker and utilizing a esp12-e /w ds18b20. esp12-e reads the temperature, then transmits this to the pi via a mqtt message where node-red grabs the message and inserts it into a database.

    • Yes, it should be possible to get the database readings from outside. Start by opening correct ports to the database and allowing remote connections. Afterwards, try editing the plugin – take a look at functions.php. In the very beginning you have to connect to the database and the rest should work normally…

      • icommentonstupidity

        The database is a local database. Finally got it to connect to the database, and even query it. Working on changing variables around, just got it to graph the data, have yet to get the axis labels correct however. My issue ultimately lies in I’m using a DateTime field rather than just Date, so I’ve got to figure out how to parse the time strictly from the date and display that on my x axis. Currently is just shows 01-01 all the way across lol.

        • Very glad to hear that you’ve made progress! The charts used are from Google, maby that info will help you with googling 🙂

      • icommentonstupidity

        Also, can I create a git fork of your code? I plan on using this graphing ability in a tutorial for an automation system and feel its only right to ask permission first.

        • Don’t ask, just fork 🙂 I can’t wait to see what you’ll come up with. You are free to do anything you please with the code, its totally open sourced.

  • Yes, it should be possible to get the database readings from outside. Start by opening correct ports to the database and allowing remote connections. Afterwards, try editing the plugin – take a look at functions.php. In the very beginning you have to connect to the database and the rest should work normally.

  • AbsorbedBarrel3

    I have set up a static ip address for my raspberry pi, but wordpress does not recognize it. How do I make wordpress recognize it?

    • What happens if you open a new tab with this static IP? Are you 100% sure that Raspberry is using this static IP?

      • AbsorbedBarrel3

        Oh I fixed the problem by going to the wifi icon at the top of the screen and changed my pi’s ip address there.

        • Cool, good to hear that!

  • AbsorbedBarrel3

    I have done almost everything on the wiring page but instead of 28-**********, I am getting 00-**0000000000

    • AbsorbedBarrel3

      Also, My wires for the DS18B20 came red, yellow, and blue.

      • Hmm, you sure it’s not black and not blue?

        And you did add dtoverlay=w1-gpio-pullup,gpiopin=4 to /boot/config.txt right?

        • AbsorbedBarrel3

          Yes, but just in case I asked someone else to check the wire colors and I did add dtoverlay=w1-gpio-pullup,gpiopin=4 to /boot/config.txt

  • EnemyNL

    I first followed the tutorial which worked out fine. Then i decided to step it up and work with both temperature sensors. the second sensor is working fine as well and data is being stored in the database.
    Modified the functions.php script to make it possible to display the other temperature as well, which works, only it displays a scatter chart instead of a line. Any idea why and how i could fix that? It seems very strange to me, cause as far as i understand the code (not too much of a programmer myself) it generates the chart in the same way, regardless which data is being used (however for original temperature it still gives me a line).

    • Hey EnemyNL,

      congrats on getting both sensors working together! The “engine” that is used for drawing these graphs is Google Chart. Maby if you search around in this specific direction you’ll be able to find some anwsers.
      What if you store only a few readings and try displaying them. Are they connected with a line?

  • Sarmad Raza

    Hello fellow, i have been following tutorials for Weather Station and i got till fixing the DHT22 it works fine but i cannot expand it with bmp180 when i run sudo python i get this error :

    Traceback (most recent call last):
    File “”, line 37, in
    sensor = BMP085.BMP085()
    File “build/bdist.linux-armv7l/egg/Adafruit_BMP/”, line 69, in __init__
    File “build/bdist.linux-armv7l/egg/Adafruit_BMP/”, line 72, in _load_calibration
    File “build/bdist.linux-armv7l/egg/Adafruit_GPIO/”, line 200, in readS16BE
    File “build/bdist.linux-armv7l/egg/Adafruit_GPIO/”, line 177, in readS16
    File “build/bdist.linux-armv7l/egg/Adafruit_GPIO/”, line 164, in readU16
    File “build/bdist.linux-armv7l/egg/Adafruit_PureIO/”, line 173, in read_word_data
    IOError: [Errno 5] Input/output error

    i dont understand whats the reason pressure sensor is connected fine on the same board with DHT22 my pressure sensor has only four pins Vin,Gnd,scl,sda and they are connected according to the circuit diagram ! Help

  • Gangaram

    Hi I’m facing this problem

    [email protected]:~/Raspberry-Weather/production# sudo python
    Temperature: None C
    Humidity: None %
    Failed to get reading. Try again!

    What is the cause ?

    • Hi Gangaram,

      please double check if everything is wired correctly. Also, do you have a spare sensor to see if the current one is broken?

  • Seth Bickford

    I’m having a few problems.

    1: When I log on into the Pi it doesn’t ask for a login, or to turn on SSH. I ran “userdel pi” and it said: “user pi is currently being used by process 730”.

    2: I tried to get a static IP, and I ran “nano /etc/network/interfaces” and the window I got was different than what you said was the default.

    auto lo
    iface lo inet loopback

    iface eth0 inet manual

    allow-hotplug wlan0
    iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

    allow-hotplug wlan1
    iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

    It also says no write permission (even though it gives me an option to save progress, but I’ve never saved changes).These were all default.

    3: I run “rm /var/www/html/index.html” and it says it’s a write-protected file. I type “y” and it said “Permission denied”. I’ve done all the software commands up to this point and got an Apache website working saying I need to remove index.html. Is all of this the fault of the login process I could never find?

    FYI, I have a Raspberry Pi 3 Version B model.

    • Fear not Seth, we’re here to help! 🙂

      – You cannot ssh to pi if I understand correctly? If so, please turn it on by typing sudo raspi-config and find the option to turn on SSH
      – Create a new user for example seth reboot and login as seth. Now you can delete user Pi
      – You cannot modify system files unless you are a super user. So before nano /etc/…. type in sudo nano /etc/…. With sudo you become a super user while editing the file in question
      – Same as deleting the index file. Type sudo rm index.html and you will be able to delete it

      Give it a go and let me know if you have other problems.

      • Seth Bickford

        When I rebooted it didn’t give me a chance to log in. When I clicked “log off” there was only user “pi” available and “Other”. I selected “Other” and typed in a new name and password and it said “Incorrect Password”. So, now I’m unaware of how to make accounts.

        edit: I found out how to do it

        • What do you get when you reboot, login as seth and userdel pi?

          I forgot to tell you to add user seth to sudo users (to make user seth an administrator). Do that by opening terminal and typing su then the password. You are now using the shell as a super user. To make seth a superuser, type in adduser seth sudo.

          • Seth Bickford

            I’m actually using the name “scott” because it is technically not mine, it’s his and I’m only helping him set it up.

            1st thing: Logging in as “scott” still makes the pi refuse to look for a wifi access point, even as a sudo user.
            Rebooting the pi makes it default by loading user “pi”.

            2nd thing:

            [email protected]:~ $ sudo deluser pi
            Removing user ‘pi’ …
            Warning: group ‘pi’ has no more members.
            userdel: user pi is currently used by process 1152
            /usr/sbin/deluser ‘/usr/sbin/userdel pi’ returned error code 8. Exiting.
            [email protected]:~ $ sudo userdel pi
            userdel: user pi is currently used by process 1152

            Edit: I did the same thing a few minutes later and it said process 1154.

          • What if you do sudo raspi-config, Boot options, Desktop CLI and select console. This means that you will not boot to the graphic interface, which is probably preventing you from deleting the user. Reboot when you set boot to console and then login as scott, then try removing user Pi.
            Or you could simply leave user pi and change its password to something more secure 🙂

            For wifi, try

          • Seth Bickford

            Okay, I managed to delete the “pi” user, and I look at the site where wifi connections should be set up, but I followed the steps and did the commands and the information for the networks I was able to connect to as the “pi” user are still there, and it should be able to get some kind of connectivity. The Ethernet isn’t working either. Am I missing something?

          • That is something totally new. Ethernet has to work, regardless of the user.

            What do you say if you start completely from scratch, leaving the user pi untouched? First test Ethernet and then setup Wifi.

          • Seth Bickford

            We have a bunch of Raspberry Pi’s, so we definitely can restart. My questions for that would be: Would it use the same IP and will that get messed up with the Apache site? Would the current Pi I use work with a different SD card untouched for the same model?

            Or, do you think this is a result of some code that needs to be fixed? I’d rather think it’s that than hardware problems. Speaking of which, I really don’t want to undo the hardware setup, which is complete.

          • You will most likely get the same IP assigned, but its not guaranteed

            Sure, try a different SD card – that is an even better idea. Use a different card with a clean installation of Raspbian. That way you do not have to start completely from scratch.

            I really have no idea what could be wrong. I have installed Raspbian at least 50 times and was able to connect to wifi and ethernet without any problems.

            Give it a try with a different SD card and we’ll see what happens.

          • Seth Bickford

            It worked!

            Except now I’m confused on “mv wordpress/*.”. It says that no destination is selected. I think I know what this means, but where would I send it to?

            Edit: Is it too late now that I’ve done “rm -rf wordpress”?

          • I think that you forgot to put a whitespace between /* and . That’s why it did not know where to move the folder.

            WordPress folder holds files that are necessary for it to run. If you move the contents of WordPress folder to /var/www, you can easily delete the WordPress folder.

          • Seth Bickford

            So, I moved the contents out of the WordPress folder into /var/www, I removed the WordPress folder, set up the database and entered the IP into the Pi’s browser, and this happened…
            Those links on the top lead to the same page. Clicking on downloads the zip file into the Downloads folder in File Manager. I deleted that because it was a copy. The only thing I thought of doing was moving the files from the zip file from /var/www to /var/www/html. I tried to do that in the File Manager and it said “permission denied”. My next guess was to type in sudo commands to move them except I don’t know what those commands are. Should I be doing this, or am I missing something?

            PS: I posted this earlier without the picture and copied the contents of the site into here, and this site said that it needed approval because it was too long, I think. Sorry for a repost.

          • I believe that you removed all files except for the Don’t worry, I will guide you through the process. Follow it exactly and you will not have any problems

            1. cd /var/www/
            2. sudo chmod html
            3. wget
            4. unzip
            5. mv wordpress/* .
            6. rm -r wordpress

            Go to the IP of your Raspberry Pi and you will see the installation wizard

            Yes, the phone has to be nearby. It is not going to be detected if its too far away. I just read on a few hours that is giving away free SIM cards! I just ordered one for free. If you do the same, you’ll have to wait a bit, so I can get it and write a tutorial.

            Yes, IP can be changed:

            You can send data to cloud. You just need to implement it 🙂

          • Seth Bickford

            I actually did sudo mv to every file of from /var/www to /var/www/html and it worked. I got to the WordPress site but the username and password we want to assign didn’t work and it says that the username and password were in a config php file. The only thing related to that I saw was a a config sample php file, and that didn’t get me anywhere. Before hand, WordPress had only asked me to enter a password. We got that set up.

            Edit: Also, what are SIM cards?

          • So wordpress is installed but you don’t have the username and password?

            SIM card is the small card you put inside your telephone and enables you to call or text people. They are giving away 1000 of these SIM cards, with one you can send 1000 texts per month, free of charge.

          • Seth Bickford

            The only username or password that the Pi has asked us to set is the MySQL password. We’ve had no windows asking us to set any username or any other password. Would the username be root? Because we didn’t change any of that.

            Also, looking at your “Raspberry Pi as webserver” page, in the second paragraph, it says: “because it can cause problems with installin WordPress”. You’re missing a “g” or an apostrophe. I thought I’d let you know.

            Edit: Okay so using the password I entered and having the username “root” works, but it says “Can’t select database”. Is there something else I’m missing?

          • Seth Bickford

            Okay, I’m an idiot. I typed in “WordPressDB” for the database name and it worked.

          • Haha no you’re not, we have all been there 🙂 Hope all goes smooth from now on 😉

          • Seth Bickford

            Looking closer at our hardwiring though, it looks like our your model uses the Pi Cobbler, while we have the Pi Cobbler +. Also, the download link you provided to buying the cobbler online shows the + version. Is there an updated model, or do we just merely deviate from the model?

            Edit: Forgot to mention, using DHT22 by the way.

          • I’m on my phone so I can’t google for specific details – does it have the same number of pins? Or simply put, have you tried wiring it to see if it works 🙂

          • Seth Bickford

            It doesn’t have the same number of pins. It has more.

            We’ve made some wire connections with an idea in mind that it would be relative to what the model shows.

            I’d provide a picture, but it’s not easy to provide a high resolution picture with a flip phone.

          • Seth Bickford

            OK, so what I did to solve this issue was moving the cables around to match the area where the names of the pins match. So, even though it’s farther away from the left side of the cobbler, I can still connect the yellow cable to pin 4, the red cable to pin 3V3, and the black cables didn’t actually have to move at all.

            [email protected]:~/Raspberry-Weather/production $ sudo python
            Traceback (most recent call last):
            File “”, line 78, in
            status=readInfo() #get the readings
            File “”, line 42, in readInfo
            print “Temperature: %.1f C” % temperature
            TypeError: float argument required, not NoneType

          • This error is popping up lately…. I’m not sure if the sensor is broken or if the reason lies within the operating system. Do you have a spare sensor at hand?

          • Seth Bickford

            We tested the sensor with a multimeter and it got voltage readings with all three cables, so I don’t think the sensor is broken. We ordered both the DHT22 and DS18B20 sensors, but only the DHT22 has showed up. The operating system was brand new and updated like you wanted us to, and we believe the sensor is also brand new.

            Are we looking for resistance readings on the sensor? Do you think it’s a problem in the script? Is our hard-wiring incorrect because we have a bigger cobbler? Is our sensor testing inaccurate? Do you think moving the files around a lot to make the commands work could’ve caused this?

            Edit: Does a resistor need to be connected?

          • I’m not sure, but the script should not be the cause. There is another fellow asking the same question – his set up has been working for some time and all of the sudden it’s not.
            We can also rule out file moving.

            It has to be connected exactly as shown in the picture 😀

          • Seth Bickford

            Well we ordered a new DHT22 sensor and we still have the same problem. Almost every hardware connection was tested by a multimeter and they all got successful readings. With a complete exchange of hardware, getting the same problem doesn’t make sense. There are a few things I think could be the problem:

            Using a Pi Cobbler + instead of the regular version could make the script not recognize it.

            There may be something up with the pi or the OS. We took the cobbler out of the pi’s pins once and the pins were slightly bent. We don’t think that should cause any negative effect.

            Not everything was downloaded. That would be embarrassing.

            There’s something wrong with the script.

            The hardwiring placements are incorrect. I don’t want to believe that though.

          • Seth Bickford

            Okay, so what I decided to do was use another method with the DHT22 to just only get readings, and not store or display them, and that worked.

            Right after that, I decide to run sudo python and it actually worked!

            So, it’s possible that I missed something while installing or not everything was updated.

          • Really? Wow, very glad to hear that.

            I do have a theory. DHT22 sometimes does not get a reading, but returns null. My script does not handle null values and crashes. I should fix it so that if DHT22 returns null, then do nothing.

          • Seth Bickford

            Actually the secondary method I used involved the Adafruit library, so that could’ve fixed it.

            But now I’m not getting continual readings every 30 minutes. Also, is there a way to get a reading every 1 minute?

          • Can you please paste me the line that you changed?

            Yes, it’s easy to get a reading every minute. You have a cronjob set to 0,30 * * * * which means that 30 minutes the script is executed. Change 0,30 to * and save.

          • Seth Bickford

            I didn’t change anything to Maybe I just had to install a few more files and update them.

            Where would I find the cronjob? I don’t see cronjob or 0,30 * * * * in

          • :))))))
            Okay, I’ll keep on digging to try and figure out what’s the cause of the problem.

          • Seth Bickford

            * * * * * /usr/bin/python Raspberry-Weather/production/

            I refresh the graph page every few minutes and the only reading that shows up is the reading that happened when I manually ran the code.
            I can confirm that is the correct path because sudo python Raspberry-Weather/production/ works.

            One last thing: Our phone we’re using for the hotspot which hosts the WordPress site was dropped last night and the screen’s cracked, and we’re getting another one. We would have to change the IP, but to what? If we transferred the data, would the IP of the new phone be the same? I don’t recommend using a phone because if the hotspot is turned off, then the site won’t load. The only other nearby networks to the pi are college WiFi networks, and using them wouldn’t work, and it would be a nightmare. Yes, we’re doing this in a college. Would bringing in a personal router work?

          • You were really close – the path is the problem You’re missing the whole path, something like /home/seth/Raspberry-Weather/production/ . Go to the folder where is located. Type in pwd and you’ll get the whole path.

            No humidity? Are you telling the graph to display humidity and temperature by using


            in the plugin shortcode?

            About the phone – I’m guessing that the IP will be assigned automatically. A personal router would work if it was plugged into the network and to the weather station. If you want the weather station to be accessible outside the college, you’d have to set up port forwarding on the router. But let’s not get into that part just yet.

          • Seth Bickford

            Okay, configuring the humidity visibility shouldn’t be too hard.

            I feel like I’ll just leave the Raspberry-Weather folder in /root.

            We just bought a new router. Its IP shouldn’t interfere with the networks of the college so we can host the site without problems.

            Also, every piece of equipment we use belongs to a professor, Scott. I’m just helping him build this.

          • If it works in /root then by all means – leave it be

            Greetings to professor Scott also, hope he’ll give you good marks when you finish this project 🙂

          • Seth Bickford

            It turns out bringing in a personal router stands no chance against the college’s security. Anyway, this was a great project to work on and thank you for your help!

          • Oh well… I’m glad you got this far 🙂

          • Tnx for the spellcheck, the guide must be full of such bugs 😀 its fixed now.

            Double check the username and password for mysql. In fact, try logging in to mysql with
            mysql -u root -p
            It should then ask you for the password, input it. When you’re connected to mysql, simply type in exit and you’ll be back. Wp-config.php needs to have the username and password for mysql. It also needs to have localhost as database host. Check that first.

            Then check if you have created the database for WordPress and if that database name is in wp-config.

  • Qukoyk

    Hi Peter

    It’s Qukoyk again.

    The weather station had worked in the lab perfectly for 10 month. Everyone including professor love this budget very much.

    But these days something wrong with the weather station.

    It couldn’t get temperature and humidify anymore, so I run manually and error information are:

    [email protected]:~ $ sudo python /root/Raspberry-Weather/production/
    Traceback (most recent call last):
    File “/root/Raspberry-Weather/production/”, line 78, in
    status=readInfo() #get the readings
    File “/root/Raspberry-Weather/production/”, line 40, in readInfo
    humidity, temperature = Adafruit_DHT.read_retry(sensor, pinNum)#read_retry – retry getting temperatures for 15 times
    File “build/bdist.linux-armv7l/egg/Adafruit_DHT/”, line 90, in read_retry
    File “build/bdist.linux-armv7l/egg/Adafruit_DHT/”, line 76, in read
    File “build/bdist.linux-armv7l/egg/Adafruit_DHT/”, line 56, in get_platform
    File “build/bdist.linux-armv7l/egg/Adafruit_DHT/”, line 24, in
    ImportError: No module named Beaglebone_Black_Driver

    It never happened before, so I think maybe it was caused by upgrade of kernel.
    Should I re-install raspberry-weather again just like solutions in other problem caused by “kernel upgrade”?
    Or do something else to fix it up?

    I need your help.


    • I’m not using DHT22 so I’m not sure what could be the case.

      Please try: sudo python install

      Have you recently ran sudo rpi-update that updated the firmware? If yes, you could try rolling it back. But not before making an image. In fact, make an image of the SD card right away. I’m speaking from my own experiences 🙂

      • Qukoyk

        I re-installed it and there’s some error info:

        [email protected]:~/Raspberry-Weather/production# python Warning: Table ‘temperatures’ already exists

        And the 2nd time I ran it showed like this:

        [email protected]:~/Raspberry-Weather/production# python
        Traceback (most recent call last):
        File “”, line 78, in
        status=readInfo() #get the readings
        File “”, line 42, in readInfo
        print “Temperature: %.1f C” % temperature
        TypeError: float argument required, not NoneType

        • First error is because the table Temperatures already existed. The second time the same error was not present, so that’s okay.

          What happens if you simply comment out the line 42 and check if it is saved in the DB.

          • Qukoyk

            It still can’t get reading, also not saved in the DB.

            [email protected]:~ $ sudo python /root/Raspberry-Weather/production/
            Humidity: None %
            Failed to get reading. Try again!

          • I see, it actually does not read anything. As you posted, humidity is None.

            Is it possible that the sensor is somehow broken? Do you have anonther DHT22 sensor that you can wire, double check and re-run the script?

          • Qukoyk

            Hmmm… actually the sensor was placed indoor and nobody had moved it before. So I think it could hardly broken.

            Unfortunately that’s the only sensor we have. But anyway, I’m trying to buy another one and do a double check.

          • Hmmm, I hope that the other one works! And that you get it soon from China 🙂

  • Chad

    I had ordered all my parts before I stumbled on your weather station fortunately one of which was the DS18B20. After some reading and a couple attempts I was able to get through your howto and get the sensor and WordPress going. Nice work. I do however have a question or two. The other sensor I intended for this I have are BMP280 and wondered how difficult you think it may be to get it going as well? My reasoning for this was “temperature, barometric pressure, altitude” capabilities for this project and another Im working on. I have jumped in both feet with little experience programming, but many years Linux/networking so Im grasping it(mostly) one line at a time. Hahaha Thanks

    • Chad

      I may have spoke too soon. I setup originally while at the office and have since brought it home where it will reside. Since then Ive had to update wp_options correcting the ip address but it no longer updates sensor data to the graph only showing sample data??

      • Hey Chad!

        I’ve never used BMP sensors myself. Can you try it might help or start you off in the right direction?

        About the graph, lets start by checking if readings are stored in the DB. Please take a look at the third FAQ at the very top of this page. it tells you how to check if anything of use is in temperatures table.

        • Chad

          Hi Peter,
          Thanks for taking the time with this. I think I found most of my issue. I started with Rasbian Jessie lite and in one of my upgrade moments did dist-upgrade and found the newest version of rasbian to be “Stretch” which now among other changes uses MariaDB it is supposed to be interchangeable but I found reinstalling to be easier. Back to Jessie for now as with Stretch and MariaDB I was getting an error installing WordPress that I just couldnt find a work around for.

          • Thanks for the heads up Chad. Looks like I’ll have to update the guide so it works with the new changes…

  • Ronelle Scharber

    Thanks for this easy instructional. I was wondering if I am supposed to install python in the same directory as all the other software or if it was supposed to install in the root. My pi3 had python installed, can I skip this step?

    • Sure, just give it a go and we’ll see what happens.

  • Ronelle Scharber

    when i run it returns:
    Traceback (most recent call last):
    File “”, line 56, in
    con=mdb.connect(“localhost”, databaseUsername,databasePassword,databaseName)
    File “build/bdist.linux-armv7l/egg/MySQLdb/”, line 81, in Connect
    File “build/bdist.linux-armv7l/egg/MySQLdb/”, line 193, in __init__
    _mysql_exceptions.OperationalError: (1049, “Unknown database ‘WordPressDB'”)

    • Does WordPressDB exist, have you created it?

  • Ronelle Scharber

    show databases returns:

    i left the WordPressDB as it was so cant be sure whats going on here.

    • I believe that you named the database WordPress. The script is trying to connect to WordPressDB. Easiest way is to change the script from WordPressDB to WordPress.

  • Chad

    Follow up working with bmp280 and have it giving me data, next step attempt to modify DB with new data then to html. Just a note I reinstalled on Pi3 all was working until the day=”today” quit? all other options(yesterday, last7, last30 are still posting data? something else I noticed and cant figure out is sql error:
    mysql> show databases;
    | Database |
    | information_schema |
    | WordPressDB |
    | mysql |
    | performance_schema |
    | phpmyadmin |
    5 rows in set (0.00 sec)

    mysql> use WordPressDB;
    ERROR 1049 (42000): Unknown database ‘WordPressDB’
    mysql> select * from temperatures;
    ERROR 1046 (3D000): No database selected
    mysql> use WordPressDB;
    ERROR 1049 (42000): Unknown database ‘WordPressDB’

    But it still works?

    • Well, that’s a bit weird. The commands you provided should work. When use WordPressDB; is used, it should display “Database changed” or something like that.

      Did you by any chance update to Raspbian Stretch?

      • Chad

        No dist-upgrade this time after it failed when I did it last time. I agree it is strange mysql query returns that. I rechecked all this morning and its working again so Ill leave it and keep an eye on things Im not sure why or what caused the interruption. Back to work on the bmp280, Thanks and have a great day.

        • Great, lovely to hear that! Have a good day! Hope all goes smooth from now on 🙂

  • math


    This a great tutorial, I am very happy I managed to go that far with it.

    I have now a little problem with the reading when I launch the script, and I got the following return after few seconds

    ~/Raspberry-Weather/production $ sudo python

    Traceback (most recent call last):
    File “”, line 78, in
    status=readInfo() #get the readings
    File “”, line 42, in readInfo
    print “Temperature: %.1f C” % temperature
    TypeError: float argument required, not NoneType

    I am not sure the DHT22 is working properly

    The webserver and the DB aren’t on the PI, I check the table is well self created but empty.

    Raspberry PI3 – 40 pins

    Thank you for your help


    • Hi Math!

      I’ve seen similar errors lately, no idea what causes them. I do have a theory. DHT22 sometimes does not get a reading, but returns null. What if you try to run the script manually every few seconds, over and over again? Just to see if you get a reading after multiple tries.

      • math

        Hi Peter,
        Thanks for your reply

        I have set cron to run the script every min, and also try to run it manually with the terminal with the exact same result.
        If I follow your theory the problem should come from the DHT22.
        How can I check if the DHT22 is working properly, if I didn’t kill it by missplugin it during the setup on my 40 pins.
        I added a pictures of the wiring with the 40 pins connector, if you need I can do a better one for the tuto

        • This part looks okay.
          You can test it by using . You need to clone it to your Raspberry Pi and install other stuff (take a look at the link and copy paste the commands). Within the folder Adafruit_DHT lies a file named Run it and we’ll see what happens.

          I’m not using DHT22, but looks like I’ll have to wire it up and see what’s going on.

          • math

            Hi Peter,
            As you advice I cloned the adafruit sensor lib and run the no expert at all in .py I am not sure of the result related to the sensor capacity

            Traceback (most recent call last):
            File “”, line 21, in
            from . import common
            ValueError: Attempted relative import in non-package


          • Try to completely remove line 21 and 22. In its place put
            import common
            import Test_Driver as driver

            hopefully that will do the trick

          • math

            Hi Peter

            Unfortunatly it didn’t the trick

            new message :
            Traceback (most recent call last):
            File “”, line 21, in
            import common
            File “/home/pi/dht22/Adafruit_Python_DHT/Adafruit_DHT/”, line 23, in
            from . import platform_detect
            ValueError: Attempted relative import in non-package

            I tried several times the script from Adafruit

            sudo .sudo ./ 2302 4
            Failed to get reading. Try again!

            I guess the sensor is broken as I figured

            I have found found a new one 1 day shipment from home, I will wait for it and try again

            thanks for your help


          • Okay, please let me know if it works. I really hope the replacement works without any problems!

          • math

            Hi Peter,

            [email protected]:~/Adafruit_Python_DHT/examples $ python 2302 4
            Temp=23.4* Humidity=31.1%

            So I confirm you that I burned the first one, and you tuto is great, all my bad!!
            So I keep going with the rest and inform you


          • Thanks for getting back. Great that everything is working!

  • math

    Hi Peter,
    So happy to have succeeded part one with your help, I went to part 2… and promise I didn’t burn anything that time.

    I plugged a BMP280 and follow all the tuto until the testing script and I got this result :

    Traceback (most recent call last):
    File “”, line 93, in
    File “”, line 37, in readInfo
    sensor = BMP085.BMP085(mode=BMP085.BMP085_ULTRAHIGHRES)
    File “build/bdist.linux-armv7l/egg/Adafruit_BMP/”, line 69, in __init__
    File “build/bdist.linux-armv7l/egg/Adafruit_BMP/”, line 72, in _load_calibration
    File “build/bdist.linux-armv7l/egg/Adafruit_GPIO/”, line 201, in readS16BE
    File “build/bdist.linux-armv7l/egg/Adafruit_GPIO/”, line 178, in readS16
    File “build/bdist.linux-armv7l/egg/Adafruit_GPIO/”, line 165, in readU16
    File “build/bdist.linux-armv7l/egg/Adafruit_PureIO/”, line 173, in read_word_data
    IOError: [Errno 121] Remote I/O error

    I plugged as follow:
    BMP280 –> RPI3

    SDA to pin 3 ( SDA1 I2C)
    SCL to Pin 5 ( SCL1 I2C)
    VCC to pin 17 (3V3)
    GND to GND

    I was wondering if my plugging was wrong if I am missing some lib, because when I try with the

    I have this result

    Traceback (most recent call last):
    File “”, line 250, in
    File “”, line 232, in main
    chip_id, chip_version = bmp.read_id()
    File “”, line 173, in read_id
    (chip_id, chip_version) = self._read_i2c_block_data(REG_ID, 2)
    File “”, line 153, in _read_i2c_block_data
    results = self.bus.read_i2c_block_data(self.address, reg, length)
    IOError: [Errno 121] Remote I/O error

    Thank you for your help

    • I really hate to say this but, I’ve never used this sensor… This part of the code was done by another weather enthusiast that liked this page….
      Did some googling, someone with a similar setup said that he did not wire everything correctly. Can you please try start over with the wiring part and take it super slow 🙂

      • math

        Hi peter,

        I did plug a BM180 instead of the bmp280 and it worked great, i got the pressure… and also plugged a camera and set the feed so I have it online along the graph… so glad. I will send some pictures of the set up once hanged on the wall

        but I a have a question when I run the new wind pressure I have the following result :

        Pressure = 101727.00 Pa
        Traceback (most recent call last):
        File “”, line 93, in
        File “”, line 46, in readInfo
        output = subprocess.check_output([“/root/Raspberry-Weather/Adafruit_DHT”, “2302”, “4”]);
        File “/usr/lib/python2.7/”, line 212, in check_output
        process = Popen(stdout=PIPE, *popenargs, **kwargs)
        File “/usr/lib/python2.7/”, line 390, in __init__
        errread, errwrite)
        File “/usr/lib/python2.7/”, line 1024, in _execute_child
        raise child_exception
        OSError: [Errno 13] Permission denied

        and of course when I read the original script I have the following result

        Temperature: 17.5 C
        Humidity: 50.2999992371 % Warning: Field ‘pressure’ doesn’t have a default value
        cur.execute(“INSERT INTO temperatures (temperature,humidity, dateMeasured, hourMeasured) VALUES (%s,%s,%s,%s)”,(temperature,humidity,currentDate, minutes))
        Saved temperature

        Thank you for time


        • Great to hear that you progressed Math! Please do send a link to your page, I’ll be more than happy to add you to the “hall of fame”.

          The original script error tells you that the “pressure” column does not have a value, the script did not send it to the database as you can see in the INSERT INTO clause.

          Please try running the first script with sudo, it might work?

          • math

            Hi Peter,
            Back on it on this rainy sunday…
            I tried also to run the script as sudo and got the following :

            Pressure = 101395.00 Pa
            Traceback (most recent call last):
            File “”, line 93, in
            File “”, line 46, in readInfo
            output = subprocess.check_output([“/root/Raspberry-Weather/Adafruit_DHT”, “2302”, “4”]);
            File “/usr/lib/python2.7/”, line 212, in check_output
            process = Popen(stdout=PIPE, *popenargs, **kwargs)
            File “/usr/lib/python2.7/”, line 390, in __init__
            errread, errwrite)
            File “/usr/lib/python2.7/”, line 1024, in _execute_child
            raise child_exception
            OSError: [Errno 2] No such file or directory

            In my previously created DB I simply : ALTER TABLE `temperatures` ADD `pressure` DOUBLE NOT NULL ;

            My question is as I have already a Raspberry-Weather folder at the root, where should I git clone the one for the pressure which have the save name?
            Maybe the error comes that I rename the first one?

            secondly could I use the BMP180 to read all parameter Humidity and temperature?

            I tested the sensor and I got this result :

            ~/Adafruit_Python_BMP/examples $ sudo python
            Temp = 19.30 *C
            Pressure = 101377.00 Pa
            Altitude = -4.41 m
            Sealevel Pressure = 101374.00 Pa

          • Create a new map and clone it to this map. Just make sure to use the new path name in crontab.
            You will have to wire the DHT22 plugin next to BMP180 to get humidity readings. Its possible, but you’ll have to do some coding also 🙂

  • Frank Ryan

    Hi Peter!
    I’m a committee member for an astronomy club in Ireland. We need to monitor the weather via the web at a remote site. We’ve been looki g at off the shelf products but these are insanely expensive. I found your website and must say ee are super impressed and excited that you have built probably exactly whst we need! So, I hope you might help with some stupid questions?
    There is no power at the site but there is 4G mobile phone coverage. We need a specific set of sensors to understand is the site suitable for astronony. So: dewpoint / humidity / atmospheric pressure / wind / temp / rainfall / sunlight and if possible – this is the tricky bit- a webcam that can show us if its cloudy / foggy at night.

    With your experience I think your our last hope. :-p

    • Hi Frank,

      let me start by saying that I’m a big fan of Ireland. Incredible place, had my vacation twice in the last two years and I will definitively return!

      Well the current tutorial does not cover all the sensors that you’d need. Which does not mean that it’s impossible, but requires some additional effort :). Currently you can get humidity and temperature readings. The webcam part sounds tricky but should not be that big of a problem. In fact Wayne upgraded this tutorial to add a camera, take a look at When I finish the projects I have in the pipeline, I should upgrade my code to use the official Raspberry camera and take a picture every 30 minutes or so.

      If I may, I’d advise you to start with only a few sensors and then slowly upgrade. I haven’t tried using a SIM with the station, but I’ve seen loads of tutorials that cover this part. Solar power should also work, you could also add a power bank that will be charged for times when there’s no sun.

      Dew point can be calculated, although I’m not sure how accurately. So you could skip this particular sensor. I have no idea about the rain sensor and wind sensor though.

      Please keep me in the loop, I’m really interested in hearing more about this project.

  • Jonathan

    For those of you having problems getting the sensor to work properly, I think I have discovered the problem/solution. I am far from an expert in any of this, so I will not be giving step by step instructions as I don’t want to lead anyone astray.

    Problem: Despite having the sensor connected properly, returns an error rather than the proper reading. I am using a Raspbery Pi Zero W (FYI). Upon some research, it appears that the Adafruit_DHT library has been updated to support “pi 3 detection”. When I followed the instructions on this site, everything worked well except this point. I believe it is due to the fact that the Adafruit_DHT library contained within this structure is outdated so it is not detecting my device properly.

    My solution: I updated the Adafruit Python DHT Sensor Library in /Raspberry-Weather to the latest version from The script immediately returned the information.

    Request: I believe the author, like me, isn’t a raspberry pi guru and relies on some of the code from others. It would be great for someone who knows what they are doing to…
    1. Verify my solution
    2. Update to reflect the newer sensor library. This should have no effect for those with older raspberry pis but should fix those with the newer models.

    Please test out my fix and provide feedback if it works for you. It is working for me.

  • Halfheart

    Hej man.
    Nice tutorial even though it is important to update the Adafruit own software to get the readings.
    Right now the Pi is in a closed office environment so I cannot show it to you.

    I just wanted to know:
    What codes are available for the graphs?
    I have:
    24 = a test of data
    I wonder is there the last 24 hours ?

    Best regards

    • Hey Halfheart!
      There are no other codes available at the moment, sorry. You’d have to change the query a little bit, if you wanted the last 24 hours…

  • Maximilian First

    hi, my error when I try sudo python
    [email protected]:/Raspberry-Weather/production/Raspberry-Weather/production# sudo python
    Traceback (most recent call last):
    File “”, line 9, in
    import MySQLdb as mdb
    ImportError: No module named MySQLdb

    • Try fixing this by installing: easy_install MySQL-python