Snack Cart POS
Why an ESP32-S3
I picked the S3 for headroom. I wanted enough power to drive the screen with plenty left over, so I wasn’t fighting the chip the whole build. It also needed WiFi, so the owner could log in from a phone, check that payments went through, and change prices and stock without touching the cart.
The S3 is probably overkill. But the difference between “just enough” and “way more than I need” was a couple bucks, so that was an easy call.
The screen was the same kind of decision: cheap and big. 3.5“ was about right. It’s not a crisp panel, but for a few dollars it does the job.
Touch → buttons

The plan was to run everything off the touchscreen. I had it calibrated, wired and working on the breadboard, and it felt bad. Resistive touch is slow and sloppy. Fine for a demo, annoying by the fiftieth snack of the week, and this thing gets used dozens of times a day by people grabbing food on their way past.
So the touch driver came out and six physical buttons went in: up, down, left, right, enter and back, color-coded so you can sort of tell what each one does. Every screen sets its own job for each button. More wiring and more code, but now it feels like an appliance instead of a toy.

The database moves to an SD card, and changes shape
The database started out on the ESP32’s internal flash, running SQLite in WAL mode because that’s the fast one. It worked fine until it started crashing and hanging on writes. Basically, WAL expects file locking that a tiny flash filesystem doesn’t really have. The display already had an SD slot on the back, so a real card was almost free to wire up, and I switched to the plain old rollback journal. Slower per write, but this thing gets unplugged and carted around, so surviving a crash beats speed.
The move made me rethink the tables too. My first design was one row per item scanned. That falls apart the moment you try to match payments to it. Venmo pays for a whole checkout at once, and the same person can spend the same dollar total on two different days, so matching by amount alone doesn’t work. Now it’s one row per checkout with its own transaction number, plus a separate table for the items in it. Nothing ever gets deleted, so “lifetime total spent” is just a SUM() over everything. No running counter that can drift out of sync.
Two bugs that weren’t in the code
Turning on the full 16MB of flash put the board in a boot loop after every upload. The board definition assumes 8MB without telling you, so the upload tool was writing an 8MB bootloader next to a partition table built for 16MB. I’d told the build about the 16MB, but not the upload step. Setting it in both places, and switching to a built-in 16MB partition preset that comes with a matching bootloader, fixed it.
The second one was worse, and a bitch to find. For months the firmware clearly worked. The screen lit up, the buttons responded, flashing succeeded. But there was zero serial output, ever, which points straight at the monitor or the tools. It was neither. This board’s USB port is wired right to the S3’s built-in USB serial, not through the separate bridge chip most dev boards have. A build flag that’s correct for boards with a bridge chip was sending Serial to two pins with nothing connected to them. One flag flipped, and months of silence were over.
Making the buttons feel right
I went through several rounds of guessing a “reasonable” debounce and repeat time, and it still acted like a double-tap machine. A better guess wasn’t the fix. I added some temporary logging that printed real press and release times, then pressed the buttons like a normal person and looked at the numbers. A normal press holds a lot longer than the usual defaults assume, which is why every value I tried still counted one press as two. Tuned to the real numbers, the buttons went from cheap-feeling to snappy.
The checkout screen, finally
For a long time the actual checkout screen, the one thing this whole device exists for, was a stub. When I finally built it, I realized it wasn’t four separate screens. It was one state machine: scan items onto a running receipt, then branch off to cancel, look up an item by hand, or pay. Nothing touches the database until the sale is confirmed. Cancel or walk away before that and the cart just disappears, so a cancelled sale never leaves a row to clean up later.
My first try at adding an item without scanning was a number pad for keying in the price, like an old cash register. It died the same session. Picking the item off the catalog list the price check screen already had was simpler.
The other real lesson came from watching someone else use it. The person running the cart day to day isn’t going to figure out a button layout by feel. Smarter icons weren’t the fix. Spelling it out was. Every screen now has a legend along the bottom saying what each button does right now, in that button’s color. Delete also stopped silently removing the last thing scanned. It moves a visible cursor now, so delete always means the row you’re looking at.
The screen looked “off” the moment it lit up for real

