ELCO-Dealer
Arduino Mega project for an automatic card dealing and shuffling machine. The system controls a mechanical assembly with four DC motors, three digital card-pass sensors, a Hall effect sensor for the HOME reference position, and a wired LCD Keypad Shield interface.
Supplies
Components:
- Arduino Mega 2560 R3 - 1
- L298N Motor Driver - 2
- DC Motor - 4 (2 motors per driver)
- RPM sensor - 3 (card detection sensor)
- Hall magnetic sensor - 1
- LCD Keypad Shield - 1
- Magnet - 6
- 9V battery - 1
- 9V battery clip to DC barrel jack connector - 1
Electrical Design
First, we will make the electrical connections according to the schematic. We will look up each component’s datasheet to identify the required pins for each one.
Pin connections implemented in our code in Step 3:
| Elemento | Pin |
|---|---|
| LCD D4, D5, D6, D7 | 4, 5, 6, 7 |
| LCD RS, EN, backlight | 8, 9, 10 |
| LCD keypad | A0 |
| L298N #1 ENA, ENB | 11, 12 |
| L298N #1 IN1, IN2, IN3, IN4 | 22, 23, 24, 25 |
| L298N #2 ENA, ENB | 2, 3 |
| L298N #2 IN1, IN2, IN3, IN4 | 26, 27, 28, 29 |
| Card sensors 1, 2, 3 | 30, 31, 32 |
| HOME Hall sensor | 33 |
Coming Up With the Mechanical Design
Once the electrical design is complete, begin with the mechanical design.
For this project, three card-ejection parts are required: two for the shuffling mechanism and one for dealing. The dealing component can use the same structure as the shuffling ones, but with the card ejection direction reversed.
In addition, two base parts and one lazy Susan component must be printed, along with six card-ejection wheels, three wheels for rotating the lazy Susan system, and another six wheels that act as stoppers.
Flowchart Design and Code Implementation
We design the flowchart that will be implemented in code.