In this article, we’ll see how to program Particle Electron in Python using Zerynth to develop cellular-connected electronics projects and products in a few clicks.

Particle Electron is a GSM enabled development platform for creating cellular-connected electronics projects and products with M2M in mind. It comes with a Particle SIM card with service in more than 100 countries worldwide and includes 3 months of Particle’s 1MB monthly data plan for IoT devices.

Particle Electron combines a powerful ARM Cortex M3 microcontroller (STM32F205RG Cortex M3) with a 3G/2G gsm module from UBlox (U260 or G350). In addition to having 1Mb of internal flash memory for storing the firmware, the Electron also features 128k of Ram and 120 MHz of clock.

Note: all the reported information are extracted from the official Particle Electron reference page, visit this page for more details and updates.

Particle Electron Board Summary

  • Microcontroller: ARM 32-bit Cortex™-M3 CPU Core
  • Operating Voltage: 3.3V
  • Input Voltage: 3.6-6V
  • Digital I/O Pins (DIO): 28
  • Analog Input Pins (ADC): 14
  • Analog Outputs Pins (DAC): 1
  • UARTs: 5
  • SPIs: 2
  • I2Cs: 1
  • CANs: 1
  • Flash Memory: 1Mb
  • SRAM: 128 KB
  • Clock Speed: 120Mhz
  • Cellular modem: U-Blox SARA U-series (3G)
  • Board dimensions: 2.0″ x 0.8″ x 0.3″ (0.5″ including headers)

 

Particle Electron Pinout and Associated Zerynth Features

Particle Electron pinout and Zerynth features

 

Required Materials to get started

From Particle Store:

  • Particle’s data plan
  • Particle Electron board
  • Particle SIM Card

From Zerynth:

  • Zerynth Studio – our powerful IDE for embedded programming in Python.

Miscellaneous:

  • Li-Po battery (2000mAh)
  • USB cable

The Electron is equipped with on-board power management circuit powered by BQ24195 pm unit and MAX17043 fuel gauge. The Electron can be powered via the VIN (3.9V-12VDC) pin, the USB Micro B connector or a LiPo battery. When powered from a LiPo battery alone, the power management IC switches off the internal regulator and supplies power to the system directly from the battery.

Connect and virtualize a Particle Electron

If you hadn’t done it yet, download and install Zerynth Studio.

Then connect the board to your PC. On Windows machines, the Particle Electron USB Drivers are required by the Zerynth Studio for accessing the serial port establishing a connection with the STM32 UART. More detailed info on the related Zerynth Doc section.

Follow these steps to register and virtualize a Particle Electron:

  • Put the Electron in DFU Mode (Device Firmware Upgrade):
    • Hold down BOTH buttons (reset and setup);
    • Release only the reset button, while holding down the setup button;
    • Wait for the LED to start flashing flashing magenta, then yellow;
    • Release the setup button; the device is now in DFU Mode (yellow blinking led);
  • Select the Electron on the Device Management Toolbar;
  • Register the device by clicking the “Z” button from the Zerynth Studio;
  • Create a Virtual Machine for the device by clicking the “Z” button for the second time;
  • Virtualize the device by clicking the “Z” button for the third time.

Program a Particle Electron in Python

After virtualization, the Particle Electron is ready to be programmed and the Zerynth scripts uploaded.

Let’s start with the “HTTP Time GSM Example” example to show the capabilities of the Particle Electron.

Just follow the steps below (for more detailed info read this getting started):

  1. access the Quick Search Bar (more info here) through the shortcut Ctrl+P and type “GSM HTTP”;
  2. select the example and clone it by clicking on the dedicated button;
  3. at this stage, Zerynth Studio converts the example in a new project giving you the possibility to edit the Title and the Description. Remember that Zerynth Studio doesn’t allow two projects to have the same name. If you are trying to clone an example that you already cloned in the past leaving the default Title, then you need to give a different title to this new project.
  4. click on “Create” and you are done!

Below you can see the code.

Copy to Clipboard

Now you have to uplink the code.

Just Select the virtualized device from the “Device Management Toolbar, click the dedicated “uplink” button of Zerynth Studio and reset the device by pressing the Reset on-board button when asked.

Done! Now you can see the result printed on the serial monitor!

Download Zerynth Studio

Congratulations! You’ve mastered programming Particle Electron in Python, in Zerynth Studio. And if you only read this post, and you’re considering whether or not you want to try it out yourself, we say: download Zerynth Studio and start having fun in Python.