07.31
I’ve added a very simple light level graph to the existing temperature measurement graphic page.
Share on FacebookWe do what we must, because we can!
I’ve added a very simple light level graph to the existing temperature measurement graphic page.
Share on FacebookI got tired of the utilitarian look of the temperature graph, and I hope to add more graphs, so it was finally time to do something.
Read More >>
Share on FacebookWhen I originally constructed the Temperature Graph, it was based on work by the OpenEnergyMonitor, and came with a Perl script on the web server end. I never much liked this for a couple reasons, its a dying language and I am not at all familiar with it. I also had to mess around with a cgi-bin directory, and things did not work out of the box with my webserver.
Read More >>
After much drama in my life, not suitable for inclusion in this forum, I am back to doing development work. First up, converting the temperature webpage to Fahrenheit. I got tired of wondering just how warm 25.67C was. I know, lazy American!
So, dusting off the original temp_sender.pde code, I added the necessary Celsius to Fahrenheit calculation. The sender still spits C as well as F out of the serial port, but only reports degrees F to the mySQL database. I have not found a reason to use the archived data yet, and this is technically beta, so I won’t worry about the abrupt jump of ~50 degrees.
This code has been running flawlessly since early March, surviving various ISP hiccups, network rewiring, etc. There is something to be said for simplicity, it just puts the temperature to a perl script and that’s it. No error checking to speak of except gross failure (i.e. the ethernet cable is unplugged).
The code is shown below and available for download here, data and library for the TMP421 temp sensor is available here, and this was the original article .
Share on Facebook#include “Wire.h”
#include
#include//Sets the unique mac address for the ethernet board
//set this according to your network!!!
byte mac[] = {0xDE,0xAD,0xBE,0xEF,0xFE,0xED};
byte ip[] = {192,168,2,51};
byte gateway[] = {192,168,2,1};
byte server[] = {173,203,204,206};//Setup a client
Client client(server, 80);LibTemperature temp = LibTemperature(0);
void setup()
{
Serial.begin(9600);
Ethernet.begin(mac, ip, gateway);
delay(1000);
}void loop()
{
float tempC = temp.GetTemperature();
Serial.print(“Temp: “);
Serial.print(tempC);
Serial.print(” degC “);
float tempF = (tempC * 9 / 5) + 32;
Serial.print(tempF);
Serial.println(” degF”);
delay(100);//Send the data
if (client.connect())
{
client.print(“GET http://ka1kjz.com/cgi-bin/post.pl?T=”);
client.print(tempF);
client.println();
client.stop();
}
else
{
Serial.println(“Failed to connect to client”);
}
delay(300000);
}