Earlier, in a series of blogs on eStorm-B1 BLE module, we have discussed about few applications of the module such as smart metering, as a Bluetooth to serial adapter along with a demo of the same. Further to a very positive response to the module, Embien has come up with an Evaluation Kit for the same. Incorporating various features targeting different market segments, we have designed the EVK as a ready to use product. This blog will introduce the reader to the kit for eStorm-B1 BLE module and in detail its application as a BLE to RS232 MODBUS converter

RS232 Modbus Serial Interface 

RS232 serial interface is still one of the most used wired communication standards. Introduced in 1960, it has survived and still surviving onslaught from many advanced standards because of its reliability and simplicity. They are intended to operate over a distance up to 15 meters and the maximum data rate is around 160 Kbits per second. They are often being used in many applications such as data acquisition systems, PLCs etc. While the underlying logical layer can be handled by UART interface, there are many possible application layer protocols that can be run on it. One of the most popular industrial protocol standards is called Modbus.

Modbus is a serial communication protocol developed for transmitting information over serial lines between electronic devices. The Modbus network can have one Master device and up to 247 slave devices. The master device can request or write the information to the slave and the slave device will supply the information. Registers are allocated for each data in the slave device and the master will write or read data to and from a slave device’s register.

It is an open protocol, where the manufacturer can build into their equipment without any royalties. The protocol has multiple versions such as Modbus RTU, Modbus ASCII for serial communication and Modbus TCP for Ethernet. Modbus has become the standard communication protocol in industry and it is a commonly available means of connecting industrial electronic devices.

Need for Wireless Communication 

Day by day, the communication interfaces and protocols are being updated to handle large data more reliably and over a longer distance. Of late, due to the advent of Industry 4.0 and IIoT, the need for wireless communication becomes inevitable. Industry 4.0 brings smartness in automation and data exchange in manufacturing technologies. It includes IoT, cloud computing, etc which calls for seamless data communication. Existing infrastructure can enable them with minimal changes using wireless technologies. This necessitates a suitable gateway for converting the wired serial interfaces to wireless.

Embien, following the current industry trends has launched a wireless module “eStorm-B1” under its eStorm series of solutions. The BLE module can support wireless serial communication with the available UART interface and can readily be used as a BLE to UART converter bridge. In addition to the COTS BLE module, Embien has also launched an evaluation kit “eStorm-B1 EVK”. This evaluation kit can support quick evaluation of eStorm-B1 module features.

Following are the features of eStorm-B1 EVK,

  1. 1X RS232 or RS485 serial interface
  2. 1X CAN interface
  3. 1X LIN interface
  4. One analog input and one isolated digital input for external sensor interface
  5. One digital output for external load control
  6. Onboard EEPROM
  7. Onboard Accelerometer
  8. Battery operated with inbuilt battery charger
  9. Compact dimension with mounting holes
  10. Screw type PCB connectors for serial and CAN interface enabling rigid connection to external devices
Evaluation kit for eStorm-B1 BLE module
Evaluation Kit for eStorm-B1 BLE Module

eStorm-B1 EVK as Wireless Modbus Gateway

Of various interfaces, one that interests us for this blog is the presence of a RS232 interface. eStorm-B1 EVK based BLE to RS232 Modbus converter is suited for wireless Modbus gateway applications discussed earlier. eStorm-B1 EVK supports three wire RS232 serial communication via null modem cable and is exposed via a screw type PCB Terminal connector. Designed for rugged industrial environments, the EVK can operate in 5V DC input and RS232 receiver can accept up to +/- 30V input withstanding surges up to 15-kV (HBM) in the RS232 lines. Optional enclosure is also available.

On the protocol front, it includes a fully tested Modbus Client stack. It can query Modbus slaves present in the line. Android application is also available that can be used to configure the device and acquire data. Some of the features supported by the eStorm-B1 EVK based Wireless Modbus Gateway are,

  • Configuration of baud rate, Stop and data bits.
  • Modbus RTC/ASCII support
  • Continuous data acquisition
  • Notification based on change of value
  • Customizable buttons in the App for simple configuration of Modbus slaves

Thus eStorm-B1 as a wireless Modbus gateway can be used to interface with multiple devices for applications such as wireless data acquisition via existing data acquisition device, controlling the machines via PLCs for various industrial automation application, etc.

About Embien

Embien Technologies is a leading provider of embedded design services for the industrial automation. We have done various types of Data acquisition Systems, Industrial Human Machine interfaces, BLE based pH Meters, precision measuring instruments etc. We are currently working on enabling the industry 4.0 initiatives to make them smarter and greener.

With wide spread proliferation of low cost wireless technologies such as WiFi, BLE etc and smart phones, there is a need to provide such connectivity to systems across application domains. For example, nowadays wellness industry expects the products such as thread mills to communicate with user phones and provide details of the calories spent so far along with the running pattern.  While it might be possible to incorporate the wireless features in newer designs, there are many cases in which the existing systems need to provide these new features with minimal design changes due to reasons such as re-engineering complexity, costs etc.  This calls for Bluetooth to Serial Adapter that can be interfaced to existing systems over UART and enabling wireless connectivity easily with minimal changes.