Every color in this build was picked on a laptop, against a mockup, months before any of it hit the real display. On the actual screen the “black” background was blue-black, the green was pastel mint, and the red for cancel was closer to salmon than a stop sign.
None of those colors were ever really neutral or bold. They’d just never been looked at outside a code editor. The “black” was #1E1E2E, which has more blue in it than anything else. You can’t see that in three hex pairs, but you sure can on a whole screen of it. The green and red were soft accent colors doing a job that needed loud ones. Pay is green, cancel is red, and nobody should have to wonder if it’s more of a salmon. I switched to a neutral grey and a plain traffic-light pair, and every color after that got picked the same way: build it, then actually look at it.
Keeping real names out of the firmware
Once real people had to be in the system (the cart owner, badge numbers, a Venmo handle), the easy move was typing them right into the code. It would have worked right away. It’s also wrong. A name in the firmware ships in every compiled file, sits in the project history forever, and comes back on every reflash. The database already lives on the SD card, so people live there too, entered on the cart itself.
Right before the code went into version control I swept it one more time and found one leftover: a dev tool for loading test data, justified by “there’s no other way to get this onto the device yet.” That had stopped being true weeks earlier, so the tool came out. When the repo went public, the only names in it were Jane Doe and John Smith.
The QR code Venmo’s own app wouldn’t scan

The first real end-to-end payment test hit a funny snag. Venmo’s own scanner didn’t recognize the cart’s QR code at all. The link inside was completely right, right handle and right amount, which made it more confusing, not less.
Turns out Venmo’s in-app scanner only reads other Venmo users’ profile codes, not any QR code with a valid Venmo link in it. A plain phone camera doesn’t care. It reads the link and hands it to whatever app claims it, which is Venmo. Scanned with the camera, it went straight into a filled-in payment with the right amount and the right person. There’s now a small note under the code so nobody else has to figure that out the hard way.

Reverse-engineering the scanner one wrong guess at a time

The barcode scanner talks its own little binary protocol, and I had no usable manual. The first copy I found was a scan of a printed page with no searchable text. So I started from someone else’s open-source library, which was close enough to change real settings and wrong often enough to be dangerous.
The buzzer was the first clue. Turning it on and off worked, just backwards. The setting the library called “on” was silent and “off” beeped. Then settings that read back fine would quietly reset to factory defaults for no obvious reason. Reflashing seemed to keep them, until leaving the cart unplugged for a couple hours proved otherwise. Resetting the microcontroller doesn’t cut power to the scanner next to it, so every reflash had been lying to me about what a real power loss would do.
The break came from a tiny QR code printed on the scanner’s own circuit board for factory tracking. It pointed to the real manufacturer, whose actual manual explained everything the library had backwards or missing, including a “save to permanent memory” command the library never had. That manual kept paying off. Months later the settings screen confidently showed values I knew were wrong, and the manual’s own example showed why: every reply comes wrapped in a four-byte header, and the code had been reading the wrapper as the setting. The fix was one number. Skip four bytes, not zero.
Getting the scanner to mind its own business
Once the scanner was wired up it had a new problem: it’s always watching. Its light and aiming laser fired at anyone who walked past an idle cart. My first thought was a small hardware switch to cut its power. There was a documented “deep sleep” command that looked like the same thing in software, right up until I waved a hand in front of the supposedly sleeping scanner and it lit right back up. It wasn’t asleep. It was idling with a better name. The real fix was a setting I was already using that controls whether it’s watching at all. Off on the screensaver, back on when it wakes. No new parts, nothing to solder.
That held until there were a dozen more screens (admin menus, settings, games) that left the light on anyway. Worse, a stray scan on most of them fell through to the front screen’s badge lookup, so wandering into the wrong menu with a badge in hand could yank the cart into somebody’s checkout. Every screen already sets up its buttons through one shared function, so now that function also decides whether the scanner should be listening.
One more trap turned up along the way. The scanner sends a little acknowledgment after every on or off command, and the old code only cleaned it up in one direction. Left alone, the “off” reply would have been read as somebody’s badge.
Making the admin side safe to walk away from

Scanning an admin’s badge used to jump straight into the admin tools every time. Convenient, until you notice an admin could never just buy a snack. Now admin access is its own step: press a button, then scan. Walking away logs you out on its own.
The menu outgrew a flat list, so it became six folders (Balances, Inventory, Users, Web Portal, Settings, Advanced Tools) instead of an endless scroll or text shrunk down to unreadable. Lists sort alphabetically, and people sort by first name, because that’s how the owner thinks of everyone on the unit.
One snag worth remembering: the plan was a screen to edit a person’s name, admin flag, status and balance. But balance has never been a stored number. It’s the sum of whatever transactions haven’t been marked paid. Making it editable would mean a second balance that can drift away from the real one. So it shows on screen, calculated fresh, and you clear it one transaction at a time.
Giving the screensaver fish somewhere to swim

