weather station arduino and processing

10
(/) let's make Explore (/tag/typeid/) Create (/about/submit.jsp) Contests (/contest/) Community (/community/) share what you make > (/editInstructable/) (/id/intel/) (/tag/typeid/categoryworkshop/channelgardening/?sort=FEATURED) (/tag/typeid/categorytechnology/channelcnc/?sort=FEATURED) (/tag/typeid/categoryworkshop/channelh Build a mobile or home weather station and graph the data in real time on your computer. The graph maps out wind speed, pressure, temperature, and wind direction for 10 minutes then saves the image as a jpeg and starts over. Related (http://cdn.instructables.com/FOY/ELW2/HKVL8129/FOYELW2HKVL8129.LARGE.jpg) (http://cdn.instructables.com/F7O/J0UE/HKZAW3MN/F7OJ0UEHKZAW3MN.LARGE.jpg) (http://cdn.instructables.com/FEH/ZV6N/HKZAW3MM/FEHZV6NHKZAW3MM.LARGE.jpg) (http://cdn.instructables.com/FA2/C2VP/HKZAW3MR/FA2C2VPHKZAW3MR.LARGE.jpg) (http://cdn.instructables.com/FXK/PKRH/HKZAW3MP/FXKPKRHHKZAW3MP.LARGE.jpg) About This Instructable License: 14,436 views 58 favorites (/member/MonteH/) MonteH (/member/MonteH/) Follow 4 auduino (/tag/typeid/categorytechnology/keyword auduino/) processing (/tag/typeid/categorytechnology/keyword processing/) weather (/tag/typeid/categorytechnology/keyword weather/) Tags: (/) Weather station Arduino and Processing by MonteH (/member/MonteH/) Collection I Made it! Download (/id/WeatherstationArduinoandProcessing/?download=pdf) 6 Steps Favorite Share (/id/WeatherstationArduinoandProcessing/) Login (/account/login) | Sign Up (/account/gopro?sourcea=header&sourceaUrl=/id/WeatherstationArduinoandProcessing/?ALLSTEPS)

Upload: raja-rahman-way

Post on 30-Sep-2015

93 views

Category:

Documents


12 download

DESCRIPTION

weather

TRANSCRIPT

  • (/)

    let's makeExplore (/tag/typeid/) Create (/about/submit.jsp) Contests (/contest/) Community (/community/)

    share what you make >

    (/editInstructable/) (/id/intel/) (/tag/typeid/categoryworkshop/channelgardening/?sort=FEATURED)(/tag/typeid/categorytechnology/channelcnc/?sort=FEATURED)(/tag/typeid/categoryworkshop/channelhomerenovation/?sort=FEATURED)

    Buildamobileorhomeweatherstationandgraphthedatainrealtimeonyourcomputer.Thegraphmapsoutwindspeed,pressure,temperature,andwinddirectionfor10minutesthensavestheimageasajpegandstartsover.

    Related

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

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

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

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

    (http://cdn.instructables.com/FXK/PKRH/HKZAW3MP/FXKPKRHHKZAW3MP.LARGE.jpg)

    AboutThisInstructable

    License:14,436views

    58favorites

    (/member/MonteH/)

    MonteH(/member/MonteH/)

    Follow 4

    auduino(/tag/typeid/categorytechnology/keyword

    auduino/)

    processing(/tag/typeid/categorytechnology/keyword

    processing/)

    weather(/tag/typeid/categorytechnology/keyword

    weather/)

    Tags:

    (/)

    WeatherstationArduinoandProcessing byMonteH(/member/MonteH/)

    Collection IMadeit!

    Download(/id/WeatherstationArduinoandProcessing/?download=pdf) 6Steps

    Favorite Share

    (/id/WeatherstationArduinoandProcessing/)

    Login(/account/login) | SignUp(/account/gopro?sourcea=header&sourceaUrl=/id/WeatherstationArduinoandProcessing/?ALLSTEPS)

  • WindMeters&Anemometers

    inspeed.com

    WindSpeedforhome,RV,portableTopquality,greatvaluesfrom$59

    WeatherStationsonSale

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

    Step1:Anemometerbuild

    TheanemometerIbuiltwasbuiltwithmaterialsIhadonhand.IbasedthebuildaroundaDCmotorIhadthatspinsfreelywithlittleeffort.thediagramlistthepartsIused.

    Step2:BMP085housing

    SeeMore(/tag/typeid/?q=)

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

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

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

    WeatherStation(http://www.instructables.com/id/WeatherStation1/?Arduinoweatherstation.(http://www.instructables.com/id/Arduinoweatherstation/?utm_source=pm&utm_medium=relatedinstructables&utm_campaign=related_test)RaspberryPiInternetWeatherStation(http://www.instructables.com/id/RaspberryPiInternetWeatherStation/?WirelessoutdoorArduinoweatherstationwithPCloggingandGraphs(http://www.instructables.com/id/WirelessoutdoorArduinoweatherWiredArduinoWeatherStation(http://www.instructables.com/id/WiredArduinoWeatherStation/?utm_source=pm&utm_medium=related

  • TheBMP085barometricpressuresensorusesI2CbustocommunicatewiththeArduino.WhenchoosingaBMP085breakoutboardthemainfeaturetolookforis5vcapabilityasthiswillbroadentherangeofpossibilitiesandsimplifywiring.Irecommendhttp://www.adafruit.com/products/391(http://www.adafruit.com/products/391).IusedCAT5etoconnecttheanemometerandsensortotheArduinoinmyvehicle.themaxdistanceyoucanrunI2ConCAT5ewireisabout25feet.fordistanceslongerthan25feetIwouldconsiderwireless.IpaintedtheCokecanwhitetocutdownthefalsetempreadingduringfullsun.

    Step3:Arduinocode

    #include#include//libraryavaliableatadafruit.com#include//libraryavaliableatadafruit.comAdafruit_BMP085bmp=Adafruit_BMP085(10085)intwSpeedintwDirectinttemp1intpress1intwsee

    /**************************************************************************//*Arduinosetupfunction(automaticallycalledatstartup)*//**************************************************************************/voidsetup(void){Serial.begin(9600)

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

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

  • Serial.print("Ooops,noBMP085detected...CheckyourwiringorI2CADDR!")while(1)}

    }

    voidloop(void){/*Getanewsensorevent*/sensors_event_teventbmp.getEvent(&event)wsee=analogRead(A0)wSpeed=map(wsee,0,1023,0,1534)//aftertestingthisgavemeaccuratewindspeedwDirect=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(definedasSENSORS_PRESSURE_SEALEVELHPA**insensors.h),butthisisn'tidealandwillgivevariable**resultsfromonedaytothenext.****YoucanusuallyfindthecurrentSLPvaluebylookingatweather**websitesorfromenvironmentalinformationcentersnearanymajor**airport.****Forexample,forParis,Franceyoucancheckthecurrentmean**pressureandsealevelat:http://bit.ly/16Au8ol*//*FirstwegetthecurrenttemperaturefromtheBMP085*/floattemperaturebmp.getTemperature(&temperature)temp1=map(temperature,30,55,0000,1023)}if(wSpeed99){Serial.print("0")//theseifstatementsadd0'stotheSerial.print(wSpeed)//leadingedgetocreateastringof}//16numberstosendovertheUSBelseif(wSpeed9){Serial.print("00")Serial.print(wSpeed)}elseif(wSpeed

  • elseif(press19){Serial.print("00")Serial.print(press1)}elseif(press1
  • Step5:Processingcode

    importprocessing.serial.*PFontp

    SerialmyPort//TheserialportintxPos=100//horizontalpositionofthegraph

    voidsetup(){size(700,500)p=createFont("Arial",16,true)

    background(0)//setbackgroundblackfor(intu=99u0t=t25)//loopcreateshorizontalgrid{stroke(100)line(99,t,width,t)}

    textFont(p,12)//setfontsizeto12textAlign(LEFT)fill(255,0,0)//redtext("WindSpeedMPH",100,height25)//printwindspeedfill(0,255,0)//greentext("Barometricpressuremb",210,height25)fill(0,0,255)//bluetext("DegreesCelsius",355,height25)fill(255)//whitetext("WinddirectionN=0deg",460,height25)fill(100)//graytextAlign(RIGHT)text("0",110,height87)for(intm=160m0p=p50)//loopplacesnumbersonverticalgrideveryotherline{floatpat=map(p,400,0,0,200)intpati=int(pat)//changesfloatpattoanintfill(255,0,0)textAlign(RIGHT)text(pati,98,p+5)//windspeedmeasurementsfloatpatie=map(p,400,0,850,1100)intpaties=int(patie)fill(0,255,0)text(paties,75,p+5)//pressuremeasurementsfloatpatiesTemp=map(p,400,0,30,55)intpatiesTemp1=int(patiesTemp)fill(0,0,255)text(patiesTemp1,45,p+5)//tempmeasurementsfloatpatiesDirec=map(p,400,0,0,359)intpatiesDirect=int(patiesDirec)fill(255)text(patiesDirect,25,p+5)//winddirectionmeasurements

  • }

    //Listalltheavailableserialportsprintln(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){//ifthegraphisfullsaveimageasjpegandstartoversaveFrame("Weather####.jpg")xPos=100p=createFont("Arial",16,true)

    background(0)//setbackgroundblackfor(intu=99u0t=t25)//loopcreateshorizontalgrid{stroke(100)line(99,t,width,t)}

    textFont(p,12)//setfontsizeto12

  • textAlign(LEFT)fill(255,0,0)//redtext("WindSpeedMPH",100,height25)//printwindspeedfill(0,255,0)//greentext("Barometricpressuremb",210,height25)fill(0,0,255)//bluetext("DegreesCelsius",355,height25)fill(255)//whitetext("WinddirectionN=0deg",460,height25)fill(100)//graytextAlign(RIGHT)text("0",110,height87)for(intm=160m0p=p50)//loopplacesnumbersonverticalgrideveryotherline{floatpat=map(p,400,0,0,200)intpati=int(pat)//changesfloatpattoanintfill(255,0,0)textAlign(RIGHT)text(pati,98,p+5)//windspeedmeasurementsfloatpatie=map(p,400,0,850,1100)intpaties=int(patie)fill(0,255,0)text(paties,75,p+5)//pressuremeasurementsfloatpatiesTemp=map(p,400,0,30,55)intpatiesTemp1=int(patiesTemp)fill(0,0,255)text(patiesTemp1,45,p+5)//tempmeasurementsfloatpatiesDirec=map(p,400,0,0,359)intpatiesDirect=int(patiesDirec)fill(255)text(patiesDirect,25,p+5)//winddirectionmeasurements

    }if(xPos

  • Wehaveabenicecommentpolicy.Pleasebepositiveandconstructive.

    IMadeit! AddImages MakeComment

    (/member/DemolisionWolf/)

    11monthsago Reply

    (/member/MonteH/)

    1yearago Reply

    (/member/ursm/)

    1yearago Reply

    Thewinddirectionsays0thewholetimebecausethewindvaneIbuiltdidnotworkproperlyandthisiswhyIchosenottogooverthebuild.Every10minthegraphissavedasjpgandcanbeaccessedthroughprocessingssketchfolder.thisgraphisthefirststormItestedmyequipmentinanditshowsthetempdropandthewindspeedincrease.

    DemolisionWolf(/member/DemolisionWolf/)

    Havingapictureofthedataisagreatidea,otherwiseit'salotofdatatostoresomewhere.

    MonteH(/member/MonteH/)(author)

    Myoriginalplanwastouseacompassmodule.https://www.sparkfun.com/products/7915.Thisruns$35andIwasnotwillingtopaythatsoImadeacontinuouspotwithagraphitebasedsemiconductorandcopperwipers.Ibuiltthepotontopofaharddrivemotor.Thewiperscreateddragandgreatlydecreasedsensitivity.

    ursm(/member/ursm/)

    hiMonteHduringreadingI'veexpectedthatthewindvanewasimpossibletoworkwithapotentiometer.thevanemustbeabletoturnfreelyaround360.forthatthetransmitionofthepositionshouldbeopticallyorbymagnets.havealookathttp://www.google.ch/imgres?imgurl=http://ginad.org.uk/weathergd/images/00vaneanglesoptical110207sml.png&imgrefurl=http://stargazerslounge.com/topic/161623arduinobasedweather

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

  • station/&h=771&w=771&sz=190&tbnid=LzHDpgB00Hs9mM:&tbnh=84&tbnw=84&zoom=1&usg=__zfGV6bUICXhqeW5sQauRhw2FzrE=&docid=2Y73kq1jLyytUM&sa=X&ei=qecoUoXxGaGG4ASVp4C4Bw&ved=0CE8Q9QEwAg&dur=6854andhttp://forum.arduino.cc/index.php?topic=15994.0regards,urs

    AboutUsWhoWeAre(/about/)Advertise(/advertise/)Contact(/about/contact.jsp)Jobs(/community/PositionsavailableatInstructables/)Help(/id/howtowriteagreatinstructable/)

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

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

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

    Pinterest(http://www.pinterest.com/instructables)

    Google+(https://plus.google.com/+instructables)

    Tumblr(http://instructables.tumblr.com)

    ResourcesForTeachers(/teachers/)ArtistsinResidence(http://www.autodesk.com/artistinresidence/home)GiftProAccount(/account/give?sourcea=footer)Forums(/community/)Answers(/tag/typequestion/?sort=RECENT)Sitemap(/sitemap/)

    GoProToday(/account/gopro?sourcea=footer)

    We'reHiring!(/community/PositionsavailableatInstructables/)

    MobileDownloadournewappsforiOS,AndroidandWindows8!

    Android(https://play.google.com/store/apps/details?

    id=com.adsk.instructables)

    iOS(https://itunes.apple.com/app/instructables/id586765571)

    Windows(http://apps.microsoft.com/windows/enus/app/7afc8194c771441a9590

    54250d6a8300)

    Join our newsletter:

    TermsofService(http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=21959721) |PrivacyStatement(http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=21292079) |LegalNotices&Trademarks(http://usa.autodesk.com/legalnoticestrademarks/) | MobileSite(http://m.instructables.com)

    (http://usa.autodesk.com/adsk/servlet/pc/index?id=20781545&siteID=123112)

    Join!

    2014Autodesk,Inc.

    Englishenteremail