Saturday, January 24, 2026

Custom Linux Image Build Using Yocto on WSL

When your Single Board Computer (SBC) is connected to specialized hardware, building an optimized Linux image with Yocto can be advantageous, as it produces a highly customized, reproducible, and lightweight system. To save time setting up the environment for building a custom Linux image, you can use a Yocto Docker container in combination with WSL.



Thursday, June 5, 2025

Exploring Edge AI with NXP's FRDM-MCXN947

I recently attended NXP technology day in Auckland, where the latest innovations from NXP were showcased - including their microcontrollers, i.MX microprocessors, and other advanced semiconductor technologies. NXP, a leading Dutch semiconductor company, designs and manufactures a wide array of products for automotive, industrial, and IoT applications. Among their latest developments is the MCX series of microcontrollers, which unifies the legacy Philips and Kinetis families into a new, modern MCU architecture.

What particularly caught my attention was the MCXN947 from the MCX N series. This device delivers high performance and low power consumption, while integrating a neural processing unit (NPU) to enable on-device AI processing. As computing increasingly moves to the edge, it's exciting to see compact, energy-efficient hardware like this supporting real-time AI workloads. NXP also hosted a hands-on machine learning session with the MCXN947, which inspired me to explore its potential as an edge AI platform.


Tuesday, March 25, 2025

Grbl_ESP32 MKS DLC32 Board with FluidNC CNC Firmware

When constructing robotic rigs capable of movement along the x, y, and z axes, I have often relied on CNC controllers such as GRBL paired with the Arduino CNC shield, as detailed in my previous post:
DrawBot XY Plotter with Arduino GRBL Controller

With recent advancements in this field, I would like to explore emerging controllers like FluidNC and new hardware boards such as the Makerbase MKS DLC32.
FluidNC is a CNC firmware that utilizes the ESP32, offering an alternative to using Arduino UNO. It is compatible with GRBL, enabling the seamless transmission of GCode. It also officially supports a lot of third party hardware boards such as Makerbase MKS DLC32 V2.1 Controller.

Figure 1. MKS DLC32 V2.1 board.

In my experience, CoreXY mechanisms that employ timing belts tend to operate more quickly and quietly compared to those utilizing lead screw rods. For those interested, I have discussed the process of updating the FluidNC firmware for the MKS DLC32 board tailored for a CoreXY type machine.


Saturday, August 5, 2023

DIY USB Video Camera Using MK82FN256VLL15 Microcontroller and OV7670 Camera Module

FRDM-K82F is a low cost development board using MK82FN256VLL15 microcontroller. Here, I will test its FlexIO connector using OV7670 camera module. [NXP16, NXP16B]

Hardware

We need to solder 18 pin female connector, Header2x9, on the back of the FRDM-K82F board to connect OV7670 module as illustrated in the following figure.


Figure. FRDM-K82 attached with OV7670 camera module.


Wednesday, November 30, 2022

Translation and Rotation of Images in Six Degree of Freedom Using OpenCV

I would like to share a small C++ function to translate and rotate images in 3D space in six degree of freedom (6 DoF). It also adjusts brightness and contrast. I use OpenCV library to perform some image processing.



Monday, November 7, 2022

Near Field Communication (NFC) Using PN7150RPIM

Using OM5578 PN7150 NFC controller with Raspberry Pi is discussed.


Hardware Module

PN7150RPIM demo kit consists of PN7150 controller which is soldered on Raspberry Pi Interface board. It also includes NTAG216 a NFC card for testing [1]. There are three different versions of interface board for PN7150 NFC controller - Raspberry Pi interface, BeagleBone interface, or Arduino interface [2]. As illustrated in Figure 1, it only uses 6 pins - 3.3V, and GND for power, SDA and SCL for I2C, a GPIO input IRQ for interrupt, and a GPIO output for Enable pin. There is also an optional 5V power VANT.


Figure 1. PN7150 NFC Controller Board Pins.


The Raspberry Pi version is used as SBC interface for this discussion. Its connections to the header is shown in the following Figure [3].


Figure 2. PN7150 RPi Interface Board Connections.


Library

There is NXP Linux libnfc-nci software stack on GitHub that supports PN7150 NFC controller [4] which we will clone as follows.

$ sudo apt install autoconf automake libtool git pkg-config
$ git clone https://github.com/NXPNFCLinux/linux_libnfc-nci.git


Then, navigate into the directory and generate the configuration script. The machine should have automake, autoconf and libtool packages installed before running the script.

$ cd linux_libnfc-nci/
$ ./bootstrap


There are three options to generate the Makefile to map Linux NFC stack-
--enable-i2c
To use PN5xx I2C kernel mode driver which is default.
--enable-alt
To access GPIO and I2C resources from the user space in case the existing kernel offers access to them.
--enable-lpcusbsio
For USB devices implementing PN7150 with HID interface expose via LPCUSBSIO. protocol.
In our case, we will use --enable-alt option as the Raspberry Pi supports using GPIO and I2C through /sys/class/gpio and /dev/i2c-dev interface [5]. The stack is illustrated in the following figure.


