Introduction: Pocket ESP8266 Weather Station [No ThingsSpeak] [Battery Powered]
A Pocket Weather Station Specially Crafted for those Technology Geeks Sitting Out there and Watching my Instructable. So, Let me Tell you About this Pocket Weather Station.
Mainly This Pocket Weather Has a ESP8266 Brain and Works on Battery as it's Heart. Accompanied with DHT11 which take Temperature and Humidity Measurements and Send them over to ESP8266. Then the ESP8266 Sends this Data to our Own Website instead of using any 3rd Party Websites. After Sending Data to our Website, ESP8266 Goes into DeepSleep Mode for 30Min's and Restarts after that. The Whole Project Works on a 1A. Battery which is Recharged through a TP4056 Module. Carry this Pocket Weather Station Anywhere. Connect it to your phone Hotspot or your house Wifi Router. it can be Configured to connect to Anyother wifi without Re-programming
People can Go To: EspWeather.tk
To See my Room Temperature and Humidity which is Updated Every 30Min's By my Pocket Weather Station.
So, you now know much about this Module and Let's Get Started to Know More about Software Part also!
Push the Vote Button Above, if you Like it - Have Fun!
Step 1: Understand the Process
First of All , I Need You to Understand How this Pocket Weather Station Works.
About the Project:
So This is Basically a Very Cool Project to Do in which you will have some Fun while making it. It works on Battery and can Last Days on a Full Recharge. I know it's dht11 only but many other's sensors could be added and i would be adding them soon and updating this Instructable. Notice: This Project Needs Internet Access. The Data Submitted to website can be Viewed from anywhere in the World. And Read the Last Paragraph of this Setup , if you are moving away or quitting after Listening " It needs Internet Access" .
About UI ( User Interface ):
It is completely Simple and User is shown a Graphic Interface where he can read values easily.
Working of Project:
This Thing Works on a Pretty Simple Code.
Working is as Follows:
ESP8266 Connects to Your WiFi Router > ESP8266 Request Measurements from DHT11 > DHT11 returns Measurements to ESP8266 > Then ESP8266 Makes a HTTP Request to Our Website and Sends Data to It Through GET Request > After that ESP8266 Goes into 30Min's Deep Sleep > After 30Min's ESP8266 Reboots and Again Goes through all the Process.
What is WiFi is Router is Off?
I Used WiFiManager Library with Code which Provides a Easy interface to Configure to Anyother Wifi or Try Reconnect to Existing Wifi in ESP8266 when your Router is Off or password is Change.
WiFiManager Library prevents us from all the Mess and Re-Programming the Chip when we want to Change to anyother wifi access point or if your Router's Password is Changed.
Process of WifiManager is Simple:
At First Start > Boot's Up in AP Mode > Configure your Wifi Router > Reboots into STA Mode.( Records your Details for Further Reboots, So that you will not need to Configure again at another Reboot. )
Case : If your Wifi Router is Down or if Your Wifi's Password is Changed
Boot's into AP Mode > Configure new Wifi or Change wifi Password > If user does not Connect to AP of esp8266 then it will try Again with the same wifi details after some time.
Step 2: Gather All the Parts
The Parts Used in this Weather Station are Inexpensive. Therefore, You don't need to Go Through your Daily Budget. :p
Anyways, Here you Go:
1) ESP12E/F ( ESP12F is the Best Choice )
3) LM1117 ( I Really Recommend Going through Other Low Dropout Regulators for Better Project Life.)( It has a Quiescent Current of 0.5Mah so Better to go with other MCP Type which offer Below 30 uA!)
4) 0805 SMD 4.7K Resistor
5) 0805 SMD 12K Resistor
6) 0805 SMD 0.1uf Ceramic Capacitor
7) Li-ion Single Cell Mobile Battery 1A or Higher
8) TP4056 Li-ion Battery Charger with Protection IC
I Recommend Using TP4056 Charger Module With Protection IC only, Because When the Battery Reaches 2.4v (Above the Danger Zone) The Protection IC will handle the Command and will Automatically Shut Down the Project.
Step 3: Schematic
So, Past Few Years I UnderStood the Power of Schematic.
Therefore it has become necessary for me to give this to my viewers for better understanding. This Schematic Features The same Layout as in PCB Design. Therefore any Body who does not have any Facility to Manufacture PCB's Yourself then you usually go through this Schematic and Make your's own at a Breadboard or Schematic. :)
Here are the Connection Points on ESP8266:
GPIO16 > Reset
CH_PD > VCC
GPIO 4 > DHT11 - DATA Pin
GPIO15 > GND
VCC > BATTERY INPUT
GND > GND
Connection Points on DHT11:
VCC > BATTERY INPUT
DATA > GPIO 4
GND > GND
Step 4: PCB Layout
I Created an PCB Layout as ESP12 Pins were not Breadboard Friendly.
This PCB was Made according to my Battery Size. But can be Used on anyother size Battery.
You can always Go through the schematic and make your own PCB according to your Battery Size.
This was Made on Single Side PCB with only TOP Layer on Eagle CAD. Therefore Before Printing Tick the Mirror Option in Eagle PCB.
PCB File Attached.
Attention:As there was not much space to connect VCC PCB Trace Therefore i made a Gap ( Refer to Jumper on PCB ) , You will need to Connect those 2 Points with Insulated Wire.
Step 5: Arduino Code
For this Project I Programmed ESP8266 in Arduino IDE.
Special Credits to:
The Code Uses All these Libraries for Proper Functioning. Click on Library names above to Go and Download them.
Arduino Code Attached with this Step. There would be Some Minor Changes Needed in this Code for Working with your Router. Which would Be Clarified in Last Step.
Step 6: Etching PCB
As i will not be Discussing how to etch your Own Single Sided PCB's at Home Therefore Anyone who doesn't knows, Here is the Link where you can know how to make them.
Link: How to Etch PCB at Home
>> Skip this Step if you are Making it on Breadboard or StripBoard. OR You already know how to Make Some. >>
Step 7: Soldering All the Parts
This is Self Explanatory. You will have to Solder all the Parts Given in the List at their Respective Names Specified in PCB File.
Note: Add a Strip of Tape Covering the PCB trace near the ESP12 Bottom 6 Extra Pins, To Prevent Short Circuit.
I have added The Images Above, Which give you all the reference Places, where you have to Solder the Parts.
Don't Forget to Solder the Jumper with Insulated Wire!
>> Skip this Step if making on Breadboard or StripBoard >>
Step 8: Connecting Battery With Setup
As Mentioned I used Li-ion Single Cell 1A Battery from my Samsung Dead Mobile Phone. Fortunately Battery was Working Fine therefore I Suggest Everybody to Keep the Battery if your Phone's Motherboard Becomes Dead.
Caution: Don't Use any Swollen Batteries. They are Leaked and can Explode in any Possible Case.
Now Here Comes the Tricky Part!:
1) I saw that Bat+ and OUT+ on TP4056 were connected Together , Therefore I Used Only One Wire to Connect to Battery and Used the Other VCC Line Coming from ESP8266 Side to Connect to + Battery. ( In all sense it would have been the same case you used 2 wired for Bat+ and OUT+ )
2) Now the Difference was when coming to ground Pin's on TP4056 Module .The Module had Different Ground Pins for OUT and BAT-, Therefore while connecting ground's you will need to use 2 wires rather than connecting to ground of battery.
3) Now As you can see , I didn't Provided any Switch in this Project as this was going to be remained on everytime and would switch off automatically when Battery is Low. ( As Discussed on 3 Step , Protection IC Automatically Switches off the Output) . If you need switch then you can always add one for Sure.
Step 9: Setting Up Your Very Own Website
So, This Might be a Difficult Step for those who are New to Websites and Hosting Part. But i will always Try to Make it Easier for you.
The Website Part. Many of us Would be Getting confused, on how?
So , Let me Clarify. First of all you need to get a Domain an Hosting. Many Would be Considering Free Domain and Hosting as this is a very low processing Project and Doesn't needs any Higher Website Requirements.
Thereofore for Trial Purposes you can try Free Hosting and domain Like this Website Gives: https://www.000webhost.com/
I Really Recommend on Switching to Paid Website Domain and Hosting. As this will Ultimately Help that Hosting Provider for more Speed and Website Optimization from their Side.
Domain - It is referred to the Name Given to a Website or you may know it as URL ( Like : instructables.com)
Hosting - It is the Server which servers the Files of Website to Users.
Now i Am Providing a Pre Complied and Sources of Files which you need to Upload to your Hosting. ( Extract all the Files from the above .zip and place them)
Therefore, Just upload these to your Hosting and Do The Required Changed Mentioned in Next Step.
----- Accessing the Data Submitted to Website by Module -----
To Show the Data from module to Us . You Simply need to type your url and add "/show.php" line in front of it.
Step 10: Minor Changes Required by Users
These are the Minor Changes in Code, Required by Users to Make in Codes and Files Provided By Me , So that they can Fully Work with your Router and Website.
In Arduino Code Find these Lines of Code:
IPAddress _ip = IPAddress(192, 168, 1, 112); // Change These 3 Settings According to your Router's IP and GateWay.<br>IPAddress _gw = IPAddress(192, 168, 1, 1); IPAddress _sn = IPAddress(255, 255, 255, 0);
And Change then According to your Own Router's IP , Gateway and Subnet.
Now, Again Go into Same Code and Find This Line:
http.begin("http://yourwebsiteurl.com/main.php?temp="+ String(t) +"&hum="+ String(h) +""); //Change the URL according to your Website URL
So, In this Line You have to Change "yourwebsiteurl.com" to your own Website URL.
So, that's All and you have your Very Own Working Portable ESP8266 Pocket Weather Station.
Step 11: Finalize the Module.
Now Everyone , This is a Optional step and will Make your Module Stand Out and Prevent from Short circuit from Touches. the Simple and Stylish Solution is to Use White Heat Shrink Tube of 7cm dia. Cut a Little Peice off from Opening of DHT11.
Caution: Now Be Careful While Heat Shrinking the Tube on this Pocket Weather Station as this has a Li=-ion Battery Along! Do Heat Shrinking in minimal Time and in Parts like Heat Shrinked Some Portion then wait and Heatshrink other Portion This Way, Battery will be Prevented from Heating too Much and prevent happening something bad.
That's All and Happy Tinkering Everyone. Love y all , Drop your Comments or Ask any Question if facing any Problem.
Push the Vote Button Above if you Like this Project and Tutorial!