

Ms2-card
Emulator für eine Märklin MS2 Lokkarte, Firmware und Kopie der Hardware von GBert
- Size
- 100 × 54 mm
- Copper layers
- 2
- Thickness
- 1.6 mm
- Parts
- 63
- Nets
- 73
- Pads
- 251
- Tracks, vias
- 653, 134
- Pours
- 342
- Routed
- Yes
- KiCad
- KiCad 7 (file 20221018)
- Created
- 2 Aug 2024
- Updated
- 5 May 2026
Overview
Ms2-card is an open-source printed circuit board by ST-Oldie, from the ST-Oldie/Lokkarten-Emulator repository on GitHub, published under the GPL-3.0 licence. It is a 2-layer board of 100 × 54 mm with 63 parts on 73 nets, routed with 653 tracks and 134 vias.
It is built around the ESP-12F, CP2102N-A02-GQFN24R and BL1551B, with the AMS1117-3.3, FM24CL64B-G and MMBT3904 among its other parts. Its parts include 22 resistors, 14 capacitors, 11 connectors, 8 ICs and 4 diodes. It belongs with the ESP8266 boards of this library.
Main components
8ESP-12F
SMD,24x16mm-40℃~+85℃ -96dBm 15dBm 2.4GHz 3.3V 375mA 55mA PCB UART WIFI4 SMD,24x16mm WiFi Modules ROHSDOITWiFi ModulesCP2102N-A02-GQFN24R
QFN-24-EP(4x4)-40℃~+85℃@(Ta) 1.3uA 3V~3.6V 9.5mA USB 2.0 USB to UART QFN-24-EP(4x4) USB Converters ROHSSilicon LabsUSB ConvertersBL1551B
SC-70-6-40℃~+125℃ 1 1.8V~5.5V 15.5pF 2.7Ω@5.0V 20ns 2:1 30ns 350MHz SC-70-6 Analog Switches, Multiplexers ROHSBLAnalog Switches, MultiplexersAMS1117-3.3
SOT-223-40℃~+125℃ 0.003%Vout 1 1.1V@(800mA) 15V 1A 3.3V 5mA 72dB@(120Hz) Fixed Over Current Protection、Short Circuit Protection、Thermal shutdown Positive SOT-223 Voltage Regulators - Linear, Low Drop Out (LDO) Regulators ROHSAdvanced Monolithic SystemsVoltage Regulators - Linear, Low Drop Out (LDO) RegulatorsFM24CL64B-G
C0402_CSSOIC-8 FRAM ROHSInfineon TechnologiesFRAMMMBT3904
SOT-23-55℃~+150℃ 1 NPN 100 100nA 200mA 200mW 300MHz 300mV 40V 6V NPN SOT-23 Bipolar (BJT) ROHSJiangsu Changjing Electronics Technology (CJ)Bipolar (BJT)MMBT5401
SOT-23-55℃~+150℃ 1 PNP 100MHz 100nA 150V 300 300mW 500mV 5V 600mA PNP SOT-23 Bipolar (BJT) ROHSJiangsu Changjing Electronics Technology (CJ)Bipolar (BJT)SP0503BAHTG
SOT-143-55℃~+125℃ 10A@8/20us 14V 150W@8/20us 30pF、60pF 5.5V 6V 80nA ESD IEC 61000-4-2、IEC 61000-4-5、IEC 61000-4-4 Three channels Unidirectional SOT-143 ESD and Surge Protection (TVS/ESD) ROHSTECH PUBLICESD And Surge Protection (TVS/ESD)
README
hardware/README.mdLokkarten Emulator

