Introduction: Particle Core - Offline Mode or Semi-automatic Mode

The Particle Core is a cool device that makes it possible to connect a large number of devices to the Internet. I have a series of instructables relating to IoT, and many more yet to come. But after getting multiple request on how to work with a Particle Core offline, I decided to write up on instructable.

So in this tutorial I'm going to show you how to work with your Particle core without actually connecting to the internet, I will also show you how to turn on WiFi and connect to the internet form the program being uploaded to the core.

Note: The procedure for the Particle Photon is the same as that of the core.

So lets get started....

Step 1: Why Work Offline?

Well, if you power your core using a battery or if you followed my fish feeder instructable you would have realized that you would not have a long battery life, with the WiFi eating up most off the power. When the WiFi is ON the spark core drags 139mA of current, and in offline mode it drags around 33mA of current. The WiFi drags 100mA more current.

You still have to get the core connected to the internet while uploading the program to it, you can also so it using Particle CLI which I will show you how to setup up in another tutorial.

Step 2: Getting Started

If you have followed my previous instructables you already have setup your core and have it connected to the internet.

If you are here first, then you can check the step two of any of the previous instructables in the series for steps on how to get started. The steps involve -

  • Creating an account at Particle.io
  • Getting it connected to the internet.
  • Claiming a Core
  • Trying out Tinker
  • Trying out my previous instructables

If you have gone through all of these steps then you are good to proceed to the next step.

Step 3: Circuit

To check out the core in the semiautomatic mode or offline mode is quite easy, in this tutorial I'm not going to use any additional hardware all that I use is a Particle core and turn the led at digital pin 7 on and off. I have also tired out using the Particle button to get the current ratings and compared to when online and when offline.

You can find a sample code that I used while running the test on the next step, and all the current readings are shown in the picture.

Step 4: Code

All the program being uploaded to the spark core will remain the same all you need to do is call "SYSTEM_MODE(SEMI_AUTOMATIC);" to get it to run in semiautomatic mode and you call the "Spark.connect();" function to get it to connect to WiFi again.

In this example, I executed the blink example on D7, and got the core to connect to the internet when the voltage at digital pin falls LOW.

SYSTEM_MODE(SEMI_AUTOMATIC);

void setup() { pinMode(D7, OUTPUT); attachInterrupt(D0, connect, FALLING); }

void loop() { digitalWrite(D7, HIGH); delay(500); digitalWrite(D7, LOW); delay(500); }

void connect() { if (Spark.connected() == false) { Spark.connect(); } }