SplitFlap
No description available
Install / Use
/learn @SahibManjal/SplitFlapREADME
SplitFlap
SplitFlap enables the use of split-flap displays as train signs following a preset schedule. With a little wiring, a microcontroller, and a small server, convert your room into a train station by making your decomissioned train signs flip as they would in their heyday!
<p align="center"> <img src="flip.gif" alt="split-flaps flipping" /> <br> <a href="https://en.wikipedia.org/wiki/Yamato-Yagi_Station"> Yamato-Yagi station</a>'s split-flap displays flipping </p>While other attempts have been able to manipulate Split Flap displays to your needs, there has not been an explicit example recreating how these Split Flap displays worked in real-life. By utilizing timetables, mimicking flip behavior from real-world examples, getting live delays for adaptability, and integrating the various types of Solari Split Flaps displays, we have been able to faithfully recreate real-life scenarios.
Setup
Prerequisites
- Arduino toolchain (for instance, the official IDE or CLI) and the ArduinoJSON and ArduinoHttpClient packages
- ESP32 microcontroller
- Destination and stop pattern split-flap displays
- Circuitry connecting the ESP32 to the split-flap displays
ESP32 Configuration
Fill in the flippers array in Flipper_Config.cpp (look in Flipper_Config.h for type Flipper):
Flipper flippers[FLIPPER_AMOUNT] = {
{DESTINATION, <in1>, <in2>, <enable>, <home>, <flipState>, <flipAmount>, <flapPosition>},
{STOP_PATTERN, <in1>, <in2>, <enable>, <home>, <flipState>, <flipAmount>, <flapPosition>},
};
Each entry corresponds to a split-flap display and includes its FlipperType and the GPIO pins on the ESP32 responsible for controlling it.
There are five possible split-flap types:
DESTINATIONdisplays the last stop of a trainSTOP_PATTERNindicates all stations a train stops atHOURshows the hour of trains departureTENS_MINUTEandONE_MINUTEshow the tens and ones digit of the minute of a trains departure
REQUIRED: the flippers array must include a DESTINATION and STOP_PATTERN split-flap!
There are four pins used to control each split-flap display:
in1andin2are for rotating the motorenableis broughtHIGHto allow the motor to movehomeis broughtHIGHwhen the split-flap is at the "home" position
Set the FLIPPER_AMOUNT and LATCH_TIME macros in Flipper_Config.h:
// Milliseconds between consecutive flips for a single split-flap display.
// REQUIRED: must be >= 75 to function properly
#define LATCH_TIME -1
// the number of entries in the flippers array
#define FLIPPER_AMOUNT -1
To achieve speeds similar to flip.gif, set LATCH_TIME=120.
Fill in your WIFI information and server IP address in Network_Config.h:
#define WIFI_SSID ""
#define WIFI_PASSWORD ""
#define SERVER_ADDRESS ""
Timetable
A timetable is a schedule that dictates which flap the split-flaps display at a given time. In our case, it's a JSON array of the form
[
{
"location": "Blank",
"hour": 5,
"minutes": 8,
"destinationFlap": 0,
"stopFlap": 0
},
{
"location": "L-Haibara",
"hour": 5,
"minutes": 38,
"destinationFlap": 31,
"stopFlap": 39,
"comment": "Actual end is Yamato-Asakura"
},
...
]
Each entry is a train stopping at the station, whose details are displayed on the split-flap displays.
locationis the final destinationhourandminuteindicate the departure timedestinationFlapandstopFlapindicate the flap position for theDESTINATIONandSTOP_PATTERNsplit-flaps respectively
More specifically, timetables should match this schema and entries must satisfy the following constraints:
destinationFlapandstopFlapindicate flap positions via the number of flips from their "home" flaphourmust be between 0 and 23minutesmust be between 0 and 59
In Server/timetable/, create two timetables for weekdays and weekends/holidays called weekday.json and weekend.json respectively.
Install
Clone this repository on a server of your choice (RPi, AWS, locally) and run start.sh. Then upload the files in ESP32/ on to the ESP32.
Previous Versions
WARNING: parts of the setup instructions no longer apply. You should still be able to read the code to fill in the appropriate details.
- Version c2916b6 for no server
Roadmap
- [x] Make split-flap display flip
- [x] Follow a hardcoded schedule
- [x] Migrate code from Arduino to ESP
- [x] Support multiple split-flap displays
- [x] destination
- [x] stopping pattern
- [x] time
- [x] Setup server for selecting timetable
- [x] Setup ESP32 communication with server
- [ ] Webscrape for live delays and cancelations
- [ ] Fix initial index of motor mismatch
- [ ] Configure code for control box
References
- Kintetsu Corporation Timetables
- Kintetsu Corporation Livetracking
- Helpful SplitFlap Reverse Engineering Blog Post
- Japanese Holidays
Contact
Encountered a bug you'd like to report? Fill out a GitHub issue. Need help/support? Have an idea for a new feature? Make a GitHub Discussion!
