My business card runs Linux

Translation of an article from Blog engineer George Hilliard

My business card runs Linux
Clickable

I am an embedded systems engineer. In my free time, I often look for something that can be used in the design of future systems, or something from the category of my interests.

One such area is cheap computers capable of running Linux, and the cheaper the better. So I dug down a deep rabbit hole of obscure processors.

I thought: "These processors are so cheap that they can practically be given away for free." And after a while the idea came to me to make a bare card for Linux in the form factor of a business card.

As soon as I thought about it, I thought it would be really cool to do it. I have already saw electronic business cards to it, and they had various interesting features, such as flash card emulation, flashing lights, or even wireless data transfer. However, I have not seen business cards with Linux support.

So I made myself one.

This is the finished product. A complete minimal ARM computer running my custom version of Linux built with Buildroot.

My business card runs Linux

It has a USB port in the corner. If you connect it to a computer, it loads in about 6 seconds and is visible as a flash card and a virtual serial port through which you can enter the card shell. On the flash drive is a README file, a copy of my resume, and some of my photos. The shell has several games, Unix classics like fortune and rogue, a small version of the 2048 game, and a MicroPython interpreter.

All this is done with a very small 8 MB flash chip. The bootloader is 256 KB, the kernel is 1,6 MB, and the entire root filesystem is 2,4 MB. Therefore, there is a lot of space left for a virtual flash drive. There's also a writable home directory if someone makes something they want to keep. All this is also stored on a flash chip.

The entire device costs less than $3. It's cheap enough to give away. If you received such a device from me, it means that most likely I am trying to impress you.

Design and assembly

I designed and assembled everything myself. It's my job and I love it, and most of the difficulty was finding cheap enough parts for this hobby.

The choice of processor was the most important decision influencing the cost and feasibility of the project. After extensive research, I chose the F1C100s, a relatively obscure processor from Allwinner that is cost-optimized (i.e. cheap as hell). Both RAM and CPU are in the same case. I bought processors on Taobao. All other components are purchased from LCSC.

I ordered the boards from JLC. For $8 they made me 10 copies. Their quality is impressive, especially for such a price; not as neat as OSHPark, but still looks good.

I made the first batch matte black. They looked nice, but were very easily soiled.

My business card runs Linux

There were a couple of problems with the first batch. First, the USB connector was not long enough to fit securely into any USB ports. Secondly, the flash tracks were not made correctly, but I got around this by bending the contacts.

My business card runs Linux

After checking everything in the work, I ordered a new batch of boards; You can see a photo of one of them at the beginning of the article.

Due to the small size of all these small components, I decided to resort to reflow soldering using cheap stove. I have access to a laser cutter, so I cut a soldering stencil out of laminator film on it. The stencil turned out pretty good. The 0,2 mm processor pin holes required special care for quality workmanship - it was critical to correctly focus the laser and select its power.

My business card runs Linux
Other boards work well for holding the board during paste application.

I applied solder paste and positioned the components by hand. I made sure that lead was not used anywhere in the process - all boards, components and paste comply with the standard RoHS - so that my conscience does not torment me when I distribute them to people.

My business card runs Linux
With this batch, I missed a little, but the solder paste forgives mistakes, and everything came together fine

It took about 10 seconds to position each component, so I tried to keep their number to a minimum. More details about map design can be found in another my detailed article.

List of materials and cost

I kept a strict budget. And the business card turned out as intended - I don't feel sorry for giving it away! Of course, I won’t distribute it to everyone and everyone, because it takes time to make each copy, and my time is not taken into account in the cost of a business card (it’s kind of free).

Component
Price

F1C100s
$1.42

PCB
$0.80

8MB flash
$0.17

All other components
$0.49

Total
$2.88

Naturally, there are other costs that are difficult to calculate, such as shipping (because it is spread across components destined for several projects). However, for a Linux-enabled board, it's definitely quite cheap. This breakdown also gives a good idea of ​​what it costs companies to make devices at the lowest price point: you can be sure that it costs companies even less than it did me!

Capabilities

What to say? The card boots a very heavily trimmed Linux in 6 seconds. Due to the form factor and cost, the card does not have I / O, network support, any serious amount of storage to run heavy programs. Nevertheless, I managed to cram a lot of interesting things into the firmware image.

USB

You could come up with a lot of interesting things with USB, but I chose the simplest option so that people are more likely to get it working if they decide to try my business card. Linux allows the card to behave like a "device" with support Gadget Framework. I took some drivers from previous projects that included this processor, so I have access to all the functionality of the USB gadget framework. I decided to emulate a pre-generated flash drive and give shell access via a virtual serial port.

shell

After logging in as root on the serial console, you can run the following programs:

  • rogue: classic Unix dungeon crawler;
  • 2048: simple game in 2048 in console mode;
  • fortune: output of various pathetic sayings. I decided not to include the entire quotation base here to leave room for other features;
  • micropython: a very small Python interpreter.

Flash drive emulation

At compile time, the build tools generate a small FAT32 image and add it as one of the UBI partitions. The Linux Gadget Subsystem presents his PC as a mass storage device.

If you are interested in seeing what appears on a flash drive, then the easiest way to do this is to familiarize yourself with sources. There are also some photos and my resume.

Resources

Source code

My Buildroot tree is available on GitHub - thirty-threeforty/businesscard-linux. There is code for generating a NOR flash image, which is installed using the processor's USB download mode. It also has all the package definitions for games and other programs that I stuffed into Buildroot after everything worked. If you want to use the F1C100s in your project, this is a great starting point (feel free to ask me questions).
I used beautifully executed project Linux v4.9 for F1C100s by Icenowy, with a slight rework. Almost standard v5.2 works on my card. It lies on GitHub - thirty-threeforty/linux.
I think I have the best U-Boot port of the F1C100s in the world today, and it's partly based on Icenowy's work as well (unexpectedly, getting U-Boot to work properly turned out to be quite a nuisance). You can also take it on GitHub - thirty-threeforty/u-boot.

Documentation for F1C100s

Found a rather poor F1C100s documentation, and post it here:

Downloading for those who are curious my project diagram.

My business card runs Linux

Conclusion

I learned a lot during the development of this project - this is my first project where I used a reflow oven. I also learned how to find resources for poorly documented components.

I used my experience with embedded Linux and board design. The project is not without flaws, but it shows all my skills well.

For those interested in the details of working with embedded Linux, I suggest reading my series of articles about this: Mastering Embedded Linux. There I talk in detail about how to create software and hardware from scratch for tiny and cheap Linux systems, similar to this business card of mine.

Source: habr.com

Add a comment