Wednesday, April 15, 2020

Sunday, April 5, 2020

Using Orange Pi

Orange Pi is a cheap alternative to Raspberry. They can be bought at their online store Shenzhen Xunlong at Aliexpress. There are many Orange Pi models. For example, Orange Pi One costs only ~USD 10. Another model called Orange Pi PC Plus even has 8 GB eMMC onboard and costs ~USD 25 only.

Figure. Orange Pi One

Saturday, March 28, 2020

Tesseract OCR with C++, OpenCV, and wxWidgets

Tesseract is a free optical character recognition software and it is considered one of the most accurate open-source OCR engines [1].

Getting Started with FRDM-K64F

To use FRDM-K64F with the latest MCUXpresso IDE, you need to update the firmware for its debugger. It is similar to FRDM-K82F where the details can be seen at the following post.

There are only a few minor difference between FRDM-K64F and FRDM-K82F to get started. Therefore, I will only list some major points here.

Figure. FRDM-K64F board

Original OpenSDA appears as MBED drive. And it is not working with MCUXpresso. To update the firmware for its debugger,
  • Disable 'Windows storage services' (
  • Hold reset button and connect the device to a USB port. It should now appear as a drive called BOOTLOADER
  • Drag and drop bootloader ‘0244_k20dx_bootloader_update_0x5000.bin’ into the drive.
  • Remove and reconnect without holding reset. Board shows as ‘MAINTANCE’.
  • Drag and drop Segger jLink OpenSDA for board specific firmware for K64F (‘02_OpenSDA_FRDM-K64F.bin’) which is available at
  • Remove and reconnect without holding reset button. It now appears as ‘FRDM-K64FJ’
  • To use JLink , open cmd and enter

    > cd "C:\Program Files (x86)\SEGGER\JLink"
    > JLink.exe -speed auto -device 'MK64FN1M0xxx12' -if SWD

  • At the JLink prompt

    J-Link> r
    J-Link> erase
    J-Link> q

  • After that, it should be OK to use MCUXpresso

Tuesday, March 24, 2020


ADS1115 is a precision, low power, 16 bit 860 SPS I2C analog to digital converter (ADC). It has internal reference, oscillator, and programmable comparator. ADS1115 modules are readily available at online markets like AliExpress and Adafruit

Friday, February 28, 2020

Working with JSON in C++

In this article, using JsonCpp library and wxJson library to work with JSON (JavaScript Object Notation) in C++ is discussed.


A convenient way to use JsonCpp is adding its amalgamated source. At first, get the source from the official repository,,

by entering the following command.

$ git clone

Thursday, January 30, 2020

Multithreading with wxWidgets

In this article, the use of multithreading with wxWidgets is discussed using C++ example programs. The following usage examples are discussed and detailed explanations for each of the step and function of using multhreading are presented.

A basic multithreading example, and the result of running the program is shown in the following link and the figure.

Figure 1. thread1.cpp

Simple Multithreading Example

As a simple multithreading example, the program at the following link is discussed.

Firstly, start, stop, pause, and resume buttons are added. Start button is used to create and start a new thread. Clicking the 'Stop' button looks for the last created thread and delete it. Pause button is used to pause the last started thread. Resume button is used to look for the last paused thread and run it.

Wednesday, January 29, 2020

Linux Device Driver on Raspberry Pi

In this article, I would like to discuss developing a IO device driver for Linux. Although, I use a Raspberry Pi as an example, it should work on other Debian based Linux systems too.

Friday, January 17, 2020

Identification and Compensation of Hysteresis Using Discrete Backlash Operator

In this article, I would like to present about 'A Discrete Backlash Operator for Identification and Compensation of Hysteresis and Non-linearity for Piezoelectric Actuator' and its practical implementation in MatLab and LabView. The authors, Yan Naing Aye and Ang Wei Tech, are with School of Mechanical and Aerospace Engineering, Nanyang Technological University, 50 Nanyang Avenue, Singapore 639798., .

The paper in PDF format and the implemented code in MatLab and LabVIEW are available at



A new invertible digitized model called Discrete Backlash Operator is proposed to model complex hysteretic nonlinearities. A discrete backlash operator is formed by combining multiple elementary virtual gears called discrete backlash gears. A discrete backlash operator with n discrete backlash gears has 2 power n possible states. The inverse model of discrete backlash operator is also developed for a feedforward controller to control the piezoelectric actuator.

Friday, January 10, 2020

Getting Started with FRDM-K82F

FRDM-K82F is a low cost development platform using MK82FN256VLL15 microcontroller. When I started using the board according to its getting started guide at

Get Started with the FRDM-K82F [NXP16],

I found out that its out-of-box demo is not running on my version of FRDM-K82F board. The insturctions on that page are also out of date. And, I could not get it worked.

After spending my time testing, browing the Internet, and experimenting, I found out that the following things might be necessary, in a brief, to make the board worked.
  • Debug adapter - update it
  • IDE - use MCUXpresso instead of Kinetis Studio
  • SDK - use MCUXpresso SDK Builder (make sure to 'drag and drop')
  • Flash - unlock the MCU's flash if required

Figure. FRDM-K82F board.