Easing into the IoT Cloud (Part 2)

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.

Figure 1
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.

Figure 2
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.

Connected Padlock Uses U-Blox BLE and Cellular Modules

U‑blox has announced their collaboration with India‑based Play Inc. on a connected GPS padlock for industrial applications. The lock, which doubles as a location tracker, features a U‑blox M8 GNSS receiver, MAX‑M8Q, and uses the u‑blox CellLocate service to extend positioning to indoor locations. U‑blox Bluetooth low energy with NINA‑B112, and 2G, 3G and 4G U‑blox cellular communication modules, including some that are ATEX certified, enable communication between users and the lock.
According to the company, In many industrial settings, locks are an unwelcome bottleneck. They typically require the physical presence of a person with a key to open them, they need to be checked periodically for signs of tampering, and when they are forced open, owners typically find out too late. Play Inc’s i‑Lock combines physical toughness and wireless technology to address these challenges. Offering a variety of access methods, including physical keys and keyless approaches using remote GPRS and SMS passwords as well as Bluetooth low energy or cloud‑based communication via mobile device apps, the i‑Lock lets plant managers or other customers flexibly grant authorization to access the goods that are under lock. And in the event that the padlock is forcefully opened, they are immediately alerted via a server or, optionally, SMS texting.

In addition to securing mobile and stationary goods, the lock’s GNSS receiver lets users track goods in transit. The i‑Lock supports a variety of tracking modes to optimize power consumption for increased autonomy. Location‑awareness further enables geofence restricted applications, in which the i‑Lock can only be open if it is within predefined geographical bounds—for example a petroleum filling station.

The security lock was designed to endure both physical attempts of tampering and cyberattacks. Its fiberglass reinforced enclosure withstands temperatures from -20 to +80 degrees C. The lock features Super Admin, Admin, and User access levels, 128-bit AES encryption, user‑configurable passwords, and a secure protocol to ensure data‑transmission accuracy.

The i‑Lock will be presented at The IoT Solutions Congress Barcelona on October 16‑18, 2018.

U-blox | www.u-blox.com

2G Cellular Module Smooths Upgrade Path to LPWA

U‑blox has announced the SARA‑G450, a cost‑optimized 2G cellular module for machine‑to‑machine (M2M) applications, such as utility metering and tracking systems. Provided in the industry‑proven SARA form factor, the SARA‑G450 quad‑band GSM/GPRS module lets product developers easily migrate their products to 3G, LTE, or LPWA technology to meet a broad range of environmental and technological requirements.

2G cellular technology offers reliable performance for mobile applications and broad geographical coverage. Until recently, this made it the technology of choice for machine type connectivity such as fleet management, metering and tracking. While some regions are currently phasing out their 2G network infrastructure (most notably the USA), 2G continues to be a viable and popular option for M2M solutions in regions still lacking NB‑IoT and LTE Cat M1 networks or where coverage is spotty. The SARA‑G450 is an ideal solution for cost and space‑sensitive applications in these markets.

Thanks to its pin‑compatibility with the entire u‑blox cellular line‑up product designers can use a single platform and PCB design to enable solutions for a variety of air interface technologies, including  2G, 3G, LPWA (LTE Cat M1 and NB1), and high speed LTE. This also means that product developers can anticipate future upgrades of their applications to move to LTE Cat M1 and NB1 connectivity as soon as they become available in their target markets.

SARA‑G450 is a standard grade quad‑band GSM/GPRS module that is power‑optimized for IoT applications. It offers the flexibility to combine with a variety of best‑in‑class u‑blox GNSS or Bluetooth modules for solutions that integrate positioning, short range and cellular communication. An embedded internet suite facilitates the development of a wide range of M2M devices.

Samples will be available at the end of August with production starting end of September.

U-blox | www.u-blox.com