Skip to content

Commit 393e895

Browse files
authored
Project/oleksandr.kozoriz (#1314)
* Started log for W12 * Log * Hardware update (potentiometer) * Update hardaware list * Week 12 log * log
1 parent 48d7601 commit 393e895

3 files changed

Lines changed: 40 additions & 11 deletions

File tree

17.6 KB
Loading

website/versioned_docs/version-fils_en/project/2026/oleksandr.kozoriz/index.md

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,49 @@ Nevermind, forget it, the double feed is not the final boss, the final boss turn
7777
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.
7878

7979
### 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.
81106

82107
### 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.
84109

85-
### Week 14
86-
To be continued...
110+
![Final Hardware](final_hardware.webp)
111+
112+
A few software tweaks, and thats it, the project is finished!
87113

88114
## Hardware
89115

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

92118
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)
93119

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.
95123

96124
![Hardware schematic](hardware.webp)
97125

@@ -123,13 +151,13 @@ The format is
123151
| [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) |
124152
| [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) |
125153
| [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) |
126-
| [4x4 Push Button Keyboard Matrix](https://www.electronicwings.com/sensors-modules/4x4-keypad-module) | User input | 1 | [3.99 RON](https://www.optimusdigital.ro/en/touch-sensors/2441-tastatura-matriceala-4x4-cu-butoane.html) |
154+
| [4x4 Keypad](https://www.electronicwings.com/sensors-modules/4x4-keypad-module) | User input | 1 | [22.50 RON](https://www.conexelectronic.ro/senzori-si-module-pentru-platforme-de-dezvoltare/16456-TASTATURA-16-TASTE-MEMBRANE-SWITCH.html) |
127155
| [Button with Round Cover](https://en.wikipedia.org/wiki/Push-button) | Start / Reset / Edit buttons | 3 | [1.99 RON](https://www.optimusdigital.ro/en/buttons-and-switches/1114-red-button-with-round-cover.html) |
128-
| [Breadboard HQ (830 points)](https://en.wikipedia.org/wiki/Breadboard) | Prototyping | 1 | [9.98 RON](https://www.optimusdigital.ro/en/breadboards/8-breadboard-hq-830-points.html) |
129-
| [Breadboard Jumper Wires Set](https://en.wikipedia.org/wiki/Jump_wire) | Wiring | 1 | [7.99 RON](https://www.optimusdigital.ro/en/wires-with-connectors/12-breadboard-jumper-wire-set.html) |
130-
| [10 cm 10p Male-Female Wires](https://en.wikipedia.org/wiki/Jump_wire) | Wiring | 2 | [2.99 RON](https://www.optimusdigital.ro/en/wires-with-connectors/650-fire-colorate-mama-tata-10p.html) |
156+
| [10K Potentiometer](https://en.wikipedia.org/wiki/Potentiometer) | Adjusting the LCD contrast | 1 | [2.39 RON](https://www.optimusdigital.ro/en/potentiometers/12360-10k-wh148-variable-resistor-without-washer-and-nut.html) |
157+
| [Mini Breadboard](https://en.wikipedia.org/wiki/Breadboard) | Wiring | 3 | [2.19 RON](https://www.optimusdigital.ro/en/breadboards/248-syb-170-colored-mini-breadboard-green.html) |
158+
| [Jumpers, Resistors, Capacitros etc](https://en.wikipedia.org/wiki/Electronic_component) | Basic electronics | - | [~20 RON](https://www.optimusdigital.ro/en/) |
131159
| [Cardboard](https://en.wikipedia.org/wiki/Cardboard) | CAD (Cardboard Aided Design) | 1 | [4.40 RON](https://www.dedeman.ro/ro/cutie-depozitare-din-carton-ctft-435-420-x-330-x-210-mm/p/1045878) |
132-
| **Total** | | | **224.50 RON** |
160+
| **Total** | | | **~250 RON** |
133161

134162
*was borrowed from the lab
135163

@@ -146,6 +174,7 @@ The format is
146174
| [defmt](https://github.com/knurling-rs/defmt) | Logging framework for resource-constrained devices | Debug & Logging |
147175
| [defmt-rtt](https://github.com/knurling-rs/defmt) | defmt log messages over the RTT protocol | Debug & Logging |
148176
| [panic-probe](https://github.com/knurling-rs/defmt) | Panic handler that exits with an error code | Addressing errors |
177+
| [cortex-m](https://github.com/rust-embedded/cortex-m) | Low level access to Cortex-M processors | Embassy dependency |
149178
| [cortex-m-rt](https://github.com/rust-embedded/cortex-m) | Minimal runtime / startup for Cortex-M microcontrollers | Embassy dependency |
150179
| [hd44780-driver](https://github.com/JohnDoneth/hd44780-driver) | Driver HD44780 compliant displays | Displaying the output |
151180
| [heapless](https://github.com/rust-embedded/heapless) | `static` friendly data structures that don't require dynamic memory allocation | Displaying strings on the LCD properly |

website/versioned_docs/version-fils_en/project/2026/oleksandr.kozoriz/kicad.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)