Jump to content
 

Using a PIC micro-processor to control trains


MarshLane
 Share

Recommended Posts

On 05/02/2020 at 09:35, RobjUK said:

 

Quote

The motor's resistance has nothing to do with it. There is a shunt regulator across the motor that maintains a voltage across the motor proportional to the current supplied by the controller. This means the controller is controlling the motor's speed by current rather than voltage which also makes any voltage drop due to rail resistance irrelevant.

 

Except that the voltage "seen" at the controller consists of two components: The controller knows the current and it also sees the track voltage. It determines the motor voltage by controlling the current so it can easily determine the difference. The difference is the voltage drop along the track and as it knows the current it can easily determine the track resistance and therefore the distance from the feed.

 As a test , I picked up a few lengths of C&L HiNi track and did some resistance tests with my bench DVM.  Even accepting what you say , Id suggest that the practicality of extracting tiny  differences in voltage drop against a noise floor typical of model railways is close to impractical.  This is before you add effects that occur when track is painted and ballasted as you get leakage currents and parasitic currents flowing. My DVM tests suggest that there is a small range of resistivity in practice and that this range overlaps the absolute resistivity from track section to track section , meaning that you could even have to resort to track resistivity profiling to get it any near working 

Edited by Junctionmad
Link to post
Share on other sites

13 hours ago, RobjUK said:

 

Can you clarify that?

It makes no sense to me in the way it's written.

(Working with electronics and motor controllers for decades).

 

The voltage across a DC motor relates to it's speed-dependant back emf, plus voltage due to current and resistance.

Current on its own controls torque, or varies with load, depending how you look at it - not speed.

 

I agree resistance can be ignored to some extent if you alternately measure the back EMF then adjust the current up or down as required (with a series regulator) - or with a fixed series resistance, you can calculate the additional voltage that is adding to the back emf - but that's just with a bare motor at the far end of the circuit.

 

Where does the "shunt regulator" part come in to it?

 

 

I'll try to clarify ;)

 

The shunt regulator is in the locomotive.

 

For easy math let's say the controller outputs 1 amp when the locomotive's motor should receive 12 volts. But the motor might only need 0.5 amps. The electronics in the locomotive measures the incoming current and adjusts the shunt regulator until the motor receives 12 volts. In this case the motor is passing 0.5 amps and the shunt is passing 0.5 amps. If the load on the motor changes the on-board electronics adjusts the shunt current to maintain the motor voltage at 12 volts.

 

So the current supplied by the controller does two things. Obviously it supplies power but it is also a signal that represents the desired motor voltage.

 

Of course the whole thing is likely not very practical particularly at the smaller scales. There could be other ways to take advantage of rail resistance to determine position.

Link to post
Share on other sites

31 minutes ago, AndyID said:

 

I'll try to clarify ;)

 

The shunt regulator is in the locomotive.

 

For easy math let's say the controller outputs 1 amp when the locomotive's motor should receive 12 volts. But the motor might only need 0.5 amps. The electronics in the locomotive measures the incoming current and adjusts the shunt regulator until the motor receives 12 volts. In this case the motor is passing 0.5 amps and the shunt is passing 0.5 amps. If the load on the motor changes the on-board electronics adjusts the shunt current to maintain the motor voltage at 12 volts.

 

So the current supplied by the controller does two things. Obviously it supplies power but it is also a signal that represents the desired motor voltage.

 

Of course the whole thing is likely not very practical particularly at the smaller scales. There could be other ways to take advantage of rail resistance to determine position.

If you put a shunt regulator across a motor , you  will get a constant voltage across the motor , but you can’t vary speed, as you have no means of changing the regulation 

 

the simplest shunt regulator would be a zenner in parallel. 

 

As the load changes the voltage across the motor would remain constant ( once within the parameters of the shunt regulator ) etc. 

 

to measure track resistance you need a known voltage and a known current , the current is known and in theory the voltage drop across the motor is fixed , and as the controller supply voltage is fixed , in theory you have a known track voltage. ( ie controller output voltage -shunt voltage ) 

 

However , you have several real world issues 

 

* you have an unknown voltage drop in the supply to the loco 

 

* a shunt regulator is imperfect , and due to its output resistance it will have a voltage range. This will vary with I2R heat, ambient etc. and the basic response curve will not be precisely linear across the current range 

 

* given the very low resistance numbers and the inevitable variability of the track resistance and the factors mentioned above, not to mention the typical noise floor due to the all too common spikes and surges on a typical dc track , means the actual methodology simply wouldn’t be feasible in real applications 

 

 

Link to post
Share on other sites

34 minutes ago, Junctionmad said:

If you put a shunt regulator across a motor , you  will get a constant voltage across the motor , but you can’t vary speed, as you have no means of changing the regulation

 

I think you missed this bit:

 

"The electronics in the locomotive measures the incoming current and adjusts the shunt regulator"

Link to post
Share on other sites

22 hours ago, AndyID said:

For easy math let's say the controller outputs 1 amp when the locomotive's motor should receive 12 volts. But the motor might only need 0.5 amps. The electronics in the locomotive measures the incoming current and adjusts the shunt regulator until the motor receives 12 volts. In this case the motor is passing 0.5 amps and the shunt is passing 0.5 amps. If the load on the motor changes the on-board electronics adjusts the shunt current to maintain the motor voltage at 12 volts.

So you want to creep slowly - or especially to creep uphill with a long/heavy load.

 

That means a very low current to command a low speed, by your system. But, the motor needs high current.........

 

Link to post
Share on other sites

3 hours ago, RobjUK said:

So you want to creep slowly - or especially to creep uphill with a long/heavy load.

 

