Standalone CNC line scan camera

I use my line scan camera to take cool pictures of trains and other stuff.

Line scan camera
Show figure 1 detailsClose figure 1 details

FIGURE 1

Camera
FUJIFILM GFX100S
Lens
SIGMA 70mm F2.8 DG MACRO A018
Aperture
f/5.0
Shutter
1/56 s
ISO
ISO 3200
Software
Digital Camera GFX100S Ver2.13
Date

Line scan camera

Piccadilly line.

For more information about how it works and the algorithms I use to process the images, see: line scan camera image processing.

But heretofore I had to plug it into my laptop, which was kinda annoying for many reasons.

Dongle hell with the Macbook.
Show figure 3 detailsClose figure 3 details

FIGURE 3

Camera
Apple iPhone 14 Pro Max
Lens
iPhone 14 Pro Max back triple camera 6.86mm f/1.78
Aperture
f/1.8
Shutter
1/147 s
ISO
ISO 64
Software
26.0
Date

Dongle hell with the Macbook.

A dropped frame can really ruin a capture. Here, the end of car 5519, near 5521, was missing a slice.
Show figure 4 detailsClose figure 4 details

A dropped frame can really ruin a capture. Here, the end of car 5519, near 5521, was missing a slice.

1 The camera

OK here it is!

Left side.
Show figure 5 detailsClose figure 5 details

FIGURE 5

Camera
FUJIFILM GFX100S
Lens
SIGMA 70mm F2.8 DG MACRO A018
Aperture
f/3.5
Shutter
1/80 s
ISO
ISO 2000
Software
darktable 5.5.0+1479~g9e36df0344
Date

Left side.

Right side.
Show figure 6 detailsClose figure 6 details

FIGURE 6

Camera
FUJIFILM GFX100S
Lens
SIGMA 70mm F2.8 DG MACRO A018
Aperture
f/3.5
Shutter
1/85 s
ISO
ISO 2000
Software
darktable 5.5.0+1479~g9e36df0344
Date

Right side.

Front side.
Show figure 7 detailsClose figure 7 details

FIGURE 7

Camera
FUJIFILM GFX100S
Lens
SIGMA 70mm F2.8 DG MACRO A018
Aperture
f/5.0
Shutter
1/34 s
ISO
ISO 2000
Software
darktable 5.5.0+1479~g9e36df0344
Date

Front side.

Rear side.
Show figure 8 detailsClose figure 8 details

FIGURE 8

Camera
FUJIFILM GFX100S
Lens
SIGMA 70mm F2.8 DG MACRO A018
Aperture
f/5.0
Shutter
1/80 s
ISO
ISO 2000
Software
darktable 5.5.0+1479~g9e36df0344
Date

Rear side.

Here are slightly older pics with worse 3D printed battery holder, bezel, and no wifi hat.

Trying it out.
Show figure 9 detailsClose figure 9 details

FIGURE 9

Camera
FUJIFILM GFX100S
Lens
GF55mmF1.7 R WR
Aperture
f/11.0
Shutter
1/42 s
ISO
ISO 640
Software
darktable 5.3.0+959~gf86f0af591
Date

Trying it out.

Rear side.
Show figure 10 detailsClose figure 10 details

FIGURE 10

Camera
FUJIFILM GFX100S
Lens
GF55mmF1.7 R WR
Aperture
f/11.0
Shutter
1/42 s
ISO
ISO 640
Software
darktable 5.3.0+959~gf86f0af591
Date

Rear side.

1.1 Bill of materials

Here’s the BOM (prices are approximate):

ComponentApprox. Cost
Alkeria Necta N4K2-7C$2000
NVIDIA Jetson Orin Nano Super$250
Intel 670P 2TB SSD$55 back in 2022, probably like $300 now lol
CNC case$110
Three-key Bluetooth macro pad$20
7 inch 1080P 2000 nit touchscreen$70
Short USB-A to USB-C cables$5
Short USB-A to right angle micro USB 3 cable$5
Short HDMI cable$15
USB-C PD to barrel plug adapter$7
Anker power bank$60
Table 1
Block diagram of how it's connected. The SVG was generated by AI but it looks right to me.
Show figure 11 detailsClose figure 11 details

Block diagram of how it’s connected. The SVG was generated by AI but it looks right to me.

1.2 Case design

I modelled the case in Rhinoceros 3D.

I ordered it from JLC CNC for about RMB 831, which is like $110.

JLCCNC order screenshot
Show figure 12 detailsClose figure 12 details

JLCCNC order screenshot

Sendcutsend would have cost ten times as much.
Show figure 13 detailsClose figure 13 details

Sendcutsend would have cost ten times as much.

3D printed prototype
Show figure 14 detailsClose figure 14 details

FIGURE 14

Camera
FUJIFILM GFX100S
Lens
SIGMA 70mm F2.8 DG MACRO A018
Aperture
f/8.0
Shutter
1/15 s
ISO
ISO 3200
Software
darktable 5.3.0+959~gf86f0af591
Date

3D printed prototype

A pile of 3D printed rejects.
Show figure 15 detailsClose figure 15 details

FIGURE 15

Camera
Apple iPhone 14 Pro Max
Lens
iPhone 14 Pro Max back triple camera 6.86mm f/1.78
Aperture
f/1.8
Shutter
1/40 s
ISO
ISO 320
Software
26.3
Date

A pile of 3D printed rejects.

Transferring the guts from the old 3D printed prototype to the shiny metal one.
Show figure 16 detailsClose figure 16 details

