Contact

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 contact me via Skype (my username is peterslo85) or 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/__init__.py”, 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/__init__.py”, 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.

    –alessandro

    • 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 https://svn.apache.org/repos/asf/oodt/tools/oodtsite.publisher/trunk/distribute_setup.py

      sudo python distribute_setup.py

      sudo rm distribute_setup.py

      Try again, and enjoy. E.g.:

      sudo easy_install pip

  • David

    Hello,

    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 http://askubuntu.com/a/12933.
      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

    Hi,

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

  • Christian

    Hello,

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

    Best Regards, Chris

  • Kristian

    root@raspberrypi:/var/www# wget http://www.raspberryweather.com/wp-content/uploads/2015/02/phpMyadmin-4.3.9-all-languages.tar.gz
    –2015-10-29 19:42:31– http://www.raspberryweather.com/wp-content/uploads/2015/02/phpMyadmin-4.3.9-all-languages.tar.gz
    Resolving http://www.raspberryweather.com (www.raspberryweather.com)… 89.212.138.37
    Connecting to http://www.raspberryweather.com (www.raspberryweather.com)|89.212.138.37|:80… connected.
    HTTP request sent, awaiting response… 404 Not Found
    2015-10-29 19:42:32 ERROR 404: Not Found.

  • Kristian

    hi.

    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 192.168.1.4 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.
    Shanta

    • 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

    hi,
    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

    Hi
    Every time I want to test the python getInfo.py script, to see if the wiring is ok it just shows this:
    root@raspberrypi:~/Raspberry-Weather/production# python getInfo.py
    Traceback (most recent call last):
    File “getInfo.py”, 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 getInfo.py. 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/getInfo.py
    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/getInfo.py

  • 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:

    AND

    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

    Hi!

    Excited to start this tutorial and build my own PWS!

    Question:

    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,

      hmmmm.

      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 raspberrypi.org? 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 “getInfo.py”, line 100, in
    status=readInfo()
    File “getInfo.py”, line 53, in readInfo
    output = subprocess.check_output([“/root/Raspberry-Weather/Adafruit_DHT”, “2302”, “4”]);
    File “/usr/lib/python2.7/subprocess.py”, line 566, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
    File “/usr/lib/python2.7/subprocess.py”, line 710, in __init__
    errread, errwrite)
    File “/usr/lib/python2.7/subprocess.py”, 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.
    Gary

  • JP

    I don’t know enough about programming to do this myself, but I would like to upload to wunderground.com for pws. they have requirements as displayed on this site. http://wiki.wunderground.com/index.php/PWS_-_Upload_Protocol 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 getInfo.py 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:

      page=requests.get(“https://weatherstation.wunderground.com/weatherstation/updateweatherstation.php?ID=YOUR_ID_HERE&PASSWORD=YOUR_PASSWORD_HERE&dateutc=now&tempf=”+str(temperature)+”&softwaretype=vws%20versionxx&action=updateraw”)

      You have to register https://www.wunderground.com/personal-weather-station/signup.asp 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 “getInfo.py”, line 37
        page=requests.get(“https://weatherstation.wunderground.com/weatherstation/updateweatherstation.php?

        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: https://www.adafruit.com/products/1733 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 http://www.raspberryweather.com/pressure-and-wind-expansion/.

      • 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.

    pi@raspberrypi:/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?

    pi@raspberrypi:~ $ rm /var/www/index.html
    rm: cannot remove ‘/var/www/index.html’: No such file or directory
    pi@raspberrypi:~ $ sudo rm /var/www/index.html
    rm: cannot remove ‘/var/www/index.html’: No such file or directory
    pi@raspberrypi:~ $ pi@raspberrypi:~ $ rm /var/www/index.html
    -bash: pi@raspberrypi:~: 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!

    Cheers,

    Dave

    • 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 http://www.raspberryweather.com/create-your-own-wordpress-site/ as I have created the database using CREATE DATABASE WordPressDB; however there are no instructions for table & field names. Therefore following the instructions at http://www.raspberryweather.com/raspberry-weather-graph/. 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 getInfo.py 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!

    Qukoyk

    • 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:

        TZ=’Asia/Tokyo’
        0,30 * * * * /usr/bin/python /root/Raspberry-Weather/production/getInfo.py

        I can run “python /root/Raspberry-Weather/production/getInfo.py” 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/getInfo.py

          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 WORRRRRRRRRRRRRRKED!!!!!!

            助かりました!

            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

    Hello,

    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) https://www.adafruit.com/products/1733. 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 http://www.raspberryweather.com/pressure-and-wind-expansion/ .

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