Skip to the content
2 layers100 × 54 mmMs2-card, the printed circuit board in 3D

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

8

README

hardware/README.md

Lokkarten Emulator

alt Lokkarten 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

text
#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

text
esptool.py --port /dev/ttyUSB1 erase_flash
esptool.py --port /dev/ttyUSB1 --baud 460800 write_flash --flash_size=detect 0 ./build_output/firmware/tasmota.bin

OLD - BACKUP

SD-CARD

https://github.com/arendst/Tasmota/discussions/13938

https://www.mikrocontroller.net/articles/MMC-_und_SD-Karten

Raspberry Pi I2C

FunctionGPIOPin
SDAGPIO2Pin 3
SCLGPIO3Pin 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

text
// 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_SPI

Parts

63
QtyValueFootprintReferences
10100nFCapacitor_SMD:C_0603_1608MetricC2, C3, C4, C5, C6, C10, C11, C20, C31, C32
94k7Resistor_SMD:R_0603_1608MetricR2, R11, R12, R13, R14, R15, R20, R21, R30
447kResistor_SMD:R_0603_1608MetricR5, R6, R22, R23
310kResistor_SMD:R_0603_1608MetricR3, R8, R9
3BL1551BPackage_TO_SOT_SMD:SOT-363_SC-70-6U3, U4, U20
3LEDLED_SMD:LED_0603_1608MetricD1, D31, D32
2330Resistor_SMD:R_0603_1608MetricR31, R32
2MMBT3904Package_TO_SOT_SMD:SOT-23Q1, Q2
1100Resistor_SMD:R_0603_1608MetricR4
1100uFCapacitor_Tantalum_SMD:CP_EIA-7343-31_Kemet-D_Pad2.25x2.55mm_HandSolderC1
1180kResistor_SMD:R_0603_1608MetricR7
11uFCapacitor_SMD:C_0805_2012MetricC30
14.7uFCapacitor_SMD:C_0805_2012MetricC7
1470nFCapacitor_SMD:C_0603_1608MetricC8
1680Resistor_SMD:R_0603_1608MetricR1
175kResistor_SMD:R_0603_1608MetricR10
1AMS1117-3.3Package_TO_SOT_SMD:SOT-223-3_TabPin2U6
1CP2102N-A02-GQFN24R Package_DFN_QFN:QFN-24-1EP_4x4mm_P0.5mm_EP2.6x2.6mmU30
1Card EdgeMS2-Card:MS2_EdgeJ22
1Conn_01x03Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ32
1Conn_01x04Connector_PinHeader_1.27mm:PinHeader_1x04_P1.27mm_VerticalJ23
1Conn_01x06Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_VerticalJ11
1ESP ProgConnector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalJ2
1ESP-12FRF_Module:ESP-12EU1
1FM24CL64BPackage_SO:SOIC-8_3.9x4.9mm_P1.27mmU2
1MMBT5401Package_TO_SOT_SMD:SOT-23Q3
1MicroSD_SPI_CDsd-card-conn:GCT-MEM2055-00-190-01-AJ10
1PogoPinPogoPin:PogoPin2J21
1Power SelectConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ31
1RESETButton_Switch_THT:SW_PUSH_6mm_H4.3mmSW1
1SP0503BAHTPackage_TO_SOT_SMD:SOT-143D30
1SchaltreglerConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ1
1Smartcard ConnectorMS2-Card:iso7816_connJ20
1USB_B_MicroConnector_USB:USB_Micro-B_Amphenol_10118194_HorizontalJ30
1W25Q128JMPackage_SO:SOIC-8_3.9x4.9mm_P1.27mmU10

Similar boards

  • 4 layers53.1 × 98 mmMarsupial, the printed circuit board in 3D

    Marsupial

    VIPQualityPost/marsupial

    2 port USB PD + data hub

    208 parts3
  • 4 layers90 × 90 mmSahel pcb, the printed circuit board in 3D

    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 mmPlayer, the printed circuit board in 3D

    Player

    kholia/mShuffle

    https://rfcorner.in/posts/rethinking-tangara-music-player/

    35 parts2
  • 4 layers320 × 80 mmRelay Unit, the printed circuit board in 3D

    Relay Unit

    Tuskar-Marine/hardware

    All tools for the Mermaid's Rest open sailing tools

    142 parts6
  • 4 layers100 × 100 mmPCBA OCTV, the printed circuit board in 3D

    PCBA OCTV

    intechstudio/grid-hardware

    403 parts59GPL-3.0
  • 4 layers56 × 60 mmPCBA KNOT, the printed circuit board in 3D

    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 mmGrid devkit, the printed circuit board in 3D

    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 mmMIDI Host, the printed circuit board in 3D

    MIDI Host

    scorchio/knot

    Custom firmware for the Intech Studio Knot

    109 partsGPL-3.0

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).