M5Knife – A Pocket Toolkit for the M5Stack Cardputer Adv

 

I’ve been working on a little project for the M5Stack Cardputer Adv, and it’s reached the point where I’m happy to make it publicly available.

It’s called M5Knife, and the idea is straightforward: turn the Cardputer into a useful, self-contained collection of utilities, rather than dedicating it to one particular job.

Think of it as a sort of digital Swiss Army knife. Hence the name.

What is M5Knife?

The M5Stack Cardputer Adv is a remarkably capable little machine. With its ESP32-S3 processor, built-in keyboard, colour screen, Wi-Fi, Bluetooth, infrared transmitter and microSD card support, there’s quite a lot of hardware packed into something that fits in your pocket.

M5Knife attempts to make practical use of that hardware through a simple menu-driven interface.

The main screen presents a horizontally scrolling row of icons. Select a tool, do whatever you need to do, and press the G0 button to return to the launcher.

No complicated command lines, no need for a separate computer once the firmware is installed, and no need to keep swapping firmware just to perform a different task.

What’s included?

File Manager

M5Knife includes a file manager for browsing the contents of a microSD card.

You can navigate directories, create folders, rename and delete files, and view text files. There’s also a small built-in text editor, supporting files up to 8 KB.

It’s not intended to replace a desktop text editor, but it’s surprisingly useful for making quick changes directly on the device.

USB Card Reader

One of my favourite features is the USB mode.

Connect the Cardputer to a PC, select USB, and the Cardputer presents its microSD card as a USB storage device.

That means files can be transferred without taking the card out of the Cardputer.

The firmware also includes safeguards around USB access, including requiring the host to release the card before returning to normal operation.

Wi-Fi and Network Utilities

M5Knife can scan for wireless networks, connect to them and remember connection details for future use.

The Network menu includes several useful diagnostic tools:

  • Network information, including IP address, gateway and signal strength.
  • DNS hostname lookup.
  • ICMP ping.
  • TCP port scanning.
  • A basic LAN scanner for discovering devices responding on selected TCP ports.

These aren’t intended to replace professional networking tools, but they’re handy for quick checks when you’re away from your desk.

HTTP File Server and Wi-Fi Hotspot

This is another feature I’m particularly pleased with.

M5Knife can run a small HTTP file server, allowing you to browse and manage files on its microSD card using a web browser on another device.

You can upload and download files, create directories, rename items and delete files.

If the Cardputer is connected to your home network, you can access it over that network.

But what if you’re nowhere near a wireless network?

M5Knife can create its own Wi-Fi hotspot.

Connect your phone directly to the Cardputer and access the file manager through your browser. There’s no router or Internet connection required.

To make things easier, the Cardputer can display QR codes for joining its Wi-Fi network and opening the file manager.

It effectively becomes a tiny standalone wireless file server.

Bluetooth Scanner

The Bluetooth tool scans for nearby Bluetooth Low Energy (BLE) devices and displays their advertised names, where available, along with signal strength.

It’s useful for getting an idea of which BLE devices are nearby.

Infrared Remote Controls

The Cardputer Adv has a built-in infrared transmitter, so naturally I had to find something to do with it.

M5Knife supports manual IR transmission and a library of up to eight saved remote-control profiles, using NEC and Samsung protocols.

Profiles can be configured, imported and stored in the Cardputer’s internal non-volatile memory.

I’ve tested the IR functionality with real equipment, including a television and a set-top box.

It’s rather satisfying to control a television from something that looks like a miniature computer.

Settings, Status and System Information

There’s also a Settings menu for controlling things such as screen brightness, automatic Wi-Fi connection, network time synchronisation and sleep behaviour.

Configuration is stored in the ESP32’s non-volatile memory, so the Cardputer doesn’t need an SD card inserted simply to remember its settings.

Settings can also be exported to, and imported from, a human-readable configuration file on the SD card.

The Status screen displays useful information such as memory usage, SD card capacity, network addresses and battery status.

A QR Code Back to GitHub

One of the final additions for version 0.5.15 is a QR code on the About screen.

Select the GitHub QR option and the Cardputer displays a scannable link directly to the M5Knife repository.

Now that the repository is public, anyone looking at the device can scan the code and find the project.

A small feature, admittedly, but a nice finishing touch.

Building and Installing M5Knife

M5Knife is written for the M5Stack Cardputer Adv, using the Arduino framework and PlatformIO.

The GitHub repository contains the complete source code, PlatformIO configuration and a README covering installation, keyboard controls, configuration and the individual tools.

You’ll need a Cardputer Adv, a USB connection and a computer with a suitable PlatformIO development environment to compile and upload the firmware.

A microSD card is recommended for the file-management features.

The project is released under the MIT licence, so the source code is available for anyone who wants to examine it, modify it or build upon it.

Is It Finished?

Version 0.5.15 represents a stable, working collection of features that I’ve tested on the hardware.

That doesn’t necessarily mean development has finished. There are always improvements to be made, particularly to the user interface, and I’m sure more ideas will occur to me.

For now, though, I’m happy with what it does.

M5Knife has become a genuinely useful little collection of tools, and it’s been an enjoyable exercise in seeing just how much functionality can be squeezed into the Cardputer Adv.

If you’ve got one of these little machines, perhaps you’ll find it useful too.

Get M5Knife

M5Knife 0.5.15 is available now on GitHub:

https://github.com/ReconditeBox/M5Knife

The repository contains the source code, build instructions and documentation.

It’s free, open source, and you’re welcome to have a look.

Happy tinkering!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.