Blog Archives

Wireless Personal Area Networks

July 4th, 2014

A significant number of development projects have a wireless component. There are many different wireless technologies available, including Wi-Fi, GSM, RFID, Bluetooth, 2.4G custom protocols and Personal Area Networks. Personal Area Networks use a high level communication protocols to create area networks built from small, low-power digital radio-enabled devices.
Personal Area Networks in particular have been growing in popularity; this is due to a number of factors:

  • Small form factor
  • Flexibility
  • Low power solutions available
  • Low complexity improves reliability

An expansion port with a supply rail and SPI communication can easily provide the option for wireless connectivity in the future.

Personal Area Network Solutions

Among the many providers of Personal Area Network (Wikipedia) solutions are Microchip, Atmel and Texas Instruments; each of which supports a variety of protocols. Some of the protocols available and some we have worked with include:

  • Microchip: ZigBee and custom MiWi protocol
  • Atmel: ZigBee and custom ZigBit modules
  • Texas Instruments: ZigBee, SimpleLink and custom SimpliciTI protocol

miwi_boards

 

 

 

 

Figure 1 – A small, low-power circuit using a Microchip module and MiWi module

Capability Requirements

These protocols and modules encompass a wide range of capabilities and features. When choosing a protocol and module, the key requirements include:
Node Count

Solutions exist which support everything from two to many thousands of networked devices.

Topology

The way in which the devices are linked together affects the complexity, latency and reliability of the network. The simplest topology is a peered network, where each device only communicates directly to its neighbours.

pan_peer_topology

 

 

Figure 2: Peered Topology

For a larger network, a cluster-tree topology introduces routing, allowing messages to be sent to non-neighbouring devices through established “branches”.

cluster-tree

 

 

 

 

Figure 3: Cluster-Tree topology

While the cluster-tree topology allows for routing, it does not do so in the most efficient way – some messages will be routed all the way down to the base of the tree before being routed back out to the destination. For a more adaptable, reliable and faster network a mesh topology is more suitable. Mesh networking allows each device to freely route along the most direct path.

mesh-topology

 

 

 

 

Figure 4: Mesh topology

Range

The range of a module can vary from a few metres to hundreds of meters.

Power

Many modules and protocols allow low power devices which can easily achieve a battery life of two or more years.

Size

Modules come in small form factors, 10mm to 20mm.

Maturity

Many of the vendors have solutions that will meet many needs, and have evaluation boards for quickly getting a network working, speeding up development time. Experience with a particular module or protocol is invaluable for assessing and selecting technologies. Many performance limitations are unknown and only discovered once the development process has started. A selecting newly released technology, or the first generation, is always a flag for being cautious.

Approvals

There are tight Regulations around wireless systems and the process for getting approval is time consuming and expensive process. Many of the above solution providers have pre-approval, which results in faster and cheaper product development with less risk.

Round up

Interconnectivity between electronics devices is a growing requirement. Personal Area Network technology provides a platform for creating a small to large, short distance wireless network, with the ability to improve efficiency, security and convenience.

PDF Generation within Embedded Systems

May 14th, 2014

A traditional data logger presents the data as either plain text, comma-separated values (CSV), or Extensible Mark-up Language (XML). Files in these formats work well if you have supporting software to process data, but, if you are looking for a quick way of distributing a file, that anyone can open, a Portable Document Format (PDF) is more suitable. This is because data is presented in a consistent and easy to manage manner; instead of a wall of text the user can be presented with, for example, a clearly laid out summary, plots and images. Anyone can easily open or distribute the data without needing any software beyond what they already have on their computer.

We have developed embedded software which can generate a dynamic PDF file directly on a microcontroller (Wikipedia), which can then be written to an SD card or delivered via USB (the device can show up as a mass storage device – just like your flash drive). Use as a data logger is just one of the potential applications.

PC and Embedded System Comparison

We began by writing the software in C#, to run on a PC, as this would let us quickly and easily determine what was required to generate a PDF in code – this turned out to be reasonably simple, although we could already tell that there would be unique challenges encountered when writing the code for an embedded device (an 8-bit PIC microcontroller in this case).

When writing software to run on a PC there is a huge pool of resources available to the program, the table below shows a comparison between a typical PC and a typical 8-bit microcontroller.

PC Microcontroller
RAM (B) 4,294,967,296 256
ROM (KB) 1,073,741,824 8
Clock Speed (MHz) 3000 16

Quite a difference! A PC has 17 million times more memory (RAM), 134 million times more storage (ROM) and operates 188 times faster! So while it is easy to generate an entire PDF file in RAM on a PC, this is simply impossible to do on many microcontrollers.

Typically, this would not pose much of a problem as a file can be written start to finish. However, the PDF format is designed for fast viewing – one of the ways this is achieved is by using a table at the end of the file which references the location of all components (pages, images, fonts etc.). The table allows the viewing software to directly read the required parts of the file, saving time and memory. This referencing technique, along with others, can be tricky to handle programmatically.

Solution

The simplest solution would be to generate the entire PDF in RAM before going back and filling in all the missing references – but, as discussed earlier, this is not possible due to the constraints of an embedded system. By using a number of predictive and compensative methods the generating software can overcome this difficulty – progressively generating the file line by line and pushing each to external storage (e.g. SD card). In this manner, only a small amount of the file is in memory at any point in time, ensuring that the limited resources are not depleted while still allowing large, complicated PDF files. A simple example page, generated in this manner, is shown below.

pdf_generation

 

 

 

 

 

 

 

 

 

 

This is a common difficulty when writing code for an embedded system – the real challenge is in understanding how the microcontroller operates and being aware of the restrictions. With this in mind, fast and efficient systems can be created.