Skip to main content
Version: FILS English

Cash Counting Machine

A device that would count stack of banknotes and display the sum.

info

Author: Oleksandr Kozoriz
GitHub Project Link: https://github.com/UPB-PMRust-Students/fils-project-2026-sanyaswee

Description

A simplified version of a cash counting machine, where the user would place a stack of banknotes in it and enter the value of one banknote. The machine would pull the banknotes one by one with a roller, count them using a beam interrupt sensor, and display the total sum.

Motivation

It is quite interesting for me to build something that brings code to a physical world. I had no prior experince in embedded development, and this subject was a discovery for me. Seeing your code being executed in a real world is something facinating, and I am quite sure this project won't be my last one. Regarding this idea - it was the first one that came to my mind and was not done before, so - that's it!

Architecture

The user would place a stack of banknotes into the dedicated compartment. Then they would input the value of one banknote. After pressing the start button, the motor would pull the bottom banknote into a narrow slit, then, employing the gravity, the banknote would trigger the beam interrupt sensor, thus, increase the counter. If after a certain amount of time nothing triggers the sensor, the motor would stop. The front panel would feature the display, which would show the total sum along with the current value of one banknote; and a bunch of buttons, such as start, clear (set the counter and sum to 0), number inputs and preset banknote values (10/20/50/100 etc).

Potential design

Log

Week 6

I have ordered all of the components, waiting for them to arrive.

Week 7

All of the components have arrived, and I decided to build an MVP prototype fully on breadboard, without the screen and actual pulling mechanism, just the logic.

Breadboard MVP

There were some issues, such as elecric noice generated by the spining motor interfering with the sensor signals. I had to add a capacitor and also filter the pulses in software, for now everything works fine.

So I've finished the coding part, added a bit of concurrency and it works as expected, now, I am ready move on to the most important part - the actual pulling mechanism.

Week 8

To be continued...

Hardware

The "brain" of the system is STM32 microcontroller and the "eyes" of the system is IR beam interruption sensor.

The sensor has 3 terminals: Vcc, GND and OUT. OUT is high by default, and the sensor pulls it low only if there is something on the way of the beam (e.g. banknote)

Other main components are the LCD display, that is used as the information output; DC motor and driver, for pushing the banknote on the way of the sensor's beam; and the buttons for user interaction.

Hardware schematic

Schematics

Place your KiCAD or similar schematics here in SVG format.

Bill of Materials

DeviceUsagePrice
STM32 Nucleo-U545RE-QThe microcontroller~130 RON*
Mini Infrared Interruption Sensor ModuleDetection of the passing banknote6.99 RON
1602 LCD with Blue Backlight 3.3 VThe main display19.99 RON
DC MotorPulling the banknotes into the slit3.99 RON
L293D Motor DriverThe motor driver3 RON
18 mm Rubber WheelThe roller5 x 0.89 RON
2x150 mm ShaftThe shaft for the roller1.95 RON
2x50 mm ShaftShaft extention0.95 RON
2 mm to 2 mm Coupling HubShaft connections2 x 5.99 RON
Miniature Ball Bearing (2 mm Internal Diameter)Shaft support2.89 RON
4x4 Push Button Keyboard MatrixUser input3.99 RON
Red Button with Round CoverStart / Reset buttons2 x 1.99 RON
Breadboard HQ (830 points)Prototyping9.98 RON
Breadboard Jumper Wires SetWiring7.99 RON
10 cm 10p Male-Female WiresWiring8 x 2.99 RON
CardboardCAD (Cardboard Aided Design)4.40 RON

*was borrowed from the lab

Software

LibraryDescriptionUsage
embassy-stm32Hardware Abstraction Layer for STM32 microcontrollersControlling GPIOs and extrenal interrupts (EXTIs)
embassy-syncSynchronization primitives with async supportMutexes and Watches for accessing the counter value
embassy-timeInstant and Duration for embedded no-std systems, with async timer supportDebouncing and other timers
embassy-executorasync/await executorSpawning the processes
embassy-futuresUtilities for working with futuresAwaiting results from multiple processes
defmtLogging framework for resource-constrained devicesDebug & Logging
defmt-rttdefmt log messages over the RTT protocolDebug & Logging
panic-probePanic handler that exits with an error codeAddressing errors
cortex-m-rtMinimal runtime / startup for Cortex-M microcontrollersEmbassy dependency
hd44780-driverDriver HD44780 compliant displaysDisplaying the output
embedded-halHardware Abstraction Layer for embedded systemsDisplay driver's dependency
  1. Currency-counting machine
  2. The Rust Book
  3. Embassy