That means a very low current to command a low speed, by your system. But, the motor needs high current.........

 

 

Yes, but the current/voltage relationship need not be linear. Come to think of it it could possibly be an inverse relationship. That might be useful for reducing heat dissipation in the on-board electronics.

 

10 hours ago, sharris said:

An in-locomotive electronic regulator to control the motor?  Maybe some form of digital messaging protocol could be devised to set its level of regulation?

 

It might even catch on :D

 

Yes, we might call it ACC or something equally "catchy". Of course ACC is vastly superior to DCC because ACC returns continuous position feedback to the controller.

 

It might even make sense as a means of position sensing for RC trains. That would simplify the on-board electronics quite a bit. It would only require a dead-short between the wheels ;)

 

But like I said, still a few details to sort out.

Link to post
Share on other sites

On 08/02/2020 at 06:32, AndyID said:

 

By sensing the current. Sorry if I didn't make that clear. Do you think a diagram would be helpful?

Sure I’m intrigued cause the whole proposal is rather unusual 

 

I know exactly how shunt regulators work. What I don’t understand is how you command them remotely without building a whole signal transmission system 

Edited by Junctionmad
  • Like 1
Link to post
Share on other sites

On 08/02/2020 at 01:13, AndyID said:

It might even make sense as a means of position sensing for RC trains.

 

Nahh, I'd used synchronised atomic clocks in the locomotives and controller, and terahertz clocked counters to measure time-of-flight between the RC transmitter and receiver. :laugh_mini:

 

Although, getting back on topic, I get the feeling that the original poster didn't want to cram his locomotives full of electronics, hence the various options of magnets, barcodes and RFID chips that could be glued to the bottom of the chassis.

 

Edited by sharris
Link to post
Share on other sites

I've only been looking at this topic occasionally, but the one thing I don't get is the idea of trying to (simply) control a DC motor speed from 0 to max rpm by somehow measuring its current and subsequently forcing a specific value of current, instead of just KISS applying a voltage, either by direct analog, DAC or PWM. On my book, motor current is an indication of load, not speed. 

 

Andy

  • Agree 1
Link to post
Share on other sites

2 hours ago, Andy Reichert said:

I've only been looking at this topic occasionally, but the one thing I don't get is the idea of trying to (simply) control a DC motor speed from 0 to max rpm by somehow measuring its current and subsequently forcing a specific value of current, instead of just KISS applying a voltage, either by direct analog, DAC or PWM. On my book, motor current is an indication of load, not speed. 

 

Andy

you're not alone here Andy

  • Agree 2
Link to post
Share on other sites

11 hours ago, Andy Reichert said:

I've only been looking at this topic occasionally, but the one thing I don't get is the idea of trying to (simply) control a DC motor speed from 0 to max rpm by somehow measuring its current and subsequently forcing a specific value of current, instead of just KISS applying a voltage, either by direct analog, DAC or PWM. On my book, motor current is an indication of load, not speed. 

 

Andy

 

:)

 

I have some experience of motor control, albeit 3-phase BLDC. We do use torque control (i.e. current) loop but, ultimately, with some fancy maths, it's all about controlling and regulating the voltage applied to the motor.

 

Link to post
Share on other sites

  • RMweb Premium
19 minutes ago, Crosland said:

 

:)

 

I have some experience of motor control, albeit 3-phase BLDC. We do use torque control (i.e. current) loop but, ultimately, with some fancy maths, it's all about controlling and regulating the voltage applied to the motor.

 

Oxymoron alert.

Being pedantic you cannot have a Brushless DC motor, even more so a 3 phase one. It's another of those cop-out phrases that people like to invent for novel technology.

In reality the motor is AC, the control unit starts with a DC input voltage and converts it.

 

LIke this (a 3 phase BLDC!):

1066326217_motor1.jpg.f5cb9d124bfe7f053502596a8a64b8be.jpg

 

It uses a Hall device to detect speed.

Edited by melmerby
Link to post
Share on other sites

  • RMweb Premium
1 hour ago, Crosland said:

If you want to be really pedantic we started with an AC input voltage.

 

Full mains voltage rectified to 400V DC bus. Perhaps that makes it a BLACDCAC motor. Sounds like it should be powering a drill :)

 

Not if you are starting with a 12v battery, as with the one I posted.:D

Link to post
Share on other sites

7 hours ago, melmerby said:

Not if you are starting with a 12v battery, as with the one I posted.:D

 

If you want to be really, really pedantic the motor currents might alternate but the mean applied voltage is biased which means it's still a DC supply. AC has a mean voltage of zero as does a balanced 3-phase supply.

Link to post
Share on other sites

11 hours ago, melmerby said:

Oxymoron alert.

Being pedantic you cannot have a Brushless DC motor

 

Considering the variety of output waveforms that come from different types of 'DC controller' it's a bit rich on a model railway forum saying something can't be a DC motor ;)

Link to post
Share on other sites

On 09/02/2020 at 05:10, sharris said:

 

Nahh, I'd used synchronised atomic clocks in the locomotives and controller, and terahertz clocked counters to measure time-of-flight between the RC transmitter and receiver.

 

 

That wouldn't be much use. Unless you had two of them it would only give you distance without direction.

 

I can see I'm going to have to post a block diagram of the track resistance thingy. It's very simple for RC with battery power. Not so simple if power is supplied from the track.

Link to post
Share on other sites

In real life this system can’t maintain an accurate known voltage drop which would need to be millivolt stable 

 

 the effect of a finite output impedance of the regulator would mean that such a voltage would vary at different parts of the load line and to attempt to mitigate that , you’d have to have a 10x or more current through the regulator as opposed to the motor leading to major inefficiencies 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...