Auf der Lokkarte befindet sich ein I2C EEPROM (24LC64 64kBit -> 8kByte). Die Schaltung ersetzt den Speicher durch ein kompatiblen FRAM Baustein (U2). Dadurch entfällt die zeitkritische I2C Slave Behandlung.
Der Prozessor (ESP8266 oder extern) befüllt den FRAM Baustein mit Lokkarten Daten. Damit es zu keinen Komplikationen auf dem MS2 I2C Bus kommen kann, ist der I2C Bus durch analoge Schalter (BL1551B - Signal I2C_Select) getrennt.
Der Prozessor signalisiert das Einstecken der Lokkarte (Signal Card) durch Verbindung der Kontakte am Kartenrand.
Die Platine wurde mit KiCad 7.0.11 erstellt. Die Produktionsdaten wurden mit dem JLCPCB Fabrication Toolkit Plugin generiert (Verzeichnis production). Platinendicke: 0,8 mm wählen !
Die zwei Fehler im DRC Check (Corteyards overlap) können ignoriert werden, da die Bestückung mit dem SPI EEPROM U10 und C11 alternativ ist.
Detail-Beschreibung
Der Kartenwechsel wird bei der MS2 über einen mechanischen Taster erkannt. Bei der MS2 wurden verschiedene Arten des Tasters verbaut. Die Platine verwendet einen federnden Testpin, damit ein Kartenwechsel für die verschiedene Bauarten simuliert werden kann: https://dirtypcbs.com/store/designer/details/ian/12/dirty-pogo-pins
Power Select: hier wählt man zwiechen Versorgung durch MS2 oder USB.
Schaltregler kann als Ersatz dienen, wenn der Längsregler U6 nicht ausreicht. Dazu muss U6 aber entfernt werden.
Für C1 ist ein Tantal Kondensator vorgesehen. Da Tantal aber ein Rohstoff aus Krisengebieten ist, ist ein anderer Kondensator mit niedrigem ESR ratsam. Die Pads sollten genügend Platz bieten, einen anderen Kondensator einzusetzen, wie z.B. Reichelts "VF 100/6,3 P-C" oder "VF 100/16 P-D".
Silabs CP2102 wurde für die Seriell-USB Anbindung gewählt, weil dieser ein guter Kompromiss zwischen Stabilität, Unterstützung und Preis ist.
Q1/Q2 und R8/R9 dienen dazu, das Update der ESP8266 ohne Eingriff zu ermöglichen.
U3 und U4 trennen den I2C Bus von der MS2, damit es keine Störungen des MS2 I2C-Busses gibt. I2C Select schaltet entweder den ESP8266 oder alternativ einen anderen I2C Master für den Zugriff auf das FRAM hinzu.
U20 dient dazu, einen Kartenwechsel der MS2 zu signalisieren.
Das MS2 I2C Bus Clock Signal wird zusätzlich auch noch über Q1 und ein RC Glied an den ADC des ESP8266 Moduls angeschlossen, um den Zeitpunkt des letzten I2C Bus Zugriffs zu messen.
TODOs/Done
- CP2102 Test - OK
- I2C intern Test - OK
- I2C extern Test - OK
- ESP Programmierung Test - OK
- SD Kartenanbindung Test - OK
- Allternative zur SD-Karte - SPI EEPROM - ungetestet
Hardware / neue Version
- 470 nH Vdd
ESP8266 - Code Segmente
#define SPI_MISO 12
#define SPI_MOSI 13
#define SPI_CLK 14
#define SPI_CS 15
#define I2C_Select 2
#define I2C_SDA 4
#define I2C_SCL 5
#define Card_Change 16
void setup () {
// SD Karte initialisieren
SD.begin(SPI_CS)
// I2C initilisieren
Wire.begin(I2C_SDA, I2C_SCL);
Wire.setClock(100000);
pinMode(Card_Change, OUTPUT);
pinMode(I2C_Select, OUTPUT);
}
// MS2 I2C FRAM Zugriff
digitalWrite(I2C_Select, 0);Flashing
esptool.py --port /dev/ttyUSB1 erase_flash
esptool.py --port /dev/ttyUSB1 --baud 460800 write_flash --flash_size=detect 0 ./build_output/firmware/tasmota.binOLD - BACKUP
SD-CARD
https://github.com/arendst/Tasmota/discussions/13938
https://www.mikrocontroller.net/articles/MMC-_und_SD-Karten
Raspberry Pi I2C
| Function | GPIO | Pin | |
|---|---|---|---|
| SDA | GPIO2 | Pin 3 | |
| SCL | GPIO3 | Pin 5 |
Tasmota Tests
git clone https://github.com/arendst/Tasmota.git cd Tasmota git tag pio run
{"NAME":"ESP-12F","GPIO":[1,1,1,1,1,1,0,0,1,1,1,1,1,1],"FLAG":0,"BASE":18}
user_config_override.h
// Select none or only one of the below defines USE_RULES or USE_SCRIPT
#ifdef USE_RULES
#undef USE_RULES // Add support for rules (+8k code)
#endif
#ifndef USE_SCRIPT
#define USE_SCRIPT
#endif
#define SDCARD_DIR //Not essential I think
#define USE_SCRIPT_FATFS_EXT //Not essential I think
#define USE_SCRIPT_FATFS //Not essential I think
#define USE_UFILESYS
#define USE_SDCARD
#define SDCARD_CS_PIN 4 //Not strictly necessary since the same #define happens in xdrv_50_filesystem.ino
//Further down I define SPI
#define USE_SPIParts
63| Qty | Value | Footprint | References |
|---|---|---|---|
| 10 | 100nF | Capacitor_SMD:C_0603_1608Metric | C2, C3, C4, C5, C6, C10, C11, C20, C31, C32 |
| 9 | 4k7 | Resistor_SMD:R_0603_1608Metric | R2, R11, R12, R13, R14, R15, R20, R21, R30 |
| 4 | 47k | Resistor_SMD:R_0603_1608Metric | R5, R6, R22, R23 |
| 3 | 10k | Resistor_SMD:R_0603_1608Metric | R3, R8, R9 |
| 3 | BL1551B | Package_TO_SOT_SMD:SOT-363_SC-70-6 | U3, U4, U20 |
| 3 | LED | LED_SMD:LED_0603_1608Metric | D1, D31, D32 |
| 2 | 330 | Resistor_SMD:R_0603_1608Metric | R31, R32 |
| 2 | MMBT3904 | Package_TO_SOT_SMD:SOT-23 | Q1, Q2 |
| 1 | 100 | Resistor_SMD:R_0603_1608Metric | R4 |
| 1 | 100uF | Capacitor_Tantalum_SMD:CP_EIA-7343-31_Kemet-D_Pad2.25x2.55mm_HandSolder | C1 |
| 1 | 180k | Resistor_SMD:R_0603_1608Metric | R7 |
| 1 | 1uF | Capacitor_SMD:C_0805_2012Metric | C30 |
| 1 | 4.7uF | Capacitor_SMD:C_0805_2012Metric | C7 |
| 1 | 470nF | Capacitor_SMD:C_0603_1608Metric | C8 |
| 1 | 680 | Resistor_SMD:R_0603_1608Metric | R1 |
| 1 | 75k | Resistor_SMD:R_0603_1608Metric | R10 |
| 1 | AMS1117-3.3 | Package_TO_SOT_SMD:SOT-223-3_TabPin2 | U6 |
| 1 | CP2102N-A02-GQFN24R | Package_DFN_QFN:QFN-24-1EP_4x4mm_P0.5mm_EP2.6x2.6mm | U30 |
| 1 | Card Edge | MS2-Card:MS2_Edge | J22 |
| 1 | Conn_01x03 | Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_Vertical | J32 |
| 1 | Conn_01x04 | Connector_PinHeader_1.27mm:PinHeader_1x04_P1.27mm_Vertical | J23 |
| 1 | Conn_01x06 | Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical | J11 |
| 1 | ESP Prog | Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Vertical | J2 |
| 1 | ESP-12F | RF_Module:ESP-12E | U1 |
| 1 | FM24CL64B | Package_SO:SOIC-8_3.9x4.9mm_P1.27mm | U2 |
| 1 | MMBT5401 | Package_TO_SOT_SMD:SOT-23 | Q3 |
| 1 | MicroSD_SPI_CD | sd-card-conn:GCT-MEM2055-00-190-01-A | J10 |
| 1 | PogoPin | PogoPin:PogoPin2 | J21 |
| 1 | Power Select | Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_Vertical | J31 |
| 1 | RESET | Button_Switch_THT:SW_PUSH_6mm_H4.3mm | SW1 |
| 1 | SP0503BAHT | Package_TO_SOT_SMD:SOT-143 | D30 |
| 1 | Schaltregler | Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_Vertical | J1 |
| 1 | Smartcard Connector | MS2-Card:iso7816_conn | J20 |
| 1 | USB_B_Micro | Connector_USB:USB_Micro-B_Amphenol_10118194_Horizontal | J30 |
| 1 | W25Q128JM | Package_SO:SOIC-8_3.9x4.9mm_P1.27mm | U10 |
Similar boards
- 4 layers53.1 × 98 mm

