Hi there folks, In this post, I’m going to talk about building a simple solar powered cloud-connected weather station using the Particle Electron. I’ll also discuss the tradeoffs between the different power saving modes the Electron offers and how to structure and plan a cellular-data driven project to run completely off of solar 24/7/365.

Getting Started: Weather Logger Tutorial

This weather logger is going to sample data from a DHT22 humidity/temperature sensor and log it to a cloud platform (ThingSpeak) using HTTP POST every 20 minutes. Between transmits, we’ll put the device into sleep mode to conserve power. In my testing, this configuration uses only an average of 0.1021 W. This means our configuration uses only 2.5 Wh of energy a day (0.1021 W * 24 h)–so we can comfortably power our device using a Voltaic 6W or 3.5W panel. After the tutorial, I’ll discuss other power saving modes of the Electron and additional Solar considerations. For this tutorial we’re going to be using:

Hardware Setup

First, place the Electron in the middle of the included mini breadboard, and place the DHT22 so that pins 1-4 connect to pins D1-D4 on the Electron as shown below. We’ll be powering the DHT22 from digital pins so that we can turn power off to the sensor when we enter sleep mode. Ensure that the included LiPo battery is connected to the Electron and the U.FL antenna is attached.   particle electron sensor setup

Solar Setup

To keep our device running, ideally we’d like to generate 2.5 Wh of energy a day to replace what’s used in 24 hours. With a 6W panel that gets 3 hours of good sun a day we can safely estimate generating 0.5*6W*3=9Wh a day, more than enough to keep us going and charge up LiPo battery reserves to get the device (and any sensors/LEDs) through weeks with bad weather or no sun. We multiply the panel Wattage by 0.5 to get a safe estimate of actual power generated and delivered to the Electron given various sources of loss from power regulation. This calculation also means you can get by with a 3.5 W panel if you’re in an area with good sun and don’t mind losing some power margin of error (you’d be generating at least 5.25 Wh a day). Since there’s already a LiPo battery charge controller (and intelligent power switching between battery and USB) built into the Particle Electron, all you need to do is directly connect the panel to the Electron’s MicroUSB connector as shown below. The battery charging draws between 0.65W and 1.8W in my testing. particle electron microusb

Solar Setup 2

If you’re in need to store larger amounts of power or store it faster (e.g. you’re in an area with only a few hours of good sun a day), I’d recommend using a Voltaic V15 or V44 battery to store power from the panel and then pass it to the Electron. This is because the Voltaic batteries can pull down upto 4W of power from the panel at peak generation, whereas the Particle Electron’s charge controller doesn’t typically allow for power storage at such fast levels.

Basically, just connect the Voltaic battery to the panel and then connect the battery to the Electron with standard microusb. Picture is below.


Basic Software Setup


ThingSpeak will receive data from the Particle Electron and display/store it for us. Go to ThingSpeak and set up an account. Click on “my channels” from the top tool bar and then “New Channel” particle electron thingspeak Add a name for the channel and add two fields (one for temperature and one for humidity) and save the channel. particle electron thingspeak   Once that’s done, click on the API Keys tab on your channel and note down your channel ID and write API key for later (we’ll need these to push data to this channel). particle electron api Key


Go to the Particle Build IDE, hit the code item in the lefthand menu, and create a new app. Screen Shot 2016-06-28 at 2.09.31 PM Next, we need to add and include the ThingSpeak and Adafruit_DHT libraries in our app. Do this by hitting the libraries tab item on the left and searching first for “ThingSpeak” and then for “Adafruit_DHT” and selecting “Include in App” and select your current app. Screen Shot 2016-06-28 at 2.12.58 PM Screen Shot 2016-06-28 at 2.14.35 PM Then you can go ahead and insert the code below into the editor, which can also be found here: https://gist.github.com/suyashkumar/fb1f09df4e475bda9cf0ba33cf009bf8. Comments are included on almost every line as explanation for what is going on. If you have a question, post in the comments below! Make sure you replace myChannelID and myWriteAPIKey with the values for your ThingSpeak channel. If you used different pin mappings for the DHT22, change them in lines 7-10.  Screen Shot 2016-06-28 at 2.23.11 PM


Now you should be good to go! You’ll want to find a way to water/weather proof this device if you’re going to deploy it in the wild. A quick power discussion is below. electron_setup   Screen Shot 2016-06-28 at 3.39.31 PM

Power Discussion

As mentioned earlier, posting to ThingSpeak 3 times an hour is going to consume 2.5 Wh a day (24 hours). The Particle Electron has two main sleep modes, though–Deep Sleep and SLEEP_NETWORK_STANDBY with summaries and comparisons below. To use deep sleep mode, comment out the current sleep line in the code above (line 44) and uncomment the one on line 45. In sum:

  • Sleep Network Standby (Higher Power, Low Data): Uses approx 0.1W of power max, keeps network connection alive (which saves a lot of data). Best if you transmit 1 or more times an hour. 
  • Deep Sleep (Ultra-Low Power, High Data): Uses approx 0.0005W of power in sleep, but uses 6-10kB of data every time it wakes from sleep. Best if you transmit infrequently (say 1 a day) and need low power. Every time the device wakes up, it wakes up as if from “reset,” and runs the code from the setup() function.

Check out a more detailed power analysis and actual recorded data in a future post. Note also that using Particle.publish() to send data to the particle cloud will save you data and power, but requires you to pull your data from the particle services with your own software. More on that in a future post as well.

About The Author

Suyash is a recent graduate of Duke University double majoring in Biomedical Engineering and Computer Science. He has been an avid fan of sustainable and energy-conscious design and has built many Solar Powered devices with attention to energy efficient implementation. He spent a year living in the solar-powered Duke SmartHome dorm and uses Voltaic products to enable his sustainably-minded tinkering. Find out more about me at http://suyashkumar.com and at https://github.com/suyashkumar

7 Responses

  1. LP

    Temperature rating?
    Hi Suyash, great read! I am looking to implement a similar project with Particle Electron 3G device here in Canada. I worry about weatherproofing the device and temperature, can you shed some light on the specs for the V44 battery? I don’t see rated charging or operating temps. I notice your pictures have snow in them on the weatherproof case project, would the charging circuit still work at -30 C (-22 F)?

    • Voltaic Systems

      Hi – the V44 isn’t rated for -30C. Our current batch has an issue operating in Always On mode at -3C that we’re working to resolve (January, 2017), the V15 has been tested to -20C in Always On mode and has performed fine. It is possible to put two together in parallel although we would recommend testing. That said, the rated charge temps on our batteries, and nearly all LiPo batteries, is 0-45C. Charging below freezing will shorten the lifetime of the battery. Have a look at Tadiran for lithium ion in super low temperature environments – http://www.tadiranbat.com/

      • LP

        Thanks very much for the quick reply and the link, these batteries look interesting but I rather liked the idea of having a plug-and-plug solar+battery system with a charge controller built-in. My project is getting more complicated the more I look at it (that’s how it always is I guess). It’s not often that it goes down to -30C here, but it happens and I need to make sure things keep working. I wonder how a sealed, insulated container would affect ambient temp and the charging circuit. The heat generated from the charging would surely make ambient temp in the case go up a few degrees…

  2. Christian

    Hi! Is it possible to share the code-snippet of the sleeps? I’m using one of your panels to make a outdoors air quality sensor and therefore trying to conserve as much power as possible (with NETWORK STANDBY)

    All the best,

  3. Mohamed

    Hi Suyash, really greate post.
    I am working on a similar project, I have connected 6v 3.4 watt solar directly to vin, but it is not charging. I like ur idea to connect directly to USB, I thought when supplying through USB it should be 5v regulated power supply, and if I connected the solar directly to the USB the voltage will be fluctuating from 0 to 6v, kindly advice.

    • Voltaic Systems

      Hi Mohamed,

      The Particle was designed to accept power directly from solar including the variations in voltage and current. We have seen that it doesn’t draw as much current as our V15 which does add power regulation. I’m not sure why your LiPo isn’t charging. Some quick things to check: a) your battery is drained at least partially b) your panel is outside and facing the sun and c) you have confirmed that your solar panel is working properly (check the voltage with a multimeter).


Leave a Reply

Your email address will not be published.