Redesigned control system for Windows 10 UWP


Project Requirements

SFP has successfully manufactured particle filtration test equipment for many years and variations of their current software and hardware interface has worked well in a number of products. SFP could see however that in coming years a key PCI card component used between the PC and the test equipment electronics would become obsolete and that with many new PC’s not even providing PCI card slots it will become difficult to build completely new products and support them based on this legacy technology. Similarly, it was becoming apparent that application software design had changed significantly in recent years and with advent of Windows 10 and the evolution of software into cleaner ‘app’ based products their current application software, written in Visual Basic 6.0 was also due an update.

The requirement therefore was to redesign the interface between the PC and the test equipment so that there would be no dependency on interface cards or legacy technologies and to completely rewrite the application software using modern interaction techniques whilst at the same time add new features based on years of practical field experience.


The most critical decision with the hardware was how to interface to a PC in a way that would be supported for the foreseeable future. USB was the obvious answer and Microsoft’s improved support for the generic CDC (Communications Device Class) over USB would ensure that no dedicated USB driver would need to be developed in order to interface and communicate with a PC.

The hardware had specific requirements in order to connect to the test equipment’s peripherals and included a photometer, two pressure sensors, two solenoid drivers and inputs from 6 NDFs (Neutral Density Filters). It would also need to support generic analogue in, analogue out, digital in and digital out ports to allow for future expansion and product options.

Following initial research the Atmel SAM4E16E was selected as the core hardware controller. It provided a completely integrated USB interface, 2 independent channels of 12 bit ADC with hardware support for oversampling up to 16 bits. It also provided 2 channels of 12 bit DAC along with a large number of general purpose IO lines. With its built in 1024K of program EEPROM and 128K of RAM it would also provide ample space for software development. The only component missing from the controller was a generic data EEPROM that could be used to store calibration constants and other setup information. This was addressed by attaching a 4K EEPROM over one of the controllers TWI (I2C compatible) interfaces.

sfp-hardware-640Figure 1 – Redesigned USB interface hardware with substantially increased I/O capabilities

Firmware, test and calibration

The firmware was developed completely within Atmel Studio 7 using Atmel’s ASF (Atmel Source Framework) to speed up development of the USB interface and to add thin wrappers around the ADC, DAC, I2C and IO hardware controllers. Debugging and testing was carried out using the SAM-ICE specific ARM debugger from Segger.

To communicate with the board a proprietary serial protocol was implemented and this was verified with a custom test harness that made it possible to exercise all of the inputs and outputs independently from the real hardware. The test harness also supported the precise calibration of the analogue inputs and outputs storing the constants on the boards EEPROM.

sfp-testharnessFigure 2 – USB interface test harness used to test, validate and calibrate the hardware

Application Software

In order to offer SFP customers a modern user interaction experience Windows 10 UWP (Universal Windows Platform) was chosen as the front end. Based on established technologies such as WPF (Windows Presentation Foundation) and XAML (Extensible Application Markup Language) it linked in well with the C# programming language, .net (UWP) framework and the MVVM (Model, View and View Mode) design pattern architecture. Underneath the hood and due mainly to UWP sand boxing requirements SQLite was used for the local relational database storage of all user parameters, values, tests and results.

MVVM made it possible to insulate the runtime engine from the business logic and modular programing techniques made it possible to organise the code into hierarchies and clean blocks with distinct functionality. The modularity of the code also made it possible to create demo mode builds that allowed testing of the applications functionality without requiring the test equipment or hardware to be present.

sfp-applicationFigure 3 – Application software running a test in demo mode with simulated inputs

Technical Challenges

The main challenge when developing the hardware was to decide how to split the analogue channels between the two available microcontroller ADC inputs. There was a built in multiplexor on the SAM4 chip but the ADC input range was unipolar from 0 to 3.3V. This meant that a level shifting analogue front end was required for each of the 11 inputs in order for it to work across the required -10V to +10V range. The option chosen, was to create a dedicated external multiplexor for the 8 general purpose analogue inputs that were constantly scanned and fed into a single level shifter connected to the first ADC channel but then provide 3 dedicated level shifters for the 3 specialised hardware interfaces and feed those directly into the internally scanned multiplexor of the second ADC channel. The result was a large reduction in the component count for the generic inputs but a prioritisation of dedicated hardware for the specialised inputs.

The most significant challenge when developing the application software was to implement the real-time serial port interface and protocol with very low latency so that there would be no observable delays between the application software and the test equipment. Initially the serial port interface was implemented exclusively using a command/response protocol but better performance was achieved if certain information was broadcast from the hardware interface to the PC application at the moment an event occurred. For example, if the system power was to be turned off, a command and response confirmation was perfectly suitable but if a single digital input changed logic level then an immediate broadcast of the changed state created instant feedback on the user interface.


The new interface hardware successfully achieved its goal of removing the obsolete general purpose PCI slot computer hardware. It also improved the resolution of the system and added new IO capabilities for future expansion. The test harness developed initially to test the USB serial port protocol evolved into an ideal tool for commissioning and calibrating the interface boards when they are manufactured. The application software adopted much of the good work that was done in the previous generation of software but brought it right up to date with modern programming language, tools, architecture and user experience. The addition of new features such as real-time graphics and level meters gave much more information back to the operator and made it possible to introduce new capabilities not previously possible.

About Open Technologies Limited

OTL specialise in the design and development of real-time software and hardware applications. We strive to innovate and bring our customers both cutting edge technologies and efficient solutions to their problems. With many years of experience working in industrial and consumer sectors we are always conscious of the need for reliable, maintainable and sustainable products. We are always looking to work with new clients and welcome the opportunity to discuss how we may be able to help you.

Contact OTL