Skip to content
/ scsmd Public

This is "Single Coil Switch Machine Driver", based on Arduino and designed to control accessories equipped with a single coil and controlled by polarity reversal.

Notifications You must be signed in to change notification settings

vhar/scsmd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

What is SCSMD?

This is "Single Coil Switch Machine Driver", based on Arduino and designed to control accessories equipped with a single coil and controlled by polarity reversal.
The SCSMD have two modes of operation - "DCC" and "MANUAL".
For switching between modes, used the push button.
Controlling in "MANUAL" mode carried out by toggle switches or by means of digital outputs from Arduino, for example with DCC++ command station (https://github.com/DccPlusPlus).
For configure DCC address, SCSMD has a "LEARNING MODE".

What do you need in addition?

In addition, you need to install libraries Bounce2 and DCC Decoder
https://github.com/thomasfredericks/Bounce2
https://github.com/MynaBay/DCC_Decoder

Configuration Variables (CV)

  • 514 - Output control and inverse mode
    The lower 4 bits define the output control mode. 0 = DCC, 1 = MANUAL.
    The upper 4 bits define the inverse output polarity. 0 = NORMAL, 1 = INVERSE.
    Default 0
  • 515 - Output #1 pulse time. X*100ms.
    Default 10 (1000ms)
  • 516 - Output #2 pulse time. X*100ms.
    Default 10 (1000ms)
  • 517 - Output #3 pulse time. X*100ms.
    Default 10 (1000ms)
  • 518 - Output #4 pulse time. X*100ms.
    Default 10 (1000ms)
  • 555 - Output #1 Address (LSB).
    Contains the low-order address bits for Output #1
    Default 1
  • 556 - Output #2 Address (LSB).
    Contains the low-order address bits for Output #2
    Default 2
  • 557 - Output #3 Address (LSB).
    Contains the low-order address bits for Output #3
    Default 3
  • 558 - Output #4 Address (LSB).
    Contains the low-order address bits for Output #4
    Default 4
  • 563 - Output #1 Address (MSB).
    Contains the high-order address bits for Output #1
    Default 0
  • 564 - Output #2 Address (MSB).
    Contains the high-order address bits for Output #2
    Default 0
  • 565 - Output #3 Address (MSB).
    Contains the high-order address bits for Output #3
    Default 0
  • 566 - Output #4 Address (MSB).
    Contains the high-order address bits for Output #4
    Default 0
    The values contained in CV555 and CV563 correspond to the bits in the Output #1 packets as follows:
    Accessory-Output = (CV555 + (CV563 *256)) - 1
    NOTE:Please, don't configure CV555-558 & CV563-566. Use LEARNING mode, for set the Output Address

How to configure

For first time run, do reset procedure.
To configure the CV, the serial port is used.
To change the value of the CV, send the appropriate command via the port monitor.
Available command:

  • <R CV> reads a Configuration Variable from the decoder
    CV: the number of the Configuration Variable memory location in the decoder to read from
    returns: <r CV VALUE> where VALUE is a number from 0-255 as read from the requested CV
  • <W CV VALUE>
    writes, without any verification, a Configuration Variable to the decoder
    CV: the number of the Configuration Variable memory location in the decoder to write to
    VALUE: the value to be written to the Configuration Variable
    returns: <r CV VALUE>
  • <B CV BIT VALUE>
    writes, without any verification, a single bit within a Configuration Variable to the decoder
    CV: the number of the Configuration Variable memory location in the decoder to write to
    BIT: the bit number of the Configurarion Variable regsiter to write (0-7)
    VALUE: the value of the bit to be written (0-1)
    returns: <r CV BIT VALUE>

How to reset decoder to default values

For reset decoder:

  • Press and hold "Reset" button on Arduino board.
  • Press and hold SW1 push button on PCB.
  • Release "Reset" button.
  • After the controlling LED twice flashing - release SW1 push button.

How to use

If output set in "MANUAL" operating mode, the switching is performed by supplying or disconnecting the low level (ground) to the corresponding control inputs.
At the same time, SCSMD ignores commands received for the Output-Address if this output set to "MANUAL" operating mode.
If output set the "DCC" operation mode, the switching is performed from the command received in DCC input to switch the corresponding output.
At the same time, SCSMD does not react to the signal level change at the input of the manual control for this output.
Also, in the “DCC” operating mode, the turnout positions are stored in the EEPROM and upon SCSMD power-up they switch to the position they were in the power turning off.

How to switch operating mode

By default, the all outputs operates in the DCC mode.
In order to switch between the operating modes:

  • Press and hold SW1 push button more when 1,5 sec.
  • The controlling LED start single flashing. It means that SCSMD switched to "LEARNING MODE" for output #1.
  • To select the "LEARNING MODE" for output #2, briefly press the SW1 button. The controlling LED will flash twice.
  • For the third output - press the SW1 button again, the controlling LED will flash three times, etc.
  • Within 15 seconds after switching on "LEARNING MODE" for the desired output, press and hold again more than 1.5 seconds the SW1 button. The LED will also stop blinking, indicating that the SCSMD has exited from "LEARNING MODE".
    The operating modes for selected output are switched in turn. If the mode was DCC, it will be switched to MANUAL and vice versa.

How to set DCC address

To set the Output address, the SCSMD must be in the "LEARNING MODE".

  • Press and hold SW1 push button more when 1,5 sec.
  • The controlling LED start single flashing. It means that SCSMD switched to "LEARNING MODE" for output #1.
  • To select the "LEARNING MODE" for output #2, briefly press the SW1 button. The controlling LED will flash twice.
  • For the third output - press the SW1 button again, the controlling LED will flash three times, etc.
  • After the desired output, send any command from DCC command station to necessary accessory address.
  • The controlling LED stops flashing. It means that SCSMD stored a new Accessory-address for selected output.
    If within 15 seconds after entering the "LEARNING MODE", the SCSMD does not receive a command to switch the accessory, it will exit the "LEARNING MODE", the controlling LED will stop blinking, and the Output-Address will remain the same.

Change Log

2017-11-24 version 1.0.1b

  • mapping enable pin to PWM for future using
  • change control pin processing
  • extended turnout structure

2017-11-26 version 1.0.2b

  • added procedure for resetting settings
  • changed the procedure for switching between operating modes

2017-12-05 version 1.0.2b

  • fixed bug when switching between operating modes

2017-12-29 version 2.0.1b

  • added Configuration Variables
  • СV setting is possible via serial port
  • the operating mode can be set for each output separately
  • the DCC address is set for each output separately

About

This is "Single Coil Switch Machine Driver", based on Arduino and designed to control accessories equipped with a single coil and controlled by polarity reversal.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published