- 4 layers90 × 90 mm

Sahel pcb
Aliou8/SAHEL-SPECTRA-RF
CubeSat for educational purposes. It is based on an STM32H7 MCU for data handling and uses two CC1125 radios for communication. The software is developed using a Zephyr-like RTOS.
172 parts2GPL-3.0 - 2 layers60 × 68.7 mm

- 4 layers320 × 80 mm

- 4 layers100 × 100 mm

- 4 layers56 × 60 mm

PCBA KNOT
intechstudio/knot
Knot is the bridge between old-school MIDI gear like synthesizers, groove boxes, guitar pedals and neat USB MIDI devices.
111 parts58GPL-3.0 - 4 layers32.7 × 99.7 mm

Grid devkit
RustyCircuit/grid-devkit
KiCad PCB designed to interoperate with the Intech Studio Grid ecosystem. This devkit is a fork of Intech's VSNX hardware design, adapted to fill a gap between fully-developed hardware and breadboard/DIY controller…
167 parts1GPL-3.0 - 4 layers56 × 60 mm

Questions
How big is the Ms2-card PCB?
It measures 100 × 54 mm and has 2 copper layers, 1.6 mm thick.
What parts does the Ms2-card use?
63 parts, built around the ESP-12F, CP2102N-A02-GQFN24R, BL1551B and AMS1117-3.3. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
Where can I download the Ms2-card KiCad files?
From the ST-Oldie/Lokkarten-Emulator repository on GitHub, at the commit this page was made from: the board is hardware/ms2-card.kicad_pcb and its schematic hardware/ms2-card.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Can I use the Ms2-card design in my own project?
Its repository publishes it under the GPL-3.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).