JMRI: Adding/Editing Sensors
Author: Bob Jacobsen
Keywords: JMRI help Sensor Add Edit

# Adding/Editing Sensors

- Add a Sensor
- Edit a Sensor
- Hardware specific Sensor properties

## Add a new Sensor

When adding a Sensor, from the "System connection:" drop down list select the hardware connection this Sensor is attached to.

Enter a valid address for the Sensor (look at the Tooltip for accepted input options per system). If desired, enter a User Name which can be anything you wish to describe the Sensor.
Finish by clicking the "OK" button.

### Creating A Number of Sensors

It is also possible to create a number of Sensors in one go.
Where supported the "Add a sequential range" check box will be enabled.

Checking this box will enable the "Number of items" spinner. Click the small arrows up or down to set the number of Sensors you wish to add. Clicking "OK" will then create that number of sequential Sensors in the table.
If a User Name has been entered, a number will be added to the end of the name to keep each Sensor User Name unique.

## Edit a Sensor

Clicking on [Edit] in any line of the Sensor Table opens the Edit Sensor pane to edit the following:

- Basic
- Debounce Delays
- Pull-Up/Down
- Usage
- Properties

### Basic

This tab lets you see and change basic information about the Sensor as entered on its creation:

- User Name
- a Comment on the sensor (free text to keep a note)
- a checkbox to use this Sensor as Inverted (Inactive will be interpreted as Active and vice versa)

### Debounce Delays

This tab lets you see and change Sensor specific values for the Sensor Debounce Delay.

### Pull-Up/-Down

This tab lets you set whether your hardware has a puul-up or pull-down resistor installed over the Sensor input.

### Usage

This is an information field, showing where you have the Sensor displayed on a Panel.

### Properties

Custom properties, only advised for advanced users.

## Hardware Specific Information

Please refer to our summary of allowed entry patterns per connection.

### NCE AIU Number to JMRI Sensor Mapping

The NCE Auxiliary Input Unit (or AIU) allows the NCE command station to check the status of inputs from the layout. These are referenced in JMRI as Sensors with names like "NS785". "NS" means "NCE Sensor", and "785" is the number of a specific Sensor input.

The hardware address can be entered in two different ways:

  Enter in the AIU Cab Address followed by the Pin Number separated by a ":"
  So for a sensor on AIU Cab Address 50, pin 2 you would enter into the Hardware Address field :
  50:2

  The Sensor number can also be found and entered into the hardware address field by using the following formula:

  Sensor ID = (AIU Cab Address - 1) * 16 + (Pin Number On AIU) -1

  For example: The AIU cab address is set to 50 and one of the BD20s is connected to pin 2. Therefore the Sensor ID would be:

  Sensor ID = (50 - 1) * 16 + (2) -1

  Sensor ID = 785

More on NCE sensor naming.

### LocoNet Sensor to JMRI Sensor Mapping

LocoNet Sensor addresses are either simply entered as an ordinal number or made up from two different parts: the Board number and the Channel number.
Sensors can also be configured from the Turnout addresses for the Aux & Switch input.

The hardware address can be entered in a number of different ways:

  If you know the Sensor number, enter it in the Hardware Address field.

  Enter the board number, followed by the channel number separated by a ":"
  So for a Sensor on board 11, channel 1 you would enter into the Hardware Address field:
  11:1

  For Sensors attached to Turnouts, you enter into the hardware address field "T:" followed by the Turnout number. This will add the Aux input associated with the Turnout. To add both the Aux and the Switch input, check "Add a sequential range" and set the number to add to 2.
  So for a Sensor attached to Turnout 81 you would enter the following:
  T:81

  The third method is to calculate the address of the Sensor and add it manually into the hardware address field using the following method:

  If you want to calculate the address of a BDL168 input, you can use
  number = 16 * (board number) + (channel number) - 16

  where "channel number" runs from 1 to 16. For example, the first circuit (number 1) on board 11 has number:
  number = 16 * (11) + (1) - 16 = 161

  as we saw in the example above.

  If you want to calculate the address of a DS54 aux input, use:
  number = 2 * (turnout number - 1) + 1

  For example, the aux input associated with Turnout 81 has number:
  number = 2 * (81 - 1) + 1 = 161

  If it's the switch input, you add one more to that:
  number = 2 * (turnout number - 1) + 2

  For example, the switch input associated with Turnout 12 has number:
  number = 2 * ( 12 - 1 ) + 2 = 24

More on LocoNet sensor naming.

### Lenz XpressNet Sensor to JMRI Sensor Mapping

XpressNet Sensor addresses are made up from two different parts: the Feedback Encoder address and Contact.

The hardware address can be entered in a number of different ways

  Enter in the encoder address, followed by the contact separated by a ":"
  So for a Sensor on Feedback Encoder address 99, Contact 3 you would enter into the Hardware Address field:
  99:3

  If you wish to calculate the address of the Sensor, subtract 1 from the Feedback Encoder's address, multiply that result by 8, and then add the input number you are using.
  For Example, if you are using Contact 3 on a Feedback Encoder with address 99, 99 - 1 = 98. 98*8=784. 784+3=787.
  The feedback address you will use is 787.

More on XPressNet sensor naming.

### CBUS® to JMRI Sensor Mapping

Short event 18 on and off : "+18".

Short event 18 on, short event 21 off : "+18;-21".

Long event Node 2 Event 18 on and off : "+N2E18".

CAN frame hex string : "X9000020012;X91FFFFFFFE".

Full details for CBUS sensor naming.

### Maple and C/MRI Sensor to JMRI Sensor Mapping

Maple and C/MRI sensor addresses are made up from two different parts: a Node Id and Pin/Sensor Id.

The hardware address can be entered in a number of different ways:

  Enter the Node Id, followed by the Sensor Id, separated by a ":". This method can also be used for the alternative/extended addressing.
  So for a Sensor on Node 2, pin 3 you would enter the following into the hardware address field:
  2:3

  Another method of adding the Sensor address is to use the following formula:

  Node Id x 1000 + pin.
  So for a Sensor on Node 2, pin 3
  (2x1000)+3 = 2003

  To use the alternative/extended addressing scheme, refer to your C/MRI hardware connection guide.

More on Maple and C/MRI sensor naming.

### Grapevine Sensor to JMRI Sensor Mapping

There are three separate types of Grapevine Sensors:

Advanced Serial Detectors
  Up to three Advanced Serial Detector boards can be attached to a Grapevine Node. Each provides eight occupancy detectors, and associates a motion detector with each of those.

  Board | Occupancy | Motion
  --- | --- | ---
  Master | 1-8 | 9-16
  Slave 1 | 17-24 | 25-32
  Slave 2 | 33-40 | 41-48

Original Serial Sensors
  Occupancy Sensors on the original serial boards replace Sensors attached through advanced boards at addresses 1 to 8. There are no motion sensors in this case.
Parallel Sensors
  The parallel sensors, connectors on the Grapevine node itself appear as JMRI sensors 101 to 108 on the node. If the optional second bank of serial sensors are present, they appear as sensors 109 to 116 on the node.

More on Grapevine sensor naming.

Back to the Sensor Table help page.

CBUS® is a registered trade mark of Dr Michael Bolton