Very simple occupancy detection

Moderator: Moderators

Very simple occupancy detection

Postby SvenH » 29.03.2014, 17:58

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...?
SvenH
 

Re: Very simple occupancy detection

Postby rjversluis » 29.03.2014, 18:16

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.
Best Regards, Rob.
:!: PS: Do not forget to attach the usual files.
:!: PS: Nicht vergessen die übliche Dateien an zu hängen.
[ macOS - Linux] - [ N: CBus - CAN-GCA ] - [ 0: RocNetNode - GCA-Pi ]
rjversluis
Site Admin
 

Re: Very simple occupancy detection

Postby SvenH » 29.03.2014, 18:44

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...)
SvenH
 

Re: Very simple occupancy detection

Postby rjversluis » 29.03.2014, 18:47

Well, good luck.
You have to write your own software in the RasPi to report it to Rocrail.
Best Regards, Rob.
:!: PS: Do not forget to attach the usual files.
:!: PS: Nicht vergessen die übliche Dateien an zu hängen.
[ macOS - Linux] - [ N: CBus - CAN-GCA ] - [ 0: RocNetNode - GCA-Pi ]
rjversluis
Site Admin
 

Re: Very simple occupancy detection

Postby woodyboy » 29.03.2014, 22:32

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
Last edited by woodyboy on 04.04.2014, 11:21, edited 2 times in total.
Regards,

Bert

Equipment: Roco WLANMaus, MS2, Gleisbox 2x(separated switch & rollingstock). Ubuntu 16. Edits booster. Arduino: S88 CANbus interface & Ethernet-CANbus gateway
woodyboy
 

Re: Very simple occupancy detection

Postby Richard-TX » 30.03.2014, 11:28

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.
Richard
Dallas/Fort Worth
Texas USA
Richard-TX
 


Return to DIY Hardware