Skip to the content
2 layers75 × 50 mmLocoCardBreakout, the printed circuit board in 3D

Sketch for a Switchboard talking the CAN CS2 protocol based on the ESP32 NodeMCU-Board

Size
75 × 50 mm
Copper layers
2
Thickness
1.6 mm
Parts
10
Nets
10
Pads
43
Tracks, vias
84, 6
Routed
Yes
KiCad
KiCad 5 (file 20171130)
Created
30 Dec 2018
Updated
5 Nov 2026

Overview

LocoCardBreakout is an open-source printed circuit board by deltaphi, from the deltaphi/RR32CanController repository on GitHub, published under the GPL-3.0 licence. It is a 2-layer board of 75 × 50 mm with 10 parts on 10 nets, routed with 84 tracks and 6 vias.

It is built around the 24LC64(LX). Its parts include 2 ICs, 2 connectors, 1 capacitor and 1 resistor. It belongs with the interfaces and adapters boards and the ESP32 boards of this library.

Main components

1

README

README.md

RR32CanSwitchboard

Sketch for a Switchboard talking the Maerklin CAN protocol based on the ESP32 NodeMCU-Board.

CI Status

  • Linux Unittest Build CI

  • Embedded Build PlatformIO CI

  • Windows Unittest Build Windows CI

Software

This project is built using PlatformIO. It makes use of some features that may not be easily portable to other Arduino-supported MCUs.

Library Notes

This project makes use of several libraries. Versioned links to those libraries are available as git submodules. Note that for seom libraries, using forks from the same source as this project may be required.

Note that the CAN driver from the lib directory must not be present when you want to compile using the ESP32-IDF driver. Otherwise, the Controller will just attempt to sit there without sending queued messages or receiving any messages transmitted on the bus.

WiFi

This sketch only supports runtime-selection of CAN connection vs. WiFi connection. The WiFi connection information (SSID, Password, IP of CAN-Gateway) must be hardcoded.

To support hardcoding, a template file "_wificonfig.h" is provided. Copy the template to "wificonfig.h" and adjust the configuration information to your needs.

Menuing

General concept

General: Shift + Direction Change enters the menu (cycles through menus) or leaves the menu without applying any changes.

Menu Levels:

  • Level 0/Default: Loco Control
  • Level 1: Loco List
  • Level 2: Settings Menu
Menuing for Accessories

Menuing is required to map turnout input buttons to turnouts or action lists.

TODO: Design.

Menuing for Engine Control

Menuing is required for selecting an engine to control. This involves the following usecases:

  • Select locally known engine

    • Show list of locally known Engines
    • Select engine
    • Selected Engine is now the active engine
  • Select locally unknown engine

    • Verify that at least one local slot for an engine is open
    • If not:
      • Promt the user to remove an engine from the local database to be able to download a new one.
      • Show list of locally known Engines
      • Select an engine.
      • Selected Engine is marked for replacement
    • If yes:
      • Empty engine slot with lowest index is marked for replacement
    • Download list of Engines & total number of known engines from the master controller.
    • Either: Select engine from the master list
      • Details of Selected engine are downloaded.
    • Either: Scroll up/down beyond the currently known set of engine names.
      • If the engine name is unknown, download list of engines from the master controller.
    • Once the download is complete, the selected engine is now the active engine
Encoder Acceleration for Engine Control

Formula for acceleration curve: y = m*x + c. x is the time since the last rotation in the same direction, y is the number of actual increments to apply.

The acceleration is linear. It should be set up so that there is a cutoff at 500ms (no acceleration when increments are more than half a second apart) and that an "immediate" half rotation (e.g., within 50ms) hits the opposite end of engine velocity.

Thus, boundary conditions for an encoder with 24 increments per rotaton are: 1 Tick = m*500ms + c kMaxEngineVelocity Ticks / 12 increments = m * (50ms / 12 increments) + c

Formulas for calculating m and c:

m = (y1 - y2)/(x1 - x2) = (1 - (kMaxEngineVelocity/12))/(500 - (50/12)) = -0.16

c = y1 - m*x1 = 84.03

Settings Menu

Menu Entries:

  • Turnout mapping
  • Action list mapping
  • Default connection settings
  • WiFi settings
Turnout Mapping

When in the Turnout mapping menu:

  • Press a button (red or green) for a turnout
  • Display shows number of button and whether red or green was pressed (line 1)
  • Display shows human-readable number of currently mapped turnout
  • Use encoder to adjust the number of the turnout
  • pressing the encoder stores the turnout mapping (visual feedback possible?)
  • pressing another turnout button switches to settings for that button
  • pressing shift + encoder leaves the menu.

Possible extension: Use the function buttons to increase/decrease in steps of 10

Unit Testing

This project includes a CMake project. The CMake project is purely used to run unit tests for some parts of the code on your development machine. You do not need to deal with unit tests (or the CMake project) unless you want to actively develop the software. To use the CMake project, create an out-of-tree build directoy (in-tree build will confuse the Automagic of PlatformIO). Unit testing should be possible using any C++14 capable compiler on any Desktop Operating System. It has been tested successefully using MSVC 2017 Community Edition.

Hardware

PCB

