Jump to content

controlling DC trains with computer


HantuBlauLOL

Recommended Posts

Hi guys,

 

Currently I wondering about this idea. So few days earlier I learned something about a "signal generator" software. As the title, that software make a signal output on sound output jack. One of the signal is square wave, which could drive a DC motor (aka PWM signal).

 

If we take this to the next level (programming for timer based automatic train operation), I think it would be more useful.

 

 

But the problem for now is, the output max voltage is less than 1v, which is unusable for N scale train motors.

 

I need help here. Could anyone design an "amplifier" for this signal so its usable for scale trains?

Link to comment

The audio output is between 0.7 and 1V with a few mA of current that could't drive a motor and could barely drive an IR led, even when the full peak to peak dynamic spektrum of 2V is used on a stereo output.

 

This brings us to the nature of the output signal which is symmetrical around the zero, very much like a DCC signal and would only make a DC motor buzz.

 

Most audio amplifiers decouple the DC component on their input and use a capacitor on their output. This means a 100% pwm signal would be interpreted as 0 and they could only emit balanced waveforms like the sound output mentioned above.

 

I don't say it's impossible to do it but much harder than an amplifier and the audio output must use a less direct encoding, like frequency modulation.

Link to comment

On the other hand you could use an arduino board with a motor driver shield to drive the trains and the pc connection could be made with a usb cable with a simple ascii serial protocol on top. This should be doable with off the shelf components and software.

Link to comment

Did you try to create a 0% and 100% wave? I mean using the same frequency but not an 50% square wave? Try to listen to the 0% and 100% sound. Can you spot or measure any difference? Or any difference between a 25% or 75% wave? The problem is that audio outputs are designed for a certain frequency range and continous analog waveforms. You can't really get the sharp asymmetric signals out of the audio card as the line out amplifier filters out most of the data, mainly the DC component. Now if you derive the square wave, you get the information that actually gets out. If you try to listen to the 0%, 25%, 50%, 75% and 100% waves, you'll see the problem.

 

This is why the audio port should be used to transmit a frequency encoded signal, where the frequency (like between 5 and 20 kHz) contain the speed data. Or do what i did many years ago for a robotics project and emit an mfm coded serial stream, decode, deserialise and use the digital output as speed data for the pwm generator in the converter circuit. (just add checksums to prevent runaways as the error rate is quite high)

 

For a really simple circuit, you can try to just drive a power transistor with the rectified, but unamplified sound signal and set the speed with the loudness of the signal. In this case, even a simple sine wave will work nicely and the speed will be determined by the average volume. Just use low voltage drop signal diodes and an impedance matched gate circuit for the transistor, otherwise it won't work. The louder your noise get, the faster your trains run. It's not too elegant, but works.

Link to comment

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
×
×
  • Create New...