In this blog, we will discuss in detail about such an application where by Embien’s eStorm-B1 platform is used as a Bluetooth UART module and performing BLE communication to an Android mobile app.

eStorm-B1 Bluetooth UART Module

Embien recently launched “eStorm-B1”, an automotive ready BLE module as a part of its eStorm offerings. The module supports many peripherals and interfaces such that it can be used as a standalone system or can embed in an existing system to enable BLE communication.

Of the available interfaces such as CAN, SPI, I2C etc, this particular demo uses UART as the choice of communication. For such application, eStorm-B1 will act as a slave module which can receive commands from the host processor via UART and do actions accordingly.

The following block diagram depicts the setup of eStorm-B1 as a UART to BLE bridge,

 Bluetooth to Serial adapter

eStorm-B1 – UART to BLE Bridge Setup

The host processor and the module are connected via TTL UART interface. Interrupt signal from eStorm-B1 can be routed to a digital input of the host processor with interrupt detect functionality such that the host processor is made aware of the connection event occurred between the devices. eStorm-B1 can operate in sleep mode where it consumes ultra low power and the module can be switched between active and sleep mode suitably when data transfer is required.

Bluetooth UART module communication

Based on a simple command set, the host processor can speak to the eStorm-B1 module and in turn communicate with another BLE device such as a smart phone, tablet or an IoT gateway.

The following picture illustrates the serial command sequence between the eStorm-B1 BLE module and host processor via UART,

UART to BLE command sequence

Serial Command Sequence

The following video shows the real time demo of eStorm-B1 UART to BLE bridge application typically applicable in many IoT device developments for enabling BLE communication on existing system.

To show case the same, instead of a host MCU, a PC is used and connected to the eStorm-B1 over an USB to UART bridge. PC is connected to eStorm-B1 module via UART interface using an external commercially available UART to USB converter. Tera term, a terminal emulator is used to transfer the data’s from Laptop to eStorm-B1 module via UART. On the other end, a custom Android application installed in Smartphone is used to receive and transmit the data via BLE. UART to BLE Bridge is suitable for various device designs such as wearable device in healthcare, key finder, tire pressure monitoring system in automotives, asset tracking in industries, etc.

Apart from the above mentioned features, the eStorm-B1 also supports rich peripheral options such as timers/PWM, ADCs, GPIO’s which adds more advantage for standalone system developments in various domain applications such as automotive, industrial, healthcare etc.

About Embien: Embien Technologies is a leading provider of embedded design services for the Semi-conductor, Industrial, Consumer and Health Care segments. Embien has successfully executed many projects for IoT product developments such as healthcare/wellness wearable’s, data acquisitions systems, Gateways, and Data Analytics platforms etc. Embien also offers a set of wearable design collections complete with electronics, firmware and Cloud that can be used to shorten product development costs and time significantly.

As discussed in the previous blog, the LEDs in a DMD panel are organized as small groups in a matrix form. With this the number of pins and power required are significantly reduced. But it is preferable to be able to control with 4-5 pins so that even an 8 bit MCUs can manage such display. This calls for a bit complex electronics in the panel and software in the MCU, but should be manageable in terms of cost and usability.

This blog covers the internal circuitry inside DMD in detail. The block diagram of the overall set up is depicted below.

DMD - System Block Diagram

Dot Matrix Display – Overall Setup Block Diagram

As it can be seen, there are shift registers and demulitplexers used to simplify the effort in MCU. The dual P-channel MOSFET feeds the positive supply voltage to the LED anodes which denotes the row control and the shift registers provides the return path for the LED’s which denotes the column control. The MCU controls the demultiplexer with GPIO interface and interfaces with the shift registers through serial interface, most commonly SPI. More details of them are covered below. For further explanation, we will consider a DMD panel of 512 LEDs, each row is a collection of anode of 32 LEDs and each column is a collection of cathode of 4 groups of 4 LEDs (one column of 16 LEDs divided into 4 groups each of 4 LEDs for reducing IO pins required). The following figure depicts the arrangement of 16X32 LED panel

Row and Column arrangement in 16 X 32 DMD panel

16 X 32 DMD panel arrangement

Role of Serial Shift Register (74HC595)

The purpose of the shift register is to reduce the number of GPIOs required to drive the column of the LED matrix. 74HC595 is an 8-bit serial shift register with output latches and storage register.  The block diagram of the shift register commonly used inside DMD is given below (courtesy of 74HC595 datasheet)

74HC595 shift register block diagram

Serial Shift Register – Block Diagram

