4
\$\begingroup\$

We are currently doing a project with DCC locomotives, involving a micro controller LPC1768.

Now the scenario is that we have a railway and under the railway we have hall effect sensors which the locomotives crosses over. Since we will have two different locomotives running on the track, is it possible to identify which one is currently crossing a particular sensor, since the trains do have their specific addresses in an address byte would it be possible to measure how the magnet(one magnet is in the form of a cylinder and one of a cube, and we are assuming they should affect the voltage or current differently) on each train affects the hall sensor. Another solution we have already thought of is to run the trains and measure where they are based on the magnets it has crossed. But for a nicer implementation a solution like the one ask for would be far easier to implement.

\$\endgroup\$
  • 1
    \$\begingroup\$ Ideas: (1) Use a polarity sensitive Hall sensor and mount one magnet N-side up and the other S-side up. (2) Put two magnets on one loco. Use two sensors to detect one or two magnets ... But: watch out for stray field from the motor magnet. \$\endgroup\$ – Transistor Jun 3 '16 at 16:31
  • \$\begingroup\$ Read the rules. Remove the silly salutation and the "thank you" at the end. Ping me when you fix this, and I'll undo the downvote and then maybe even read the rest of your question. Otherwise, those that can't be bothered to read the rules or to follow them don't deserve what they came here for. \$\endgroup\$ – Olin Lathrop Jun 3 '16 at 16:38
  • \$\begingroup\$ Magnets aren't a very good communications medium, which is what you are trying to do- communicate information (the locomotive identity). I'd be inclined to think of something like LEDs pulsed at different frequencies under the locos, with appropriate sensors on the track. The other possibility might be pulse-fed electromagnets. \$\endgroup\$ – Ian Bland Jun 3 '16 at 20:44
  • \$\begingroup\$ Thank you for your advices, I will look into your ideas @transistor. \$\endgroup\$ – Velija Povlakic Jun 4 '16 at 0:13
  • \$\begingroup\$ I reckon my question being a bit vague, and I will have it in consideration next time. Sorry I like being polite won't remove them. I understand your statement and could not agree with you more, thank you for pointing that out to me :) @OlinLathrop \$\endgroup\$ – Velija Povlakic Jun 4 '16 at 0:26
4
\$\begingroup\$

Look at RFID tags. They can be microscopically small (and lightweight). And cost only a few pennies for guaranteed unique identification. You could put a tag in each piece of rolling stock and use inexpensive sensor kit(s) to monitor/record/control the complete makeup of trains.

Ref: http://www.pcrnmra.org/pcr/clinics/RFID-in-Model-Railroading-20130123.pdf

\$\endgroup\$
  • \$\begingroup\$ Oh wow, nice to know about these RFID tags. Thank you so much for the answer! :D \$\endgroup\$ – Velija Povlakic Jun 4 '16 at 0:34
2
\$\begingroup\$

Its possible assuming a few things: That the magnets are different (your question wasn't quite clear on that). That your hall effect sensor can pick up the change in magnetic field with out saturation and with sufficient sensitivity.

If the magnets have different field strengths then you could differentiate the magnets by the difference in voltage from the sensor (assuming its not saturation, the voltage output of the sensor is proportional to the magnetic field strength). You could detect the voltage difference with a voltage discrimination circuit built from comparators

If the magnets are like a 'barcode' (like your post might suggest) then it would be more complex. The solution wouldn't be easy to implement, because you would have to monitor the voltage from the hall effect sensor and sample fast enough with an analog to digital converter to see the magnet go by, you would have to develop an algorithm to do this.

\$\endgroup\$
  • \$\begingroup\$ Keep in mind that in a model railroad layout, there are going to be many sensors, at least one per control block in the track. Sensing the field strength of each magnet would have to be separately calibrated for each sensor. \$\endgroup\$ – Dave Tweed Jun 3 '16 at 20:21
  • \$\begingroup\$ Thank you for a lot of time saving, we will definitely be not identifying based on the signal from the sensor. \$\endgroup\$ – Velija Povlakic Jun 4 '16 at 0:42
1
\$\begingroup\$

Single magnets, no.

However, you might try something like placing a pair of magnets in line, with sufficient spacing that a double magnet would produce a double pulse.

\$\endgroup\$
  • \$\begingroup\$ Got it! Think we will manage it through only programming and some common sense, thank you for the idea anyways! \$\endgroup\$ – Velija Povlakic Jun 4 '16 at 0:44
1
\$\begingroup\$

You need three magnets. Mount one of them under the fist locomotive. Place the other two under the second one at some small distance from each other.

Now count how many magnets were sensed in 2 seconds after sensing the first one. If 0 - it's a locomotive 0. If one - the other one.

If you need more locomotives use more magnets and also use different distances between them.

\$\endgroup\$
0
\$\begingroup\$

You are getting into the overall problem of occupancy detection. There are no easy answers. Some solutions are:

  1. Light detection. IR or visible light detectors are put under the track in various places. Either some ambient illumination is assumed, or IR LEDs are put overhead. Rolling stock on the track is detected by the shadow it casts.

    This has the advantage of working with any rolling stock without modification, but is susceptible to noise, changes in ambient illumination, and has problems with steady state levelling. Accumulated dirt is a never-ending problem. It also only measures occupancy at specific points.

  2. Current sensing. This measures the current draw from different sections of track. Some friends of mine are into model railroading, and I designed them a advanced DCC current sensor. It worked so well that I even made a product out of it.

    Advantages are that it senses whole sections of track regardless of where the rolling stock is. Problems are that unpowered cars aren't sensed unless you put deliberate resistors across wheel sets. 10 kΩ is sufficient for the OC1.

  3. Magnetic sensing. This is probably the least popular from what I can tell.

    It doesn't have the problem of adjusting to the ambient level as light detection does, but not all cars have a sufficiently large magnetic signature. It also requires more circuitry at each point, and is point-based like the light method.

All these methods as usually employed only tell you something is there, not what is there. The most common method I've seen to know what is where is to track it in clever software. As long as the software initially knows what's where, it can track it as it moves between sensed segments or points. There is a module in JMRI that already does this, and I've seen it work.

You could theoretically have each locomotive pulse a magnet with a unique ID, then detect that with the Hall sensors. However, if I wanted to do that I'd probably use IR pointing down with sensors below the track. That makes both the transmission and detection circuitry simpler.

With good software tracking, you only need occasional identification. I'd look into a combination of the two to keep track of where things are.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.