There is a KiCAD PCB design included for turning this project into a handheld device. The PCB is designed for the Strapubox 2090 case.

Parts

10
QtyValueFootprintReferences
4MountingHoleMountingHole:MountingHole_2.5mmH1, H2, H3, H4
1100nCapacitor_THT:C_Disc_D3.0mm_W1.6mm_P2.50mmC1
110kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR1
124LC64Package_DIP:DIP-8_W7.62mm_LongPadsU1
1Conn_01x03_MaleConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ2
1Conn_01x10_MaleConnector_PinHeader_2.54mm:PinHeader_1x10_P2.54mm_VerticalJ1
1SmartCardReaderESP32EvalBoard:SmartCardReaderU2

More from deltaphi/RR32CanController

8
  • 2 layersControllerTHT, the printed circuit board in 3D

    ControllerTHT

    deltaphi/RR32CanController

    Sketch for a Switchboard talking the CAN CS2 protocol based on the ESP32 NodeMCU-Board

    71 parts2GPL-3.0
  • 2 layers35 × 124 mmController, the printed circuit board in 3D

    Controller

    deltaphi/RR32CanController

    Sketch for a Switchboard talking the CAN CS2 protocol based on the ESP32 NodeMCU-Board

    63 parts2GPL-3.0
  • 2 layers85.1 × 49.5 mmIOBreakout, the printed circuit board in 3D

    IOBreakout

    deltaphi/RR32CanController

    Sketch for a Switchboard talking the CAN CS2 protocol based on the ESP32 NodeMCU-Board

    51 parts2GPL-3.0
  • 2 layers66 × 33 mmSwitchboardSMD, the printed circuit board in 3D

    SwitchboardSMD

    deltaphi/RR32CanController

    Sketch for a Switchboard talking the CAN CS2 protocol based on the ESP32 NodeMCU-Board

    47 parts2GPL-3.0
  • 2 layers99.1 × 48.3 mmSwitchboard, the printed circuit board in 3D

    Switchboard

    deltaphi/RR32CanController

    Sketch for a Switchboard talking the CAN CS2 protocol based on the ESP32 NodeMCU-Board

    42 parts2GPL-3.0
  • 2 layers81.3 × 59.7 mmESP32Breakout, the printed circuit board in 3D

    ESP32Breakout

    deltaphi/RR32CanController

    Sketch for a Switchboard talking the CAN CS2 protocol based on the ESP32 NodeMCU-Board

    33 parts2GPL-3.0
  • 2 layers28 × 40 mmS88Driver, the printed circuit board in 3D

    S88Driver

    deltaphi/RR32CanController

    Sketch for a Switchboard talking the CAN CS2 protocol based on the ESP32 NodeMCU-Board

    9 parts2GPL-3.0
  • 2 layers7.6 × 25.4 mmSwitchboardConnector, the printed circuit board in 3D

    SwitchboardConnector

    deltaphi/RR32CanController

    Sketch for a Switchboard talking the CAN CS2 protocol based on the ESP32 NodeMCU-Board

    2 parts2GPL-3.0

Similar boards

  • 2 layers69.6 × 37.3 mmController, the printed circuit board in 3D

    Controller

    purdeaandrei/overnumpad_controller_1xb

    An open source replacement keyboard controller for 4th generation IBM/Lexmark keyboards, and for some Unicomp keyboards

    65 parts27
  • 2 layers79 × 107 mmEurorack spinfx, the printed circuit board in 3D

    Eurorack spinfx

    grappendorf/eurorack-spinfx

    Spin FV-1 based effects module for Eurorack systems

    80 parts16
  • 2 layers285.7 × 95.5 mmJones, the printed circuit board in 3D

    Jones

    jpskenn/Jones

    Row-staggered 60% keyboard with gapless R2-R3 row. GH60 case compatible.

    249 parts12MIT
  • 2 layers285 × 95.1 mmNora, the printed circuit board in 3D

    Nora

    jpskenn/Nora

    Narrow pitch keyboard with Choc switches and keycaps. GH60 compatible.

    303 parts12MIT
  • 2 layers85 × 56 mmYoga v2, the printed circuit board in 3D

    Yoga v2

    mschwingen/hardware

    Hardware designs by Michael Schwingen, michael at schwingen dot org

    85 parts10
  • 4 layers401.5 × 130.1 mmOssw, the printed circuit board in 3D

    Ossw

    BinaryS010/ossw

    Open SCART Switch

    336 parts8GPL-3.0
  • 2 layers114 × 89 mmAyn-4b, the printed circuit board in 3D

    Ayn-4b

    afiskon/ayn-4b

    Portable QRP CW Transceiver

    278 parts7MIT

Questions

How big is the LocoCardBreakout PCB?

It measures 75 × 50 mm and has 2 copper layers, 1.6 mm thick.

What parts does the LocoCardBreakout use?

10 parts, built around the 24LC64(LX). 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 LocoCardBreakout KiCad files?

From the deltaphi/RR32CanController repository on GitHub, at the commit this page was made from: the board is Hardware/LocoCardBreakout/LocoCardBreakout.kicad_pcb and its schematic Hardware/SwitchboardSMD/SwitchboardSMD.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the LocoCardBreakout 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).