Hello, Im finally find some time and turn on my seeduino which i have almost one year in cabinet and start to learn some Arduino Basic. Im creating simple reef controller, just to learn and help monitoring my glass baby
First I create testing menu and connect two DALLAS temperature sensors. After loosing half of my hairs I finally get it work. I use oneWire for connecting two sensors and use one digital pin. But, I can`t figure how I can see float values from sensors. I mean now my temperature jumps after 0.5 Celsius. I study a lot of almost same setups but people has say 25.12 C . What Im missing? DALLAS is digital signal it is for that? I read something about digital to analog converter but it seems that complicate things. Or may I use two analog TMP36GT9Z which takes me 2 analog pins, but its ok. There is for sure float values. There is my code, sorry for form but Im really happy that it works somehow Thanks a lot guys.
/*
The circuit:
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3) */
//SET TEMPERATURE
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 10 //Define temp pin
OneWire oneWire(ONE_WIRE_BUS); //Other sensors One Wire
DallasTemperature sensors(&oneWire);
DeviceAddress aqua = { 0x28, 0x42, 0x7B, 0xB4, 0x01, 0x00, 0x00, 0x2C };
DeviceAddress air = { 0x28, 0xCB, 0x62, 0xB4, 0x01, 0x00, 0x00, 0xDF };
//SET LCD
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
//SET VARIABLE
int mainMenu = 500;
int changeMenu = 3500;
int lcdLight = 13;
void setup() {
// Start DALLAS library
sensors.begin();
sensors.setResolution(aqua, 5);
sensors.setResolution(air, 5);
// set up the LCD's number of colu mns and rows:
pinMode(lcdLight, OUTPUT);
lcd.begin(20, 4);
lcd.noDisplay();
delay(3000);
lcd.display();
digitalWrite(lcdLight, HIGH); //Turn on display
delay(1000);
//Main Page
lcd.setCursor(2,0);
lcd.print("AQUA CONTROLLER");
delay(mainMenu);
lcd.setCursor(8,1);
lcd.print("by");
delay(mainMenu);
lcd.setCursor(3,2);
lcd.print("DEATH FISH Co.");
delay(mainMenu);
lcd.setCursor(3,3);
lcd.print("version 1.0.1");
delay(changeMenu);
lcd.clear();
}
void loop() {
sensors.requestTemperatures(); // Send the command to get temperatures
float aquaTemp = sensors.getTempC(aqua);
float airTemp = sensors.getTempC(air);
//LCD MENU
lcd.setCursor(0,0);
lcd.print("Temp Aqua");
lcd.setCursor(2,1);
lcd.print(aquaTemp);
lcd.setCursor(12,0);
lcd.print("Temp OUT");
lcd.setCursor(14,1);
lcd.print(airTemp);
lcd.setCursor(2,2);
lcd.print("NO SENSORS FOUND");
delay(500);
lcd.setCursor(2,2);
lcd.print("****************");
delay(500);
lcd.setCursor(0,3);
lcd.print("Ph:");
lcd.setCursor(12,3);
lcd.print("ORP:");
delay(1000);
}