a Weather Station With Atmega328P-PU Microcontroller
by shahrokhani in Circuits > Microcontrollers
1154 Views, 3 Favorites, 0 Comments
a Weather Station With Atmega328P-PU Microcontroller
Recently I took an online free course with edx (Founded by Harvard University and MIT in 2012, edX is an online learning destination and MOOC provider, offering high-quality courses from the world’s best universities and institutions to learners everywhere), with the title: Backyard Meteorology: The Science of Weather, and it was very informative and I recommend it to all people who are interested in amateur meteorology, in the first or second lecture, professor John Edward Huth- the instructor- recommended buying a weather station that could measure the altitude of the geographical location and barometric air pressure, I thought instead of buying a barometer or weather station the best idea was making one with the cheapest components available around me and in my junk box, I had a search in web, and I found a few projects, some in instructables site, my problem was using a naked microcontroller not an Arduino or Raspberry pi which were and are more expensive, the price of AtmegaP-PU, Arduino Uno, and Reaspberry Pi zero - the cheapest Pi- are: $4,$12 and $21 so the AtmegaP-PU is the cheapest one. Sensors which I've used in this project are, DHT22 (Digital Temperature and Humidity Measurement Sensor) which is nearly $8 - this is more accurate than DHT11 sensor, also I've used BMP180 Temperature Barometric Pressure, Altitude Module Sensor, which is $6 and I've made use of Nokia 5110 LCD Display Module green back-light with PCB adapter for Arduino, which is just $5,so with the budget of $23 and some wires and other parts from my junk box I could make this fantastic weather station which I am going to explain to you in following paragraphs.
STEP 1: DESIGN AND CIRCUIT DIAGRAM
Since my target was, measuring temperature and relative humidity and barometric pressure and altitude, so the sensors which I must use are, DHT22 and BMP180, I use DHT22, for temperature and relative humidity measurement and the BMP180, for barometric pressure and altitude, though the BMP180 could measure temperature as well, but the temperature measured by DHT22 is more accurate than BMP180 sensor. and the Nokia 5110 for displaying the measured values and as I explained in introduction, Atmega328P-PU as microcontroller, you can see the design of the system and the circuit diagram in above figure.
STEP 2 : Tools Needed
Tools needed are shown in the above figures, and are as follows:
1- Mechanical tools:
1-1- hand saw
1-2- small drill
1-3- cutter
1-4-wire stripper
1-5-screw driver
1-6-soldering iron
2-Electronics tools:
2-1-multimeter
2-2-power supply, see my instructable for making a small one : https://www.instructables.com/id/An-Awesome-Portab...
2-3-bread board
2-4-Arduino Uno
Step 3 : Components and Material Needed
1-Mechanical material:
1-1-casing in this project I've used a case shown above, which I made it for my previous projects(please refer to: https://www.instructables.com/id/A-Hand-Held-Therm...
2-Electronic components :
2-1-ATMEGA328P-PU: https://www.amazon.com/Atmel-Semicondu-ATMEGA328P-...
2-2- Graphic LCD 84x48 - Nokia 5110: https://www.amazon.com/Graphic-LCD-84x48-Nokia-511...
2-3- 16 MHz Crystal + 20pF capacitors : https://www.amazon.com/Adafruit-Crystal-20pF-capac...
2-4- BMP180 Barometric Pressure, Temperature and Altitude Sensor: https://www.amazon.com/JBtek-Barometric-Pressure-T...
2-5- DHT22/AM2302 Digital Temperature and Humidity Sensor: https://www.amazon.com/HiLetgo-Digital-Temperature...
2-6- Jumper wire: https://www.amazon.com/s?k=Jumper+wires&ref=nb_sb_...
2-7- Rechargeable 9 volt Battery : https://www.amazon.com/Energizer-Rechargeable-volt...
2-8-LM317 linear regulator with variable output voltage: https://www.amazon.com/Voltage-Regulator-Adjustabl...
Step 4: Programming ATMEGA328P-PU
First, the Arduino sketch should be written, I have used those in different sites and modified it with my project, so you can download it if you would like to use it, for relevant libraries you can use the relevant sites especially github.com, some of the libraries addresses are as follows:
Nokia 5110: http://www.rinkydinkelectronics.com/library.php?i...
BMP180: https://github.com/LowPowerLab/SFE_BMP180
Secondly, the above program should be uploaded in to ATMEGA328P-PU, if this microcontroller is bought with bootloader, there is no need to upload boot loader program in to it, but if the ATMEGAP-PU microcontroller is not loaded with bootloader, we should do it in due course, there are plenty of instructables to use for such procedure, you can also use Arduino site: https://www.arduino.cc/en/Tutorial/ArduinoToBreadb..., and instructables like: https://www.instructables.com/id/burning-atmega328...
Thirdly, after you have done with uploading the bootloader in to ATMEGA328P-PU, you should start uploading the main sketch in to the microcontroller, the method is written in Arduino site, as mentioned above, you should use 16 Mhz crystal as shown in that site, my circuit is shown above.
Downloads
Step 5 : Making the Project
In order to make the project, you have to test the circuit on a breadboard, so use a breadboard and jumper wires as shown in the figure and test the project to see the display, if you see what you want to measure on the NOKIA 5110 display, then it is the right time to follow the rest of the procedure of making the weather station, if not, you have to figure out the problem which is either software or hardware, usually it is due to bad or wrong connections of jumper wires, follow the circuit diagram as close as possible.
The next step is to make the project, so for make a permanent connection for the microcontroller, you have to use an IC socket and solder it to a small piece of perf. board and two pieces of female pin header as shown in the above photos, due to the many IC socket pins which are 28 and pin headers' end which are 14+14, so you have to solder 56 solders and you should test all those solder points for right connectivity and for non connectivity of adjacent points, before getting assured of the right functioning of that piece do not embark upon using it for inserting the microcontroller. if everything goes well, now you should go on hooking up the next parts.
Another important thing to consider is the fact that the components need 5V to operate but the back light of the NOKIA 5110 display, needs 3.3 V, if you use 5 V for back light, it may affect badly on the life span of the display, so I've used two LM317 linear regulators with variable output voltage, and I've adjusted one for the 5V output and another for 3.3 V output, in fact I have made the one with 5V output myself and bought another with 3.3V output. Now is the time for fixing the components in to the casing, you can see the photos, DHT22 sensor should be fixed in a way that its input face be out of the case to sense the temperature and relative humidity, but the BMP180 Barometric Pressure, Temperature and Altitude Sensor, could be inside the casing but enough holes should be drilled on the casing to make it in contact with the outside air, as you could see in the photos above. Another important point is providing a small perf. board, which you could see on the photos, and make two rows of female pin headers one for earth or negative connections and one for positive 5V, outputs.
Now, is time for wiring up the components and assemblies, connect all wires according to the circuit diagram and be sure nothing is left out,otherwise there will be problem with the final result.
Hope you've found this project useful and like it...