6
\$\begingroup\$

I'm attempting to control the speed of two slot cars in a set using Arduino.

enter image description here

Each car is controlled by a controller with a variable resistor that looks like this:

enter image description here

They're wired in parallel to the same 17V DC power supply:

enter image description here

Simplified:

enter image description here

For Arduino control, I experimented with manipulating a single car's speed using a MOSFET. It worked really well. Using a PWM output on the Arduino, I was able to pulse the MOSFET on and off to throttle the current and change the car's speed. The behavior of the MOSFET seemed to be exactly the same as the variable resistor controller; the resistance, voltage, and current fluctuated the same way on various parts of the circuit.

Enter car B. I added a MOSFET to the setup and mimicked the MOSFET wiring for car A, grounding them both to the Arduino ground. The result looks like this:

enter image description here

Here's a sketch:

enter image description here

Close up, MOSFET A:

enter image description here

MOSFET B:

enter image description here

At first, all seemed well. I sent signals to MOSFET A and successfully changed Car A's speed. I stopped Car A and pulsed MOSFET B, and I was able to control Car B's speed just fine.

Then, I turned Car B to a constant speed, and sent a signal to MOSFET A while Car B was still running. Car A started, but Car B's speed immediately dropped as a result of running Car A.

I hooked a multimeter up across the rails of Car B and watched its voltage while it ran on its own. Then, sure enough, when Car A started running alongside it, Car B's voltage dropped dramatically.

I figured this was because of my wiring configuration, so I left the multimeter on Car B, and made one change. I replaced MOSFET A with the original slot car controller:

enter image description here

I started running Car B again using its MOSFET. The multimeter showed a steady voltage, so I began to squeeze Car A's controller (the variable resistor), and Car A's speed increased. This time, however, unlike using a MOSFET to control Car A, the variable resistor did not affect Car B's voltage at all. Car B remained at a steady speed the whole time.

Any idea why this happens? The MOSFET seemed to function the same as the variable resistor (empirically) with a single car, but had totally different behavior with two cars in parallel. Is it because the MOSFET is not really changing resistance to current, but just switching it on and off, so it opens up another path for current to flow fully every time it closes? Is there an Arduino-controllable alternative to a MOSFET that would fluctuate actual resistance like the variable resistor? Digital potentiometer? Servo hooked up to a potentiometer? ;) I'm really curious what the difference is and what causes the major differences in behavior.

\$\endgroup\$
12
  • 1
    \$\begingroup\$ I hate to ask, but did you double-check that you connected between the busses for power and ground on your breadboard? I see the orange jumper, but no others. \$\endgroup\$
    – Bryan B
    Commented May 16, 2012 at 21:41
  • \$\begingroup\$ Good catch. You did help me notice one missing jumper. I meant to connect the two grounds up top so there was a shorter path out of the MOSFET to ground. But, I'm probably being a bit unconventional in how I set it up, in that the two power busses on either side on the bottom are connected to the positive controller lines for the cars, while the two ground busses up top are connected to their respective negatives. So, it's ok for the ground lines to be connected between controllers (since they are inside the slot car set anyway), but I intentionally kept the two positives separate. \$\endgroup\$ Commented May 16, 2012 at 22:13
  • \$\begingroup\$ What's the resistance range on the original controllers? What happens if you hook both MOSFETs to the same PWM signal? \$\endgroup\$
    – mng
    Commented May 16, 2012 at 23:03
  • 2
    \$\begingroup\$ Slot cars use a fair amount of current, breadboards and breadboard jumpers can have significant resistance, and the MOSFETs are going to be sensitive to any voltage drop in their source wire. I would suggest that rather than having the supply wire enter the top rail and then having current for both MOSFETs go through a single red jumper wire, you should connect the ground to three breadboard-compatible wires using a solid connection (not the breadboard itself) and then have one of those wires connect to each MOSFET source and have the third connect to the Arduino. \$\endgroup\$
    – supercat
    Commented May 17, 2012 at 16:00
  • 1
    \$\begingroup\$ Thus, the current feeding each car will only have to go through one short length of breadboard wire (between the main ground wire and the breadboard), and two breadboard holes, and those connections won't be shared between the two cars. As it is, the current for both cars has to go through a shared red jumper wire and three shared breadboard holes. If the connecting ground wires off-board would be difficult, you could try as a start replacing the orange jumper with another red jumper from the top rail to the left half of the bottom ground rail. \$\endgroup\$
    – supercat
    Commented May 17, 2012 at 16:03