The screensaver fish “dances.” It flips between facing left and right on a fixed sixteen-beat pattern, like it can’t decide which way to go. It also did all of that in one spot. The dance was cute. The standing still wasn’t. So it got a wander on top: every beat it flips a coin on moving forward, rolls again to drift up or down, and stays inside an invisible box set in from the edges.
One oddity. When the fish wandered into the bottom-right corner, a thin grey bar showed up along the bottom of the screen. It was a scrollbar. The fish trails bubbles from its nose, and down in that corner one bubble would spawn a single pixel past the edge of the screen. The graphics library noticed, and being helpful, offered a whole scrollbar so you could go rescue it. Nothing on that screen was ever meant to scroll, so the fix was to tell it that, once.
Turning the WiFi radio off until it’s needed

The web portal had been broadcasting its own WiFi network from the moment the cart booted, used or not. Fine on a workbench, not something to ship. The fix was nearly free: the only thing turning the radio on was one line at startup, so that line moved to “an admin just opened the Web Portal screen.” Leave the screen and the radio shuts off. It comes up faster than a phone opens its WiFi settings, so it doesn’t feel like a wait. The screen shows the network name, password and a QR code for the page, so nobody has to type anything on a phone.
A stopgap clock, then the real one

I thought about skipping a hardware clock. Then I pictured the owner going weeks between admin logins, with the cart losing power somewhere in there, and decided timestamps matter here. I grabbed a DS3231 I had on hand, which was the wide package, and I didn’t have an adapter for it. So it’s on a narrower adapter with a couple of unused pins hanging off the end. Ugly, works.
Until it was wired, a manual Set Clock screen filled in, where you dial in the date and time by hand. It was built on the same plumbing the real chip would use, so nothing else had to change later. When the chip did go in, a couple of the planned pins were unusable on this exact board. One wasn’t broken out at all, and the other was already driving an onboard LED I hadn’t accounted for. So it moved to two neighbors.
Then the test that actually mattered: a long power-off, not a quick unplug and replug. It came back knowing what day it was. The Set Clock screen stayed, demoted from “the only clock there is” to “how you fix drift.”
From breadboard to enclosure

Up to here everything lived on a breadboard, where a wire in the wrong spot just gets moved. The enclosure started as test fits: a button plate and a screen bezel, printed and textured to check the look before committing to a whole box.

The original plan was a walnut body with a few 3D-printed parts where needed. What I built flipped that completely: a fully printed PETG shell, about 350 grams of it. Something with buttons on top gets pushed, so the base has about two pounds of steel shot set in deep-pour epoxy. That keeps it from tipping forward every time someone presses Enter with feeling. Then plastic primer and textured paint to hide the layer lines a glossy finish would show off. A side cutout lets the SD card in and out without opening the case, and a couple of vent holes keep the electronics from slow-cooking in a sealed plastic box.

The bottom got feet made of black hot glue, drawn on in lines. It grips better than foam pads, and since it’s just lines of glue, those lines might as well be the mascot fish and a few bubbles. Nobody will see it unless they flip the cart over, which is the right audience for it.

Soldering it all for real came out a little different from the plan, like it always does. The scanner landed one pin over from where the firmware expected it, the direction pad came out with up/right and down/left swapped, and the clock line was off by one too. None of it was worth desoldering. Pin numbers are just numbers, so I fixed it in software.
Two new parts went on the power input: a resettable fuse sized above the worst-case draw (WiFi transmitting and the scanner firing at the same time), and a bulk capacitor to soak up those same spikes before they sag the supply and reset the board mid-sale. Both are sized off datasheet numbers, not a meter. Good enough to build around, and the manual says so.

