Made a satellite's pictures small enough to send home
On a student satellite, each picture of the experiment had to fit through a thin radio link, from a computer with less memory than one photo.
From 2020 to 2021 I led the software team of AcubeSAT. It’s a small satellite built by university students in Thessaloniki, for ESA’s Fly Your Satellite programme. It carries a lab the size of a chip, built to study how microgravity and radiation affect living cells. The experiment’s results are pictures. Every one of them has to come home through a thin radio link, in the few minutes the satellite spends above its ground station.
So before anything flew, we had to answer a plain question. How small can a picture get before it stops being science?
Less memory than one photo
The satellite’s main computer is a microcontroller, an Arm Cortex-M7 from Microchip running FreeRTOS. It has 384 KB of working memory. Our test pictures were 1,024 by 1,024 grey pixels, one byte each, so a single picture was a megabyte. Not even one whole picture fit in the computer’s working memory.
That rules out most of what you’d do on a laptop. A compressor on board has to work through the picture piece by piece, in buffers whose size is fixed before launch. It also has to finish while the rest of the satellite keeps running. So we didn’t judge compression only as an algorithm. It also had to work as embedded code on that chip.
The format that stores pictures upside down
I started with the formats everyone knows, JPEG and PNG, using two small libraries, TooJPEG and LodePNG, on the Cortex-M7. Our sample images came as BMP files, so the first job was to read BMP correctly by hand.
BMP has three surprises. It stores the rows from the bottom of the picture up. It stores each colour pixel as blue, green, red, the reverse of what most code expects. And it pads every row to a multiple of four bytes, so a row is often a few bytes longer than its pixels.
My converter checked the header, the pixel format and the length of the input before it trusted any of it. Then it turned each row the right way up, swapped the colours and dropped the padding.
Standards made for space
Space agencies have their own image standards, written by the Consultative Committee for Space Data Systems. CCSDS 121 is a lossless coder that has flown on many missions. CCSDS 122 transforms the picture with wavelets first, and it can be lossless or trade a little error for a much smaller file.
ESA has a tool for exactly this comparison, called WhiteDwarf. We ran our test pictures through both standards, varying the size of the pieces and the bit rate. For each run we recorded the compressed size and how far the decoded picture strayed from the original.
| Original | 1,049 KB |
| CCSDS 121, lossless | 417 KB |
| CCSDS 122, lossless | 390 KB |
| CCSDS 122, 2 bits per pixel | 259 KB |
| CCSDS 122, 1 bit per pixel | 131 KB |
Without losing anything, the best we got was about 2.7 times smaller. Lossy compression at one bit per pixel made the picture eight times smaller. The mean squared error was under 3, on a scale where each pixel runs from 0 to 255. A typical pixel moved by less than two grey levels. At two bits per pixel the picture was four times smaller, and the error fell below 0.6.
Those numbers turned a vague worry into a choice someone could make. The satellite could send eight times as many pictures per pass with a tiny, measured error. Or it could send about 2.7 times as many with every pixel exact.
A neural network on a microcontroller
We also wanted the satellite to pick out the interesting part of a picture by itself, so it could send the part that mattered. I got TensorFlow Lite Micro running on the board. It loaded a compiled model, checked its format, set aside a fixed block of memory and ran it.
That’s as far as it went. The model it ran was TensorFlow’s hello-world example, which predicts a sine wave. It proved that a model could run on that chip within a fixed budget, and nothing more.
Eight students and no salaries
I led eight students in the software team and co-led three more in hardware. I found most of them at outreach events and interviewed more than 40 candidates. Most of the team were unpaid students, so the work ran on motivation. That meant selling them the mission, putting what they learned first and hiring people who wanted the hard problems.
The compression work became my master’s thesis in 2022. It also became a paper, Resource-Constrained Image Processing for Scientific CubeSats, which won a best presentation award at ICACS 2022.