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
An autonomous ball launcher for dogs that detects the pet's position using a PIR sensor,
4
-
rotates a motorized turret toward it, and launches a tennis ball using a dual-flywheel mechanism.
3
+
An autonomous ball launcher for dogs that detects the pet's position using a PIR sensor, rotates a motorized turret toward it, and launches a tennis ball using a dual-flywheel mechanism.
5
4
6
5
:::info
7
6
@@ -14,119 +13,111 @@ rotates a motorized turret toward it, and launches a tennis ball using a dual-fl
14
13
15
14
## Description
16
15
17
-
The Smart Pet Ball Launcher is an embedded device designed to play fetch autonomously with a dog.
18
-
The system waits in low-power sleep mode until a PIR motion sensor detects the pet. Once detected,
16
+
The Smart Pet Ball Launcher is an embedded device designed to play fetch autonomously with a dog. The system waits in low-power sleep mode until a PIR motion sensor detects the pet. Once detected,
19
17
the turret (mounted on a 3D-printed rotating base with a bearing) sweeps to locate the animal.
20
-
When the dog returns the ball and places it in the loading tube, an HC-SR04 ultrasonic sensor
21
-
confirms the ball is present at the launch gate. A SG90 servo then lifts the gate, releasing the
22
-
ball between two counter-rotating brushless motor flywheels which propel it toward the pet. A OLED display shows the current system state and game mode. Three game modes are stored in the STM32U5 Flash memory: Random, Training, and a failure-detection sleep mode. Session statistics (number of throws, average return time) are logged and exposed via UART.
18
+
When the dog returns the ball and places it in the loading tube, an HC-SR04 ultrasonic sensor confirms the ball is present at the launch gate. A dual MOSFET module then triggers an electromagnetic solenoid piston (JF-0530B) that releases a spring-loaded arm, allowing the ball to drop between two counter-rotating brushless motor flywheels which propel it toward the pet.
19
+
An OLED display shows the current system state and game mode. Three game modes are available: Random, Training, and a failure-detection sleep mode. Session statistics (number of throws, average return time) are logged via UART using defmt.
23
20
24
21
## Motivation
25
22
26
-
Pets need regular physical activity, but owners are not always available to play with them.
27
-
Existing commercial ball launchers use fixed angles and have no awareness of where the animal
28
-
actually is. This project builds a device that actively tracks the pet using a PIR sensor,
29
-
adapts its aim using a servo turret, and features intelligent game modes that grow with the
30
-
animal's ability.
23
+
Pets need regular physical activity, but owners are not always available to play with them. Existing commercial ball launchers use fixed angles and have no awareness of where the animal
24
+
actually is. This project builds a device that actively tracks the pet using a PIR sensor, adapts its aim using a servo turret, and features intelligent game modes that grow with the animal's ability.
- Tested SG90 servo gate control via PWM (TIM3_CH1).
41
+
- Integrated SH1106 OLED driver (custom, no external crate) with real-time state display
64
42
65
43
### Week 12 - 18 May
44
+
- 3D printed supports for both servo motors, one glued to the tube, the other to the project support, for better resistance.
45
+
- Changed the infrastructure of the wheels, placing them with a spring between them to adapt to the ball and for better ball-wheel adhesion.
46
+
- Implemented MG996R turret sweep logic and PIR-based angle locking.
47
+
- Integrated ESC arming sequence and brushless motor control (TIM1_CH1, TIM8_CH2).
66
48
67
49
### Week 19 - 25 May
50
+
- Encountered a problem with the servo motors: connecting them directly from the STM32 board caused them to burn out due to insufficient current. Solution: powered each servo separately
51
+
through a dedicated MP1584EN DC-DC step-down module from the 12V supply.
52
+
- Replaced the SG90 gate servo with a dual MOSFET module + electromagnetic solenoid piston (JF-0530B, 12V) for more reliable and faster ball release. The MOSFET gate is controlled via a GPIO output on PB4 — no PWM required.
53
+
- Implemented the complete state machine: Stopped, WarmUp, WaitBall, WaitDog, Launching ,Cooldown, Sleeping.
54
+
- Implemented all three game modes (Random, Training, Sleep) with session statistics logging.
68
55
69
56
## Hardware
70
57
71
-
The main controller is the **STM32 Nucleo-U545RE-Q**, chosen for its low-power STOP mode,
72
-
Flash memory for statistics logging, and strong Embassy async support.
58
+
The main controller is the **STM32 Nucleo-U545RE-Q**, chosen for its low-power STOP mode, and strong Embassy async support.
59
+
60
+
Two **A2212/13T 1000KV brushless motor** spin 3D-printed flywheel wheels in opposite directions to propel the tennis ball through the launch tube. They are powered by a 12V 5A switched-mode power supply and controlled via two FVT LittleBee 30A-S ESC speed controllers connected to PWM outputs of the STM32.
73
61
74
-
Two **A2212/13T 1000KV brushless motors** spin 3D-printed flywheel wheels in opposite directions
75
-
to propel the tennis ball through the launch tube. Their speed is powered through a **12V 5A
76
-
switched-mode power supply** and regulated down where needed by an **LM2596 DC-DC step-down
77
-
module (1.25–35V, 3A)**.
62
+
The turret assembly rotates on a **3D-printed base with a bearing**, driven by an MG996R servo via PWM (TIM2_CH3, PB10). The servo is powered through an **MP1584EN step-down module** (12V,6V) to avoid overloading the STM32 board.
78
63
79
-
The turret assembly rotates on a **3D-printed base with a bearing**, driven by an **MG996R
80
-
servo**via PWM. An **SG90 servo** controls the ball release gate at the tube entrance.
64
+
Ball release is handled by a **dual MOSFET power module** (15A, 400W) driving an **electromagnetic solenoid piston JF-0530B**(12V, push-pull). A single GPIO HIGH signal on PB4 energizes the solenoid, retracting a spring-loaded arm and releasing the ball. The arm
65
+
returns automatically via the spring. The solenoid is powered from the 12V supply through the MOSFET, and the MOSFET signal pin is connected directly to the STM32 GPIO (3.3V logic compatible).
81
66
82
-
An **HC-SR501 PIR sensor** triggers the MCU wake-up via external interrupt. An **HC-SR04
83
-
ultrasonic sensor** is placed at the tube entrance to confirm ball presence before launch.
84
-
A **128x64 I2C OLED display** shows system state and mode. Physical **buttons** allow the user
85
-
to select between game modes (Random, Training) and start/stop the system.
67
+
An **HC-SR501 PIR sensor** triggers MCU wake-up via external interrupt (EXTI0, PA0). An HC-SR04 ultrasonic sensor is placed at the tube entrance (TRIG=PA1, ECHO=PA4) to confirm ball presence. A **128x64 I2C OLED display** (SH1106, 1.3") shows system state and mode(SCL=PB6, SDA=PB7). **Three tactile buttons** allow mode selection and manual control.
86
68
87
-
<!-- ### Schematics -->
69
+

70
+

88
71
89
-
<!-- Place your KiCAD schematics here in SVG format -->
72
+
### Schematics
73
+
74
+

90
75
91
76
### Bill of Materials
92
77
93
78
| Device | Usage | Price |
94
79
|--------|--------|-------|
95
-
|[STM32 Nucleo-U545RE-Q](https://www.st.com/en/evaluation-tools/nucleo-u545re-q.html)| Main microcontroller |~85 RON |
96
-
|[A2212/13T 1000KV Brushless Motor x2](https://hobbymarket.ro/motor-brushless-1000kv-a2212-13t-pentru-drone-si-aeromodele.html)| Dual flywheel ball propulsion |~120 RON |
97
-
| 3D Printed Flywheel Wheels x2 | Grip and propel the ball |~0 RON (printed) |
98
-
| 3D Printed Turret Base + Bearing | Rotating turret platform |~0 RON (printed) |
99
-
|[MG996R Servo Motor](https://www.emag.ro/servomotor-towerpro-mg-996r-180-55g-cuplu-pana-la-10-kg-cablu-30-cm-3-pini-multicolor-2-c-038/pd/DTHLKLMBM/)| Turret horizontal rotation |~35 RON |
100
-
|[SG90 Micro Servo](https://www.emag.ro/servomotor-sg90-180-de-grade-ai156-s297/pd/D33V1GMBM/)| Ball release gate |~15 RON |
101
-
|[HC-SR501 PIR Sensor](https://www.emag.ro/senzor-de-miscare-detector-pir-hc-sr501-sensibilitate-reglabila-33-x-23-x-30-mm-multicolor-2-a-020/pd/DZLTKLMBM/)| Pet presence detection + MCU wake-up |~10 RON |
102
-
|[HC-SR04 Ultrasonic Sensor](https://www.emag.ro/modul-senzor-ultrasonic-detector-distanta-hc-sr04-xbaxah-ultrasonic/pd/D5HMPD2BM/)| Ball presence detection at tube |~7 RON |
103
-
|[LM2596 DC-DC Step-Down Module](https://www.bitmi.ro/electronica/modul-coborator-de-tensiune-lm2596-dc-3a-10017.html)| Voltage regulation for logic components |~12 RON |
104
-
|[12V 5A Switched-Mode Power Supply](https://www.optimusdigital.ro/en/12-v-ac-dc-power-supplies/5067-12v-5a-60-w-switched-mode-power-supply.html)| Main power source |~60 RON |
105
-
|[OLED Display 128x64 I2C 1.3"](https://www.emag.ro/display-oled-rezolutie-128-x-64-1-3-inchi-comunicare-i2c-27-x-27-mm-multicolor-5904162806386/pd/D7RP0LMBM/)| System state and mode display |~25 RON |
106
-
|[Buttons x5](https://www.emag.ro/set-5-bucati-buton-microintrerupator-smd-tactil-6x6x3-1mm-4-pini-cupru-rosu-setmswitch/pd/DT9XRK3BM/)| Mode selection and start/stop |~8 RON |
|[STM32 Nucleo-U545RE-Q](https://www.st.com/en/evaluation-tools/nucleo-u545re-q.html)| Main microcontroller | 85 RON |
81
+
|[A2212/13T 1000KV Brushless Motor x2](https://hobbymarket.ro/motor-brushless-1000kv-a2212-13t-pentru-drone-si-aeromodele.html)| Dual flywheel ball propulsion | 120 RON |
82
+
|[FVT LittleBee 30A-S 30A ESC BLHeli_S Motor Speed Controller x2](https://de.aliexpress.com/item/32738195790.html?gatewayAdapt=glo2deu)| Brushless motor speed control | 45 RON |
83
+
| 3D Printed Flywheel Wheels x2 | Grip and propel the ball | 0 RON (printed) |
84
+
| 3D Printed Turret Base + Bearing | Rotating turret platform | 0 RON (printed) |
85
+
|[MP1584EN Mini DC-DC Step Down Module](https://www.optimusdigital.ro/en/adjustable-step-down-power-supplies/166-mp1584en-mini-dc-dc-step-down-module.html)| Tension regulatory | 6 RON |
86
+
|[MG996R Servo Motor](https://www.emag.ro/servomotor-towerpro-mg-996r-180-55g-cuplu-pana-la-10-kg-cablu-30-cm-3-pini-multicolor-2-c-038/pd/DTHLKLMBM/)| Turret horizontal rotation | 35 RON |
87
+
|[Dual MOSFET Power Module 15A, 400W](https://sigmanortec.ro/Modul-dual-MOSFET-de-putere-15A-400W-p187778881)| C Control ball release gate | 3 RON |
|[HC-SR501 PIR Sensor](https://www.emag.ro/senzor-de-miscare-detector-pir-hc-sr501-sensibilitate-reglabila-33-x-23-x-30-mm-multicolor-2-a-020/pd/DZLTKLMBM/)| Pet presence detection + MCU wake-up | 10 RON |
90
+
|[HC-SR04 Ultrasonic Sensor](https://www.emag.ro/modul-senzor-ultrasonic-detector-distanta-hc-sr04-xbaxah-ultrasonic/pd/D5HMPD2BM/)| Ball presence detection at tube | 7 RON |
91
+
|[LM2596 DC-DC Step-Down Module](https://www.bitmi.ro/electronica/modul-coborator-de-tensiune-lm2596-dc-3a-10017.html)| Voltage regulation for logic components | 12 RON |
92
+
|[12V 5A Switched-Mode Power Supply](https://www.optimusdigital.ro/en/12-v-ac-dc-power-supplies/5067-12v-5a-60-w-switched-mode-power-supply.html)| Main power source | 60 RON |
93
+
|[OLED Display 128x64 I2C 1.3"](https://www.emag.ro/display-oled-rezolutie-128-x-64-1-3-inchi-comunicare-i2c-27-x-27-mm-multicolor-5904162806386/pd/D7RP0LMBM/)| System state and mode display | 25 RON |
94
+
|[Buttons x3](https://www.emag.ro/set-5-bucati-buton-microintrerupator-smd-tactil-6x6x3-1mm-4-pini-cupru-rosu-setmswitch/pd/DT9XRK3BM/)| Mode selection and start/stop | 8 RON |
|[defmt-rtt](https://github.com/knurling-rs/defmt)| RTT logging transport | Streams defmt logs to PC over debug probe |
122
-
|[panic-probe](https://github.com/knurling-rs/probe-run)| Panic handler | Debugging crashes via probe |
112
+
113
+
**Note on OLED driver**: The SH1106 controller used in the 1.3" display is not compatible with the ssd1306 crate. A minimal custom driver was implemented directly in src/sh1106.rs using raw I2C commands and an embedded 5×7 font, without any external display crate dependency.
123
114
124
115
## Links
125
116
126
117
1.[Embassy-rs documentation](https://embassy.dev)
127
118
2.[STM32U5 Low Power Modes — Reference Manual](https://www.st.com/resource/en/reference_manual/rm0456-stm32u5-series-advanced-armbased-32-bit-mcus-stmicroelectronics.pdf)
128
119
3.[A2212 Brushless Motor datasheet](https://hobbymarket.ro/motor-brushless-1000kv-a2212-13t-pentru-drone-si-aeromodele.html)
129
120
4.[HC-SR501 PIR Sensor datasheet](https://www.mpja.com/download/31227sc.pdf)
0 commit comments