Go Down

Topic: How do I get two different signals from one voltage divider ? (Read 286 times) previous topic - next topic

DonRecardo

The title doesnt explain it very well but I couldnt think of a better one

Its probably easier for me to say what the circuit is to be used for first to make it easier to
understand what I need to do

in a car engine the speed of the car is proportional to the speed the engine is turning at
so if for example you get 10 MPH at 1000 RPM  you will get 20MPH at 2000RPM so logically
the sound of the engine note goes up in proportion to the speed of the car

I am fitting a sound unit into a large scale model train
the throttle is a pot that gives a variable output of 0v to 5v and this feeds a PWM circuit to control the motor. It also goes to the input of the sound board so as the train speed increases the engine note rises.
and all that sounds great but it isnt.
My train is a model of a diesel hydraulic and the speed shouldnt follow the engine sound in the same way .When you open the throttle ( even to full throttle ) the train should start reving as you would expect but pull away slowly and increase its speed till it reaches that set by the throttle but this should take a few seconds , and the same with slowing down, shut the throttle and the engine note drops right down but the train slows gradually again over a few seconds . Its a bit like driving a car with a badly slipping clutch

So , the pot I need to use  as the throttle should still give me a voltage between 0-5v that follows the throttle lever for the sound board  but also a second output that has a delayed rise and fall  for the train speed ( I will try to upload a picture to show basically what the two signals are doing versus time.

 

I am assuming it could be done by taking the output of the pot to a capacitor and resistor that would limits its charging/discharging rate but I am not sure how to do it or what sort of value cap and resistor to use .

Any ideas would be appreciated

MarkT

You need to measure the speed of the train with an encoder on one of the wheels?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

DonRecardo

You need to measure the speed of the train with an encoder on one of the wheels?
You need to measure the speed of the train with an encoder on one of the wheels?
No not really I just need to make the output from the pot change slowly even if I move the pot quickly which is why I thought a capacitor charging/discharging might be the way to go

What speed the wheels are going is irrelevent to what speed the engine sounds go , which is why  when the train is at a stand still and you open up the throttle quickly the train pulls away slowly even though the engine
is revving quite high

groundFungus


vinceherman

Confirm or correct my understanding of your description.
You want the throttle to drive the sound card directly, which it does now.
You want a modified throttle signal to go to the PWM motor control circuit so that the train accelerates and decelerates more slowly.

I could see an arduino sitting between between your throttle and your motor circuit, taking the throttle input and spreading it out over time, giving you the slow acceleration and deceleration you want.

If your motor circuit can take a PWM input, then you could feed it from the arduino.  If not, a digital potentiometer should do the trick.

If it were me, I would also want an E-stop button that would instantly feed the motor a stop signal.  We put a long, slow acceleration curve on our HO trains and it is surprising how many times we hit the red button.

dougp


AdeV

I think groundFungus and vinceherman are on the right track* - in order to properly simulate though, you'll need 2 integrators - one to drive the sound effects (because that will have a relatively quick reaction time), and a second one with a rather larger capacitor to control the motor speed of the loco.

I'm not sure if you can use the same pot for this, or if you'd need to change to a dual-gang pot to keep them electrically separate.

Alternatively, can you send PWM to your PWM circuit & have it behave properly? If so, you could use a microprocessor to generate the two signals based on throttle input, speed of throttle movement etc.

Also, when you're simulating inertia, it's wise to have an emergency override switch or button.... just in case you mistime it, no point in having an actual rail crash in the interests of realism!

*No pun intended.

DVDdoug

I don't think you need to mess with the analog...   You can put some delay/ramping in the software and maybe ramp-up (accelerate) more-slowly than you ramp-down (decelerate).   

For your delays, use the method from Blink without Delay, since the delay() function will pause the processor during the delay time and prevent it from responding to your input. until the delay-time is up

DonRecardo

An integrator may be what you are looking for.
I think thats exactly what I was refering to , I just wasnt sure at the beginning how it was wired up
but your link explained it thank you 

DonRecardo

Confirm or correct my understanding of your description.
You want the throttle to drive the sound card directly, which it does now.
You want a modified throttle signal to go to the PWM motor control circuit so that the train accelerates and decelerates more slowly.

I could see an arduino sitting between between your throttle and your motor circuit, taking the throttle input and spreading it out over time, giving you the slow acceleration and deceleration you want.

If your motor circuit can take a PWM input, then you could feed it from the arduino.  If not, a digital potentiometer should do the trick.

If it were me, I would also want an E-stop button that would instantly feed the motor a stop signal.  We put a long, slow acceleration curve on our HO trains and it is surprising how many times we hit the red button.
I have no doubt your suggestion would work fine but Im not sure it isnt overkill for what I need
Using Fungus's integrator was what I had been refering to , I just didnt know its name

As for your safety measures I quite agree . The train is a 5" gauge ride on and may be carrying 8 or more passengers so I do have an E stop and a hand brake just incase it all goes a bit wrong

Don

TomGeorge

Hi,
You need to build a controller with INERTIA simulation.
You read the control pot as the engine/motor speed sound and the the inertia circuit/software takes care of the actual track speed.

You throttle UP, power unit noise goes UP, track speed goes UP under inertia control.
You throttle DOWN,  power unit noise goes DOWN, track speed goes DOWN under inertia control.


You shut the throttle OFF, the power unit noise drops immediately back to IDLE, track speed goes DOWN to STOP under inertia control.

You integrate a brake control to modify the inertia effect along with an E-Stop.


Hope this helps.. Tom... :)
GWR (Gods Wonderful Railway) fan.



Everything runs on smoke, let the smoke out, it stops running....

Go Up