You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/versioned_docs/version-fils_en/project/2026/oleksandr.kozoriz/index.md
+39-10Lines changed: 39 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,21 +77,49 @@ Nevermind, forget it, the double feed is not the final boss, the final boss turn
77
77
From the software point of view, the logic is now reversed: we wait for rising edge, not for the falling one. With the new logic applied, due to motor vibration paper pendulum creates insane amount of false-triggers, so my next goal is to reconsider the pendulum material and position in order to minimize them. Increasing the debouncing interval may also resolve the issue.
78
78
79
79
### Week 12
80
-
To be continued...
80
+
I've made the new pendulum out of PET plastic, it works great. However, the false triggers still occur because the new logic is applied. The motor generates a lot of electromagnetic noice and voltage spikes. I've already defeated the voltage spikes with a 100nF capacitor, but for the case [EMI (elecromagnetic interference)](https://en.wikipedia.org/wiki/Electromagnetic_interference), I've just filtered the impulses in software, assuming that if the duration of a signal was less then 2ms it was coming from the motor, not from the sesor.
81
+
82
+
For the old falling-edge logic it worked fine: `noice impulse` -> `EXTI falling edge` -> `sleep for 2ms` -> `check if the GPIO is still low`, wich would immediately rise back to high after the noice is gone.
83
+
84
+
However, now, with a mechanical flag banknotes tend to jam or to get stuck in the slit from time to time, which keeps the sensor output high for a longer period of time. `noice impulse` -> `EXTI rising edge` -> `sleep for 2ms` -> `check if the GPIO is still high`, which is the case because the banknote is still there. Theoretically that issue could also occur with the old logic if the banknote got stuck in the slit, but on practice it only occured with the rising edges.
85
+
86
+
To address this, it would be better to physically reduce the noice rather than make some complex filtering algorithms. After some research I found out that communication cables utilize a [twisted pair](https://en.wikipedia.org/wiki/Twisted_pair) to fight the elecromagnetic radiation. So I twisted the `motor<--->diriver` wires and the `sensor<--->breadboard` wires, and it actually helped a lot.
87
+
88
+
I took a stack of 10 lei banknotes and decided that it is time for the first benchmark:
89
+
| # | Outuput |
90
+
|---|---------|
91
+
|**Expected value**|**150**|
92
+
|**1**|**150**|
93
+
| 2 | 140 |
94
+
|**3**|**150**|
95
+
| 4 | 130 |
96
+
| 5 | 120 |
97
+
| 6 | 140 |
98
+
| 7 | 130 |
99
+
|**8**|**150**|
100
+
| 9 | 130 |
101
+
| 10 | 130 |
102
+
103
+
There are no cases where the outuput is greater then 150, meaning that false triggers do not occur anymore. Therefore I consider EMI to be defeated by now, and for the rest of the values, the error is coming from the double feed.
104
+
105
+
For the double feed, I glued up 3 sponges on the slit: 2 with insulating strip underneath for straightening the banknotes, and one with a toothpick sticked into it, acting as adjustable physical gate. After playing around with the toothpick and calibrating the debouncing configuration it works percise enough for now.
81
106
82
107
### Week 13
83
-
To be continued...
108
+
I've finally mounted everything into the structure, and replaced external 830p breadboard with 3 small internal breadboards.
84
109
85
-
### Week 14
86
-
To be continued...
110
+

111
+
112
+
A few software tweaks, and thats it, the project is finished!
87
113
88
114
## Hardware
89
115
90
116
The "brain" of the system is **STM32 microcontroller** and the "eyes" of the system is **IR beam interruption sensor**.
91
117
92
118
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)
93
119
94
-
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.
120
+
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 and keypad for user interaction.
121
+
122
+
The initial plan was then the banknote would just fly through the sensor slit, however there was an issue with Romanian Lei banknotes: the polymer simply did not block the beam, so the sensor did not react to them at all. It worked fine with other currencies, but since I want this machine to be universal, I slightly changed the architecture: the banknote bumps into a piece of plastic, that moves a bit in the sensor slit and immediately returns to it's previous position. This creates a rising edge that gets handled by the STM.
95
123
96
124

97
125
@@ -123,13 +151,13 @@ The format is
123
151
|[2x50 mm Shaft](https://en.wikipedia.org/wiki/Shaft_(mechanical_engineering))| Shaft extention | 1 |[0.95 RON](https://www.optimusdigital.ro/en/metal-axes/312-ax-metalic-2x50-mm.html)|
124
152
|[2 mm to 2 mm Coupling Hub](https://en.wikipedia.org/wiki/Coupling)| Shaft connections | 2 |[5.99 RON](https://www.optimusdigital.ro/en/coupling-hubs/451-2mm-to-2mm-coupling-hub.html)|
125
153
|[Miniature Ball Bearing (2 mm Internal Diameter)](https://en.wikipedia.org/wiki/Bearing_(mechanical))| Shaft support | 1 |[2.89 RON](https://www.optimusdigital.ro/en/bearings/402-rulment-in-miniatura-cu-diametru-interior-2-mm.html)|
|[hd44780-driver](https://github.com/JohnDoneth/hd44780-driver)| Driver HD44780 compliant displays | Displaying the output |
151
180
|[heapless](https://github.com/rust-embedded/heapless)|`static` friendly data structures that don't require dynamic memory allocation | Displaying strings on the LCD properly |
0 commit comments