Anda di halaman 1dari 10

Login(/account/login)

| SignUp(/account/gopro?sourcea=header&sourceaUrl=/id/WeatherstationArduinoandProcessing/?ALLSTEPS)
Explore
(/tag/typeid/)
Create (/about/submit.jsp)
Contests
Community (/community/)
let's make (/contest/)
(/)
(/)

share what you make >


(/editInstructable/)

(/id/intel/)

(/tag/typeid/categoryworkshop/channelgardening/?sort=FEATURED)
(/tag/typeid/categorytechnology/channelcnc/?sort=FEATURED)
(/tag/typeid/categoryworkshop/channelhome

WeatherstationArduinoandProcessing byMonteH(/member/MonteH/)
Download(/id/WeatherstationArduinoandProcessing/?download=pdf)

(/id/WeatherstationArduinoandProcessing/)
Collection

(http://cdn.instructables.com/FOY/ELW2/HKVL8129/FOYELW2HKVL8129.LARGE.jpg)

IMadeit!

6Steps

Favorite

Share

AboutThisInstructable
14,436views

License:

58favorites
(http://cdn.instructables.com/FEH/ZV6N/HKZAW3MM/FEHZV6NHKZAW3MM.LARGE.jpg)

MonteH
(/member/MonteH/)
Follow

(/member/MonteH/)
Tags:
(http://cdn.instructables.com/F7O/J0UE/HKZAW3MN/F7OJ0UEHKZAW3MN.LARGE.jpg)
(http://cdn.instructables.com/FXK/PKRH/HKZAW3MP/FXKPKRHHKZAW3MP.LARGE.jpg)

auduino(/tag/typeid/categorytechnology/keyword
auduino/)
processing(/tag/typeid/categorytechnology/keyword

Buildamobileorhomeweatherstationandgraphthedatainrealtimeonyour
computer.Thegraphmapsoutwindspeed,pressure,temperature,andwind
directionfor10minutesthensavestheimageasajpegandstartsover.

processing/)
weather(/tag/typeid/categorytechnology/keyword
weather/)

(http://cdn.instructables.com/FA2/C2VP/HKZAW3MR/FA2C2VPHKZAW3MR.LARGE.jpg)

Related

WindMeters&
Anemometers
inspeed.com

WindSpeedforhome,RV,portableTop
quality,greatvaluesfrom$59

(http://cdn.instructables.com/FAT/VYTT/HKZAW3MS/FATVYTTHKZAW3MS.LARGE.jpg)

WeatherStationson
Sale
RemovetheseadsbySigningUp(/account/gopro?
sourcea=removeads&nxtPgName=Weather+station+Arduino+and+Processing&nxtPg=/id/WeatherstationArduinoandProcessing/?
ALLSTEPS)

Step1:Anemometerbuild

(http://cdn.instructables.com/FEH/ZV6N/HKZAW3MM/FEHZV6NHKZAW3MM.LARGE.jpg)

TheanemometerIbuiltwasbuiltwithmaterialsIhadonhand.Ibasedthebuild
aroundaDCmotorIhadthatspinsfreelywithlittleeffort.thediagramlistthe
partsIused.

Step2:BMP085housing

(http://cdn.instructables.com/F7O/J0UE/HKZAW3MN/F7OJ0UEHKZAW3MN.LARGE.jpg)

WeatherStation
(http://www.instructables.com/id/Weather
Station1/?
Arduinoweatherstation.
(http://www.instructables.com/id/Arduino
weatherstation/?
utm_source=pm&utm_medium=related
instructables&utm_campaign=related_test)
RaspberryPiInternet
WeatherStation
(http://www.instructables.com/id/Raspberry
PiInternetWeather
Station/?
WirelessoutdoorArduino
weatherstationwithPC
loggingandGraphs
(http://www.instructables.com/id/Wireless
outdoorArduinoweather
WiredArduinoWeather
Station
(http://www.instructables.com/id/Wired
ArduinoWeatherStation/?
utm_source=pm&utm_medium=related
SeeMore(/tag/typeid/?q=)

(http://cdn.instructables.com/FA2/C2VP/HKZAW3MR/FA2C2VPHKZAW3MR.LARGE.jpg)

TheBMP085barometricpressuresensorusesI2Cbustocommunicatewiththe
Arduino.WhenchoosingaBMP085breakoutboardthemainfeaturetolook
foris5vcapabilityasthiswillbroadentherangeofpossibilitiesandsimplify
wiring.Irecommendhttp://www.adafruit.com/products/391
(http://www.adafruit.com/products/391).IusedCAT5etoconnectthe
anemometerandsensortotheArduinoinmyvehicle.themaxdistanceyoucan
runI2ConCAT5ewireisabout25feet.fordistanceslongerthan25feetIwould
considerwireless.IpaintedtheCokecanwhitetocutdownthefalsetemp
readingduringfullsun.

Step3:Arduinocode
#include<Wire.h>
#include<Adafruit_Sensor.h>//libraryavaliableatadafruit.com
#include<Adafruit_BMP085.h>//libraryavaliableatadafruit.com

Adafruit_BMP085bmp=Adafruit_BMP085(10085)
intwSpeed
intwDirect
inttemp1
intpress1
intwsee
/**************************************************************************/
/*
Arduinosetupfunction(automaticallycalledatstartup)
*/
/**************************************************************************/
voidsetup(void)
{
Serial.begin(9600)

/*Initialisethesensor*/
if(!bmp.begin())
{
/*TherewasaproblemdetectingtheBMP085...checkyourconnections*/

Serial.print("Ooops,noBMP085detected...CheckyourwiringorI2C
ADDR!")
while(1)
}
}
voidloop(void)
{
/*Getanewsensorevent*/
sensors_event_tevent
bmp.getEvent(&event)
wsee=analogRead(A0)
wSpeed=map(wsee,0,1023,0,1534)//aftertestingthisgavemeaccuratewind
speed
wDirect=analogRead(A1)//itwillbedifferentforyouranemometer
/*Displaytheresults(barometricpressureismeasureinhPa)*/
if(event.pressure)
{
/*DisplayatmosphericpressueinhPa*/
press1=map(event.pressure,850,1100,0,1023)

/*Calculatingaltitudewithreasonableaccuracyrequirespressure*
*sealevelpressureforyourpositionatthemomentthedatais*
*converted,aswellastheambienttemperatureindegress*
*celcius.Ifyoudon'thavethesevalues,a'generic'valueof*
*1013.25hPacanbeused(definedas
SENSORS_PRESSURE_SEALEVELHPA*
*insensors.h),butthisisn'tidealandwillgivevariable*
*resultsfromonedaytothenext.*
**
*YoucanusuallyfindthecurrentSLPvaluebylookingatweather*
*websitesorfromenvironmentalinformationcentersnearanymajor*
*airport.*
**
*Forexample,forParis,Franceyoucancheckthecurrentmean*
*pressureandsealevelat:http://bit.ly/16Au8ol*/

/*FirstwegetthecurrenttemperaturefromtheBMP085*/
floattemperature
bmp.getTemperature(&temperature)
temp1=map(temperature,30,55,0000,1023)
}
if(wSpeed<1000&&wSpeed>99){
Serial.print("0")//theseifstatementsadd0'stothe
Serial.print(wSpeed)//leadingedgetocreateastringof
}//16numberstosendovertheUSB
elseif(wSpeed<100&&wSpeed>9)
{
Serial.print("00")
Serial.print(wSpeed)
}
elseif(wSpeed<10){
Serial.print("000")
Serial.print(wSpeed)
}
else{
Serial.print(wSpeed)
}

if(press1<1000&&press1>99){
Serial.print("0")
Serial.print(press1)
}

elseif(press1<100&&press1>9)
{
Serial.print("00")
Serial.print(press1)
}
elseif(press1<10){
Serial.print("000")
Serial.print(press1)
}
else{
Serial.print(press1)
}

if(temp1<1000&&temp1>99){
Serial.print("0")
Serial.print(temp1)
}
elseif(temp1<100&&temp1>9)
{
Serial.print("00")
Serial.print(temp1)
}
elseif(temp1<10){
Serial.print("000")
Serial.print(temp1)
}
else{
Serial.print(temp1)
}

if(wDirect<1000&&wDirect>99){
Serial.print("0")
Serial.print(wDirect)
}
elseif(wDirect<100&&wDirect>9)
{
Serial.print("00")
Serial.print(wDirect)
}
elseif(wDirect<10){
Serial.print("000")
Serial.print(wDirect)
}
else{
Serial.print(wDirect)
}
Serial.print("\n")
delay(996)//22delaysforanalogtodigitalconverter
//tostabalizeand996delaytogenerateonesecintervals
}

Step4:
Ifyoudon'talreadyhaveProcessingyoucandownloaditfreeat
http://processing.org/(http://processing.org/).Mycodeissloppyandinefficient
IamsurebutwiththelittleexperienceIhavethefactthatitisworkingisgood
fornow.

Step5:Processingcode
importprocessing.serial.*
PFontp
SerialmyPort//Theserialport
intxPos=100//horizontalpositionofthegraph
voidsetup(){
size(700,500)
p=createFont("Arial",16,true)
background(0)//setbackgroundblack
for(intu=99u<widthu=u+60)//loopcreatesverticalgrid
{
stroke(100)
line(u,0,u,height99)
}
for(intt=height99t>0t=t25)//loopcreateshorizontalgrid
{
stroke(100)
line(99,t,width,t)
}
textFont(p,12)//setfontsizeto12
textAlign(LEFT)
fill(255,0,0)//red
text("WindSpeedMPH",100,height25)//printwindspeed
fill(0,255,0)//green
text("Barometricpressuremb",210,height25)
fill(0,0,255)//blue
text("DegreesCelsius",355,height25)
fill(255)//white
text("WinddirectionN=0deg",460,height25)
fill(100)//gray
textAlign(RIGHT)
text("0",110,height87)
for(intm=160m<widthm=m+60)//loopplaces09forminutes
{
intMin=(m100)/60
fill(100)
textAlign(CENTER)
text(Min,m,height87)
}
fill(100)
textAlign(CENTER)
text("Minutes",width/2,height70)
for(intp=400p>0p=p50)//loopplacesnumbersonverticalgrideveryotherline
{
floatpat=map(p,400,0,0,200)
intpati=int(pat)//changesfloatpattoanint
fill(255,0,0)
textAlign(RIGHT)
text(pati,98,p+5)//windspeedmeasurements
floatpatie=map(p,400,0,850,1100)
intpaties=int(patie)
fill(0,255,0)
text(paties,75,p+5)//pressuremeasurements
floatpatiesTemp=map(p,400,0,30,55)
intpatiesTemp1=int(patiesTemp)
fill(0,0,255)
text(patiesTemp1,45,p+5)//tempmeasurements
floatpatiesDirec=map(p,400,0,0,359)
intpatiesDirect=int(patiesDirec)
fill(255)
text(patiesDirect,25,p+5)//winddirectionmeasurements

}
//Listalltheavailableserialports
println(Serial.list())
//Iknowthatthefirstportintheseriallistonmymac
//isalwaysmyArduino,soIopenSerial.list()[0].
//Openwhateverportistheoneyou'reusing.
myPort=newSerial(this,Serial.list()[0],9600)
//don'tgenerateaserialEvent()unlessyougetanewlinecharacter:
myPort.bufferUntil('\n')
//setinitalbackground:
}
voiddraw(){}
voidserialEvent(SerialmyPort){
//gettheASCIIstring:
StringinString=myPort.readStringUntil('\n')
StringxWindSpeed=inString.substring(0,4)
StringxPressure=inString.substring(4,8)
Stringxtemp=inString.substring(8,12)
StringxWindDirect=inString.substring(12,16)
intyWindSpeed=int(xWindSpeed)
intyPressure=int(xPressure)
intytemp=int(xtemp)
intyWindDirect=int(xWindDirect)
floatWindSpeed=map(yWindSpeed,0,1023,height104,3)
floatPressure=map(yPressure,0,1023,height104,3)
floattemp=map(ytemp,0,1023,height104,3)
floatWindDirect=map(yWindDirect,0,1023,height104,3)
stroke(255,0,0,150)
line(xPos,WindSpeed+4,xPos,WindSpeed)
stroke(0,255,0,150)
line(xPos,Pressure+4,xPos,Pressure)
stroke(0,0,255,150)
line(xPos,temp+4,xPos,temp)

stroke(255,255,255,150)
line(xPos,WindDirect+4,xPos,WindDirect)
xPos++

if(xPos>=width){//ifthegraphisfullsaveimageasjpegandstartover
saveFrame("Weather####.jpg")
xPos=100
p=createFont("Arial",16,true)
background(0)//setbackgroundblack
for(intu=99u<widthu=u+60)//loopcreatesverticalgrid
{
stroke(100)
line(u,0,u,height99)
}
for(intt=height99t>0t=t25)//loopcreateshorizontalgrid
{
stroke(100)
line(99,t,width,t)
}
textFont(p,12)//setfontsizeto12

textAlign(LEFT)
fill(255,0,0)//red
text("WindSpeedMPH",100,height25)//printwindspeed
fill(0,255,0)//green
text("Barometricpressuremb",210,height25)
fill(0,0,255)//blue
text("DegreesCelsius",355,height25)
fill(255)//white
text("WinddirectionN=0deg",460,height25)
fill(100)//gray
textAlign(RIGHT)
text("0",110,height87)
for(intm=160m<widthm=m+60)//loopplaces09forminutes
{
intMin=(m100)/60
fill(100)
textAlign(CENTER)
text(Min,m,height87)
}
fill(100)
textAlign(CENTER)
text("Minutes",width/2,height70)
for(intp=400p>0p=p50)//loopplacesnumbersonverticalgrideveryotherline
{
floatpat=map(p,400,0,0,200)
intpati=int(pat)//changesfloatpattoanint
fill(255,0,0)
textAlign(RIGHT)
text(pati,98,p+5)//windspeedmeasurements
floatpatie=map(p,400,0,850,1100)
intpaties=int(patie)
fill(0,255,0)
text(paties,75,p+5)//pressuremeasurements
floatpatiesTemp=map(p,400,0,30,55)
intpatiesTemp1=int(patiesTemp)
fill(0,0,255)
text(patiesTemp1,45,p+5)//tempmeasurements
floatpatiesDirec=map(p,400,0,0,359)
intpatiesDirect=int(patiesDirec)
fill(255)
text(patiesDirect,25,p+5)//winddirectionmeasurements
}
if(xPos<width){
//incrementthehorizontalposition:
xPos++
}
}
}

Step6:Runningeverythingtogether

(http://cdn.instructables.com/FAT/VYTT/HKZAW3MS/FATVYTTHKZAW3MS.LARGE.jpg)

Thewinddirectionsays0thewholetimebecausethewindvaneIbuiltdidnot
workproperlyandthisiswhyIchosenottogooverthebuild.Every10minthe
graphissavedasjpgandcanbeaccessedthroughprocessingssketchfolder.
thisgraphisthefirststormItestedmyequipmentinanditshowsthetempdrop
andthewindspeedincrease.

Wehaveabenicecommentpolicy.
Pleasebepositiveandconstructive.

IMadeit!

AddImages

DemolisionWolf(/member/DemolisionWolf/)

MakeComment

11monthsago

Reply

Havingapictureofthedataisagreatidea,otherwiseit'salotofdatatostore
somewhere.
(/member/DemolisionWolf/)

MonteH(/member/MonteH/)(author)

1yearago

Reply

Myoriginalplanwastouseacompassmodule.
https://www.sparkfun.com/products/7915.Thisruns$35andIwasnotwilling
(/member/MonteH/)
topaythatsoImadeacontinuouspotwithagraphitebasedsemiconductor
andcopperwipers.Ibuiltthepotontopofaharddrivemotor.Thewipers
createddragandgreatlydecreasedsensitivity.

ursm(/member/ursm/)

1yearago

Reply

hiMonteH
duringreadingI'veexpectedthatthewindvanewasimpossibletoworkwitha
(/member/ursm/)
potentiometer.
thevanemustbeabletoturnfreelyaround360.
forthatthetransmitionofthepositionshouldbeopticallyorbymagnets.
havealookathttp://www.google.ch/imgres?
imgurl=http://ginad.org.uk/weathergd/images/00vaneanglesoptical110207
sml.png&imgrefurl=http://stargazerslounge.com/topic/161623arduinobased
weather

station/&h=771&w=771&sz=190&tbnid=LzHDpgB00Hs9mM:&tbnh=84&tbnw=84&zoom=1&usg=__zfGV6bUICXhqeW5sQauRhw2FzrE=&docid
and
http://forum.arduino.cc/index.php?topic=15994.0
regards,urs

AboutUs

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.

GoProToday(/account/gopro?sourcea=footer)

We'reHiring!(/community/PositionsavailableatInstructables/)

English

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

Anda mungkin juga menyukai