A screen that couldn’t be nudged
With the case done, the screen didn’t quite line up with its window. A few pixels off on two edges. The obvious fix was to shift the whole image over a few pixels in software. It crashed the instant I tried it. The display chip only understands positive coordinates, and the header sits in the top-left corner of every screen, so “a few pixels left” meant asking it to draw somewhere that doesn’t exist.
What worked was the opposite of clever: don’t move the picture, shrink it. Five pixels off two edges is a sliver nobody will notice, and it can’t make a coordinate the chip doesn’t understand, because it still starts right where it always did.
The database library that quietly says no
This one’s more of a running theme than one bug. The SQLite library that fits on this chip is older than the SQLite most of the world uses, and it has a habit. When it doesn’t support something, it often doesn’t fail. It just does nothing and reports success.
The first time, some catalog items just never got added. The same SQL worked on a laptop, but the cart’s library predates “insert this, or update it if it already exists” as one statement. Then a new “hide this product” feature crashed the cart on its first test. The step that adds a column to an existing table ran without complaint, and the column wasn’t there. A test on a blank card later found the same missing column on a brand-new table, which meant a fresh cart would have shown an empty product list forever. That column is now built in from day one.
Number four was the database’s own integrity check, which also does nothing here. Number five showed up the last week: a normal query in the boot-time data check got refused, and the check counted “couldn’t ask” as “found a problem,” raising an alarm on a card with zero sales on it. That’s five features this library has politely declined to support.
So now when something touching storage “does nothing” instead of failing, I stop debugging the code and go look at what’s actually on the card. The cart does a version of that itself, logging a warning at boot if a database change didn’t take.
Three ways to pay, and letting the apps do the typing
Venmo was the only way to pay from the first real payment on. Ship week added Cash App and Zelle, which were very different problems.
Cash App was easy. Its links can carry an amount, so its QR code fills in the total just like Venmo’s. It can’t carry a note, which is fine, since non-Venmo payments just get matched by amount and time.
Zelle has no public payment links at all. Its QR codes get made inside each bank’s app. People online have worked out the format, so I built one from a phone number. The bank app rejected it, and every published example I could find used an email, never a phone number. Instead of guessing more, the cart now does the obvious thing. Every one of these apps has a “my QR code” screen, so you scan your own code into the cart. For Zelle, the cart stores the bank’s code exactly as scanned and shows that same code to customers. No format left to guess, because it’s literally the bank’s own code. Plus, nobody ever has to type a username on a six-button keypad.
The web portal, rebuilt for a phone
The web admin pages started as wide tables of editable boxes. Fine on a laptop, miserable on a phone, which is what an admin actually has on them. So I rebuilt them page by page: one line per product with name, price, stock and ±1/±10 buttons, tap-to-toggle pills for admin and active, and “Paid? Yes / No” right there when clearing a balance.
Reading the old code first turned up two real bugs. The five-minute auto-logout fired while an admin was busy on their phone (nobody was touching the cart’s buttons, after all) and left the WiFi running. And the “Clear Selected” confirmation was attached somewhere browsers ignore, so it never asked.
The web login came out entirely. Getting to the portal already takes an admin badge plus the WiFi password. In its place is one rule: the admin who opened the portal can’t demote, deactivate or delete themselves, so the cart can never end up with no admins.
The last web feature was Excel reports, on a device with no room for a spreadsheet library. But a modern Excel file is just a zip of a few text files, and zip lets you skip compression, which skips the hard part. So the cart writes one straight onto the SD card and hands it to the phone. Three tabs, currency formatting, bold headers. The one bug: the web server library quietly adds its own “this is a download” header, the cart added a second, and Chrome refuses those outright.
Extras: a fish that flaps and a box that tilts
The owner asked for games. I don’t know what they pictured, but what they got was a start screen button labeled “Extras.”
The first one was Laggy Fish. It works with a limit instead of fighting it: this display redraws at maybe ten frames a second, which kills almost any game, so the game is about steering a sluggish fish on purpose, QWOP-style. Two days before launch a coworker said “Flappy Bird,” and it got torn down to the studs and rebuilt as exactly that. Same fish, same name, same joke.
The fish sprite was over a third of the screen wide, so a script shrank it to 48×32 and thickened the outline so it didn’t vanish. Fast taps could start and end inside one frame and get missed, so this game alone gets a hardware interrupt that catches every press. And the lag sped up and slowed down with how much pipe was on screen, so it runs on its own fixed clock now. Still chunky, which is the joke, but the same chunky every frame. High scores save to whoever scanned in.
A sliding block puzzle had been on the list early and got shelved over one question: how do you know a random board can actually be solved? A shooter called Castle Defense took its slot, picked because any random board was fair. It never really clicked, so two days before launch it got replaced by the puzzle after all, with a twist. Every press tilts the whole box, and every block slides as far as it can at once, like tipping a tray. Get the red block out through the gap. It’s called Slide Free.
The tilt also answered the old question. Each press has only four outcomes and everything piles up against a wall, so a board can only reach a few hundred to a few thousand layouts, and a little Python tool on the PC can visit every one of them in a fraction of a second. Unsolvable boards never ship.
Solvable isn’t the same as hard, though. “Fewest moves” was my first guess, and it falls apart fast: ten moves with one way through is hard, ten moves with forty ways to win is easy. So I went looking for research instead of making up a formula, and found Jarušek and Pelánek, who watched people spend hundreds of hours on puzzles like this. For puzzles where moves can’t be undone (a tilt can’t), the best predictor was a simulated person who presses fairly randomly when lost and more carefully near the answer. The tool scores every board that way, plus a reset button, which a real person hits the moment things get worse. The boards live on the SD card in five tiers of a hundred, and the cart logs how each one goes, so the fake player can be tuned against real ones someday.
The fix that caused the bug it was fixing
Ship week opened with a small complaint. Opening the item lookup list didn’t just open it. It opened and immediately jumped down a page, like the button got pressed twice. Building that list takes the cart a moment, and the hold-to-repeat timer was counting that moment as time the button was held, then firing a second press into the new screen.
The fix was to start the hold timer after a screen finishes loading. It went out, and the next report was weirder: opening the Users menu now skipped right past it into “Add User.” The fix compared a timestamp taken before the screen loaded against one taken after, got a negative number, and because of how that kind of number wraps around, read it as a huge hold. Now every press fired twice, instantly. One missing line fixed both for good. I trust easy fixes a drop less now.
The backup that could have erased itself
On launch day the whole codebase got one last read-through, looking for anything that could hurt after handoff. The best find was in the backups. Every boot, the cart copies its database to a backup, and restores from it if the database is damaged. But a missing database doesn’t look damaged. The library just creates a new, empty one, which passes every check, and then the boot backup copies that empty one over the good one. Lose one file and both copies are gone.
So now boot asks one question before backing anything up: does this database have an admin? A real one always does. That fix led to a bigger one the same afternoon. Boot now reads every row of every table (since the built-in integrity check is, of course, one of the five things that does nothing), keeps five rolling backups instead of one, compares each copy byte for byte before it replaces anything, and flat out refuses to back up a database that fails. The splash screen just stays up a little longer, so all that paranoia looks like a logo.
Since boot was checking things anyway, it now checks everything else that would otherwise fail silently, and writes it to a boot log:
- Why the chip last restarted. A brownout shows up in plain text, which tells you if the power supply and capacitor are keeping up.
- A dead clock battery.
- A scanner that never answered.
- A jammed button.
- Sales whose totals don’t add up.
- How long an SD write takes, since a wearing card tends to slow down before it dies.
Anything wrong shows as a yellow line on the Admin Menu, where customers never see it.
A manual you can hold

