Page 1 of 1

Very simple occupancy detection

PostPosted: 29.03.2014, 17:58
by SvenH
We have a RaspBerry Pi that (soon) will drive a simple Märklin oval through a 6604 booster. Goals of our project are to a) keep it simple and b) do as much as possible in software, not hardware. This is a learning experience.

Next milestone will be block / occupancy detection.

As the Pi has a number of GPIO pins, with a built-in pull-up resistor, could we simply isolate a C-rail, and connect it to a GPIO pin? Our hypothesis is that a passing train will pull the pin to ground (assuming the grounds are connected of course). Does this work? If yes, it seems a pretty simple way to detect trains...

And if yes, how do we feed this back into RocRail...?

Re: Very simple occupancy detection

PostPosted: 29.03.2014, 18:16
by rjversluis
Hi Sven,

you better take a look at Rocnetnode and the GCA-Pixx hardware:
http://wiki.rocrail.net/doku.php?id=roc ... netnode-en

Connecting the track directly to the RasPi will probably destroy the GPIO.

Re: Very simple occupancy detection

PostPosted: 29.03.2014, 18:44
by SvenH
Hi Rob,
Thanks for your quick reply! Yes, we did look at RocNet etc, very impressive, but beyond our scope at this point in time.
I am more than willing to accept that our idea (mass detection on GPIO) is a very bad one, but looking at this here, a simple 1kOhm resistor between the rail and the logical input seems a good option to introduce some safety:

http://tinyurl.com/nep3c2d

What could possibly go wrong :wink: ? (famous last words...)

Re: Very simple occupancy detection

PostPosted: 29.03.2014, 18:47
by rjversluis
Well, good luck.
You have to write your own software in the RasPi to report it to Rocrail.

Re: Very simple occupancy detection

PostPosted: 29.03.2014, 22:32
by woodyboy
Before you connect your GPIO i should check if the brown wire from the 660x to the track is galvanic the same as the GND of your Pi. If this is not the case your Pi wil be a electronic Pye due to over voltage of your GPIO. I would prefer an opto if you go straight to the GPIO.

Good luck

Re: Very simple occupancy detection

PostPosted: 30.03.2014, 11:28
by Richard-TX
The simplest way to detect train using the Rpi is to go with Rocnetnode a couple of GCA kits. Peter's kits are inexpensive and flawless.

Doing it with the raw GPIO port is possible but not with a simple resistor. It takes much more than that to interface the Rpi to the DCC track. Doing it with a simple resistor almost guarantees destruction of the Rpi.