View Full Version : Supressing Current Spike
04-07-2007, 05:02 AM
When I first put my noisy model train motor on the track I find it creates a pattern of noise that causes my logic circuits to crash (see my post noise). What can I do to slowly ease that motor on? The circuit initially has no load, whenever a load is placed on it, I want to prevent it from suddenly powering up.
04-07-2007, 05:11 AM
"Slowly easing the motor on" is not likely to fix your problem. Model trains have other noise issues like the intermittant connection to the rails. You need to have a stable, noise-free power supply for your logic circuits. How are you powering your logic? What do you have and how is it connected? There may also be noise working back into your circuitry from the outputs (whatever they are). You may need some isolation for the inputs and outputs as well. Other people use Stamps and Propellers to control huge relays switching 3-phase power in industrial environments without problems. Their controllers have to be very carefully designed to avoid these kinds of noise problems. It can be done.
04-07-2007, 05:14 AM
The logic is powered by the USB bus. I have schmitt trigger optoisolators between the power supply and logic completely seperating everything and still it somehow manages to affect it.
04-07-2007, 05:42 AM
Again, you will have to post at least a partial schematic and some portions of your code for anyone else to give you more than general suggestions. You may have noise coming in on your USB bus. You may have problems in your program when there are noisy inputs. Who knows? You're not providing enough information.
04-07-2007, 06:26 AM
My schematics and programs are attached.· Note SX20 pin chips are used in the schematic because that is what I will use in the final design.· I am using SX28s for prototyping because they are through-hole.· There is also a 4mhz resonator for U2.· The UM232R is a usb to ttl converter module.· The resonator and UM232R (there are pointers that correspond to the appropiate pins on it) are not listed because I do not know their symbols.·
04-07-2007, 06:37 AM
Are you ramping the PWM up when starting the motor?
04-07-2007, 06:42 AM
The only time noise is a problem is when the track is live and I place the·locomotive on the track.· Even if I do this I have to "like wiggle it around in a certain way" to get the logic to crash.· Normally I would not do this but certain conditions on my·train layout may cause·the same problem·so I·do not want it·crashing under any circumstances.· I think its the UM232 and/or U2·that is crashing because U3, the PWM generator, still generates pulses after the crash.· RB on U2 still holds its state along with RA.1.· The only thing that does not·work is the SERIN·part.·
Post Edited (Lightfoot) : 4/6/2007 10:54:38 PM GMT
04-07-2007, 06:46 AM
Starting at 0 duty and gradually chanmging duty to the desired speed. In a loop it would resemble:
'set duty to 0 here
duty = duty plus 1
I am not sure on SX code, but you ge the idea, you start the duty at 0 and ramp it up so the motor des not get full power at the start. Think of it as turning a dial, only you are increasing the duty.
04-07-2007, 06:48 AM
Sorry I guess it wasn't clear where the problem was, can you not just start the motor power after the train is on the track?
04-07-2007, 06:50 AM
just edited my last post.
04-07-2007, 06:52 AM
I suspect you're coupling noise somehow from your track or control circuitry into your USB driven power supply. It looks like there's some filtering on the UM232R, but it's only about 15uF. You might need more. I'd suggest adding a 100uF 6V or 10V electrolytic capacitor across your Vdd supply and perhaps another one or two 0.1uF ceramic capacitors mounted at the SX processors (within an inch or two max.) Make sure none of the logic is physically too close to the track or its wiring and that the USB cable doesn't parallel anything carrying power. I'm assuming that your power ground and logic ground are separate.
I'm not an SX programmer, but your programs look pretty trivial.
04-07-2007, 06:54 AM
they are seperate
04-07-2007, 06:58 AM
You may also need much better filtering in your motor power supply. Try adding 470uF or 1000uF on the output of the regulator..
04-07-2007, 07:34 AM
.1uf caps across power pins
470uf cap across voltage regulator output
100uf cap across +5v and GND for logic power supply.
04-07-2007, 08:49 AM
To understand this better, you have a live track that you want to place the locomotive on and have the locomotive immediately start moving? The locomotive has the typical slides on the bottom that move over the surface of the track?
If that is the case, could you try a few tests and post the results. First, since the track is live, could you place a 220R and and LED across the track somehow so that you have LED status at all times showing power. Second, place an LED and resistor on both SX's on a spare pin, set the code to go high(LED on) on boot. Put an LED on the power rails for both supplies. Once you have visual indicators in the places described, try to get it to crash again and note any LED status changes.
Lastly, try sheilded cable on all inputs to the SX's, and even try some grounded aluminum foil or sheilded enclosure around all the logic and SX's.
04-07-2007, 08:56 AM
No, it is not european HO scale. One rail is + and the other is -. The power is picked up by the wheels.
04-07-2007, 09:07 AM
Well the same test should apply and might provide some info.
Post Edited (TChapman) : 4/7/2007 2:06:38 AM GMT
Beau Schwabe (Parallax)
04-07-2007, 10:01 AM
This regulator design is ideal for what you are experiencing...
Beau Schwabe (mailto:email@example.com)
IC Layout Engineer