Compact Weather Sensor With GPRS (SIM Card) Data Link

by joejackson2003 in Circuits > Sensors

1120 Views, 2 Favorites, 0 Comments

Compact Weather Sensor With GPRS (SIM Card) Data Link

IMG_20200824_075057.jpg
IMG_20200819_215347.jpg
IMG_20200819_215333.jpg
IMG_20200819_215411.jpg
IMG_20200819_215301.jpg
IMG_20200819_215320.jpg
IMG_20230411_122741.jpg

Exciting update April 2023

New sensor deployed in Cyprus. Expected battery life 8-10 months (reduced transmission frequency once every 2 hours).


Project summary

This is a battery-powered weather sensor based on a BME280 temperature/pressure/humidity sensor and an ATMega328P MCU. It runs on four lithium AAA batteries. It has an ultra-low sleep consumption of 6 µA. It sends data hourly via GPRS (using a SIM800L GSM module) to ThingSpeak, controlled by a DS3231 realtime clock. Estimated service on one set of battery is 4-5 months.

I currently use a 1p-Mobile pay-as-you-go SIM card, which offers extremely good conditions for the purposes of this project, with very favourable costs for the low mobile data this projects uses and £10 minimum charge every 3 months.

Motivation: Development of an economical, zero-maintenance, autonomous, battery-powered environmental sensor that can be placed in the wild to acquire weather or other data and transmit via GSM/GPRS network to an IoT server.

Physical dimensions: 109 x 55 x 39 mm (including case flanges). Weight 133 g. IP rating 54 (estimated).

Material cost: Approx. £20 per unit.

Assembly time: 2 hours per unit (hand soldering)

Power source: 4x AAA lithium batteries (Energizer Ultimate), non-rechargeable (nominal voltage 6.0V, but up to 7.0V with fresh batteries open-circuit).

Network protocol: GSM GPRS (2G)

Potential uses: Any remote location with GSM signal coverage. Forests, lighthouses, buoys, private yachts, caravans, camping sites, mountain refuge huts, uninhabited buildings

Reliability test: One unit has been undergoing long-term testing unattended since 30.8.20. Apart from one software crash, it has been sending data reliably every 30 minutes.

Required Parts

pcb.jpg
IMG_20200831_173035.jpg
  • Custom-made PCB. Zipped Gerber files here (instructables.com seems to block ZIP file uploads). I highly recommended jlcpcb.com for PCB production. For people living in the UK, I'm happy to send you a spare PCB for a minimal contribution to material and postage cost - message me.
  • ATMega328P-AU
  • Modified DS3231 Realtime Clock (see paragraph below)
  • BME280 Breakout board, such as this one
  • SIM800L GSM GPRS Module
  • Various SMD parts as per detailed list.
  • Hammond 1591, Black ABS Enclosure, IP54, Flanged, 85 x 56 x 35mm, from RS Components UK

Modification of DS3231

The quadruple resistor network circled in red needs to be unsoldered. Other more destructive methods are OK too, but avoid bridging of the pads on the inside row of 4 pads (towards the side of the MCU). The other 4 pads are connected anyway by PCB traces. This modification is essential in order to allow the SQW pin to function as an alarm. Without removing the resistors, it will not work until you connect a VCC supply to the module, which defeats the purpose of having a very low-power RTC.

Downloads

Schematic Principles

schem1.jpg

The top priorities for the design were:

  • Battery operation with low sleep current consumption
  • Compact design

Power supply

Four 1.5V Energizer Ultimate Lithium AAA batteries. A P-channel MOSFET for reverse polarity protection.

There are two voltage regulators in the circuit:

  • A Texas Instruments TPS562208 2 Amp step-down regulator to power the SIM800L at around 4.1V. This is switchable from the ATMega and is put into shutdown mode most of the time via Enable pin 5.
  • An MCP1700 3.3V regulator for the ATMega and BME280. This is an extremely efficient low-drop regulator with a quiescent current of only around 1 µA. As it is only tolerant up to 6V input, I added two rectifier diodes (D1, D2) in series to drop the unloaded 6.9-7.0V battery voltage to an acceptable level around 6V. I forgot to add the usual 10 µF decoupling capacitor on the PCB for the power supply on the ATMega. Therefore, I've upgraded the usual output capacitor on the MCP1700 from 1 to 10 µF and it works fine.
  • Battery voltage monitoring via ADC0 on the ATMega (through a voltage divider)

Real-time clock

A modified DS3231, which wakes the ATMega at specified intervals to start a cycle of measurement and data transmission. The DS3231 itself is powered with a CR2032 lithium cell.

BME280

I have tried using the original Bosch BME280 module on its own, which is nearly impossible to solder due to its minute size. Therefore, I am using the widely available breakout board. As this has an unnecessary voltage regulator, which consumes energy, I switch it on with an N-channel MOSFET just before measurements.

SIM800L

This module is reliable but seems to be fairly temperamental if the power supply is not rock-solid. I found that a 4.1V supply voltage works best. I've made the PCB traces for VCC and GND to the SIM800L extra thick (20 mil).

Schematic/PCB comments

  • The network label "1" - listed as "SINGLEPIN" in the parts list simply refers to a male header pin.
  • The two pins adjacent to the slide switch need to bridged with a jumper for normal operation, otherwise the VCC line is open here. They are intended for current measurements if needed.
  • The 100 µF capacitor (C12) for the SIM800L module is not necessary. It was added as a precautionary (desperate) measure in case of expected stability problems

Recommended assembly steps

  1. Assemble all power supply components in the lower left part of the PCB. The Enable pin (pin 5) of the TPS562208 must be on logical high for testing, otherwise the module is in shutdown mode and you will have 0V output. To pull the Enable pin high for testing, a temporary wire from pad 9 of the ATMega (which on the PCB is wired to PIN 5 of the voltage regulator) can be connected to a VCC point; the nearest point would be to the lower pin of R3, which lies on the VCC line.
  2. Test output from the TPS562208 between the bottom pins of either C2, C3 or C4 and GND. You should have around 4.1V.
  3. Test output from MCP1700, between top right pin of U6 and GND. You should have 3.3V.
  4. Solder ATMega328P; observe the pin 1 marker in top left corner. Some practice required, but not too difficult.
  5. Burn bootloader onto ATMega328 - tutorials for this elsewhere.You do not necessarily have to use pin headers to connect to MOSI, MISO, SCK and RST. For the few seconds it takes to burn the bootloader, you can use Dupont wires and use a bit of angulation to achieve a good contact.
  6. Attach 5x female pin header for the DS3231.
  7. Solder SIM800L via male pin headers
  8. Solder BME280
  9. Upload code in Arduino IDE using a USB2TTL adapter (select Arduino Uno/Genuino as target).

Downloads

Arduino Code

See Arduino source code in file attachment.

Downloads

Real-world Test

IMG_20200901_123422.jpg
IMG_20200901_123417.jpg
IMG_20200830_132926.jpg
IMG_20200830_134424.jpg
IMG_20200830_163406_1.jpg
IMG_20200830_163347.jpg

I drilled two small holes on the right side of the case just deep to front side. I covered them from inside with Goretex patches to allow air exchange but exclude water. I added some additional rain protection with little plastic roofs. I then slot the complete assembly into the case with the components facing forward and battery facing the lid. I add a bit of silicon grease to the case for added water ingress protection.

The unit is currently "installed" next to a small river. Here is the live data feed.