90 lines
3.1 KiB
Markdown
90 lines
3.1 KiB
Markdown
# 電車ベクトル (DenshaBekutoru)
|
||
|
||
## Model Train Direction Sensor
|
||
|
||
DenshaBekutoru is a small controller board for brick-built model locomotives.
|
||
|
||
The target use case is: read the motor power signals, detect the current driving direction, and switch the headlights accordingly. The software is also prepared to derive speed information from the motor signal behaviour.
|
||
|
||
This project is built around one practical problem: the motor is driven from an H-bridge, so the signal is noisy, polarity changes are not “clean logic”, and inductive spikes make direct evaluation difficult.
|
||
|
||
## What it does
|
||
|
||
- detects train direction from the motor power signal
|
||
- evaluates two processed motor-side signals via analogue inputs
|
||
- switches the front / rear lights according to direction
|
||
- keeps the last valid direction if the train stops or the signal becomes unclear
|
||
- is designed as small as possible for installation in brick-built locomotives
|
||
|
||
## Technical approach
|
||
|
||
The current version is built around:
|
||
|
||
- optocoupler-based input isolation and signal conditioning
|
||
- Arduino Pro Mini 5V as controller
|
||
- software averaging of analogue inputs
|
||
- startup calibration to adapt to different controllers and builds
|
||
- threshold + hysteresis logic
|
||
- simple state machine with direction memory
|
||
- PWM-capable output pins for possible later LED dimming
|
||
|
||
The main idea is not to read one raw signal and react immediately.
|
||
The idea is to turn a noisy motor signal into a stable direction decision.
|
||
|
||
## Current status
|
||
|
||
**Version 2 (beta) is built and working.**
|
||
|
||
Current state:
|
||
|
||
- [x] schematic finished
|
||
- [x] PCB finished
|
||
- [x] firmware finished for the current beta state
|
||
- [x] three PCBs built and tested
|
||
- [x] first boards handed over for real-life testing in a model railway club
|
||
- [ ] Feedback and what to improve
|
||
|
||
## Design goals
|
||
|
||
- as small as possible
|
||
- beginner-friendly where possible
|
||
- no SMD if it can reasonably be avoided
|
||
- easy to reproduce later as a DIY kit
|
||
- modular PCB concept with main section, future-option section, and test section
|
||
|
||
## Repository content
|
||
|
||
Typical content of this repository:
|
||
|
||
- `KiCad/` – schematic and PCB files
|
||
- `firmware/` – Arduino test and controller software
|
||
- documentation and pictures will be added step by step
|
||
|
||
## Project status note
|
||
|
||
This is still a beta project.
|
||
|
||
The current hardware and software already work, but testing on real locomotives is still ongoing.
|
||
The next version will depend on real-life feedback from actual use.
|
||
|
||
Possible next steps:
|
||
|
||
- verify behaviour with different motor controllers
|
||
- check robustness in real train builds
|
||
- improve wiring / connector handling
|
||
- finalise optional features like LED dimming
|
||
- prepare a first “official” DIY kit version
|
||
|
||
## Blog / documentation
|
||
|
||
- Project overview: https://togo-lab.io/?p=223
|
||
- Hardware description: https://togo-lab.io/?p=233
|
||
- Software description: https://togo-lab.io/?p=243
|
||
|
||
## Short summary
|
||
|
||
DenshaBekutoru is a small Arduino-based direction sensor for brick-built model trains.
|
||
|
||
It reads the noisy motor signal from an H-bridge-driven setup, isolates and evaluates it, and switches the headlights automatically.
|
||
|
||
The current beta version is working and now entering real-life testing. |