Gas Detector Algorithm Upgrade
(Microcontroller Firmware, Algorithm Simulation )


LCI’s client had manufactured a device for the measurement of Radon and Thoron gas levels in mines. A new and more precise algorithm for calculating the results was developed by their research team – it was implemented in Visual Basic.

LCI was contracted to convert the new algorithm to C and implement it in an 8-bit microcontroller used in the device. The client wanted to prevent the re-design of the existing hardware.

The major challenge was the limited amount of flash and RAM memory in the microcontroller, as well as its limited computation power (especially compared to the PC on which the new algorithm was developed).


Conversion of the algorithm to C progressed without major issues; small adjustments to the algorithm were done to speed up execution and decrease code size.

To shorten the development time, the converted algorithm was first tested on a PC using float variable type to simulate 4-byte double implementation of the microcontroller.

As part of the test process, the LCI team prepared several hundred random and manually selected test cases to verify results of the newly implemented algorithm. These tests showed that the algorithm calculated results correctly for the majority of test cases. However, the algorithm was not stable and did not converge to correct results in certain challenging cases. The findings were reviewed with the client’s team and LCI provided a development set-up to enable the client’s team of researchers to easily reproduce and troubleshoot the problems.

While the customer’s research team worked on a new version of the algorithm, the LCI team implemented additional test cases (more than one thousand test cases were prepared).

The new version of the algorithm was re-tested and found stable. The final microcontroller code was prepared and the most problematic test cases were re-run directly on the device hardware to simulate one year of continuous operation of the device. The microcontroller results matched PC results well and the firmware was released for manufacturing.

Winning Result:

The new algorithm was successfully implemented and thoroughly tested to minimize implementation risks. LCI’s expertise in firmware development ensured the delivery of a much more complicated algorithm without the need for hardware re-designs.

Market Served: Mining