The last thing the cart needed wasn’t code. The owner wanted a real manual someone else could run the cart from. Not two hundred pages, just proper documentation. It came out at eleven pages, written from the firmware itself instead of from memory: every button and screen, every alert and what to do about it, how the backups work, how to recover onto a new card, and a power budget for each state the cart can be in. It averages about a watt, roughly ten cents of electricity a month. Those numbers come from datasheets, and it says so. It’s in the Docs tab.
The first cover drawing was based on the original enclosure sketch, a tall narrow box with the screen above the scanner. The real thing is wide, with the screen on the left and a yellow diamond of buttons on the right. So it got redrawn from a photo, which also caught the manual’s layout description copying the same old sketch.

Then it became an actual book. Printed as a booklet, two pages to a side, folded, and stapled down the middle with three staples. A folded stack never lines up at the open edge, so it went through a paper trimmer, and a corner-rounding punch finished it off.

It sits next to the cart now. Round corners and everything.

Launch, and since

It went live Sunday, October 4. Scan a badge, scan snacks, pay by Venmo, Cash App or Zelle from a QR code on the screen. Where it stood on launch day:
- It had run for a week straight. Pulling the power mid-save lost that one sale and damaged nothing. Pulling the SD card landed on a clear error screen that recovered once the card went back in.
- A blank SD card can be set up from scratch on the cart itself, no computer needed.
- The production card started clean: real people, the real catalog, real payment accounts, and transaction numbers starting at #1.
- The web portal can download the whole database, so a dead SD card is a two-minute recovery instead of a morning of re-entering everything.
- The scanner’s setup-code feature is off, so nobody can reconfigure it by scanning a special barcode.
Launch day had no problems. A month and change in, the count is two minor bugs and one feature request. Those will get flashed in at some point, probably whenever I get bored.
Still on the list: link barcodes for the rest of the products, count the real stock, get an actual meter reading on the power draw, and someday write stories for the choose-your-own-adventure engine that got built and then pulled from the launch build until there’s a story worth running on it.
The full source is on GitHub if you want to dig in.