Industrial manufacturing
Industrial Internet of Things | Industrial materials | Equipment Maintenance and Repair | Industrial programming |
home  MfgRobots >> Industrial manufacturing >  >> Industrial Internet of Things >> Internet of Things Technology

Prototyping Digital I/O with Microchip’s RN487x Bluetooth Module

Build reliable digital input and output peripherals using the RN487x Bluetooth module

In the second part of our three‑part series on Microchip’s RN487x Bluetooth modules, we’ll walk through creating a digital input (a switch) and a digital output (an LED). For background on module configuration, refer to the first article.

Project 1: RN487x Digital Input Switch

Our design follows a three‑step pattern:

  1. Hardware – a switch that generates the digital signal.
  2. Configuration – RN487x commands to allocate a database variable and map the pin to it.
  3. Application – a workstation script that reads the database value.

Digital Input Hardware

The input is a simple normally‑open switch (SW1). The RN487x provides internal pull‑ups, so a switch connected to ground on closure gives a clean two‑state signal.

Prototyping Digital I/O with Microchip’s RN487x Bluetooth Module

Prototyping Digital I/O with Microchip’s RN487x Bluetooth Module

We use the RN4871, which supports single‑pin GPIO. The circuit can be powered from two AAA batteries or a coin cell. Additional components:

Digital Input Configuration

Ensure the module is in a known state before proceeding (see appendix for initialization). Create one service and one characteristic in the GATT database to represent the switch state:

PS,59c88760536411e7b114b2f933d5fe66
PC,59c889e0536411e7b114b2f933d5fe66,10,01

Here, PS creates the service, and PC creates the characteristic. The UUIDs are placeholders; generate your own following the UUID standard. The second parameter in PC (10) requests immediate notifications on value changes, and the third parameter (01) sets the value size to one byte.

The peripheral script configures the pin and handles events:

@PW_ON
SW,0A,09
@PIO1H
SHW,0072,01
@PIO1L
SHW,0072,00

Each method prefixed with @ runs on a system event:

Digital Input Application

Use the switch.py Python script (link provided). Replace the sample MAC address with your device’s MAC. After powering the peripheral, run the script on a Bluetooth‑capable machine. The script connects to the device, listens for notifications, and prints each switch event. See the Linux setup guide in the appendix.

Key BLE feature: notifications—the peripheral pushes state changes to the client without polling.

Project 2: RN487x Digital Control (LED)

We apply the same three‑step pattern for an output:

Digital Control Hardware

The LED (D1) is connected as an open‑collector sink. The schematic follows the RN487x reference design.

Prototyping Digital I/O with Microchip’s RN487x Bluetooth Module

Prototyping Digital I/O with Microchip’s RN487x Bluetooth Module

Components:

Digital Control Configuration

Initialize the module as described in the appendix. Create a single service and characteristic:

PS,59c88760536411e7b114b2f933d5fe66
PC,59c889e0536411e7b114b2f933d5fe66,08,01

Here, 08 indicates the peripheral must confirm writes, and 01 sets a one‑byte value. The script handles client connections:

@CONN
|O,08,72

When a client connects, the command associates the database variable with the LED pin (bitmask 08) and the characteristic handle (72). Subsequent writes by the client toggle the LED.

Digital Control Application

Run light.py (link provided) after replacing the MAC address. The script connects to the peripheral, then sends a new value every second to turn the LED on and off. The script logs progress and illustrates the handle association feature.

Watch the full demonstration in the accompanying project video.

Next Steps

This concludes part 2 of our RN487x series. Part 3 will tackle analog sensors and controls, and provide additional resources applicable to all projects.


Internet of Things Technology

  1. C# Fundamentals: Input and Output Essentials
  2. Mastering Microchip RN487x Bluetooth Modules for Low‑Power Peripherals
  3. Elevate Your Operations: Leveraging IoT Tank Monitoring for Safer, Smarter, and More Profitable Petroleum Management
  4. Seamlessly Control Arduino Uno via ESP8266 WiFi Module and Blynk App
  5. WiFi vs. Bluetooth: Key Differences and Similarities Explained
  6. 8 Proven Methods to Test Capacitors with Digital & Analog Multimeters
  7. Precise Power Measurement Using Digital and Analog Multimeters
  8. Accurate Voltage Measurement with Digital and Analog Multimeters – A Step-by-Step Guide
  9. Measuring AC and DC Current with Digital and Analog Multimeters: A Practical Guide
  10. Lean Digital: Definition, Benefits, and How to Seamlessly Integrate It