Arduino's in series as an S88 occupancy detector interface:

Post all your DCC only problems, solutions and discoverys here.
Post Reply
User avatar
RudyB
Posts: 250
Joined: Sat Sep 20, 2014 9:29 am

Arduino's in series as an S88 occupancy detector interface:

Post by RudyB »

A new video is out on the use of multiple Arduino's in series as an S88 occupancy detector interface.

Link to the video and to the software download.

Image

The software contains just 4 short chapters:

1. Initialisatiom
Declaration of the interrupt routines and of the 16 input pins with internal pull up.
The sensors should switch to GND. There is no current detection, but that can be externally added if wanted.

2. Main loop
Continuous scan of all 16 inputs. If a GND level is detected, the corresponding bit of a 16 bit variable called 'sensors' is set. This acts as a latch function, once set it remains set until it is sent out over the S88 interface. There's no anti-bounce ... I do not see the need.

3. S88 PS interrupt.
The S88 PS pulse signals the start of a new sequence of reading out 512 sensor bits.
The contents of the 'sensors' variable is transferred to another 16 bit variable called 'data'
The 'sensors' variable is then reset to 0.
The clockCounter is set to 0 (where it already is at that moment ... but just to be certain)

4. S88 Clock interrupt.
The S88 Clock pulse is the moment at which the next sensor bit must be made available at the output for the S88 bus to be read.
Read the bit with number 'clockCounter' from the variable 'data' and send its value (0 or 1) to the data-Out pin (which is connected to the S88 bus, or if it is the second, third, n-th Arduino in line, to the data-In pin of the previous Arduino).
Read the data-In pin and transfer its value (0 or 1) to the 'data' variable bit with number 'clockCounter'.
Increment the clockCounter, modulo 16

That's all.

Have fun.
Always try to have fun - website/blog - youtube channel
Post Reply