Building a low-cost, cloud-connected weather station

Measures rainfall, temperature, humidity, soil moisture, and wind speed, then publishes data to the cloud over a 3G network via the Particle Electron microcontroller

Posted by Tyler Nigon on July 14, 2017


The Particle Electron provides the capability of publishing data to “the cloud” at regular intervals via a 3G cellular connection. Sensors to capture weather data these days are very affordable, and data rates for the Electron are cheap (base rate of $2.99 for the first MB per month and $0.99 per MB thereafter). This gives me the opportunity to build and deploy a weather station that will provide real-time data collected from a remote location. Commercial weather stations with similar functionality are currently retailing for ~$1,000+ and require you to pay ~$200+ annually for their service plan. Real-time access to weather data at my field sites allows me to perform analyses that require time-critical weather data (e.g., crop growth and nutrient cycling simulation models) without having to travel to the site to physically retrieve the data. As an agricultural researcher and farm manager, real-time weather data collected from my field sites allows me to do a better job managing those sites.

Take a look at the data being collected and published every 30 minutes to ThingSpeak from my station in Waseca, MN! If it's winter, this station is probably indoors and will not be publishing data, but past data can be viewed by clicking the link.

AERF Weather Station Weather station publishing data to ThingSpeak and located in Waseca, MN at one of my research fields. Ugh, I'm embarrased of all the weeds there.. 11 July 2017

And here’s the weather data being published to Weather Underground from the station at my parent’s dairy farm in Greenwood, WI. If it's winter, this station is probably indoors and will not be publishing data, but past data can be viewed by clicking the link.

Nigon-View Weather Station Weather station publishing data to Weather Underground and located in Greenwood, WI at my parent's dairy farm. Happy Father's Day, Dad! 10 July 2017

Weather Underground PWS KWIGREEN83

Here I go through the steps I took to set up the Particle Electron and build my weather stations. I hope this is helpful, and if you build one for yourself, I’d love to hear from you!

A special thanks to Haodong Liang as much of the sensor-related code was adapted from his project!

Parts list

Listed prices are what I paid and are only estimates

Required ($262.11)

  1. Particle Electron - $69.00
  2. Tipping bucket rain gauge - $29.95
  3. Anemometer (Wind speed sensor) - 44.95
  4. Digital Temperature & Humidity Sensor -$9.95
  5. Photoresistor (I had one available, so I just included it in my project) - < $1.00
  6. Solar Radiation Shield -$9.99
    • I noticed the price increased to $17.81 about a week after purchasing
    • This is certainly oversized for our sensor, but was the cheapest I found. The fins do snap off from the bottom and will reduce the size.
  7. Boost Voltage Converter (to 12V) - $5.95
    • If upgrading to a 12V battery, the boost voltage converter isn’t necessary as you can connect directly to the 12V battery)
  8. Tripod - $71.63
  9. 7" Spike Nails - $3.39
  10. 8-pin IP68 Multipole Plug Socket - $4.75
  11. PVC fittings for mounting sensors off the ground - $11.55
pvc parts Not picutred: 5' x 3/4" PVC pipe

Soil Moisture Upgrade ($115.95)

  1. Watermark Soil Moisture Tension Sensor - $43.00
  2. Watermark Voltage Adapter 200SS-VA - $58.00
  3. ADS1115 16-bit Converter - $14.95

12V Battery Upgrade ($82.47)

  1. Larger battery (12V) - $36.99
  2. Battery box - $11.99
  3. Solar Panel - $21.55
  4. Charge Controller - $9.99
  5. JST Jumper 2 Wire Assembly (optional; provides “unplugging” flexibility for switching between 12V and 3.7V battery)- $0.95

Consumable Parts and Electronics

  1. Double Sided Protoboard - 1X
  2. 10K Ohm Resistors - 2X
  3. 200 Ohm Resistor - 1X
  4. Wire, solder, shrink tubing, battery terminals (for the 12V battery upgrade), soldering iron, PVC cement, plumbing goop, hardware and tools for mounting sensors and solar panel, etc.

Electron Setup

1. Be sure your Particle Electron is activated

This requires the SIM card that shipped with your Electron, as well as a valid credit card for billing.

2. Update Particle System Firmware (may not apply)

You may have to update the Particle System Firmware if it’s your first time using the Electron and you haven’t done so already.

