In Shenzhen, there many beautiful beach. In the summer days, I most favorite sport is sailing.
For the sailing sport, I am still a starter, I like the feeling of the seawater touching my face, and more, I got many new friends with this sport.
But for the sailing sport, the proper wind is very important. Many times when we got to the beach, we found that there no wind , or too much wind for me as a starter. And with the official weather forcasting, it is Impossible for them to forecast/monitoring the wind.
So I plan to make a real-time wind station, and to share with the info will all Shenzhen sailing enthusiast.
Step 1: Hardware
What I need is :
1. Basically, an anemometer;
2. Temperature and humidity sensor;
3. Air pressure sensor. As they are the forcasting for strong wind/rain;
4. Connection module to the internets. I use the ESP12 wifi module
5. And , a water proof case, and power bank;
Besides, I designed a base board so all the electronic module can be inserted easy, as the attached pictures.
Of course, you can also use a breadboard for this.
New: the hardware relative simple, i have package it into a kit at Makerfabs .
In the hardware design, The Anemometer is analog output, so it need to be connected to the ESP12 ADC module, And the BMP180 Barometer use the I2C for communication connect them to ESP12 GPIO4/5, which support the I2C communication, and the DHT 11 to a digital output. Note that a pullup resistor needed; take the attached reference pictures.
Step 2: Firmwares
Download my example sketch at https://github.com/hunrypan/weatherstation?tdsourcetag=s_pcqq_aiomsg. Note that some libraries need to be installed in advance, include:
Modify the WIFI setting, and MQTT. Of course, if no, you need to register an account, and created a new instance. And modify them in the firmware:
const char* ssid = "xxx"; // Wi-Fi SSID<br>const char* password = "xxx"; // Wi-Fi Password
and the MQTT info (if you not familiar with this, please refer to Makerfabs ESPwatch for the MQTT detailed usage )at:
const char* hostname = "postman.cloudmqtt.com";<br>int port = 16265; const char* user = "xxx"; const char* user_password = "xxxx"; const char* id = "xxxx";
And in the firmware loop, the ESP12 module read the sensor
or wind/temperature/air preasure by:
int windspeed = analogRead(windpin);<br>humi = dht.readHumidity(); temp = dht.readTemperature();
Upload the firmware to the ESP node MCU board.
Step 3: Nodejs and Deploy to AWS
The Esp8266 WIFI module send weather’s info to MQTT server, by publish message on topic to MQTT server. Last nodejs get weather’s info from mqtt server,by subscribe topic on save Mqtt server.
I deploy my NODE JS on AWS server, so anybody that interest on this can access my wind station at: