Arduino Termostat + Lcd Nokia 3310

Automatizace, řízení, měření, logování a programování s využitím platformy Arduino.
Karya
Příspěvky: 30
Registrován: pát srp 19, 2011 10:12 am

Arduino Termostat + Lcd Nokia 3310

Příspěvek od Karya »

Caute


Uz aj ja som hrdim vlastnnikom Arduina.Obraciam sa na vas.Nevedel by mi niekdo pomoct spravit podmienku?Moja predstava je ak v bojleru 1 bude teplota 60 c nezapinaj rele ak bude viac ako 60 zapny.Pripojene mam 2x DS18B20.Dakujem

Kód: Vybrat vše

#include <OneWire.h>
#include <DallasTemperature.h>
#include <PCD8544.h>

// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 2


// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);

// Assign the addresses of your 1-Wire temp sensors.
// See the tutorial on how to obtain these addresses:
// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html

DeviceAddress insideThermometer = { 0x28, 0x6C, 0x2B, 0x24, 0x03, 0x00, 0x00, 0xB2 };
DeviceAddress outsideThermometer = { 0x28, 0x48, 0x24, 0x24, 0x03, 0x00, 0x00, 0xB7 };

// The dimensions of the LCD (in pixels)...
static const byte LCD_WIDTH = 84;
static const byte LCD_HEIGHT = 48;
static PCD8544 lcd;
const int LED = 13;

// A bitmap graphic (10x2) of a thermometer...
static const byte THERMO_WIDTH = 10;
static const byte THERMO_HEIGHT = 2;
static const byte thermometer[] = { 0x00, 0x00, 0x48, 0xfe, 0x01, 0xfe, 0x00, 0x02, 0x05, 0x02,
                                    0x00, 0x00, 0x62, 0xff, 0xfe, 0xff, 0x60, 0x00, 0x00, 0x00};

// --------------------------------------------------------------------------------------------------

void setup(void)
{
  lcd.clear(); 
  pinMode(LED, OUTPUT);

  // Start up the library
  sensors.begin();
  // set the resolution to 10 bit (good enough?)
  sensors.setResolution(insideThermometer, 10);
  sensors.setResolution(outsideThermometer, 10);
 
   lcd.begin(LCD_WIDTH, LCD_HEIGHT);
}

void printTemperature(DeviceAddress deviceAddress)
{
  float tempC = sensors.getTempC(deviceAddress);
  lcd.print(tempC);
  lcd.print(" ");

  if (tempC > 22.00 )  // podmienka na zopnutie rele 
  
   digitalWrite(LED, HIGH);
  else 
  digitalWrite(LED, LOW);

}

void loop(void)
{ 
  delay(500);
 sensors.requestTemperatures();
 lcd.setCursor(10,1);
 lcd.print("Bojler (1): ");
 printTemperature(insideThermometer);
 lcd.setCursor(10,5);
 lcd.print("Bojler (2): ");
 printTemperature(outsideThermometer);

  
  // Draw the thermometer bitmap at the bottom left corner...
 
 lcd.setCursor(0,0);
 lcd.drawBitmap(thermometer, THERMO_WIDTH, THERMO_HEIGHT);
  
 lcd.setCursor(0,4);
 lcd.drawBitmap(thermometer, THERMO_WIDTH, THERMO_HEIGHT);
 }
Uživatelský avatar
lwq
Příspěvky: 465
Registrován: úte dub 10, 2012 10:42 pm
Lokalita: Mělník
Systémové napětí: 48V
Výkon panelů [Wp]: 8550
Kapacita baterie [kWh]: 32
Bydliště: MistyMountain

Re: Arduino Termostat + Lcd Nokia 3310

Příspěvek od lwq »

V cem je problem ? Pouzij google :comp:

... nahore pridat ...

Kód: Vybrat vše

const int LED = 13;
const int RELE = 10;
v setupu pridat ...

Kód: Vybrat vše

pinMode(RELE, OUTPUT);
A kod by mel byt ...

Kód: Vybrat vše

if ((tempC > 60.00) && (deviceAddress == "insideThermometer"))  // podmienka na zopnutie rele 
{
digitalWrite(LED, HIGH);
digitalWrite(RELE, HIGH);
}
else
{ 
digitalWrite(LED, LOW);
digitalWrite(RELE, LOW);
}
... s tim, ze na PINu 13 tezko neco das, je tam natvrdo LEDka (vetsinou) ... takze pouzit 13 jako indikaci sepnuti rele ... a na sepnuti rele pouzit jiny pin, napsano je to pro pin 10.

A pro uplnost tady mas navod jak pripojit 5V rele k arduinu ... Tim rele muzes ovladat treba stykac a tak ...

http://www.glacialwanderer.com/hobbyrobotics/?p=9

Rele - napriklad ...

http://sk.farnell.com/omron-electronic- ... dp/1231978

(na civce chce cca. < 200mA)

... ja bych tedy pouzil napriklad nize uvedene pro ovladani hned 4 rele ...

http://sk.farnell.com/national-semicond ... dp/1468983

... snad sem pomohl ... :repair:
Karya
Příspěvky: 30
Registrován: pát srp 19, 2011 10:12 am

Re: Arduino Termostat + Lcd Nokia 3310

Příspěvek od Karya »

Dakujem.Preberal som to aj na inom fore a spravil som to takto.Teraz riesim grafiku na lcd.Nechce mi to zobrazit na cely lcd aj ked mam nastavene 84x48 rozlisenie.Vedel by mi niekdo poradit?

Kód: Vybrat vše

delay(500);
  sensors.requestTemperatures();
  ...
  if (sensors.getTempC(insideThermometer)>70.0 && sensors.getTempC(outsideThermometer)<75.0) digitalWrite(cerpadlo, HIGH);
  if (sensors.getTempC(insideThermometer)<60.0 || sensors.getTempC(outsideThermometer)>75.0) digitalWrite(cerpadlo, LOW);
vanous
Příspěvky: 116
Registrován: sob říj 15, 2011 7:28 pm

Re: Arduino Termostat + Lcd Nokia 3310

Příspěvek od vanous »

Karya píše:Dakujem.Preberal som to aj na inom fore a spravil som to takto.Teraz riesim grafiku na lcd.Nechce mi to zobrazit na cely lcd aj ked mam nastavene 84x48 rozlisenie.Vedel by mi niekdo poradit?
neznám ten nokia LCD, ale někdy je potřeba buďto v parametru volání knihovny zadat ty, nebo rozlišení, nebo to případně upravit v knihovně (já si musím upravovat nastavení z 2x16 na 4x20 display...)
Karya
Příspěvky: 30
Registrován: pát srp 19, 2011 10:12 am

Re: Arduino Termostat + Lcd Nokia 3310

Příspěvek od Karya »

Tu je ta knihovna.Hladal som co by sa v nej malo zmenit ale nenasiel som.Vedel by si sa mi nato pozriet?Ked som skusal tento program tak to fungovalo na celom.Pridavam odkaz.

http://www.roboti.4fan.cz/vyuka/profesi ... 10-z-nokie

http://www.ulozto.cz/x8zt5AS/lcd-7z

  • Podobná témata
    Odpovědi
    Zobrazení
    Poslední příspěvek