FIGURE 16

Camera
FUJIFILM GFX100S
Lens
GF55mmF1.7 R WR
Aperture
f/16.0
Shutter
1/42 s
ISO
ISO 1000
Software
Digital Camera GFX100S Ver2.13
Date

Transferring the guts from the old 3D printed prototype to the shiny metal one.

1.3 Setting up the Jetson

I picked the Jetson because it has a low price and great compute compared to the similarly priced Raspberry Pi 5.

I wanted to only use the NVME M2 2280, and apparently the only way to do so is to use the NVIDIA SDK Manager, which requires an x86_64 Ubuntu 24.04 machine. It was really annoying. I couldn’t do it from my Arch Linux machine (must be Ubuntu), another Jetson (not x86), or my Windows machine, but was eventually able to do it by actually using an Ubuntu desktop. The process was also really finicky with its USB cable requirements. I had to plug the cable into the back of the PC.

Another unanticipated issue was that the Jetson doesn’t keep time when powered off due to not having an RTC battery. Sometimes, my photos end up being out of order.

My friend soldering an RTC battery
Show figure 17 detailsClose figure 17 details

FIGURE 17

Camera
FUJIFILM GFX100S
Lens
SIGMA 70mm F2.8 DG MACRO A018
Aperture
f/2.8
Shutter
1/70 s
ISO
ISO 125
Software
Digital Camera GFX100S Ver2.13
Date

My friend soldering an RTC battery

Actually, you can just bridge R560 with solder. Some people online painstakingly solder a 560 mΩ SMD resistor which is super difficult. I think the actual resistance is supposed to be 1 kΩ and the “R560” is just the name of the part and not the resistance.

Pinout
Show figure 18 detailsClose figure 18 details

Pinout

It works.
Show figure 19 detailsClose figure 19 details

FIGURE 19

Camera
FUJIFILM GFX100S
Lens
SIGMA 70mm F2.8 DG MACRO A018
Aperture
f/2.8
Shutter
1/160 s
ISO
ISO 100
Software
Digital Camera GFX100S Ver2.13
Date

It works.

1.4 Touchscreen

Touchscreen specs
Show figure 20 detailsClose figure 20 details

Touchscreen specs

The good news is that the touchscreen is super bright (2000 nits), so it is easily legible in daylight unlike the Macbook.

Also, it is powered by 5V USB (you can also power it by a barrel plug if you want), so I could just plug it into the Jetson and it just works.

1.5 Capture UI

It’s implemented in C++ with Dear ImGui.

GitHub code

I set up a systemd thing to launch it automatically upon boot.

Live debugging in the field.
Show figure 21 detailsClose figure 21 details

FIGURE 21

Camera
Apple iPhone 14 Pro Max
Lens
iPhone 14 Pro Max back triple camera 6.86mm f/1.78
Aperture
f/1.8
Shutter
1/1321 s
ISO
ISO 80
Software
26.3
Date

Live debugging in the field.

I set up a keybinding to toggle capture on/off with the spacebar so that I can control it wirelessly with a Bluetooth macro pad, to avoid shaking the camera when capturing.

2 Future ideas

I’d do these differently next time:

Another idea is to add a regular video camera (i.e. an area-scan camera) to the thing. That would help measure the speed of the train as well as help me see which part of the scene the line scan camera is looking at.

Right now, the tripod quick release plate (a Peak Design plate) is attached by a single M4 screw. I’d like to use two screws instead attached to the Alkeria camera for better strength.

3 Other people's line scan cameras

3.1 Adam Magyar

Adam Magyar’s “Einstein’s Camera” is perhaps the most famous one.

Adam Magyar’s “stainless” project

Adam Magyar and his line scan camera.
Show figure 22 detailsClose figure 22 details

Adam Magyar and his line scan camera.

His monochrome line scan camera takes really clean images even in low light, but is huge and needs a backpack. To be fair, it was over a decade ago.

3.2 Seth Itow

My former colleague Seth created his handheld battery-powered line scan camera independently after being inspired by my previous stuff.

Seth’s line scan camera

Seth's line scan camera.
Show figure 23 detailsClose figure 23 details

Seth’s line scan camera.

3.3 Philomena

Philomena (aka FlamingSpork) has a neat one too. She wrote a really good writeup with lots of details and explanations.

Philomena’s line scan camera

Philo's line scan camera
Show figure 24 detailsClose figure 24 details

Philo’s line scan camera

4 FAQ

Do you actually carry it with a strap attached to those Peak Design anchor links?

Good heavens no! It’s just a meme.

What lenses do you use?

In customizing my line scan camera I mentioned that I converted it to Sony E mount (manual only, no electronic contacts).

I use a Cheecar 50mm f/1.2 and a Samyang 85mm f/1.8 CS, both manual focus for Sony E mount (APS-C). The line is 28mm long so an APS-C lens covers it while being affordable.

I also have a variety of full frame lenses that I occasionally use on both this and my Fuji GFX camera, including:

My Cheecar and Samyang have an IR-block filter, but the Voigtlanders don’t. Actually, I had one for the 90mm, but I smashed it accidentally.

Before vs after putting on the IR-block filter.
Show figure 25 detailsClose figure 25 details

Before vs after putting on the IR-block filter.

How long does the battery last?

The Anker battery lasts about 1 hour. It is nice because it has a display indicating the amount of charge remaining, and it has a built-in USB-C cable capable of outputting PD 20 V and more than the 35 W needed for the setup.