When clicking the compile and download icon, I received a notification saying “This project is only compatible with Particle system firmware v0.5.3 or later…” and that I will need to update my firmware. I first tried to update firmware via their “preferred” method (i.e., using Firmware Manager), but the GUI just froze on me, even after a couple restarts (I am using a Windows 10 machine). In the interest of minimizing data consumption, I definitely did not want to update wirelessly, so here I describe what I had to do update via Particle-cli:

compile and download Click this little cloud icon to compile and download code from the Particle Build web IDE.
build error This is the error I received when trying to compile and download my code before updating the system firmware on my Particle.

If you have not done so already, install particle-cli according to these instructions.

Note 1: “particle-cli” is Particle’s Command Line Interface that provides a robust set of tools to configure and set up your Electron.
Note 2: You must be sure node.js is installed to be able to successfully use particle-cli.

With the Particle Electron connected to the computer via USB, login to the Particle by typing particle login in your Terminal or Command Prompt (green box in image below), then update your Particle by typing particle update (blue box).

cli update Login and update your Particle.

Return to the online Particle Build Web IDE and compile and download firmware (click the little cloud icon shown above) - it should proceed without the error message now.

Wiring Diagram

1. Connect your sensors to the Electron according to the following:

  • DHT Tempurature/humidity sensor --> D5

  • Photoresistor --> A1

  • Reed switch (rain pin) --> D2

  • Anemometer --> A2

  • ADS1115 16-bit converter --> SCL to D1; SDA to D0; note also that ADDR on ADS1115 should be connected to ground

  • Watermark signal wire --> ADS1115 A3 pin

    wiring_diagram Protoboard wiring diagram for connecting the temperature/humidity sensor, photoresistor, reed switch (tipping bucket rain gauge), Watermark (soil moisture), and anemometer.

I definitely recommend connecting everything via a breadboard before soldering anything to be sure the sensors and software are behaving as expected.

Note 1: This wiring diagram was created with fritzing; the .fzz file can be downloaded from Github and loaded into Fritzing for more detail; the Fritzing software also implements interactive tooltips that show the pin ID when hovering with your mouse.
Note 2: If you are using a three-pin temperature/humidity and/or a three-pin photoresistor sensor, the 10K Ohm pullup resistor may already be attached to the sensor itself. If so, the pullup resistor between 3V3 and signal on the protoboard is not necessary. Refer to this tutorial for details regarding the different sensor styles.
Note 3: Double check the input pins and be sure they coincide with the pins declared in the code.

There are photos showing my protoboard wiring and sensors in the Mounting the Hardware section. Check them out to see how I did it.

Understanding the Code

Particle uses an online IDE for modifying and compiling Particle code before it can be uploaded to the Electron. My code, electron-weather.ino, can be downloaded or copied from Github so you can follow along.

I’m not going to discuss every bit of the code in the electron-weater.ino file, but here I will generally explain what is being done when the Electron is connected to sensors and is in an active state (measuring and publishing data).

1. Libraries

  • Adafruit_ADS1X15.h
  • stdint.h
    • To get a 16-bit data type so we can measure the full dynamic range of ADS1115 output
  • Adafruit_DHT.h
    • To measure temperature and humidity
  • SdFat.h
    • To write data to a micro SD card (this code has not yet been validated)

2. Time

Among the first several lines of code, you’ll find the variables sensorCapturePeriod and publishPeriod. The values of these variables should be changed depending on your preference for how often you’d like the sensors to capture data (multiple captures per publish period are averaged over the entire publish period), and how often you’d like to publish the data to the cloud. The code below will capture sensor data every 5 seconds and publish data every 30 minutes.

// ============================================================
// Time
// ---
// Set time zone and daylight savings information and initiate
// intervals to determine when to capture sensor readings and
// publish data.
// ============================================================
float offsetDST = Time.getDSTOffset(); // Get current DST offset; default is +1.0
// I read that Particle does not automatically detect DST, so
// it must be manually delclared; however, whenever publishing
// time, Unix UTC is expected, so I don't want to globally
// adjust the Time variable.. If I did, then the Unix timestamp
// may be altered (not 100% sure about this..?). My goal in
// declaring time zone is to know when to reset daily rain.
// Time.beginDST(); // Because DST is not automatically detected by Particle, it must be manually declared
// Time.endDST(); // Comment out beginDST() or endDST() depending on if DST is in effect
unsigned int isDST = 1; // Change to 0 if not observing daylight savings time
int gmt_timeZone = -6; // Change to appropriate time zone for your device
unsigned int sensorCapturePeriod = (5); // units are seconds
unsigned int publishPeriod = (60 * 30);  // units are seconds
unsigned int sensorCount = 1; // this provides 32 bits of dynamic range
unsigned int publishCount = 1;
time_t initialTime;
time_t endOfDay;
time_t scheduledSensor;
time_t scheduledPublish;

