a change is resistance is not correct ?
No, a "power rail" is essentially a piece of wire, and while it does have a resistance it's pretty unlikely that's what you where measuring, and anyway it would not have changed with a slight change of current.
I assume you actually measured voltage. Where exactly did you place the two probes to make the reading?
But anyway as Paul said, you are barking up the wrong tree here, if you can't somehow access the control signal then measuring the current through the motor's power wire is the most foolproof method.
^ yes you guys are correct.
Here is the scenario,
I am working on an train layout, and just wanted the arduino to tell me when the train was on a specific section of rail… the rails have power all the time… so as you guys can’t see, it can’t really hook up to the motor inside the model train.
So I am now thinking or using some sort of reflectance sensor to “see” the train pass on top. Not sure if this will work.
But in regards to what I was measuring, I had the multimeter in ohms 20K and I had the red probe on one end, and the black one of the other end of the rail. When I touched one of the leads of the motor to this, I would see the reading go from 0.000 to 0.001.
I am sorry, I am new to electronics, and I will be taking a class at the local community college in June. I am fascinated by electronics etc. - back to what I was doing, I though I was measuring the resistance.
It's always a good idea to say what the overall project is about.
If you have different track sections you could probably use the Arduino to detect whether current is flowing thorough the motor of a loco on any particular section, but there would be a lot of wiring. And you would probably have no position indication for a stationary loco unless you created some system to send short pulses which could be used for detection but wouldn't be sufficient to move the motor.
I am planning to use Light Dependent Resistors (LDR) embedded in my sleepers to detect my trains. They are very cheap and easy to interface to the Arduino. And from tests I have done they will work perfectly well with ambient light.
If you were to start by describing what you really need, rather than some idea that has occurred to you that just might be the answer, you are likely to get a solution much quicker.
Detection of a train on a track segment is - of course - a very old requirement both on "real life" railways and models. It is usually performed by using an AC circuit versus the DC feed for traction, with inductors used for isolation of each track segment.
Since contrary to your original explanation, you can insert circuitry in line with each track segment, the outright simplest way to do this is to insert a pair of "back to back" power diodes in series at each section, and monitor the voltage across these - most easily with a pair of transistors whose emitters connect to the supply and bases - through a 1k resistor - to the track side. This allows for both positive and negative supply to the track. (I have left out a few details here.)
In order to detect stationary locomotives, you simply ensure that the controller always supplies a minimum of about 2V to the track.
I know guys, I am sorry for now being straight forward from the get go. Will that next time, you are right, this way you are better able to help.
Robin2: ..If you have different track sections you could probably use the Arduino to detect whether current is flowing thorough the motor of a loco on any particular section, but there would be a lot of wiring....R
This is essentially want I want to do, but I have not idea how, other than connecting to the L and R rail, but then all I am able to get is the 12v from the rails, and its very jumpy.
This is why I was thinking ( with my limited knowledge) of how to detect resistance or current as mentioned. The other question is, wouldn't I need to break the rail in order to measure the current running through it, or now that I think about it, could I tap into the negative wire feeding the neg track and plug that into a digital input ? with hopes that when the locomotive is places on that section of track, the input wire can sense a change in current.
The Arduino can only measure voltages. The usual way to measure a current is to have a very low resistance "shunt" in series and measure the tiny voltage across it when current flows. You would need to amplify the voltage to make it detectable by the Arduino. And you need to be able to deal with reversed voltages. So it starts to become a lot of trouble if you want to do a lot of separate sections.
I don't really follow @Paul_B's suggestion, but it seems to be no less trouble to implement.
In my opinion although it would be nice to do it like the real railways it is just too much trouble - hence my decision to use LDRs. For each detection point all you need is the LDR and another regular resistor to make a voltage divider. The Arduino reads the voltage at the junction between the LDR and the other resistor. When anything covers the LDR the detected voltage will change. You need to consider the operating logic to decide where to locate them - for example do you want to know when the front of the train first covers one, or when the end of the train uncovers it or maybe both.
yeah I also seem to think that the light sensor may work even better and be more consistent, considering how power supplies are not always steady.
So I have been doing a lot of research - more than what I anticipated but it think this has been a great learning experience.
I did try the light sensor with the arduino and I worked well - for now. The biggest problem is that since the sensor it between the rails and it's looking up, I get some false alarm. I want something more consistent so I am back to the drawing board.
Paul has been quite generous via PM's with some insight that has lead to advances in my quest but I still need help.
I have been reading that I can make a voltage divider between the positive and negative rail and read the divided voltage and feed it through an op-amp and then to the arduino or any other 5v logic device.
Last night, I placed a since resistor across the rails, connected the multimeter to its legs and took two readings: one with the train one the track which showed a drop in resistance, versus when the train was not on it. This was done of course with no power.
Ideally, I would like to use this information (drop in resistance) to drive the output of an op-amp, but I am just not sure how to achieve this. I understand that will need to convert this resistance to a change in voltage, but Like I said, I have read about using a voltage divider? or even a bridge rectifier?
I also power the train track with 10-12 volts, but because I plan to plug all of this into the arduino I need the output of the op-amp to be 5v. I just want a High or low.
I think I am much closer than when I started this thread and have a good idea what I need; just need a little push in the right direction.
The biggest problem is that since the sensor it between the rails and it's looking up, I get some false alarm.
Explain more about the false alarms. It may be possible to eliminate them with software. Using optical sensors is so much simpler that it is worth persevering.
False alarms meaning a change in ambiance light would trip the sensor.
One way to deal with that is to have another sensor exposed to ambient light and use the difference between the two to trigger events.
However I suspect the difference in light level due to a train obscuring a sensor would be much greater than the change due to ambient light. I suggest some testing.