explaingit

qzx/libnci

Analysis updated 2026-05-18

0CAudience · developerComplexity · 4/5Setup · hard

TLDR

A C library for reading and writing NFC tags on Linux, built around the PN7160 chip and designed to support other NFC controllers later.

Mindmap

mindmap
  root((libnci))
    What it does
      Reads NFC tags
      Writes NDEF data
      Talks to PN7160 chip
    Tech stack
      C language
      libgpiod
      OpenSSL
      Meson build
    Use cases
      Raspberry Pi NFC projects
      DESFire card access
      NTAG 424 secure tags
    Audience
      Embedded developers
      Hardware hobbyists
    Platforms
      Raspberry Pi 5
      ESP32 Arduino port

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a Raspberry Pi based NFC reader or writer for tags and cards.

USE CASE 2

Add support for DESFire secure cards or NTAG 424 DNA tags to a project.

USE CASE 3

Port the NFC stack to an ESP32 microcontroller using Arduino.

What is it built with?

ClibgpiodOpenSSLMesonNinjaArduino

How does it compare?

qzx/libnciac000/find-flvacc4github/kdenlive-omnifade
Stars00
LanguageCCC
Last pushed2013-04-05
MaintenanceDormant
Setup difficultyhardmoderatemoderate
Complexity4/52/52/5
Audiencedeveloperdevelopergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1h+

Requires specific NFC hardware (PN7160 chip) plus libgpiod and OpenSSL to build.

The README does not state a license.

In plain English

libnci is a C library for reading and writing NFC tags on Linux, built specifically for the PN7160/PN7161 chip from ELECHOUSE running on a Raspberry Pi 5. It follows the NCI (NFC Controller Interface) standard, a common protocol many NFC chips use, so the project is designed to support other similar chips later without changing its public interface. The library is organized in layers. At the bottom sits the hardware communication: one file handles the GPIO pins (using libgpiod version 2) and another handles the I2C bus. Above that is the NCI framing layer that talks the actual protocol to the chip, then a general device layer that exposes the public functions applications call. On top of that are card specific readers: one for Type 4 Tags, a common NFC tag format, and dedicated support for DESFire cards and NTAG 424 DNA tags, including their encrypted communication modes. A cryptography layer handles the AES encryption these secure cards need, using OpenSSL. Most of these layers can be tested without any physical hardware attached. Thread safety rules are spelled out clearly: each connection to the chip should only be used by one thread at a time, though separate connections can run in different threads safely. There are a couple of documented exceptions for cleanly stopping background operations from another thread. To build it you need the meson build tool, ninja, a C compiler, libgpiod, and OpenSSL. Once built, it installs like a normal system library, with headers, a pkg-config file, and support for being linked into other C, Meson, or CMake projects. There is also an experimental port to the ESP32 microcontroller using the Arduino framework, though the author notes this version has not yet been tested on real hardware. Included example programs let you detect nearby tags, read and write NDEF messages, a standard NFC data format, and manage DESFire cards. According to the README, tag detection, basic reading, and the more advanced DESFire secure messaging have all been verified against real hardware.

Copy-paste prompts

Prompt 1
Help me wire a PN7160 NFC chip to a Raspberry Pi 5 using libnci.
Prompt 2
Show me how to use libnci to read an NDEF message from a Type 4 tag.
Prompt 3
Explain how DESFire EV2 secure messaging works in libnci.
Prompt 4
Help me build and install libnci using meson and ninja.

Frequently asked questions

What is libnci?

A C library for reading and writing NFC tags on Linux, built around the PN7160 chip and designed to support other NFC controllers later.

What language is libnci written in?

Mainly C. The stack also includes C, libgpiod, OpenSSL.

What license does libnci use?

The README does not state a license.

How hard is libnci to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is libnci for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.