Because I’m a scientist and I like consistency, I added functionality in the void setup() function to begin the effective “active time” (this is kept track of in the code via the initialTime variable) of the Electron either at the top or bottom of the hour. That is, after flashing your code, the Electron will begin taking sensor measurements when Time.minute() == 0 or when Time.minute() == 30. This will effectively result in consistent times for both the sensor readings and the publish events. Using a publishPeriod = (30*60) as in the above code, data will consistently be published every 30 minutes at the top and bottom of every hour. Because the code also keeps sensorCount and publishCount variables, we are able to schedule future sensor readings and publish events based on our initialTime. This is noteworthy because it results in future sensor reading times to be independent of the time that passes when sensors are capturing measurements. Sure, it is perhaps less than a millisecond to have a sensor take a measurement, but if we’re taking thousands of measurements every day, this adds up over a period of weeks or months (and will inevitably result in inconsistencies in the time that data are captured and recorded from day to day). You don’t care about such consistency? Feel free to comment out the initalTime lines and add a single line of code to set the inital time --> initialTime =;

Example: if I flash code to my Electron at 09:07:00, the initialTime variable will be adjusted to represent 09:30:00. The sensors will begin capturing data after the 09:30:00 time (how long after depends on when the sensorCapturePeriod was set), and the first publishing event will occur at 10:00:00 (assuming the publishPeriod is kept at 30 minutes). The following code publishes the initial system time, time in which data will first begin being collected, time zone that is set, whether or not daylight savings time is being observed, and UTC time corresponding to the end of the day. When it comes time to upload code to the Electron, be sure these variables are correctly set for your locale.

