Intro: Netatmo DualScreen Station
Netatmo is a great weather station.
I own the basic kit + extra sensor + rain gauge.
The only limit of Netatmo Weather Station is that you need a Smartphone or Tablet to view informations collected by the station.
Therefore, I decided to make a remote screen for my Station.
Step 1: Genesis I : a Stand Alone Inside Weather Station
This stand alone was made with :
- an Arduino Uno
- a 2.8 screen from Adafruit
- a real Time Clock
- and a Pressure/Temperature sensor
It displays :
- Temperature (upper right big digits)
- Temerature (left gauge bar)
- Pressure History over 6 days
The code was fun to make and plenty of learnings with a storage of the pressure value into the EEPROM of the Arduino.
I had this device on my desk for about 9 months.
Step 2: Genesis II : the Netatmo Remote Screen
Thanks to the API of Netatmo, I build a first version.
It is made of :
- Arduino Uno
- Ethernet Shield
- Adafruit 2.8 screen
The tricky part is connecting the Arduino to the Netatmo API.
After multiple attemps playing with the Ethernet shield, I realized that Arduino Uno is not powerful enough to make an HTTPS (the S is important) connection. Therefore, I was unable to retrieve valuable information from Netatmo servers.
Hopefully, I found this guy's blog who gave me the solution Link to blog :
- Use a Synology with a PHP client to make the internet connection to Netatmo servers
- Retrieve in standard HTTP (no S) the data with the Arduino
As I do not own a Synology, I used a PHP client on a web server.
Step 3: General Setup
The Station is setup as shown on the diagram :
- An Arduino Mega (because I had one in stock),
- Two 2.8 inches screen (because I had them in stock)
- An ESP 8266 wifi module
A PHP code runs on remote server to retrieve in a securely maner the information from the netatmo servers and turns it into simple text data for the Arduino.
Electronically speaking :
- I made a custom power converter that transforms my 9v input into a 5V and 3.3V.
- The 5V powers the Arduino and the 3.3V powers the 8266.
- The Arduino is connected to the 8266 through a resistor bridge to lower the signal from 5V to 3.3V (it works in 5V but I have remarked that the 8266 heats a lot, and read that it may not last long this way...).
Step 4: On the Screen
The left screen provides many informations :
- It is mainly the real time data from the Netatmo sensors (Outside, Inside and Rain Gauge).
The right screen provides :
- Time and date
- Pressure history (from the Netatmo servers, as measured by the inside sensor)
- 3 days weather forecast (from the OpenWeatherMap servers
One can notice I have added on the right screen a green gauge bar (the left one). It gives an indication on when the Netatmo data is going to be refreshed; The Netatmo sensors update datas on the servers every 5 minutes. therefore, I etrieve the datas every 5 minutes.
the other green bar (the one on the right) is the status of the internet connexion. Red means the wifi connexion fails. Green means it is ok. It is only updated when the program connects to Internet to retrieve datas.
Step 5: The Box
The box is made of PVC (3mm). I glue it with Cyano glue or with Neoprene glue.
I covered the plastic PVC box with 1mm plywood and directly glued to the plastic.
The back of the screen and the transparent part are removable. These two pieces are screwed with nylon screws.
Step 6: Custom Fonts
The fonts provided by Adafruit in their graphical library is quite simple.
As soon as you enlarge the font, it shows pixels...
So I decided to go for my own fonts. I experienced the processed in my other instructable (Led Matrix Arduino Clock).
Here, the font is 16 pixels width and 25 pixels high.
I design my fonts in Excel. Each line is 16 pixels, therefore 16 bits. So each line of the font is an INT (2 bytes). I used Excel to calculate automatically the list of INT for each digits.
In fact, I designed 2 sets of fonts, one for the time, and the other for the all the rest.
Step 7: The Code
The code is available in the attached zip.
I have several files. One is for the internet connexion, one is for everything related to displays. The main one is for the SETUP and the LOOP.
I tried to comment and clean the code as much as possible. There might be some comments in french but most of it in english.
Feel free to comment, ask questions about it, I'll try to reply the best I can.
DAYLIGHT SAVING TIME
I don't use a RTC (Real Time Clock), so I read the time from the http header.
The time in the http header is GMT. I have made an automatic DST (Daylight Saving Time) adjustment : in France, the time changes on the last sunday of april and last sunday of october. Quite simply, you have to determine if you are the last sunday of april or october.
// manage DST
// in France , last sunday of march (+1 hour) and last sunday of october (-1 hour) if ( _monthInt < 4 ) _DST=1; // jan and feb and march -> winter if ( (_monthInt == 4) && (_day.toInt() > 23) && ( (_day.toInt() - _dowInt) > 22) ) _DST=2; // after last sun of march -> summer if ( _monthInt > 3 ) _DST=2; // after march -> summer if ( (_monthInt == 10) && (_day.toInt() > 24) && ( (_day.toInt() - _dowInt) > 23) ) _DST=1; // after last sun of october -> winter if ( _monthInt > 10) _DST=1; // after oct -> winter
- _monthInt is the month
- _day is the date
- _dow is day of week (1 = sunday)
- DST = 1 means winter time, DST = 2 means summer time
Step 8: Conclusion
I took a lot of pleasure making this device.
I learned about the ESP8266 while doing it.
I had troubles with the internet libraries I found, that is why I coded all the AT commands directly.
I noticed 2 bugs since the station is working non stop since a few days :
- The 5 minutes gauge bar (upper left corner on the right screen sometimes displays an extra green square which never disappears.
- The daily sum of rain sometimes disappears.
I look forward for your comments, to give me ideas to enhace the system, the code of bring new ideas.
Thanks all for reading up to here...
...and please vote for me.