Hello all during this Global Outbreak of COVID-19, the world is swiftly moving towards technology Dependence. Controlling things remotely and Working from Home is the new normal.DIY Weather station
Learning Internet of things is the absolute necessity of time and making a Weather station would be the best way to learn IOT. So in this blog post, we will learn to make a Weather station that will monitor Temperature, Humidity and Rainfall too. We will integrate all of this on an Android APP.
Step 1: Watch Video
Step 2: Electronics
In this project, we need to create a hardware interface between our Control Point and Internet. Which basically means we need 2 Node Points (or say 2 devices), one at Sensor side and another at Control side. The Medium would be Internet.
For our build, we will need a Microcontroller that can read our Sensor Data. Send it to Internet and also react to any Inputs received from the Internet.
Most Capable candidate for this Task Will be a NodeMCU which has ESP8266 Wi-Fi Enabled board along with USB Interface and Complementary Electronics. The best part is that we can Program it with Arduino IDE.
Refer to this blog to go through the basics of node MCU.
For Temperature and Humidity, we will use a DH11 Sensor to sense Temperature and Humidity, we have also covered the basics of DHT sensor in this Post.
For Rain, we will use a generic Rain Sensor, which uses Conductive Property of water to change resistance and indicate if it’s raining or not, and also how intense is the rain.
It comes as a Set with an operational amplifier to provide more accurate Calibrations which give us Digital or Analog Corresponding Outputs. It has a Potentiometer that can be used to Adjust the Sensitivity of sensor, which we will calibrate by pouring few drops of water on sensor and adjusting the pot until we see output LED glow.
For now, connection are very simple,
Vcc – 3.3v of Node MCU
GND – GND of Node MCU
Data – D5 of Node MCU
Vcc – 3.3v of Node MCU
GND – GND of Node MCU
Data – D2 of Node MCU
Step 3: Software Overview
To Control or Monitor our Sensor in real time, we will need 2 nodes, one node is Microcontroller that connects to Internet via Wireless ACCESS POINT.
But we need a second node or point to store data or Process it, for which we have quite a lot of option like Adafruit IO, Blynk, IFTTT, MQTT, Firebase, etc.
The Initial goal of the project was to push the data on Website server ofminov.in,with Firebase and a Firebase WordPress Integration plugin, but couldn’t get it working like expected. So switched to Firebase and MIT- App inventor to make an Android App that would display our data, and it turned out to be Awesome.IOT Weather Station Kit
We will learn that in the further steps.IOT Weather Station Kit
Step 4: Firebase Database
First go to firebase.google.com, use your Google Accounts and get started,
start a new Project by naming and completing the follow-up steps till you see the Dashboard, now go to database option on left side. Remember we have Real-time data to deal with, so create a Real-time Database.IOT Weather Station Kit
Now it asks if we need authentication or not, since we will make an App and we want it to be publicly available, so choose test mode Database. Which will keep Authentication off, it is less secure but works for this application.
the Database URL is very important, since we will push our Sensor data to this Node or server. copy the database URL for now.IOT Weather Station Kit
Step 5: Node MCU Code
Open the code and Libraries attached in this step and Paste the URL copied in previous step in firebase_host definition line without the https and /(backslash). Make sure you remove it or else the data won’t be directed correctly.
Other than that we need internet connectivity, for which we have to enter our Wi-Fi SSID and Password in definitions.
rest of the code is very simple and self-explanatory, where in we are basically pushing all the data from sensor on Real-time Database of firebase.
Step 6: Mobile APP
We used MIT APP DEVELOPER. So that you can easily reproduce this project for yourself, here is the .aia file which you can import into MIT App inventor and easily customize for your project and application.IOT Weather Station Kit
Simply import the project and go to build option, which will show you link and QR code, next install this app on your phone.
We can do this entire Task with BLYNK which indeed looks better in terms of UI, but blynk is not completely free, it comes with lot of restrictions. Yet coding and backend work of Blynk is way easier than MIT and definitely is useful for making simple Switch projects.IOT Weather Station Kit
Step 7: Power Electronics
We need to mount this system in Balcony or some place with access to Environment, we can’t power this system with USB wire. So it makes sense to use a Battery, best option would be a Lithium Polymer Battery but my Balcony is home to lots of birds and squirrels.
I can’t afford accidental fire here. So safer option would be a Lithium Ion battery, which adds up a little weight but offers higher Capacity and Safety as well. I have this Lithium Ion Cell with 2000 mAh Capacity and we will add a TP4056 Li ion charging module along with it.
After looking at Node MCU’s datasheet, we get to know that NODE MCU uses up to 170 milliamps. At 2000 mAh capacity and current draw of 170 milliamps. We get use time of around 11 hours, which is not much. But luckily we have Deep Sleep Mode in our NodeMCU, which basically puts our System in Deep Sleep to reduce Power Consumption. Simply add Esp.deepsleep (time in microseconds) at the end of our loop.
Upload the code and then connect D0 to Reset pin,do not connect D0 and Reset before uploading the code else you will get uploading error. During the Sleep mode, our system uses 8 milliamps.
Which turns down our overall current consumption of system and it brings battery life to 10 days ideally. We can remove the LEDs on Node MCU, DHT11 and Rain sensor to further reduce power consumption. But honestly 10 days is fine with me and I am happy with this system.
Step 8: Printed Circuit Board
As of yet, this project was on Breadboard, so we need to convert it to a PCB for which can be done using Online PCB services or by using a General Purpose Board.
Since I was short on time, I went with a rather unprofessional way, that is a General Purpose Board. Yet I have designed PCB and added Gerber FileIOT Weather Station Kit
Step 9: Enclosure
We are done with our PCB and Code, it’s time to test Everything with our APP, system is working well. It is optimized in power consumption, but it looks like mess, let’s try to bring the system in an enclosure, but I don’t have a 3D printer. So I would use a Plastic Container to stuff everything inside. Make appropriate slot for DHT11 sensor and I choose to Mount Rain Sensor independent of box to reduce chances of unnecessary water entering into system via slots, after all drilling and cutting was done. I painted the enclosure with a High Temperature Silver Paint and finally used few zip ties to secure this system to my grill.
Step 10: Conclusion!
Finally after doing all the above steps.
we can easily monitor Temperature at balcony from anywhere in world, just to get a gist of this.
I told my friends to install this app on their phones and see how the app updates sensor’s data in real-time.
If you enjoyed this Detailed yet Fun IOT project, do give this blog a Like, if your feel this helped you in any way.
Share it with your friends, that will help us grow and definitely it boosts our morale.
Thank You!IOT Weather Station Kit