void setup() {
    // ============================================================
    // Time
    // ============================================================
    pinMode(led, OUTPUT);
    // initialTime =;
    time_t benchTime =; // So all times are consistently calculated (it could presumably take several seconds to get through all code in which case times will be misaligned)
    if (Time.minute() >= 30) {
        initialTime = benchTime + ((59 - Time.minute(benchTime))*60) + (60 - Time.second(benchTime)); // ensures initial time will be at top of the hour
        if (isDST == 1) {
            endOfDay = initialTime + ((23 - Time.hour(benchTime))*60*60) - ((gmt_timeZone+offsetDST)*60*60) - 48; // to know when to reset daily rain
        else {
            endOfDay = initialTime + ((23 - Time.hour(benchTime))*60*60) - (gmt_timeZone*60*60) - 48; // I have no idea where the extra 48 seconds is coming from, but seems to be coming from..
    if (Time.minute() < 30) {
        initialTime = benchTime + ((29 - Time.minute(benchTime))*60) + (60 - Time.second(benchTime)); // ensures initial time will be at bottom of the hour
        if (isDST == 1) {
            endOfDay = initialTime + 30 + ((23 - Time.hour(benchTime))*60*60) - ((gmt_timeZone+offsetDST)*60*60) - 48; // to know when to reset daily rain
        else {
            endOfDay = initialTime + 30 + ((23 - Time.hour(benchTime))*60*60) - (gmt_timeZone*60*60) - 48;
    scheduledSensor = initialTime + sensorCapturePeriod; // schedule initial sensor reading and publish events
    scheduledPublish = initialTime + publishPeriod;
    Particle.publish("Initial system time is: ", hhmmss(benchTime));
    Particle.publish("Data will begin being collected at: ", hhmmss(initialTime));
    Particle.publish("GMT Time zone is: ", gmt_timeZone);
    if (isDST == 1) {
        Particle.publish("Daylight savings time: ", String("True"));
    else {
        Particle.publish("Daylight savings time: ", String("False"));
    String endOfDayDateTime = yyyymmdd(endOfDay) + "T" + hhmmss(endOfDay);
    Particle.publish("UTC corresponding to local end of day: ", endOfDayDateTime); // this is a check - should be +05:00:00 for CST during DST

According the Particle Docs, the Electron will establish a “handshake” with the Particle server:

  1. whenever the device comes online and
  2. once per week

Therefore, the Electron’s system time will be updated only after successfully establishing this “handshake” (once per week), and the system time may deviate from actual time by several seconds between handshakes.

3. Publishing data

The app has three methods of publishing data:

  1. via logs
  2. via ThingSpeak
  3. via Weather Underground

Publishing to a web server (e.g., ThingSpeak, Weather Underground, etc.) requires you to set up a user account and use a webhook to send data from the Electron to the external web server. Please refer to the Publish data to a Webserver section below for steps on how to set up a webhook between your Electron and the web server. For now, I will just demonstrate how to publish to the logs.

Publishing to logs is good for testing as it is much simpler (less code to change), but publishing to ThingSpeak (or any other web server) is recommended when you’re sure your device is working as expected and is being deployed remotely (my weather station is at a field site over 80 miles away). To save on my data use, I usually comment out one of the publish methods in the “Publish” section of the void loop() (the example below has the publishToThingSpeak() function commented out and will only publish to ThingSpeak).

// ============================================================
// Publish
// ============================================================
if ( >= scheduledPublish) {
    float tempC = getAndResetTempC(); // Get the data to be published
    float humidityRH = getAndResetHumidityRH();
    float light = getAndResetLight();
    float soilMoisture = getAndResetSoilMoisture();
    float rain_mm = getAndResetRain();
    float gust;
    float wind_mps = getAndResetAnemometer(&gust);
//    float wind_direction = getAndResetWindVaneDegrees(); // Comment out and add variable to publish...() functions if you have a wind vane connected
    FuelGauge fuel;
//    float voltage = fuel.getVCell(); // Battery voltage
    float bat_percent = fuel.getSoC(); // State of Charge from 0-100%
//    Particle.publish("System clock is: ", hhmmss(; // For testing
    publishToParticle(tempC,humidityRH,light,rain_mm,soilMoisture,wind_mps,gust); // Comment out if you don't want to publish to
//    publishToThingSpeak(tempC,humidityRH,light,soilMoisture,rain_mm,wind_mps,gust,bat_percent);  // Comment out if you don't want to publish to ThinkSpeak
    scheduledPublish = initialTime + (publishCount*publishPeriod);

I do not have a wind vane to measure the wind direction for my prototype, but the code regarding the wind vane should collect wind direction measurements. You’ll have to uncomment the wind_direction variable and add it to the appropriate publishing function (e.g., publishToParticle()) for the wind direction measurement data to publish.

Create the App/Firmware

The Particle Build Web IDE is a web interface for modifying the code to be uploaded to your Electron. I recommend spending some time becoming familiar with its layout and the different features available.

Perform the following steps in the Web IDE to create and compile the app to a local directory:

  1. Create a new app by adding a name and description (description is optional)
  2. Import code by copying/pasting contents of electron-weather.ino (available on GitHub)
  3. Include the following libraries by clicking the ribbon icon on the left sidebar, searching for the library, and clicking the “Include in Project” button. Or, follow these links (I hope the links don’t die anytime soon):
  1. Verify your code by clicking the checkmark icon
  2. Modify your code to suit your needs (e.g., comment out sensor variables that you do not have connected, adjust sensor pins if necessary, etc.)

Note: I try to make a habit to Verify my code after nearly every change I make to be sure there aren’t any syntax errors. I don’t find the Particle Build Web IDE to be particularly useful for debugging and spotting syntax errors. Much time can be saved by Verifying your code often.

  1. Compile and download a binary version of your app by clicking the cloud icon with a downward pointing arrow

Upload the App and Publish Data

Perform the following steps to upload the app and publish your data:

  1. Flash the compiled app from your local machine to the Electron by navigating to the directory to which the compiled binary version of you app was saved (.bin file). Then, with the Particle Electron connected to the computer via USB, flash the firmware from your local machine to the Particle Electron. In the Terminal or Command Prompt, type:

    particle serial flash <firmware.bin>

    Note that the Electron must be in “listening mode” (hold the MODE button on the Particle Electron for ~3 seconds until the LED is blinking blue)

flash firmware Flash firmware to your Particle via particle-cli.

Note 1: I saw several websites (including the Particle Docs page) stating that I should use the following command for flashing my firmware, but I did not have success (maybe it may have worked for an older version of Particle products…?): particle flash -serial <firmware.bin>
Note 2: I could choose to flash my app wirelessly, but I don’t like to if I can use another method as it is data-intensive.

  1. View the data being published by your Particle Electron! If the Electron was set up correctly and the compiled app was flashed to the Electron, you should be able to view a live stream of your data from your token web URL (if you are logged in to, data will be published at your Electron’s logs page).

Publish Data to a Web Server

Being able to view the published data from is nice to be able to see that the microcontroller is actually measuring and publishing data, but we are limited in what we can do with the data. Webhooks are a way to send data collected from our Particle Electron to other apps and services connected to the internet. Basically, webhooks allow us to get our data where we need it. Because the Electron is a “cellular-only” device, we must use webhooks as an internet aggregator to save our data.

Here I explain how to use a webhook to listen for specific events published by my Electron, in which case I trigger a web request to the token web URL that temporarily displays data from my Electron (the token web URL is shown at the top of the logs page). I used a webhook to allow ThingSpeak and/or Weather Underground to listen to publish events from my Particle Electron. ThingSpeak is an open IoT platform that offers free data storage of time-stamped data and allows users to easily view, analyze, and export their data. A ThingSpeak channel can be public or private. Weather Underground is a weather platform that allows users to register their personal weather station (PWS) and publish data real-time for the public to access via the web. Both ThingSpeak and Weather Underground have mobile apps to view data from a smartphone or tablet:

Both platforms have advantages and disadvantages, so I’d just suggest trying them both to see which fits better for you. I like how Weather Underground incorporates the entire forecast and allows you to easily check the weather from other stations in the area, but I think ThingSpeak has a much more straightforward approach to downloading your data. I’m sure there are dozens of other platforms you could try out to view your data as well (e.g., Google Sheets).

thingview Using ThingView (Android app) to view temperature and humidity data collected from my Particle Electron.

Publishing Data to ThingSpeak

You will need:

  1. a valid ThingSpeak Channel Number
  2. a valid ThingSpeak Write API Key
  3. to know the number of fields being used on your ThingSpeak channel (i.e., the number of variables/sensor measurements being output)

Refer to the Particle Docs page to:

  1. Set up and configure your ThingSpeak account.
    • Create a channel with the appropriate number of fields - I used all eight to record temperature, humidity, light, soil moisture tension, daily rainfall, wind speed, wind gust, and battery voltage).
    • Make note of the Channel ID and Write API Key (and be sure to keep the Channel ID and Write API key a secret!)
  2. Set up and activate Webhooks to your Particle account.

    Note: for my weather station, I send data via the webhook using the .json file format, so the following is a bit different from what’s published on the Particle Docs page.

To create the JSON webhook via the Particle CLI, perform the following steps:

  1. Create a JSON file with a Webhook option. To do so, make a copy of the following code and save it appropriately (I saved my JSON as webhook_thingspeak.json):

      "event": "webhook_thingspeak",
      "url": "",
      "requestType": "POST",
      "form": {
              "api_key": "{{k}}",
              "field1": "{{1}}",
              "field2": "{{2}}",
              "field3": "{{3}}",
              "field4": "{{4}}",
              "field5": "{{5}}",
              "field6": "{{6}}",
              "field7": "{{7}}",
              "field8": "{{8}}",
              "status": "{{s}}"
        "mydevices": true,
        "noDefaults": true,
        "deviceid": ""

Note: The webhook request (“requestType”) is a POST, which is a method of sending data to another web server. In this case, we are using ThingSpeak, but it could be another server (like Google Sheets).

  1. Open the Terminal or Command Prompt and login to the Particle CLI (optional).
  2. Navigate to the directory to which the JSON file resides, then run the following command to create the webhook for your account (replacing the angle brackets with your .json filename):

particle webhook create <webhook_thingspeak.json>

  1. If successful, you will get a success message returned on your Terminal or Command Prompt, and you will be able to see the webhook on the Particle Console webpage:
webhook integration If you see something like this on your Particle Console webpage, then your webhook integration was a success!

You will have to modify some parts of the code before successfully publishing to ThingSpeak.

  1. Change your thingspeakChannelNumber and the write api_key (these variables are towards the top of the electron-weather.ino file) to reflect those shown on your ThingSpeak Channel.
  • Remember to keep these secret, especially the write API key!

// ============================================================
// Publish
// ============================================================
unsigned long thingspeakChannelNumber = 123456;
//char thingSpeakWriteAPIKey[] = "0GNFLHX4317NSAH4";
String api_key = "ABC1DEF2GHI3JKL4"; // ThingSpeak Write API Key.
String field1 = "";
String field2 = "";  // i.e. field2 is null
String field3 = "";
String field4 = "";
String field5 = "";
String field6 = "";
String field7 = "";
String field8 = "";
String status = "";
  1. Modify the number of fields (i.e., field1, field2, etc. shown above) to reflect the number of fields that are enabled on your ThingSpeak Channel (screenshot shown below).
channel settings Be sure the number of fields enabled on your ThingSpeak channel reflect the number of associated variables in the code.
  1. Modify the number of fields and adjust the variables containing the data accordingly for each field in the publishToThingSpeak() function:

void publishToThingSpeak(float tempC,float humidityRH,float light,float soilMoisture,float rainToday_mm,float wind_mps,float gust, float bat_volts) {
  field1 = String(tempC,2);
  field2 = String(humidityRH,2);
  field3 = String(light,2);
  field4 = String(soilMoisture,2);
  field5 = String(rainToday_mm,2);
  field6 = String(wind_mps,2);
  field7 = String(gust,2);
  field8 = String(bat_volts,2);
  String TSjson;
  // Note: In order to publish a private event, you must pass all four parameters.
  1. Near the end of the electron-weather.ino file, there is a createThinkSpeakjson() function. If not using all eight fields, you will have to adjust the number of fields:

void createThinkSpeakjson(String &dest) {
    dest = "{";
        dest = dest + "\"1\":\""+ field1 +"\",";
        dest = dest + "\"2\":\""+ field2 +"\",";
        dest = dest + "\"3\":\""+ field3 +"\",";
        dest = dest + "\"4\":\""+ field4 +"\",";
        dest = dest + "\"5\":\""+ field5 +"\",";
        dest = dest + "\"6\":\""+ field6 +"\",";
        dest = dest + "\"7\":\""+ field7 +"\",";
        dest = dest + "\"8\":\""+ field8 +"\",";
        dest = dest + "\"s\":\""+ status +"\",";
    dest = dest + "\"k\":\"" + api_key + "\"}";
  1. Compile and download, then flash the app to your Electron. If your code was set up correctly, timestamped data will begin logging to your ThingSpeak account. I notice that it takes 3-5 seconds from the time it should publish until the time it actually gets published (publishing will occur at the top and bottom of every hour after data initially begin being collected). This discrepancy is expected as it takes some time to send data over the 3G network.

Publishing Data to Weather Underground

You will need:

  1. a valid Weather Underground Station ID
  2. a valid Weather Underground Password


  1. Set up a Weather Underground account and add a new personal weather station. Check out the Support page if you are having any issues with this.
  2. Once your PWS is registered, you will see your Station ID and Station Key (be sure to keep these a secret!).
  3. Set up the appropriate webhooks. If you have not done so, please read through the Publishing Data to ThingSpeak sub-section above to get an overview of how webhooks are used. Much of the information covered in the ThingSpeak section also applies when publishing to Weather Underground.

To save a bit on my data usage, I created two separate Weather Underground webhooks - webhook_wunderground_norain.json for when it hasn’t yet rained on a particular day and webhook_wunderground_rain.json for when it has rained. The difference between the two is simply whether or not rainfall rate and daily rainfall are being published. If daily rainfall is zero, then I don’t publish the rainfall data. If you’d prefer, you could choose to always publish rainfall data and only use the one webhook.

Similar to creating the ThingSpeak webhook, you’ll have to opent the command prompt, navigate to the directory to which the JSON file resides, then run the following command to create the Weather Underground webhook (replacing the angle brackets with your .json filename(s)):

particle webhook create <webhook_wunderground_rain.json>

particle webhook create <webhook_wunderground_norain.json>

If you’d like to modify the data being published, be sure to modify both the webhook .json as well as your Particle code.

Note: Refer to the Particle Guide for tips on how to reduce data use.

Mounting the Hardware

I’m not sure if it was the best idea, but in the interest of keeping external parts to a minimum, I decided to put the Electron inside the tipping bucket enclosure. Because of this, in my prototype version, I struggled with running the wires from the Electron to the sensors outside the tipping bucket, and it also made some aspects of soldering challenging.

The second time around, I drilled the hole for the 8-pin IP68 Multipole Plug Socket higher on the external tipping bucket funnel. By drilling that hole above the electronics enclosure, the 8-pin IP68 plug socket does not hit against the electronics enclosure on the inside. You’ll just have to be careful not to drill the actual funnel when drilling this hole! For the hole in the internal electronics enclosure, I would drill as high as possible to make it easier to shimmy the Electron into the enclosure and reduce the likelihood that the wires will rub against the external funnel (the wires will also be closer to where your fingers can reach them, so this is a plus as well). I would also advise to make the hole in the internal electronics enclosure as small as possible while still being able to fit all the wires through because with a larger hole, there is a greater likelihood of moisture finding its way into the electronics enclosure.

Please scroll through the photos below to see the steps I took to build the platform and mount the hardware.