Forum Replies Created

Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • in reply to: Radiation vs Weather #1951
    David
    Participant

    Those graphs look really nice Steve, what are you using to generate those?

    I’m using jpgraph for mine which seems to be alright but as you can see from the above I’m yet to refine them into nice looking ones.

    Apache, PHP, MYSQL are all running on a Debian VM and a cron job runs every 5 minutes with that python script to poll the data into MYSQL.
    Weather data is injected using Weather Display which runs on a Windows 7 VM.
    I noticed you are using “weewx” for yours I may have to give that a look as the less stuff I have running on the Windows 7 VM the better.

    All of this data is stored in one MYSQL database called “temps” this includes a table for uRAD, weather, bathroom, laundry and rack.
    The last three being for my home automation system to control extraction fans.
    I then use jpgraph and PHP to pull data from the tables.
    This is the PHP script for the Wind vs CPM graph. (I’m far from good with programming so it’s a bit of a mess)

    <?php // content="text/plain; charset=utf-8"
     
    define('__ROOT__', dirname(dirname(__FILE__)));
    require_once ('../jpgraph/jpgraph.php');
    require_once ('../jpgraph/jpgraph_line.php');
    require_once ('../jpgraph/jpgraph_error.php');
     
     
    $x_axis = array();
    $y_axis = array();
    $y1_axis = array();
    $y2_axis = array();
    $i = 0;
     
    $con=mysqli_connect("localhost","username","password","temps");
    // Check connection
    if (mysqli_connect_errno()) {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }
     
    $result = mysqli_query($con,"SELECT * FROM urad ORDER BY <code>id</code> DESC LIMIT 288");
     
     
    while($row = mysqli_fetch_array($result)) {
    $x_axis[$i] =  $row["time"];
    $y_axis[$i] = $row["cpm"];
        $i++;
    
    } 
    
    $i = 0;
    $result = mysqli_query($con,"SELECT * FROM weather ORDER BY <code>datetime</code> DESC LIMIT 288");
    
     
    while($row = mysqli_fetch_array($result)) {
    $y1_axis[$i] = $row["average_windspeed"];
        $i++;
    
    }
        
    
    $i = 0;
    $result = mysqli_query($con,"SELECT * FROM weather ORDER BY <code>datetime</code> DESC LIMIT 288");
    
     
    while($row = mysqli_fetch_array($result)) {
    $y2_axis[$i] = $row["gust_windspeed"];
        $i++;
    
    }
    
    mysqli_close($con);
     
     
     
    $graph = new Graph(1000,500);
    $graph->img->SetMargin(40,40,40,40); 
    $graph->img->SetAntiAliasing();
    $graph->SetScale("textlin");
    $graph->SetShadow();
    $graph->title->Set("Red: Average Windspeed Green: Gust Windspeed Blue: CPM");
    $graph->title->SetFont(FF_FONT1,FS_BOLD);
     
     
    // Use 20% "grace" to get slightly larger scale then min/max of
    // data
    $graph->yscale->SetGrace(0);
     
     
    $p1 = new LinePlot($y_axis);
    //$p1->mark->SetType(MARK_FILLEDCIRCLE);
    //$p1->mark->SetFillColor("red");
    $p1->mark->SetWidth(2);
    $p1->SetColor("blue");
    $p1->SetCenter();
    $graph->Add($p1);
    
    $p2 = new LinePlot($y1_axis);
    //$p2->mark->SetType(MARK_FILLEDCIRCLE);
    //$p2->mark->SetFillColor("red");
    $p2->mark->SetWidth(2);
    $p2->SetColor("red");
    $p2->SetCenter();
    $graph->Add($p2);
    
    $p3 = new LinePlot($y2_axis);
    //$p2->mark->SetType(MARK_FILLEDCIRCLE);
    //$p2->mark->SetFillColor("red");
    $p3->mark->SetWidth(2);
    $p3->SetColor("green");
    $p3->SetCenter();
    $graph->Add($p3);
     
    $graph->Stroke();
     
    ?>
    
    in reply to: Radiation vs Weather #1948
    David
    Participant

    Here is the python script I’m using to pull data from the uRAD monitor into mysql in case anybody is interested.

    import time
    import json
    import MySQLdb
    import urllib2
    response = urllib2.urlopen('http://192.168.1.225/j')
    html=response.read()
    result = json.loads(html)
    data = result['data']['temperature']
    cpm = result['data']['cpm']
    
    db = MySQLdb.connect(host="localhost",user="username",passwd="password",db="temps")
    curs=db.cursor()
    
    try:
    	curs.execute ("INSERT INTO urad (tdate, time, temperature,cpm) VALUES (CURRENT_DATE(), NOW(), %s, %s) """, (data, cpm))
    	db.commit()
    
    except db.Error, e:
            print "Error %d: %s" % (e.args[0],e.args[1])
            db.rollback()
    
    db.close()
    
    in reply to: Radiation vs Weather #1945
    David
    Participant

    Attached is Temp/Humidity graph as well as screenshot of Weather Display software.

    in reply to: Firmware upgrade #1324
    David
    Participant

    Updated the firmware on mine about 5 days ago without an issue and has been running stable ever since 🙂

    Halon where about in Australia are you?
    I’m in Melbourne and would be happy to flash yours for you if you are unable to.

    I have attached a picture of the programmer I used was ~$3 on eBay.

    • This reply was modified 9 years, 2 months ago by David. Reason: Pics too large
    in reply to: Introduce Yourself! #1296
    David
    Participant

    Hi,

    I’m David and run unit just north of Melbourne, Australia.

    Currently working a a computer/network technician and have a interest in home automation.
    Hoping to build up a weather station soon as well to be able to match data from the uRAD up with rainfall, wind conditions, temp, humidity, etc.

    -David

    • This reply was modified 9 years, 2 months ago by David.
    • This reply was modified 9 years, 2 months ago by David.
    in reply to: Plans for the network – data access #1011
    David
    Participant

    No worries.

    Is the one you have linked appropriate? If so I will order one in anticipation of the firmware update and perhaps assisting in testing the new software.

    in reply to: Plans for the network – data access #720
    David
    Participant

    Will this update be pushed out from the server or will it require local updating per unit?

Viewing 7 posts - 16 through 22 (of 22 total)