In the previous post, we choose a camera. It's an ATIK 4000. We need to develop some software to test It. Meanwhile, let's continue to prepare our observatory by adding some external and useful features. Here we talk about a local weather station.
We've split this project in 3 parts. First, we'll assemble already available units that can be found easily from many electronic shop online. This will help us to validate the concepts without being distracted by secondary aspects like miniaturization or optimization. Let's make this work and for cheap. This part is accessible to anyone. Only a few soldering of 3 resistors and some connectors to assemble a kit that's all. You can see this part as an advanced POC.
In the second part, we start with optimization, miniaturization and discussions about how to harden our initial weather station. We also discuss the environment constraints (temperature and humidity) and see how we can think in protecting our creation from extreme conditions.
The third part pushes forward the integration and miniaturization. We'll create the casing.
Edit: It appears that the posts for part 2 and 3 might become too long to be part of the blog. So we will write eBooks or PDF we will see to provide complete information about this project. Nevertheless, enjoy this part 1 which is very accessible to everyone.
The prove of concept: build a working weather station.
When you have such a device as an astronomical observatory, the first thing is to take care of it by protecting it from external damages. Weather can trigger phenomenons armful to any construction.
We are not just building a weather station. We wish to monitor some parameters that may trigger an alert to the local system so the observatory automatically enters a safe mode.
Since we wish to have full control over the whole system, we'll build our own station. We'll get the sensors, make some electronics, mechanical construction and software programming. Not only this is more fun but besides, it allows us to extend the capabilities of our alert station if needed.
Step 1 - What kind of data are we monitoring?
- Wind speed: It's measured with an anemometer. Most of the time this sensor comes with a weather vane that also gives the wind direction.
- Rainfall: It allows us to know if it's raining. The rain volume can also be estimated with this.
- Temperature: It might not be obvious but if temperature is too high or too low, it would be a good idea to place the electronic in safe mode by shutting it down. Indeed, every electronic equipment is rated for an operational range of temperature.
Since devices are producing their own heat, it's a better idea to monitor directly their temperature rather than just rely on external sensors and try to guess if there is a potential risk. But it may not be possible to do such direct monitoring for all devices since we cannot place a temperature sensor everywhere. Reading the outside temperature may be a valuable data to help in taking a decision.
A real weather station also includes a barometric sensor to get the pressure. For now, it's not our purpose but we may keep some ports left to add sensors later.
Step 2 - Chooe the electronic platform for the development.
A lot of platforms to do rapid prototyping are available. We can split them in two types:
- Platforms with no Operating Systems: Based on microcontrollers. Arduino and PIC are the best known in this category.
There is no booting operating system but a small piece of code called a bootloader. The firmware coded on the IDE on your computer is directly loaded and executed.
The catch is the communication between our station and the control system that receives the data. USB is mainly used. But it requires a constant connection with a computer.
The best way is to use Ethernet communication. It's reliable and easy to program. But is the Arduino capable of handling it correctly? There is 2 ways to get an Arduino board with Ethernet. The first is to get a board that has the chip and connector embedded and second one is to get an Ethernet shield to extend the capabilities of a basic Arduino board.
You might think of using a WIFI or any other wireless system which is not a bad idea, but still you must provide a cable or solar panels for power.
Besides, I must confess that I'm not a huge fan of wireless systems. I find them less reliable than cables. Besides, we can use 2 of the 4 pairs of an Ethernet cable to provide power supply. One cable, 2 problems solved.
- Platforms with operating systems: The full power of a computer in a tiny board. Raspberry Pi, Beaglebone, Odroid are among the more popular.
They include a SD card with a linux OS or windows iOT and you boot on a real computer. You can even plug a screen and a keyboard if you feel like. For complex treatments and analysis like in a control unit, it's the best choice.
For this project, we use the Arduino platform. We are supposed to monitor sensors and send the collected data to a control center. It's simple and there is no need here for the full power of a computer and its complexity. Should the power fail, there will be no bad consequences. With SD cards, that's not so obvious.
For this POC, we'll take a look at the Arduino UNO R3 board and we'll get an Ethernet Shield to make some experiments. We can reuse this device on later projects where Ethernet is not needed.
Step 3 - Prototyping board
Let's keep things easy on us. We should not focus on wiring at this stage. It's a good idea to assemble sensors and focus on making everything work. Once it's done, it's a good idea to test each part separately and get familiar with them. So, prior of doing any electronics, I'll suggest getting the Grove shield for Arduino. Its purpose is to easily connect and quickly interface the sensors with the board.
But, that's just for tests purposes. Indeed, these type of prototyping board does (almost) not include any protection between the sensors and the microcontroller board. If any over voltage occurs (like ESD 'electrostatic discharge'), it may damage your Arduino board. That said, no reasons to get paranoiac.
On your desk, it's fine but for a real production environment, we will later take care of our own connection board.
Everything about Grove system can be find in their wiki site: http://wiki.seeed.cc/Grove_System/
Step 4 - Choosing the sensors:
- Wind & Rain : Wind speed, direction and rainfall can be embedded in one component like the SEN-08942
This only includes the sensors. Other sensors exist. They all work on the same way, so I pick-up this one because it was there. To connect it to the Grove board, I found a small kit that provides the right Grove connectors. This is only time we need to follow the instruction to solder something in this step. There might be already assembled parts but I didn't look for it.
Pay attention on assembly:
- Solder the resistors first. It will be more convenient.
- Solder the 2 RJ11 connectors.
- Solder the small white 4 pins connectors. BE CARREFULL WITH THE ORIENTATION. Refer to the picture.
- Temperature: We use the Grove temperature and humidity sensor.
Don't underestimate these sensors. They might not be the more accurate on the market but keep in mind what we want to probe. A precision of 0.1°C is enough and they are durable.
Step 5 - Order equipment and assembly
Here is the list of equipment we will integrate:
- Arduino UNO R3
- Ethernet shield for Arduino UNO -Ethernet Shield W5100 for Arduino
- SEN-08942 wind and rainfall sensors
- Grove shield for Arduino
- Grove Temperature and Humidity Sensor Pro
Next, we add every Equipment and check if they are working properly by Adding the appropriate code to the software. We'll discuss a little on the software later on.
Arduino UNO R3 + Grove Shield
This step is straight forward. Just plug the Grove shield directly on the Arduino board. Then Adjust the voltage selector on the shield to 5V. We need 5V because the chart from the wind direction is based on a 5V power supply.
In step 4 we did the assembly of the Grove connecting board. Now we'll connect everything together using the following picture as a guide:
For wind speed, we can have it in Km/h or mph through a multiplying constant.
For the wind direction, we get the voltage. The direction is indicated in a chart that comes with the datasheet of the sensor. It gives the corresponding direction accordingly to the measured voltage. Of course, we could use the table from the datasheet to directly send the wind direction but, by sending the voltage to a control center, we can adjust the measure from any deviation due to components aging or temperature fluctuation.
Temperature and humidity Sensor:
This sensor is connected to D5 on the Grove base shield. To read from this sensor, we need a Library called dht22.
The Ethernet shield
Once the sensors have been tested, it's time to look at the Ethernet Shield. The Arduino shield from SUNFONDER is directly supported by the Ethernet library from Arduino.
To see the UDP packets on MAC use "nc -l -c 8888"
The final assembly
The whole assembly is powered by the USB cable coming from your computer.