Modules in Action
In Part 1 of this article series, Brian examined some of the technologies and services available today, enabling you to ease into the IoT cloud. Now, in Part 2, he discusses the hardware features of the Particle IoT modules, as well as the circuitry and program code for the project. He also explores the integration of a Raspberry Pi solution with the Particle cloud infrastructure.
By Brian Millier
After looking at broader aspects of easing into the IoT Cloud in Part 1, now it’s time to get into the hardware and software details. Let’s take a look at three of the Particle modules, shown in Figure 1. The P0 module contains the Cypress Semiconductor BCM43362 Wi-Fi chip and STMicroelectronics STM32F205RGY6 120 MHz Arm Cortex M3 microcontroller (MCU), in a small surface mount package. The Photon module contains this P0 module, plus a 3.3 V switch-mode power supply regulator, USB socket, mode switches and an RGB LED—all mounted on a 24-pin DIP package. The Electron module contains the U-blox SARA-U260/U270 3G cellular modem, the STM32F205RGT6 120 MHz Arm Cortex M3 MCU, a BQ24195 power management unit/battery charger, a Maxim Integrated battery gauge IC, plus the same mode switches and RGB LED contained on the Photon. It is mounted on a larger, 36-pin DIP module.
Shown here are three of the Particle IoT modules. The two on the left are Wi-Fi, and the one on the right is 3G Cellular.
The Photon and Electron share a common set of peripheral ports. These include 1x 12- bit ADC with up to 8 inputs, 2x 12-bit DACs, 2x SPI, 1x I2C, 1x I2S, 1x CAN, 1x USB, 9x PWM, 1x UART and 18x GPIO.
The Electron module, having 12 more pins, has more of some of the above peripheral ports. Because the peripheral ports of both modules occupy many of the available pins, there will be fewer GPIO pins available if you use some the peripheral ports.
Particle provides libraries or high-level APIs for just about all the peripheral ports I’ve listed. The only peripheral port that I found was not supported was the I2S block. I2S is basically a high-speed bus dedicated to audio DACs/ADCs/Codecs. Due to the high speed, synchronous data transfers that I2S devices demand, such devices are generally not compatible with the real-time operating system (FreeRTOS) that the
Particle device runs under (unless you use DMA-based I2S).
Particle’s GPIO, I2C and SPI API’s are written to be compatible with their counterparts in Arduino. Because of that, third-party Arduino libraries that are available for many common peripheral chips/breakout modules will work with the Particle modules without further tweaking.
Both the Proton and Electron come with a tiny U.FL socket for an external antenna. In the Electron, a Taoglas external antenna is required and is provided. The Photon has a small PCB-mounted Wi-Fi chip antenna, but you can also use an external antenna if you are mounting the Photon in a case that doesn’t allow RF to penetrate. There is an Automatic RF mode, where the best signal from either the chip or external antenna is used.
The Electron module can draw around 2 A or more when communicating with a cell tower. This is more current than can be supplied if you were to plug the Electron into a PC’s USB port. Although you can get USB adapters that supply greater than 2 A, you wouldn’t be able to communicate with the Electron via USB, which would be handy during debugging. Particle wisely decided to include a Li-Po battery charger on-board and included a 2,000 mA-hours Li-Po battery with JST plug in the Electron kit. This assures the user that there will be enough power available to operate the cellular modem’s RF circuitry at full power.
As of this writing, the Particle 3G Electron (in the DIP package) is only available in an educational “kit” format, which includes the Electron module, antenna, LiPo battery, USB cable and a small protoboard. With all those support components included, it’s a good deal at $69. The E-Series SMT module, meant to be integrated into a commercial product, is more expensive ($79 in unit quantities), and doesn’t include any of the support components in the Electron kit.
PROJECT CIRCUIT DETAILS
The first Particle-based project I built was the over-temperature alarm that I described in Part 1 of this series. It also sends out an alert if the power fails. Figure 2 is a schematic of the circuit. I decided to use the Dallas Semiconductor (now Maxim Integrated) DS18S20 1-wire temperature measurement device. It is more expensive than a thermistor, but is accurate to within ± 0.5°C and doesn’t need any calibration procedure. The Particle library contains a “ds18x20” library that handles both the DS18B20 and the DS18S20 devices. These two devices differ in that each one outputs temperature at a different resolution, and the library handles this transparently. The DS18x20 can be operated in a 2-wire mode—signal and parasitic power on one wire, and ground on the other. However, timing constraints are less onerous if you use separate wires for the signal and power lines, and that is how I wired mine.
Schematic diagram of the project, using an Electron Cellular module.
I chose a small Nokia 5110 LCD display for the user interface. These are inexpensive, as they are pulled from or are surplus units from popular older Nokia cell phones. An Arduino-based Nokia 5110 library works with Particle devices. This can be found in the “Library” section of the Particle Web-based IDE. The 5110 LCD has a separate backlight pin, which can be driven by a PWM signal, to control the backlight LED’s brightness. I run the backlight with a PWM duty cycle of 25%, which is plenty bright and uses less power.
The user controls are as follows:
1) An SPDT switch acts as the Setpoint UP/DOWN adjustment.
2) A TEST pushbutton, when pressed, simulates an over-temperature condition and sends out the same message for test purposes.
3) A RESET pushbutton is connected to the Electron module’s *RST pin.
4) While not shown in my diagram, I later added a switch in series with the Li-Po battery’s positive wire, to disconnect the Li-Po completely. This allows the unit to be turned off when the USB power adapter is unplugged and this switch is shut off.
The LCD displays the current time, which is synchronized with the Particle cloud server, so it’s very accurate. It also displays the measured temperature and the Setpoint temperature. The fourth line of the display indicates the AC power status. Because the power status is only monitored once per minute, it will not report a momentary power-loss.
Read the full article in the January 342 issue of Circuit Cellar
Don’t miss out on upcoming issues of Circuit Cellar. Subscribe today!
Note: We’ve made the October 2017 issue of Circuit Cellar
available as a free sample issue. In it, you’ll find a rich variety of the kinds of articles and information that exemplify a typical issue of the current magazine.