4 Answers 4

1
\$\begingroup\$

YOu are entering a world where Electro Magnetic Compatibility is at risk. Pay attention to the stray current spikes that radiate noise (Egress) and their influence on other circuits of high impedance (Ingress). YOu probably also have ripple or the conducted egress and ingress as well.

For radiated noise a handy tool is a small AM radio (not FM) nearby, to locate such noise issues if you dont have a scope.

Noise suppression management may include some common mode chokes to the track or pot lines. Perhaps some supply rail filtering may need to be added around the track.

I would use ferrite beads for each driver with caps after the bead and then use twisted pairs to send the current after going thru a ferrite torroid or similar common mode choke, like those used in Video cables. Its good to have a kit of parts for such issues.

Add decoupling caps to the breadboard for both sides.

\$\endgroup\$
2
  • \$\begingroup\$ Not sure this addresses the problem. Whilst PWM on small brushed DC motors is bound to generate a lot of noise, I am not sure it can be blame for the observations. \$\endgroup\$ Commented May 17, 2012 at 16:03
  • \$\begingroup\$ Ingress from adjacent cars will propagate to loading effects on drivers and source ripple on DC power on the tracks. It will be stemming from both radiated and conducted noise from motors and depends on distributed wiring of DC along tracks. But this interaction of the race will significantly reduce the performance of each motor. Proof: If a DC motor on a track will gain speed by simply putting a low ESR(10mΩ) Cap across the motor, then Ingress/egress is an issue. In this case, conducted. Of course it will run hotter and burn out sooner but it will be faster. \$\endgroup\$
    – D.A.S.
    Commented May 17, 2012 at 17:08
1
\$\begingroup\$

I suspect that your two PWMs are in phase: on at the same time, off at the same time. This is likely to cause the voltage to drop at the output of the power supply. Try a large electrolytic capacitor of suitable voltage rating across the power supply, and making sure that your PWMs are out of phase.

You should also have a diode connected in parallel with your driver MOSFETs, in the normally non-conducting direction. This shouldn't make much functional difference other than avoiding damage to the MOSFETs from back EMF.

\$\endgroup\$
2
  • \$\begingroup\$ I'm going to look into the phase issue. That's along the original lines of what I was thinking could be the problem, but didn't know where to start looking. I'll post back what I find out.. \$\endgroup\$ Commented May 18, 2012 at 17:01
  • \$\begingroup\$ As I think about this more, wouldn't I still always have them on at the same time on occasion no matter how I shift the phase? Even if the cycles started at different points on the timer, if both cars ran at full speed, they would overlap each other, and still have difficulties. \$\endgroup\$ Commented May 18, 2012 at 19:43
1
\$\begingroup\$

I ended up finding that the L298 driver provided all the circuitry internally to control two motors separately and keep them isolated. It worked really well using the part directly, but it needs some extra stuff to control heat. This got complicated pretty quickly, just like trying to isolate the MOSFETs did.

Finally, I settled on buying this motor driver from SparkFun, which uses the L298 at its core:

https://www.sparkfun.com/products/9670

It has worked incredibly well for months, and it was a good investment to not have to design the circuit around the L298 myself. Plus, it adds a few extra really nice-to-have features and packages it all together in a nice board with screw terminals for your power supply and motors.

\$\endgroup\$
0
0
\$\begingroup\$

You have got diodes across the motors so that is ok...

I think you problem is one of current, a breadboard and the jumper wires will limit the current flowing to the motors from the supply, you need a thicker wire for the common ground from the FETs to the supply negative.

One motor is ok, but when you start to use two, the extra current will cause problems.

Try taking 2 identical jumper wires from the motor supply ground, and have 1 to each fet source pin (leave the other wires to your ground rail on the bread board (Yes you will get a ground loop, but for testing this will prove if the breadboard / links are limiting the current))

\$\endgroup\$
2
  • \$\begingroup\$ This seems to make a lot of sense, and I'll give it a try. At the very least, it's an improvement to my current setup. The only thing that kind of throws a wrench in that thought for me is that the exact same circuit works fine if I replace one of the MOSFETs with the original variable resistor controller. Shouldn't I still face the same current issues in that case, or is there a different principle at work? \$\endgroup\$ Commented May 18, 2012 at 16:59
  • \$\begingroup\$ No dice. I just hooked everything up per @supercat's suggestions above, and have the same issue. \$\endgroup\$ Commented May 18, 2012 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.