Figure 3. libnfc-nci SW stack.


The i2c bus and GPIO pin can be configured in phTmlNfc_alt.h which is in ./src/halimpl/pn54x/tml/i2c directory. The existing values are

#define I2C_BUS "/dev/i2c-1"
#define I2C_ADDRESS 0x28
#define PIN_INT 23
#define PIN_ENABLE 24


Execute the following commands to generate the Makefile for the above settings, build and install the library.

$ ./configure --enable-alt
$ make 
$ sudo make install 


The install path is at /usr/local/lib. And for that you can use

$ export LD_LIBRARY_PATH=/usr/local/lib


or create config file as follows.

$ sudo sh -c "echo /usr/local/lib/ > /etc/ld.so.conf.d/nfc-nci.conf"


And load the configuration.

$ sudo ldconfig


C++ Examples

Example C++ programs to use NXP Linux libnfc-nci software stack as reader, emulator, etc. are also available on GitHub [6] which we will clone as follows.

$ git clone https://github.com/NXPNFCLinux/linux_libnfc-nci_examples


Then, you can navigate into an example directory, build, and run.

$ cd linux_libnfc-nci_examples/xxxx
$ make 
$ ./xxxx 




References

[1] NXP Semiconductors. PN7150 Raspberry Pi SBC Kit Quick Start Guide. 2019-07-08.
url: https://www.nxp.com/docs/en/application-note/AN11758.pdf.

[2] NXP Semiconductors. PN7150 NFC Controller SBC Kit User Manual. 2019-07-10.
url: https://www.nxp.com/docs/en/user-guide/UM10935.pdf.

[3] NXP Semiconductors. NFC's SBC Interface Boards User Manual. 2016-05-02.
url: https://www.nxp.com/docs/en/user-guide/UM10956.pdf.

[4] NXP Semiconductors. PN71xx Linux Software Stack Integration Guidelines. 2018-08-10.
url: https://www.nxp.com/docs/en/application-note/AN11697.pdf.

[5] NXP Semiconductors. Easy set-up of NFC on Raspberry Pi. 2018-08-14.
url: https://community.nxp.com/docs/DOC-341231.

[6] NXP Semiconductors. linux_libnfc-nci_examples.
url: https://github.com/NXPNFCLinux/linux_libnfc-nci_examples.

Wednesday, July 6, 2022

Friday, April 1, 2022

PCA9535 GPIO Expander

PCA9535 is a GPIO expander with 16 IO lines which has I2C bus interface. It provides additional IOs for I2C bus master such as SBC or MCU that can be used to read push button or sensor, to control LED, etc. PCA9555 is identical to PCA9535 except the presence of internal pull-up resistor which increases power consumption when the IOs are low. PCA9535C is another variation of PCA9535 with open drain outputs. Its operating supply voltage range is 2.3V to 5.5V. There are 3 hardware pins which allow to use 8 different I2C bus addresses, from 0x20 to 0x27.


Tuesday, October 5, 2021

16 Channel RS485 Modbus Relay Board

Controlling a 16 channel RS485 Modbus relay board is discussed in this post. The board needs to be powered with a 12V power supply. It has has a DIP switch to set its ID. If only the switch 1 is on and others are off, its ID will be 1. To communicate the board from a PC, a USB to RS485 converter can be used. The setup is illustrated in the following figure.


Figure 1. RS485 relay board using 12 V power supply, and a USB converter.


Alternatively, you can use a USB UART adapter together with a UART to RS485 converter. Wire connection for this setup is shown below.


Figure 2. Wire connection for UART to RS485 converter.


Unlike conventional RS485 devices, these devices do not have the control line for transmit or receive. They use autoflow control as shown below.


Figure 3. RS485 autoflow control.


Friday, September 17, 2021

V4L2 Capturing as Bitmap Image

V4L2 (Video for Linux 2) consists of drivers and API for video capturing on Linux [1]. In this article, we will discuss about using the library and analysis of video capture example. There are utilities for controlling media devices on Linux called v4l-utils [2]. We will explore about using and testing webcam with them also.


Wednesday, July 7, 2021

Wednesday, April 7, 2021

DrawBot XY Plotter with Arduino GRBL Controller

In this article, I would like to discuss about using DIY XY plotters which are also called draw bots. You can buy them at online stores such as LYCNC store or Global Tech. Factory Store on Aliexpress.


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.

http://cool-emerald.blogspot.com/2020/01/getting-started-with-frdm-k82f.html

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' ( https://os.mbed.com/blog/entry/DAPLink-bootloader-update/)
  • 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 https://www.segger.com/downloads/jlink#JLinkOpenSDABoardSpecificFirmwares
  • 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 ADC

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