Monitor Data From Anywhere Using the Particle Electron

When people talk about the Internet of Things (IoT), all that usually comes to mind is a Wi-Fi or Ethernet enabled device. However, such devices cannot be deployed in remote areas with no Local Area Network (LAN) or Wi-Fi hotspot. In such cases you have to use an alternative means of connecting to the Internet. The Particle Electron board offers this alternative.

The Particle Electron is an IoT board that uses 3G connection to send a receive data from the Internet. It can be used in any place where cellular network reception is available. Therefore, your IoT projects no longer need to be confined to areas with Wi-Fi or LAN connection.

To demonstrate how the Particle Electron board works, we are going to build a simple data logger. The setup will be able to log data from a photocell and a temperature and humidity sensor to an online server. We will then be able to view the logged data on a dashboard.

Hardware & Software Requirements

The particle electron board is going to be the heart of our project. It is a device that runs on an STM32F205 ARM Cortex M3 microcontroller. It has a 1MB flash memory and 128K RAM which is adequate for almost all kinds of embedded applications. There is a U-Blox SARA U-series (3G) cellular modem onboard that provides GSM capability.

When acquiring your Particle Electron 3G kit, it is important to consider two things. The first one is the data rates in your country. Since the Particle Electron will be using cellular networks, there are going to be some data charges. Therefore, make sure you check out the full pricing and bulk discounts for data in your country. The other thing to consider is the continent/country you are in. There are two types of Electron 3G kits that operate using the 850/1900 MHz band and the 900/1800 MHz band.

Monitor Data From Anywhere Using the Particle Electron

Appart from the Particle Electron, you are also going to use other hardware parts. Here is a full list of all you are going to need to build the project:

To be able to log and view data online you will have to create an account on the Particle website. As for programming software, there are many choices you can use. For instance you could use local programming tools such as the wiring IDE, Particle DEV or even command line. If you are more into cloud programming, you can use Particle build on your web browser or Tinker mobile app.

Before uploading code to your Particle Electron locally, using the command prompt, download the latest version of Node.js and install it to your computer. Information on how to do all that can be found here.

Hardware Configuration

To start off mount the Particle Electron on the breadboard and using jumper wires connect the 3.3V pin to one breadboard rail (power rail) and GND pin to the other breadboard rail (GND rail).

Proceed to connect the sensors to the board. The photocell will be used in a voltage divider setup together with the 10kΩ resistor. To accomplish this, place the photocell and the 10kΩ resistor in series then connect the free end of the photocell to the power rail and the free end of the 10kΩ resistor to the GND rail. Use a jumper wire to connect the junction between the photocell and resistor to the pin A0 of the Particle electron.

The DHT sensor has three pins: GND, Data and VCC. Connect its GND pin to the GND rail of the breadboard, the VCC pin to the power rail of the breadboard and the data pin to pin D5 of the Particle Electron board.

Once you finish connecting the sensors to the board, do not forget to attach the antenna and connect the battery. The complete setup should look like this.

 Monitor Data From Anywhere Using the Particle Electron

Configuring the Electron

If it is your first time using the Electron you will be required to activate your SIM. To do that, go to The procedure is simple. All you are required to do is enter your SIMs ICCID number on the interface shown below, and click on next and wait for a while.

Monitor Data From Anywhere Using the Particle Electron

Once the board LED is breathing cyan it’s connected to the Particle cloud.

Logging Data on the Particle Cloud

To log data on the Particle Cloud we need to design code that will acquire the sensor data and upload it. The code below does exactly that. It samples data from the sensor and converts it to the desired format then sends it to the Particle cloud. The whole code is shown below:

// This #include statement was automatically added by the Particle IDE.
#include "Adafruit_DHT/Adafruit_DHT.h"

// DHT parameters
#define DHTPIN 5
#define DHTTYPE DHT11

// Variables
int temperature;
int humidity;
int light;

// Pins
int light_sensor_pin = A0;

// DHT sensor

void setup() {
    // Start DHT sensor

void loop() {
    // Humidity measurement
    temperature = dht.getTempCelcius();
    // Humidity measurement
    humidity = dht.getHumidity();
    // Light level measurement
    float light_measurement = analogRead(light_sensor_pin);
    light = (int)(light_measurement/4096*100);
    // Publish data
    Spark.publish("temperature", String(temperature) + " °C");
    Spark.publish("humidity", String(humidity) + "%");
    Spark.publish("light", String(light) + "%");

Write the code in Uploading the code to the Electron can either be done locally or directly from the cloud. It is quite expensive to upload code from the cloud, due to data charges. Therefore, it is advisable to do so using a USB cable.

Once you finish writing the code download the firmware, by clicking on the compile and download firmware binary icon.

When the download is complete, install particle CLI on your computer by running the command below on the command prompt.

npm install -g particle-cli

To upload the code run the command below

particle flash –serial firmware.bin

NB: Your PC should already have the Particle CLI and Particle drivers installed, for the commands to work.

Now when you go to the dashboard, via, you should be able to see data from your Particle Electron as shown below.

Monitor Data From Anywhere Using the Particle Electron

How to Go Further

This simple project on logging sensor data using the Particle Electron board is a good demonstration of how cellular networks can be used to power IoT applications. Using this project we were able to successfully monitor two sensors remotely. However, that is just a tip of the iceberg. There is so much more you can accomplish using the Particle Electron, such as monitoring more sensors and boards and receiving the data on your own web apps or dashboards.