With one shift register we get 8 GPIOs possible. Hence for driving 32 columns of 16 LEDs, (total 128 GPIOs) we require 16 serial shift register. SPI clock, SPI MOSI and a latch signal acts a shift register inputs. The main advantage of this serial shift register is that it outputs the serial input fed to it in its serial output pin only when the latch signal is provided. The serial output of the first shift register is connected to the serial input second register. Likewise 16 shift registers are cascaded in series resulting in 128 GPIO pins.

Each of the 128 pin will in turn control 4 LEDs in a column resulting 512 LEDs on the whole. The data to be displayed can be fed as a 128 bit data with 128 clock pulse to the serial shift register. The data will not appear on the output unless the data is transferred to the storage register. Only upon the positive transition of the latch signal, the data will be transferred to the storage register. The data will automatically appear on the output since the output enable pin is permanently grounded.

Since the shift register corresponds to the control of 4 groups of LEDs in 32 columns, the Demultiplexer IC is required to drive the LEDs in 16 rows corresponding to the required data bits.

The following figure depicts the serial shift register circuitry in 16X32 DMD panel, with 128 output lines. Each shift register outputs has 8 outputs, hence 16 shift registers are serially connected for 128 output lines for column control. One output line is connected to 1 group of 4 LEDs in a column. Hence 128 output lines will be connected to 128 groups of 4 LEDs across 32 columns (i.e. one column has 4 groups of 4 LEDs).

Serial shift register with SPI interface

Serial Shift Register Circuit in 16 X 32 DMD panel

Role of Demultiplexer

Demultiplexer is dedicated for row control. 74HC138 is a 3 to 8 line demultiplexer with eight mutually exclusive inverting outputs. Out of three available address inputs only two inputs are selected for 4 individual inverting outputs. The four outputs from the demux will control the gates of four dual P-channel MOSFET where we get 4 pairs of drive outputs which in turn will drive the necessary current to the LEDs in the 16 rows. Finally there are 4 individual sets of multiplexed rows within the DMD. The block diagram of demultiplexer is depicted below (courtesy of 74HC138 datasheet)

3 to 8 line demultiplexer block diagram

Demultiplexer Block Diagram

With this arrangement only four rows will be illuminated at a time while the other is not illuminated. Hence the values of 4 outputs from the demux should be toggled periodically to illuminate all the sets of multiplexed rows. With persistence of human eye, if the LEDs are refreshed once around 20 ms, it is sufficient to show a flicker free display.

Following figure shows the four individual sets of the multiplexed rows inside DMD. The Color coding differentiates the 4 multiplexed rows and the four demux outputs are connected in the following manner

Y0 – connected to the rows R16, R12, R8, R4

Y1 – connected to the rows R15, R11, R7, R3

Y2 – connected to the rows R14, R10, R6, R2

Y3 – connected to the rows R13, R9, R5, R1

Row multiplex inside Dot Matrix Display

Multiplexed rows inside DMD

The demultiplexer input/output combination and the DMD row illumination sequence is illustrated in the following table

DMD-TB

Example

  1. Consider a 32X16 DMD panel
  2. The following figures illustrates the sequence of bit shifting

A single data bit is shifted in to the DMD and it is effectively present in the [R16, C8] location.

Bit 1 shifted into R16, C8

First Bit shift into DMD

On further data in, the Old data moves one bit to [R16, C7] and new data bit is loaded at [R16, C8]

Bit 2 loaded at R16, C8

After 2nd bit input

After the input of 9th bit, the first bit is moved to the twelfth row at [R12, C8] and the bit 9 is loaded at [R16, C8]

Bit 9 loaded at R16, C8

After 9th Bit input

Similarly with 32nd bit input, the bit one is moved to the forth row at [R4, C1] and the bit 32 is loaded at [R16, C8]

Bit 32 is loaded at R16, C8

After 32nd bit input

Upon the input of 33rd bit, the bit one is again moved to the sixteenth row but this time at [R16, C16] and the new bit 33 is loaded at [R16, C8]

New bit 33 is loaded at R16, C8

After 33rd bit input

Likewise on input of 128 bits, the bit 1 is moved to the consecutive rows and columns till [R4, C25] and the bit 128 is loaded at [R16, C8]

Bit 128 is loaded at R16, C8

After 128th bit input

Thus the entire pattern to be displayed can be loaded bit by bit. Running even at a low clock frequency of 8KHz, the 128 bits can be easily shifted in 16 ms, more than needed for human eye to detect the change.

DMD – Daisy Chain

It is possible to connect the multiple DMD panels in series using ribbon cables. This is called daisy-chaining. The number of the DMD in series is limited to the RAM size and the SPI clock frequency.
Even though the DMD can also come with multiple LEDs of varying color such as RED, GREEN, BLUE, etc, the underlying connection mechanism is same and each of the colored LED’s are controlled separately.

Now that we can control each LED of the DMD display independently, we can create any pattern to be displayed. In the upcoming blogs, we will discuss in detail about the software based control mechanism and creating rolling displays.