Вы находитесь на странице: 1из 12

Explore (/tag/typeid/)

(/)
(/)

Create (/about/submit.jsp)

Login(/account/login)
SignUp(/account/gopro?sourcea=header)
Contests
(/community/)
let's
make(/contest/) | Community

share what you make >


(/editInstructable/)

ClockwiththermometerusingArduino,i2c16x2lcd,DS1307RTCand
DHT11sensor.
byTimofteAndrei(/member/Timofte+Andrei/)
(http://cdn.instructables.com/FMJ/5WZY/HQHHWGR4/FMJ5WZYHQHHWGR4.LARGE.jpg)
Download(/id/ClockwithtermometerusingArduinoi2c16x2lcdD/?download=pdf)
Collection

IMadeit!

Favorite

Share

AboutThisInstructable
30,199views
(http://cdn.instructables.com/FUG/L2K6/HQHHX7X0/FUGL2K6HQHHX7X0.LARGE.jpg)

114favorites

License:
General
Public
License

TimofteAndrei
(/member/Timofte+Andrei/)
Follow

33

(/member/Timofte+Andrei/)
MorebyTimofteAndrei
(http://cdn.instructables.com/FFO/8J5H/HQHHW952/FFO8J5HHQHHW952.LARGE.jpg)

(/id/BareboneSanguino
clonemadeonperfboard)
(http://cdn.instructables.com/F0A/4Y2O/HQHHWGQE/F0A4Y2OHQHHWGQE.LARGE.jpg)

(/id/Cardboardlaptopstand
(http://cdn.instructables.com/FFL/TWI0/HQHHWGQM/FFLTWI0HQHHWGQM.LARGE.jpg)

3)

(/id/ArduinoNokia5110
displayIRsensor)
Tags:
(http://cdn.instructables.com/F8U/P77J/HQHHX7X2/F8UP77JHQHHX7X2.LARGE.jpg)
(http://cdn.instructables.com/FJ2/DF77/HQHHX7X3/FJ2DF77HQHHX7X3.LARGE.jpg)

arduino(/tag/typeid/categorytechnology/keyword
arduino/)
rtc(/tag/typeid/categorytechnology/keywordrtc/)
dht11(/tag/typeid/categorytechnology/keyword
dht11/)
i2c(/tag/typeid/categorytechnology/keywordi2c/)
lcd(/tag/typeid/categorytechnology/keywordlcd/)
16x2(/tag/typeid/categorytechnology/keyword
16x2/)

Related
Weekendprojectclock
datethermometerand
humiditywithArduino
mega(/id/Weekendproject
clockdatethermometer
MostrarTemperaturaen
DisplayconSensorDHT11
yArduino(/id/Mostrar
TemperaturaenDisplay
conSensorDHT11y/)
ArduinoforGreenhouse,
GardenorGrowbox
(/id/Arduinofor
GreenhouseGardenor
Growbox/)
I2CLCDControllerPartII
(/id/I2CLCDController
PartII/)
byverdelj(/member/verdelj/)
(http://cdn.instructables.com/F98/ELLK/HQHHWGR3/F98ELLKHQHHWGR3.LARGE.jpg)

Hello!It'sbeenawhileI'vedidn'tpostedanythingonInstructables,butnowI
madeasimpleprojectthatI'veseenoninternetinvariousforms.Imanagedto
buildacodeusingothercodesI'vefoundoninternetandIgottosayit'sworking
good.
Forthisprojectyouneed:
ArduinoUno
16x2LCDwithi2cmodule

ArduinoPortableWeather
Monitor,altimeter,
temperature,humidity,
usingDHT11andBMP
(/id/ArduinoPortable
SeeMore(/tag/typeid/?q=)

DS1307RTC
DHT11temperatureandhumiditysensor
abreadboard
somewiresforconnections.
AsyoucanseetheRTCishomemadebecauseIhadaDS1307chipanda
batteryextractedfromanoldgermanelectroniccashregisteringdevice.
Sotheconnectionsareverysimple:
TheRTCandthei2cLCDareconnectedtoA4pin(SDA)andA5(SCL)and
DHT11sensorisconnectedtoD2pin.DHT11has4pins,butonly3areactually
used.FirstpinisVcc,thesecondisfordataandtheforthpinisforground.AsI
said,connectdatapinofthesensortoD2onArduino.
Now,thehardestpart:thecode.
https://www.dropbox.com/s/ycgh1sa88tqq8r8/termometru_dht11_cu_ceas.ino
(https://www.dropbox.com/s/ycgh1sa88tqq8r8/termometru_dht11_cu_ceas.ino)
I'vetriedsomesketchesI'vefoundoninternet,buttherewerealotoferrors
causedbyincompatiblelibrariesandsoon.Imanagedtobuildacodemade
frompartsofothercodesandit'sworkinglikeacharmnow.Thereisasingle
problemthough.Youcanfindinthesketchabitofcodefordisplayingfirst3
lettersoftheweekday,butforsomereasonitdoesn'twork.Insteadofthose
lettersitshowssomeunknowncharactersandit'sprettyugly.Isuspectthatisa
problemcausedbyi2ccommunicationbecauseinstandardconnection(4bits)it
workswithoutproblems.
Myinspirationcamefromthispagehttp://arduino
info.wikispaces.com/PROJECTTempHumidityDisplay(http://arduino
info.wikispaces.com/PROJECTTempHumidityDisplay),andthispage
http://www.ucontrolit.tv/184/(http://www.ucontrolit.tv/184/)
Thisisthelibraryusedforthisprojecthttp://arduino
info.wikispaces.com/file/view/DHT11.zip/390039522/DHT11.zip(http://arduino
info.wikispaces.com/file/view/DHT11.zip/390039522/DHT11.zip)anddon'tforget
tousethenewLCDlibrarythatcanbefoundrighthere
https://bitbucket.org/fmalpartida/newliquidcrystal/downloads
(https://bitbucket.org/fmalpartida/newliquidcrystal/downloads)(whenyouadd
thisnewlibraryinthefolder,deletetheoldLiquidCrystalfolder!)
Andthisisthecode:
________________________________________________________________
________________________________
/*YourDuino.comExampleSoftwareSketch
DHT11HumidityandTemperatureSensortest
DisplayedonI2CLCDDisplay
Credits:RobTillaart
http://arduinoinfo.wikispaces.com/PROJECTTempHumidityDisplay
terry@yourduino.com
Combinedwith:
MarkJohnson'scode
http://uControlIt.tv
December2012
License:GNUGeneralPublicLicense

ModiffiedbyTimofteAndrei(http://timofteandreidiy.wordpress.com)
January2014
*/

/*(Importneededlibraries)*/
#include

#include
#include
#include
#include

//constchar*zile[]=
//{"Lun","Mar","Mie","Joi","Vin","Sam","Dum"}//daysoftheweekin
romanian(notused)
constchar*luni[]=
{"Dec","Ian","Feb","Mar","Apr","Mai","Iun","Iul","Aug","Sep","Oct","Noi"}
//monthsoftheweekalsoinromanian
bytetermometru[8]=//iconfortermometer
{
B00100,
B01010,
B01010,
B01110,
B01110,
B11111,
B11111,
B01110
}
bytepicatura[8]=//iconforwaterdroplet
{
B00100,
B00100,
B01010,
B01010,
B10001,
B10001,
B10001,
B01110,
}
/*(Declareobjects)*/
//SetthepinsontheI2CchipusedforLCDconnections:
//addr,en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal_I2Clcd(0x20,4,5,6,0,1,2,3,7,NEGATIVE)//SettheLCD
I2Caddress
dht11DHT11
/*(DeclareConstants,PinNumbers)*/
#defineDHT11PIN2//dht11signalpinconnectedtoD2
voidsetup()/*(SETUP:RUNSONCE)*/
{
Wire.begin()
lcd.begin(16,2)//initializethelcdfor16chars2lines,turnonbacklight
lcd.backlight()
lcd.clear()
lcd.createChar(1,termometru)
lcd.createChar(2,picatura)

//partcodefromhttp://tronixstuff.wordpress.com/
Wire.beginTransmission(0x68)
Wire.write(0x07)//movepointertoSQWaddress
Wire.write(0x10)//sends0x10(hex)00010000(binary)tocontrolregister

turnsonsquarewave
Wire.endTransmission()
//endpartcodefromhttp://tronixstuff.wordpress.com/
setSyncProvider(RTC.get)

}/*(endsetup)*/
voidloop()/*(LOOP:RUNSCONSTANTLY)*/
{
afisare_temperatura()//displayingtemperature
data_si_ora()//displayingdateandtime
}
voidafisare_temperatura()
{
intchk=DHT11.read(DHT11PIN)
lcd.setCursor(1,1)
lcd.write(1)
lcd.setCursor(3,1)
lcd.print((float)DHT11.temperature,0)
lcd.setCursor(5,1)
lcd.print((char)223)//degreesign
lcd.print("C")

lcd.setCursor(9,1)
lcd.write(2)
lcd.setCursor(11,1)
lcd.print((float)DHT11.humidity,0)
lcd.print("%")
delay(2000)
}

voiddata_si_ora()
{
tmElements_ttm
(RTC.read(tm))
lcd.setCursor(0,0)
afisare2cifre(tm.Hour)
lcd.print(":")
afisare2cifre(tm.Minute)
lcd.setCursor(7,0)
afisare2cifre(tm.Day)
lcd.print("")
lcd.print(tm.Month[luni])
lcd.print("")
lcd.print(tmYearToCalendar(tm.Year)2000)
//lcd.setCursor(12,1)//thiscodeisusedfordisplayingdayoftheweek
//lcd.print(tm.Wday[zile2])//it'sdisabledbecauseforsomereasonitdoesn't
workoni2cdisplay
}
voidafisare2cifre(intnumar){//thisaddsa0beforesingledigitnumbers
if(numar>=0&&numar<10){
lcd.write('0')
}
lcd.print(numar)
}

/*(THEEND)*/

________________________________________________________________
____________________________________

Wehaveabenicecommentpolicy.
Pleasebepositiveandconstructive.

IMadeit!

AddImages

magzibogz(/member/magzibogz/)

MakeComment

7daysago

Reply

Hellowsiryourprojectistotallyawsome...butcanihaveaschematicdiagram
(/member/magzibogz/)
ofyourDS1307RTCtogetherwiththebattery?thanks

AdrianF2(/member/AdrianF2/)

1monthago

Reply

Foartefain,maialesparteacucaracterelespeciale!Isthispossibletohave
(/member/AdrianF2/)
thehumiditytrendoveranhour?Also,asasuggestion,maybetheLCDcan

beconnectedalsoonI2C.Bestregards,Adrian

TimofteAndrei(/member/Timofte+Andrei/)(author) AdrianF2
10daysago

Reply

pvalyk(/member/pvalyk/) AdrianF2

Reply

salut!scuzepentruintarziere...uitatelaminela
(/member/Timofte+Andrei/)
proiectesavezicaamfacutnistemodificarisiam
adaugatcardSDpentruloggingaltemperaturiisi
umiditatii:DCumazissipvalyk,ecranulsiceasul
suntconectatepei2c,deciceilaltipiniramanliberi
pentrualtechestii:)Mersiptcomentariu!Bafta

14daysago

BoththeLCDandRTCareconnectedtoI2C(SdaandScl).For
(/member/pvalyk/)
temperaturetrendyouneedEEPROMmemoryordoyoumeangetthe

temperatureoncein1h?Inthatcasemodifythedelaybydefining
delaysas1h.

kantona80(/member/kantona80/)madeit!

12daysago

Reply

(/member/kantona80/)

HereisaZIParchivewithalllibrariesandtherightsketchthatworkswithLCD
I2C
YwRobotLCM1602IIC(mineworkson0x27address)
https://drive.google.com/file/d/0B0rVZYzj6RpOYm9vU...
(https://drive.google.com/file/d/0B0rVZYzj6RpOYm9vUnE4eVVVWnM/view?
usp=sharing)

(http://cdn.instructables.com/FDA/6TGF/I5JHR2ON/FDA6TGFI5JHR2ON.LARGE.jpg)

kantona80(/member/kantona80/)

12daysago

Reply

Hitimofte,greatjobfortheproject:
(/member/kantona80/)
Verydetailedandsimpletofollowinstructablesbutthetrickypartis

bycollectingalltheneededlibraries!!!
Youcouldhaveputthe
librariesthatyouhaveusedinaziparchivealltogether,inorderto
simplifythings.Ialsohaveacompilationerrorafteraddingallthe
libraries:
'NEGATIVE'wasnotdeclaredinthisscope
Kf5qgf,canyouuploadyourcodeonthecloudsomewhere?
Thanks

kantona80(/member/kantona80/) kantona80

12daysago

Reply

IthinkthattheNEGATIVEissueshownbyArduinoIDEcouldbe
(/member/kantona80/)
relatedtoadifferentLiquidCrystal_I2Clibraryversion...

airfoil233(/member/airfoil233/)madeit!

7monthsago

(/member/airfoil233/)

Helpsalot!thanksforthetutorial.

(http://cdn.instructables.com/FSR/TYB7/HWX439F4/FSRTYB7HWX439F4.LARGE.jpg)

ChcN(/member/Ch%E1%BB%A9cN/) airfoil233

Reply

4monthsago

Reply

Ihaveerror'classDS1307RTC'hasnomembernamed'get'anderror
withsetSyncProvider(RTC.get)
(/member/Ch%E1%BB%A9cN/)
helpmeplease

refill71(/member/refill71/) ChcN

3monthsago

Reply

IfyouhaveaerrorinclassDS1307RTC,pleaseaddtheTimelibrary.
(/member/refill71/)

http://www.pjrc.com/teensy/td_libs_Time.html

ChcN(/member/Ch%E1%BB%A9cN/) refill71

3monthsago

Reply

4monthsago

Reply

thanksverymuch!Itworkfine
(/member/Ch%E1%BB%A9cN/)

airfoil233(/member/airfoil233/) ChcN

HIChucN:
(/member/airfoil233/)

Maybethiswillhelp!
http://forums.adafruit.com/viewtopic.php?f=31&t=36...
(http://forums.adafruit.com/viewtopic.php?f=31&t=36378)

ChcN(/member/Ch%E1%BB%A9cN/) airfoil233

4monthsago

Reply

4monthsago

Reply

thankssomuch!Buticannotseethispage.
(/member/Ch%E1%BB%A9cN/)

ChcN(/member/Ch%E1%BB%A9cN/) airfoil233

Ihaveerror'classDS1307RTC'hasnomembernamed'get'anderror
(/member/Ch%E1%BB%A9cN/)
withsetSyncProvider(RTC.get)

helpmeplease

diy_bloke(/member/diy_bloke/) airfoil233

5monthsago

Reply

looksrealneat.
(/member/diy_bloke/)
Awordofwarningthough.Foranotherproject(

http://www.instructables.com/id/ArduinoforGreenh...
(http://www.instructables.com/id/ArduinoforGreenhouseGardenor
Growbox/))
Ihavesomethingcomparable:aclearplasticboxwiththeelectronics
andaDHT11sensorontop.Seemedrealcompact.Icouldnt
understandwhymyprojectalwaysgaveatemperaturethatwas25
degreeshigherthantherealtemperature....untilIchecked.The
electronicsinthebox,especiallytheLCD,wereheatingupthebox...
andtheDHT11sensorontop:).
Iattacheditwithawireandthe'problem'wasgone

TimofteAndrei(/member/Timofte+Andrei/)(author) airfoil233
7monthsago

wellthatisawesome,myfriend!:)don'tforgetto
(/member/Timofte+Andrei/)
sayawordtotheworldaboutme:Pthanksfor
yourfeedbackandgoodluck!:D

Reply

LectricWizard(/member/Lectric+Wizard/)

1yearago

Reply

Welldone,butneedsanHinthetitlesowecanfinditwithsearchengine.
(/member/Lectric+Wizard/)
"termometer"

TimofteAndrei(/member/Timofte+Andrei/)(author) LectricWizard
1yearago

Reply

kf5qgf(/member/kf5qgf/) TimofteAndrei

Reply

sorryforthat!i'mromanianandidon'twriteenglish
(/member/Timofte+Andrei/)
textsveryoftensoi'mreallysorryforspelling
mistakes.thanksforyourreply!

1yearago

I'vemodifiedthecodeforanEnglishversionifyou'dlikeIcanemailit
(/member/kf5qgf/)
toyou.It'sanexcellentpieceofcodeyouwrotehere.FitexactlywhatI

wanted.Justmadeafewmods,changedtheLCDlibraryandthepin
initializationtofitmyLCDshieldandviola.73's.

mukundans(/member/mukundans/) kf5qgf

3monthsago

Reply

Hikf5qgf,
(/member/mukundans/)

greetings,iamanoobjustgettingtoplaywithArduinominipro.Would
appreciateifyouemailmeyoursketch(vu3smz@gmail.com)inenglish
sothaticantryandbuildaclock.
thanks
muks

TimofteAndrei(/member/Timofte+Andrei/)(author) kf5qgf
1yearago

Reply

LectricWizard(/member/Lectric+Wizard/) kf5qgf

Reply

Thanksforyourreply!I'mgladthatcodeisusefulfor
(/member/Timofte+Andrei/)
you!Haveagoodtimeusingitandshowusyour
projectandyourimprovements!Cheers!

1yearago

Thanksforsharing!Iwon'tbeusingthisatthistimebutdidkeepthe
(/member/Lectric+Wizard/)
linkforfuturereference.CHEERS!!!!

teaMJPx(/member/teaMJPx/)

4monthsago

Reply

Thisisawesome!Iwasmakingthisonmyownbut...Withyourinstructable...
(/member/teaMJPx/)
WOW!Thanksforthis!

cts_casemod(/member/cts_casemod/)

9monthsago

Reply

Iloadedallthelibraries,butnosuccesscompiling.IThinktheymightbe
(/member/cts_casemod/)
different.Anychanceofincludingazipfilewithdht11,TimeandDS1307RTC

librariesasyouused?
Regards

TimofteAndrei(/member/Timofte+Andrei/)(author) cts_casemod

9monthsago

Reply

ChcN(/member/Ch%E1%BB%A9cN/) TimofteAndrei
4monthsago

Reply

whaterroryougot?
(/member/Timofte+Andrei/)

Ihaveerror'classDS1307RTC'hasnomember
(/member/Ch%E1%BB%A9cN/)
named'get'anderrorwith
setSyncProvider(RTC.get)
helpmeplease

TimofteAndrei(/member/Timofte+Andrei/)(author) cts_casemod
9monthsago

ohandtrytouseanolderarduinoIDE.newer
(/member/Timofte+Andrei/)
IDEsarejusttoobuggy.i'mconsideringtouse
otherkindofIDEinsteadoforiginaloneprovided
byarduinoteam.therearetoomanyannoying
problemsthatarekillingmeinside....

ChcN(/member/Ch%E1%BB%A9cN/)

Reply

5monthsago

Reply

8monthsago

Reply

Howtoadjustcorrecttime.Thanks
(/member/Ch%E1%BB%A9cN/)

jmsl100(/member/jmsl100/)

Itseemsreallysimple,butitdoesnot.Iliketocongratulateyou,verysimple
(/member/jmsl100/)
explanationofanarduinoproject.Sothetrickypartisbycollectingallthe

neededlibraries,therearesomeoftheminmanyflavors.Myonlyconcern
waswiththecompilationofthesketch.AfterIhaveallthehardwareand
software,thearduinoIDEremarks:NEGATIVEwasnotdeclared,soIdecided
toaskyou,whatisNEGATIVEdo?,andbytheway,pleaseindicatethe
correctsketchline.Regards.

TimofteAndrei(/member/Timofte+Andrei/)(author) jmsl100
8monthsago

ForsomereasonInstructablesdoesn'tletme
(/member/Timofte+Andrei/)
uploadthecodeonthesite,sohere'sadropbox
linktothecode...ihopeitworksokbecauseon
myideit'scompilingwithoutaproblem!cheers!

Reply

https://www.dropbox.com/s/ycgh1sa88tqq8r8/termometru_dht11_cu_ceas.ino

samumar82(/member/samumar82/)

9monthsago

Reply

Heykfcouldyoupleasemailmethecodeyoumodified?I'mgettingtonsor
(/member/samumar82/)
errorswiththisauthor'soneandcan'tfigureitoutwhy.

thanksalot!samuele.marchetti[at]fastwebnet.it

TimofteAndrei(/member/Timofte+Andrei/)(author)

9monthsago

Reply

use1.2.0libraryanddon'tforgetaboutDS1307RTCLibrary!oh,andtrytouse
(/member/Timofte+Andrei/)
ArduinoIDEbelow1.0.3orsomethinglikethat!I'veseenthattheoriginal

ArduinoIDEsucksmoreandmore.

quinto(/member/quinto/)

9monthsago

Reply

whichversionofLiquidCrystallibraryareyouusing?
(/member/quinto/)

Iusenewest1.2.1andIget12errorsinyourcode.
1."NEGATIVE"and"RTC"wasnotdeclaredinthisscopeforexample

11monthsago

Reply

TimofteAndrei(/member/Timofte+Andrei/)(author) guitarans
11monthsago

Reply

guitarans(/member/guitarans/)

iwouldrealylikeaschematic,
(/member/guitarans/)

SDA(A4),SCL(A5),5v,gndfori2crtcandLCD,
(/member/Timofte+Andrei/)
andDHT11isconnectedtoD2pin(readthe
code).thereisnoschematicneededforthiskind
ofsimpleproject.

Wehaveabenicecommentpolicy.
Pleasebepositiveandconstructive.

IMadeit!

AboutUs

AddImages

MakeComment

FindUs

WhoWeAre(/about/)

Facebook(http://www.facebook.com/instructables)

Advertise(/advertise/)

Youtube(http://www.youtube.com/user/instructablestv)

Contact(/about/contact.jsp)

Twitter(http://www.twitter.com/instructables)

Jobs(/community/PositionsavailableatInstructables/)
Help(/id/howtowriteagreatinstructable/)

Pinterest(http://www.pinterest.com/instructables)
Google+(https://plus.google.com/+instructables)
Tumblr(http://instructables.tumblr.com)

Resources

Mobile

ForTeachers(/teachers/)

DownloadournewappsforiOS,

ArtistsinResidence(http://www.autodesk.com/artistinresidence/home)
Join!
Join our newsletter: enteremail
GiftProAccount(/account/give?sourcea=footer)

AndroidandWindows8!

Forums(/community/)
Answers(/tag/typequestion/?sort=RECENT)
TermsofService(http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=21959721)
|
Sitemap(/sitemap/)
PrivacyStatement(http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=21292079)
|

Android
(https://play.google.com/store/apps/details?
id=com.adsk.instructables)

LegalNotices&Trademarks(http://usa.autodesk.com/legalnoticestrademarks/) | MobileSite(http://m.instructables.com)
(http://usa.autodesk.com/adsk/servlet/pc/index?id=20781545&siteID=123112)
2014Autodesk,Inc.

English

iOS
(https://itunes.apple.com/app/instructables/id586765571)
Windows
(http://apps.microsoft.com/windows/en
us/app/7afc8194c771441a9590
54250d6a8300)

GoProToday(/account/gopro?sourcea=footer)

We'reHiring!(/community/PositionsavailableatInstructables/)

Похожие интересы