Introduction: EAL - Embedded - Coin Sorting Machine

About: Studying at UCL in Odense, Denmark - The group consists of the following three members: Rasmus - Julian - Jonas -

First of lets start with a video of how the machine works:

The coin sorter/counting machine is a school project, made by three students at Lillebælt Academy in Denmark. After brainstorming for good ideas for this project, we came up with the idea of making a fairly simple coin sorting/counting machine.
The sorting of the coins actually contains no mechanical parts, as this is done by gravity, when you put coins into the machine. When a coin is put into the machine, it will slide down a long piece of cardboard (which almost the entire machine is made of). On this piece of cardboard, there has been cut five holes. Each hole has been cut, so only one type of coin will fit into it. Immediately after the coin has gone through the hole, a sensor will detect the coin, after which the value of the coin will be stored in a variable in the Arduino Mega. The coin will then fall into a separation chamber, where it can be picked up.

Components and materials used for this project:

- Arduino Mega 2560 5 x TRCT5000 reflective sensor

- Cardboard Coins

- 20 x jumperwires Breadboard

- 4 x 220 ohm resistors

- 4 x 4,7k ohm resistors

- Glue gun

- Cutter knife

The process of making the machine consists of four major steps:

Step 1: Measuring

In this step the only thing you’ll need is cardboard, something to draw with, a ruler to measure with, and plenty of skill handling these items. What you’ll do, is make a blueprint of the different parts, the machine is going to consist of, simply to gain a general idea of how the machine works. Then go on to size up the blueprint on cardboard, which is now ready to be cut.

Step 2: Cutting and Gluing

Now cut the parts, and start gluing them together. Be careful not glue it all together at once, as you’ll need space, for putting in and configuring the Arduino and sensors.

Step 3: Adding Arduino

It’s now time for gluing on the five sensors to the bottom part of the slider, which the coins are going to slide down on, and finally connect these to the Arduino Mega 2560, which can be quite difficult.

Step 4: Coding

The final step of this project is the code, as all the hardware now should be ready for use, if assembled correctly.

The code made for the Coin Sorter isn't too complicated, as you'll see. The information we need to fulfill the end goal of this project, is to know how many coins of each kind, that has been put into the machine, and the total value of these coins. This basically means that we only have one process, which is repeated five times: one for each kind of coin and sensor, which is obvious when reading the code. We therefore need to know how many times each sensor has detected a coin, and how many kroner these coins represent.

const int tcrtPin1 = 2; //TCRT-5000-sensor which is connected to pin 2

int tcrtState = 0; //tcrtState contains the status of the TCRT-5000-sensor

int enkrone = 1; //Variabel which contains the value of one single krone coin

int resultat = 0; //Variabel which contains the total value of the sorted coins

void setup() {

pinMode(tcrtPin1, INPUT);

digitalWrite(tcrtPin1, HIGH);

void loop() {

tcrtState = digitalRead(tcrtPin1); // Checks if the sensor detects any coins

if (tcrtState == LOW) { // If the sensor detects any coins then: tcrtState=0/LOW

int resultat = resultat + enkrone;

Serial.print(”Resultat = ”);





The entire code can be downloaded here:

Step 5: Limitations

The Coin Sorting Machine has it’s


· A coin may slide further down the slide, making it fall through a different hole than intended. This activates the wrong TCRT5000 sensor, for instance making the machine count a 1-krone as a 10-krone.

· In certain conditions, the TCRT5000 will not register the coin going through the slot properly, thus not counting up in the register.

· If you move the machine to a different spot that is not level, the slide might not work, since the angle changes, making a coin either get stuck or not complete it’s way down the coin slide.

If we were to make a new/better version of this machine, we’d laser cut the entire thing, not just the slide, which would make the whole machine fit together better and be faster to make, rather than cutting it manually. But that would require access to a laser cutter. If you do not have access to that kind of machine, foamboard will do.