Weather Station MK2, Part 1
Posted 2018-09-08 ‐ 10 min read
So after my last adventure into combining data collection with Python and Raspberry Pi’s I realised that just reading sensors from my windowsill was providing low quality data and not particularity useful.
So I decided that I needed to iterate upon my design and see about improving it.
After some (read: a lot) research it seemed apparent that you need to be able collect sensor reading from an area which is not being influenced by its surroundings.
The sensors need to be a decent distance away from buildings and tarmac since they radiate heat, which also affects the calculations needed to compute relative humidity and pressure.
The sensors also need to be away from any walls or fences to get good airflow but also be sheltered from direct sun illumination.
A tall order for my garden since it’s not the biggest piece of land.
However, To make any of this happen, my only real option was to go wireless, since running cable across my garden just wasn’t happening.
The remote station
Choosing a micro-controller
Originally I was going to use a either a Raspberry Pi 3 B+ or a Zero W. However after many prototypes I just wasn’t able to get the power consumption down to anything remotely close to being battery powered.
Sure the Zero lasts a couple of hours with everything powered down, but a few hours just wasn’t good enough. The RPi3B did even worse, consuming a battery murdering 410mA idle with everything off, Not to mention I was also going to need a wireless connection to send back the readings, pushing the power demand even higher into the 500+ ma band.
My only other option was to look elsewhere.
With recent explosion in all things IoT, I decided to look at what micro-controllers were being used to power this revolution.
One of the most popular manufacturers by far is Atmel.
A popular choice created by them was the Cortex M0 series of the Atmel SAMD21 family which quickly gained popularity due to Adafruits’ great implementation of it in the Feather M0 series of boards.
After much deliberation and comparing of drawbacks and strengths with controllers in the Arduinos, NodeMCU, Teensy and others, I settled on Adafruits’ Feather M0 board due to the great flexibility, the support and the “Wing” extension boards.
The brain of my Remote Weather Station was going to be an Atmel SAMD21G18, A 32 Bit ARM processor which when properly configured draws a meagre 10 µA and in the worst case up to 400-500 µA. Yes, Micro-amps.
Living the battery life
Another thing that drew me to the Feather M0 Series of boards is that they all have an integrated Li-Poly/Li-Ion charging circuit making them feature highly in my plans.
The battery was a difficult choice, I wanted a small form factor with plenty of capacity, not asking for much eh? Isn’t that what every engineer wants? But I also wanted something common and something I’ll be able to buy again when it dies.
Whilst I prototyping I hacked up an old GoPro Hero 4 battery which I no longer have a use for. They are around 3.8v and 1200mAh and it gave me about 3 and 1/2 days without any charging, whilst sending readings every 30 seconds, constants reboots and re-flashes while I debugged.
But I came across Cool Components and they had around 300 of these:
They were small, thin, light and high capacity, an all round winner!
Since the MCU will be sleeping most of the time, in a perfect world this cell would give me about 14000 hours or 58 days (factoring 70% battery life to due external conditions) in the best possible case assuming there were no peripherals attached. But since I have sensors and an RF transmitter I’ll probably see over a month, and that’s assuming it never gets charged.
30 days battery life is cool and all but I want it to be maintenance free.
So I looked towards the Sun.
Solar I think is by far one of the hardest forms of energy to harvest.
Solar irradiation, maximum power point, temperature, angle of incidence, the type of panel and so on.
I chose a 13cm by 20cm, Monocrystalline, 9V, 500mA solar panel, my reasoning being:
- Monocrystalline solar panels have higher efficiency rates since they are made out of the high grade silicon.
- They perform better than similarly rated polycrystalline solar panels in low light conditions.
- I needed 5V and regulators have a dropout voltage of a few volts.
- 500mA will be plenty to run the circuit and charge the battery in the day.
- It fitted nicely on the top of my enclosure
Regulating the sun
For regulation I chose to use a National Semiconductor JM34RP Step-Down Voltage Regulator based on the incredibly popular, industry standard LM2596 by Texas Instruments.
This regulator when used with the correct external components can regulate a 40V input down to 3.3V, although, in order to avoid huge power dissipation by means of heat, I would keep the input voltage within 10V of your output.
At maximum solar input, the panel puts out about 11-12V even though it’s a 9V panel, you should always expect a few more than its designation.
This board will happily regulate 12V to 5V without any issues.
And since there is more voltage at the input, I can gain a bit more current on the output, about 6-700mA from a 500mA panel.
A nice perk of using a Buck converter.
This board also has an LED display to show the output voltage and has terminal plugs and a USB socket rather than solder points or screw terminals.
That’s a 10-4!
For this application, 802.11 Wireless and Bluetooth and BLE would’ve been impractical. They consume far too much power, their range is limited and they are easily impacted by obstruction and other unfavourable conditions.
Most data collection systems rely on a much lower frequency in order to permit transmission over much greater distances. However, Don’t expect HD videos to be sent at these frequencies because speed is what they trade in exchange for distance.
Luckily for me, Adafruit already had something ready made.
A Feather M0 with on-board RFM69HCW radio running at 433MHz.
In the best case scenario, the highest throughput of this radio is somewhere near 300kb/s and over large distances, much, much less, you should expect around 1 or 2kb/s. Some people have had this radio work over 5km!
But for this application it’s perfect! I send a 60 byte packet of data every 15 minutes. Even at maximum range it would still be more than enough.
Surveying the environment
From the previous version of my project I learned a few important things when it comes to the actual sensors and their usage.
Hot and sticky
Humidity is a big problem, You want to sense it, but at the same time protect your circuits from it, this leads to a conundrum.
The MK1 weather box had serious issues with humidity and nearly every contact, trace and soldering joint had rust on them, this lead to at least two of the sensors dying and requiring replacement.
I also found that it caused the RPi to lock up because the sensors had stopped responding, especially the BMP180.
This time round I have decided that humidity is not an important metric for me to capture, though it will be recorded, it will be from inside a waterproof enclosure which means the readings are likely to be wrong since there is no air flow from outside.
Previously I used a BMP180 and it was perfectly adequate for measuring the pressure apart from the aforementioned rust problem, however, this time I’m using a waterproof enclosure so rust isn’t a issue and measuring the pressure inside an enclosure is perfectly fine.
I also have chosen to upgrade to the BME280 sensor which can monitor the temperature, pressure and humidity all at the same time.
However, the BME280 will be internal so the humidity will be wrong but i’ll be using the BME280’s temperature to measure the temperature of the enclosure so I can keep an eye on it during hot summer days and cold winter nights as I’ll need to stop the battery charging below 0°C and above 50°C.
Is it hot in here?
After proving itself time and time again, the DS18B20 is a solid choice for a thermometer, I used it in the MK1 and it’s back again in the MK2, but this time it’s waterproof and external. In order to get a good, accurate temperature reading I’ve housed the sensor in a solar radiation shield to keep the sun off whilst providing ample air flow but also protecting it from the wind skewing the readings.
One problem I did notice about powering the Feather via a battery is that the voltage back-feeds through the USB port / pin.
The issue with this is that the voltage was reaching the input of the buck converter and worse still was that it was even appearing on the solar power input terminals and thus was feeding the wrong way though the panel itself. Not a single protection diode on any of the boards, so I added one myself.
My solution was to use a 1N5819 which is a 40V 1A Schottky diode specifically designed for use in applications where high power efficiency is needed and low forward voltage drop (Around 450mV), I placed it between the output from the regulator and the USB pin of the feather board. This solved the issue completely, however, I might switch it out for a SB340 which is 20V but is 3A to give me a bit more headroom.
I also wanted to monitor the output of the regulator so I could tell when the sun was sufficient to charge the battery, fortunately the Atmel µC has several ADC pins available.
The problem with the ADC is that it’s only rated up to vREF which in my case is 3.3V, So to work around this I added a 5 to 1 voltage divider.
Now, at its peak 5V output it only send about 1V to the ADC A1 pin.
The station can monitor:
- The output power from the regulator to the Feather
- The battery voltage
- The outside temperature using an external, shielded thermometer
- The pressure
- The internal humidity
- The internal temperature
If you want to build one, here’s the part list:
- Atmel SAMD21G18 Microprocessor
- RFM69HCW Radio Transceiver
- 9V 500ma Solar Panel
- DC-DC LM2596 Buck Converter SMPS
- Bosch BME280 environmental sensor package
- DS18B20 1-Wire temperature sensor
- 3.7V 2000mAh Li-Poly battery
- IP68 Junction box
- Solar irradiation shield
- 1N5819 Schottky Diode
- Cable glands (various)