Hello! I am working on a non-competition robot which uses this year’s cRIO as the control system. I would like to find a way to control the brightness of lightbulbs directly from the cRIO. This means I need to find a way to make the cRIO control the current through one of its outputs (or an ouptut on the ditigal sidecar).
Is this possible? From what I’ve been trying to figure out, its not. It seems that every output is either ground, a constant (uncontrollable) 5V, or the signal which sends information by changing the voltage from ground to some constant for a specified length of time.
In the past I have used a victor motor controller to control lights, but it would save the team $75 (for a Jaguar) and give me more options if I could figure out how to do it using only the cRIO.
hal,
The Crio has limited output current capability in that it is designed to drive digital inputs. If you are wanting to vary brightness in LED or filament lamp strings, the speed controllers are the best way to do that.
If you are using incandescent bulbs, I can’t help you. But, if you are using LED’s, you can just hook them up to the PWM outputs, or to to the digital outputs (if you use the digital outputs, you will have to write code to pulse them like PWMs to vary brightness). Be sure to check the current source max on the sidecar and compare to the current draw on the LED’s
That’s what I was thinking. You might want to put a cap in parallel to “smooth out” the pulses. If current draw becomes an issue, you can hook the digital output to a transistor (simple amplifier) and use another power source.
Some Electronic Speed Controllers are significantly less expensive than a Jaguar. (I’ve seen a circuit you can build with less than $15 in parts, though one of them is a PIC that needs to be programmed.)
Stepping out of the box for a moment, would a mechanical solution work? You could use a servo to open and close a shutter on an always-on lamp.
I’m with Eric. Use the 9472 relay module and PWM its outputs. Each output is rated for 750 milliamps and should be capable of switching at over 1kHz (ie faster than you can see).
You can parallel output channels on the 9472 up to a total of 6 A. Just make sure to switch all channels at the same time. The module is rated for a switching rate of up to 10 kHz.
However, rather than take a chance of blowing up a cRIO module that is much more expensive than a speed controller, I think I would probably use the cRIO to supply a PWM signal thru an optoisolator to a simple power transistor circuit to do the actual switching of the lighting load.
Note that if you want to use PWM to control transistors or LEDs directly, you will have to write your own pulse code and use a digital output (whether signal outputs on the 9403 or driven outputs on the 9472). The PWM being output from the ports labelled PWM on the sidecar is an R/C standard servo control signal, which means the PWM duty cycle (“on time”) will vary between about 7.5% and 12.5%, which means you’ll barely be able to see an transister-controlled incandescent, and an LED probably won’t turn on even at maximum output.
Slightly out of the box again: if you amplify a standard servo PWM signal to drive a suitable load at the right multiple of its rated voltage, you can end up running it at effectively 50 to 100 percent power.
Imagine taking a 100W light bulb (spec’d for 120VAC) but run it on a 240VAC output with only 25% duty cycle through some dimming/chopping circuitry. It’s still 100W of average output but is actually 400W for 25% of the time if you look quick.
As another example, many motors or coils can actually be run at much higher voltages if you use a suitable set of power switches to PWM the “effective” voltage across the winding. Many stepper motors are often driven at MUCH higher voltages but use closed-loop current control to limit the “real” voltage that’s applied. This is especially useful for providing snappier stepper motor response because you apply more torque/current faster when you’ve got more voltage available (but still limit the current to a safe threshold).
Wow, thanks for all the great responses, everybody!!
Here’s a concept which I’ve come up with based off your advice. It uses a capacitor to “smooth” the current and voltage applied to the lights, and a transistor to protect the cRIO/Digital Sidecar from drawing too much current. Is this a good place to start? Thanks,
Hal,
The RC network is not really needed but your LED string does need some series resistance to limit the current in the LEDs. Current to the base of the transistor is limited by the 10k pullup resistor in the DSC. To fudge the calculation I start with 2 volts per LED so on a 12 volt supply, that allow for 5 LEDs in series and a series resistor. Calculating 2 volts and 20 ma for the resistor gets you 100 ohms. In reality the LEDs are less than 2 volts but as the battery output drops, the LEDs will stay on.
The R and C on your schematic aren’t doing anything really useful. You need to add a resistor between SIGNAL and the Base of your transistor.
You’ll also need to triple check the specs for the transistor that you’ve selected and ensure a sufficiently high current-transfer ratio. For example, the transistor has a beta of 100 and you’re trying to deliver 1A of current to the LEDs, you’ll want to put at least 10 mA (1A/100) into the base of the transistor (by selecting the base resistor accordingly).
You’ll probably also need to place a series resistor in your string of LEDs but it’s possibly to let the transistor do that “work” for you.
You’ll also need to consider heat dissipation. For example, with 1A in the LEDs and 2V LEDs, you’ll have 4V across the transistor and/or current-limiting resistor. 4V * 1A = 4W!!! That’s a lot of heat to remove (if you’re using really strong LEDs, but you may not be dumping 4W continuously).
You could also consider using a FET instead of a BJT. In that case, you’ll want a resistor to ground at the gate input to the FET (and maybe a small resistor into the gate).