Go Down

Topic: Standalone Atmega328 Temp/pH/Humidity Sensor WIP (Read 1 time) previous topic - next topic

SpikedCola

Aug 16, 2009, 04:14 am Last Edit: Aug 16, 2009, 08:38 am by SpikedCola Reason: 1
Nothing amazing, but I picked up another atmega328 chip and a resonator and built a little board. Right now it doesnt have anything hooked up but eventually it will be connected to an LCD, pH sensor, humidity sensor, temperature sensor, and some SSR's.

It has a blue LED connected to the [arduino] pin 13, an ICSP header for burning the bootloader (or incase I want the extra 2kb of space), a header for power, and a header for Tx, Rx, and RST (to program with the Arduino IDE).




SpikedCola

Added RJ45 connector to attach sensors, and built a DS18S20 sensor board (just one for now, more to come later):





SpikedCola

#2
Aug 16, 2009, 06:41 am Last Edit: Aug 16, 2009, 06:46 am by SpikedCola Reason: 1
I apologize if the multiple posts makes anyone unhappy; I just like having a new post for every update, as it makes it easier for me to track progress and time/dates.

Finished the code (for now) include a Max/Min/Current temp display, using custom characters (the up and down arrows) to identify which is max and which is min, without cluttering the (tiny) display. I ran out of AWG30 wire, so when I pick more up Ill add the LCD to the atmega board and wire it up.


Code: [Select]
#include <DallasTemperature.h>
#include <LiquidCrystal.h>

// RS EN D4 D5 D6 D7
LiquidCrystal lcd(0, 1, 2, 3, 4, 5);
DallasTemperature tempSensor;
double maxtemp = 0;
double mintemp = 255;
byte up[8] = { 0x04, 0x0E, 0x15, 0x04, 0x04, 0x04, 0x04, 0x00 };
byte down[8] = { 0x04, 0x04, 0x04, 0x04, 0x15, 0x0E, 0x04, 0x00 };

void setup()
{
 tempSensor.begin(12);
 lcd.begin(16, 2);
 lcd.createChar(0, up);
 lcd.createChar(1, down);
}

void loop()
{
 double temp = tempSensor.getTemperature();
 lcd.home();
 lcd.write(0);
 lcd.setCursor(5,0);
 lcd.print(temp);
 lcd.write(223);
 lcd.print("C");
 lcd.setCursor(15,0);
 lcd.write(1);
 if (temp > maxtemp)
 {
   maxtemp = temp;
   lcd.setCursor(0,1);
   lcd.print(maxtemp);
   lcd.write(223);
   lcd.print("C");
 }
 if (temp < mintemp)
 {
   mintemp = temp;
   lcd.setCursor(9,1);
   lcd.print(mintemp);
   lcd.write(223);
   lcd.print("C");
 }
}

Hugo RSF

Very cool!!!

Do u store the max, min value on the computer or in any other "thing"?

Go Up