open-source-project with an STM32C011, mpu6050 and 3d-printed case. Switches Light on when bicycle moves. Switches off after 1 minute standing still.
[ [ [
- Movement detection via MPU6050 (measurement each 2 seconds)
- Automatic On when movement detected, Off after standing still and timeout
- STM32-based (STM32CubeMX IOC included)
- 3D-printed case
- Low sysclk for low power consumption: ~1mA idle current (mcu + mpu6050)
- Technical Stack
- Quickstart
- BOM
- Build Instruction
- Firmware Flashing
- License Overview
- Known Problems
- Contribute
| Component | Technology |
|---|---|
| MCU | STM32C011 (STM32CubeMX IOC) |
| Sensor | MPU6050 (I²C) |
| Case | PLA, STL-Files |
| Firmware | STM, MIT-licensed |
| Component | Reichelt No. |
|---|---|
| STM32C011 mcu | STM32C011J6M6 |
| mpu6050 | DEBO HMC5883L 2 |
| step-down converter | LMO78_03-1.0 |
| Adapterboard SO8 | RE 899 |
| BC547, npn bjt | ... |
| 1k THT base resistor | ... |
| M3 countersunk screws | SKS M3X20-50 |
| M3 hot melt insert thread | ... |
| cable tie | SHVP BS18-10002 |
- for flashing: ST-link V3 or eval board (like NUCLEO-F746ZG)
- lipo battery, case works with 3S battery from an RC-Car (102mm x 34mm x 23mm)
- front and rear LED light (e.g. battery powered light from a supermarket/hardware store)
- Build Hardware: solder MCU on SO8-Adapterboard if needed, print STLs (0.2mm Layer, 20% Infill)
- Flash firmware: ST-link V3 or STM-eval board
- Connect: Connect to LiPo battery and front/rear light
- Test: move bicycle → Lampe ON, 1min still → OFF
STLs: mechanics/
Case: mechnics/bicycleLight_case_r2.stl (Supports: No)
Cover: mechnics/bicycleLight_cover.stl
Printsettings: 0.2mm, 210°C extruder, 60°C heat bed
use SO8 adapter pcb if needed
| Name | SO8 pin no. | STM gpio name |
|---|---|---|
| LED-Light transistor | → Pin 1 | PC14 |
| MPU6050 SDA | → Pin 5 | PA8 |
| MPU6050 SCL | → Pin 6 | PA12 |
| SWDIO (flashing) | → Pin 7 | |
| SWCLK (flashing) | → Pin 8 |
e.g. ST-Link V2/3 or STM eval kit:
- NUCLEO-F303RE (reichelt, not tested)
- NUCLEO-F746ZG (tested)
- NUCLEO-F446ZE (reichelt, not tested, but same base as F746ZG)
on MB1137 based eval boards (F746ZG, F446ZE, etc.) connector (CN6) can be used to program MCUs. headers on CN4 needs to be removed to use external programming (not the mcu on the eval board). pinout of the CN6:
| CN6 pin | connect to STM mcu | function |
|---|---|---|
| 1 | → Pin 2 | Vdd feedback (connect here also 3V3 from the eval board to power the external MCU, e.g. pin 7 from CN8) |
| 2 | → Pin 8 | SWCLK |
| 3 | → Pin 3 | GND |
| 4 | → Pin 7 | SWDIO |
| 5 | n.c. | NRST |
| 6 | n.c. | SWO |
use STM32CubeProgrammer pre-built elf in binary folder
- connect
- choose Erase & Programming
- browse to the binary folder and choose the elf file
- Start programming
| Component | License | Files |
|---|---|---|
| Firmware (own) | MIT | firmware/ |
| STM32CubeMX Code | BSD-3-Clause | *.ioc, generated HAL-Code |
| STLs/Case | CC-BY-SA-3.0 | mechanics/ |
| Images | CC-BY-SA-4.0 | images/ |
See LICENSE.
- waterproof: not perfectly waterproof. mount with cover at the bottom to be waterproof against rain at least.
See Issues.
- Fork this Repo
- Create Feature-Branch (
git checkout -b feature/mpu-opti) - Commit your changes (
git commit -m 'MPU Optimierung') - Push (
git push origin feature/mpu-opti) - Create Pull Request
- MPU6050 Motion-Detect Tutorial
- OSHWA License-Helper
⭐ Star this Repo, if it helps! Questions? Issues
Footnotes
-
https://gist.github.com/DomPizzie/7a5ff55ffa9081f2de27c315f5018afc ↩
-
https://github.com/cfpb/open-source-project-template/blob/main/README.md ↩
-
https://dev.to/sumonta056/github-readme-template-for-personal-projects-3lka ↩
-
https://github.com/sfbrigade/data-science-wg/blob/master/dswg_project_resources/Project-README-template.md ↩
-
https://www.reddit.com/r/programming/comments/l0mgcy/github_readme_templates_creating_a_good_readme_is/ ↩
-
https://www.daytona.io/dotfiles/how-to-write-4000-stars-github-readme-for-your-project ↩
