Pe ecran, informatiile se prezinta asa:
Schema exacta este:
Are o mica modificare, in sensul ca rezistenta de 15k din prima schema am realizat-o din 2, una de 10k si una de 4k7.
Am facut un film, numit indicator date mediu - masina in care am simulat toate situatiile, care am crezut eu ca pot exista, ca valori:
Fiind "baiat bun" postez si sketch-ul folosit la teste:
/*
original sketch by niq_ro (Nicu FLORICA) from http://nicuflorica.blogspot.com
program original scris de mine (niq_ro) versiunea 1.0
..............................................................*/
#include <LiquidCrystal.h>
// folosesc libraria pentru afisaje LCD simple
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
// indic modul de legare, vezi mai jos:
/* -------------------
| LCD | Arduino |
-------------------
LCD RS pin to digital pin 7 | RS | D7 |
LCD Enable pin to digital pin 6 | E | D6 |
LCD D4 pin to digital pin 5 | D4 | D5 |
LCD D5 pin to digital pin 4 | D5 | D4 |
LCD D6 pin to digital pin 3 | D6 | D3 |
LCD D7 pin to digital pin 2 | D7 | D2 |
LCD R/W pin to ground | R/W | GND |
-------------------
*/
// http://arduino.cc/en/Reference/LiquidCrystalCreateChar
byte grad[8] = {
B01100,
B10010,
B10010,
B01100,
B00000,
B00000,
B00000,
};
// variables
float R1, R2, R3; // rezsistors in voltage divisor
float k1; // adjustment for divisor
float u1, u11, u12; // for voltage
int ti; // temperature inside of car;
// data
int VPin = A0; // voltage pin
int DHTPin = A1; // data pin from DHT11
//int DSPin = 10; //
// for DHT11 sensor
#include "DHT.h"
#define DHTPIN A1 // what pin we're connected to
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into port 10 on the Arduino
#define ONE_WIRE_BUS 10
#define TEMPERATURE_PRECISION 9
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
// arrays to hold device addresses
DeviceAddress outsideThermometer;
void setup() {
R1 = 4.7; // R1 = 4k7
R2 = 10; // R2 = 10k
R3 = 4.7; // R3 = 4k7
k1 = 1/1.033;
lcd.createChar(0, grad);
lcd.begin(16, 2); // set up the LCD's number of columns and rows:
// initialing the DHT11 sensor;
dht.begin();
lcd.clear(); // clear the screen
lcd.setCursor(1, 0); // put cursor at colon 2 and row 0 = left/up
lcd.print("indicator bord"); // print a text
lcd.setCursor(2, 1); // put cursor at colon 0 and row 0 = left/down
lcd.print("1.0 by niq_ro"); // print a text
delay (2000);
lcd.clear(); // clear the screen
// Start up the DS18B20 sensor
sensors.begin();
// adress for ds sensor
// DeviceAddress outsideThermometer = { 0x28, 0xAC, 0x7A, 0xD4, 0x04, 0x00, 0x00, 0x7E };
// DeviceAddress outsideThermometer = { 0x28, 0xAC, 0x7A, 0xD4, 0x4, 0x0, 0x0, 0x7E };
// set the resolution to 9..12 bit
sensors.setResolution(outsideThermometer, TEMPERATURE_PRECISION);
} // END void setup
void loop(){
u1 = analogRead(VPin);
u11 = k1*5.0*u1/1023*(R1+R2+R3)/R1;
u12 = u11 + 0.05;
//u12=11.4; // for test
// u12=7.5; //for test;
if (u12<10.0)
{
lcd.setCursor(12, 0);
lcd.print(u12,1);
lcd.print("V");
delay(500);
lcd.setCursor(12, 0);
lcd.print(" ");
}
else
{
lcd.setCursor(11, 0);
lcd.print(u12,1);
lcd.print("V");
delay(500);
}
// DHT11 part
int h = dht.readHumidity();
int ti = dht.readTemperature();
lcd.setCursor(0, 1);
lcd.print("int:");
//ti=0; // for test;
//ti=7; // for test;
//ti=29; // for test;
if (ti<1) {
lcd.setCursor(5, 1);
lcd.print(" 0");
lcd.write(byte(0));
lcd.print("C");
delay(500);
lcd.setCursor(5, 1);
lcd.print(" ");
}
else
if (ti>=9) {
lcd.setCursor(4, 1);
lcd.print("+");
lcd.print(ti);
lcd.write(byte(0));
lcd.print("C");
}
else
//if (ti>=1 || ti<10)
{
lcd.setCursor(5, 1);
lcd.print("+");
lcd.print(ti);
lcd.write(byte(0));
lcd.print("C");
}
lcd.setCursor(11, 1);
lcd.print(h);
lcd.print("%um");
//
DeviceAddress outsideThermometer = { 0x28, 0xAC, 0x7A, 0xD4, 0x4, 0x0, 0x0, 0x7E };
sensors.requestTemperatures();
float te = sensors.getTempC(outsideThermometer);
// printTemperature(DeviceAddress outsideThermometer);
delay(300);
//te=-24;
//te=-2;
//te=-0.4;
// te=0;
//te=0.3;
//te=5;
//te=17;
//te=17.6;
lcd.setCursor(0, 0);
lcd.print("ext:");
if (te<-10) {
lcd.setCursor(4, 0);
lcd.print(te,0);
lcd.write(byte(0));
lcd.print("C ");
}
else
if (te>-10 || te<0) {
lcd.setCursor(5, 0);
lcd.print(te,0);
lcd.write(byte(0));
lcd.print("C ");
}
else
if (te=0) {
lcd.setCursor(5, 0);
lcd.print("=0");
lcd.write(byte(0));
lcd.print("C ");
}
if (te>0)
{
lcd.setCursor(5, 0);
lcd.print("+");
lcd.print(te,0);
lcd.write(byte(0));
lcd.print("C ");
}
if (te>=10) {
lcd.setCursor(4, 0);
lcd.print("+");
lcd.print(te,0);
lcd.write(byte(0));
lcd.print("C ");
}
}
Pentru a functiona corect programiorul, trebuie sa aflati adresa unica a senzorului DS18B20, ruland un program cum e cel prezentat de mine in articolul Mai multi senzori de tip DS18B20 (sau MAX31820) in paralel
Urmeaza transferarea proiectului pe un cablaj pentru a fi montat pe masina... schema de conectare la masina ar fi:
23.03.2014
Am facut si mica modificare, rezultandu-mi:
24.03.2014
Deoarece am reusit "performanta" de a strica 2 placi Arduino (partea de interfata USB + microcontroler ATmega328P-PU) din cauza consumului mare pe ramura de 5V, recomand utilizarea unui stabilizator extern pentru 5V...
23.03.2014
Am facut si mica modificare, rezultandu-mi:
24.03.2014
Deoarece am reusit "performanta" de a strica 2 placi Arduino (partea de interfata USB + microcontroler ATmega328P-PU) din cauza consumului mare pe ramura de 5V, recomand utilizarea unui stabilizator extern pentru 5V...
Niciun comentariu:
Trimiteți un comentariu