Compact Weather Sensor With GPRS (SIM Card) Data Link

Introduction: Compact Weather Sensor With GPRS (SIM Card) Data Link

Project summary

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

I use an ASDA pay-as-you-go SIM card, which offers extremely good conditions for the purposes of this project, as it has a very long expiry time for credit (180 days) and only charges 5p/MB data volume.

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: Two Lithium thionyl AA batteries, non-rechargeable (3.6V, 2.6Ah).

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.

Step 1: Required Parts

  • Custom-made PCB. Zipped Gerber files here ( seems to block ZIP file uploads). I highly recommended 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.

Step 2: Schematic Principles

The top priorities for the design were:

  • Battery operation with low sleep current consumption
  • Compact design

Power supply

Two 3.6V Saft Lithium thionyl AA 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 7.2V supply 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.


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.


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).

Step 3: Arduino Code

See Arduino source code in file attachment.

Step 4: Real-world Test

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.

Be the First to Share


    • Anything Goes Contest

      Anything Goes Contest


    Penolopy Bulnick
    Penolopy Bulnick

    2 years ago

    Thanks for sharing!

    Do you have the code to share?


    Reply 2 years ago

    Code now attached. If someone could help to put it into a readable text box that would be great.