Using Arduino to control a power supply

Thread Starter

electrophile

Joined Aug 30, 2013
167
Continuing my earlier experiment to build a laser diode driver, I wanted to turn the laser on and off from one of the pins of the Arduino. Would the attached schematic work? I'm trying to give the INHIBIT pin a path to ground using the P-MSOFET. The INHIBIT pin on the ST1CC40 (a constant current driver) when pulled below 1.2V disables the supply and when pulled above this, enables the supply.
 

Attachments

ebeowulf17

Joined Aug 12, 2014
3,307
The data sheet says you should leave the inhibit pin floating if not used, which implies to me that it has an internal pull up, or something functionally equivalent. So I think your 5v supply switched through the MOSFET is unnecessary. Looks to me like all you need is a switched path from inhibit pin to ground, perhaps directly through the opto?

I could be way off base - most of that ST1CC40 circuit is well beyond my understanding, so it's entirely possible I'm misinterpreting this part as well.
 

Thread Starter

electrophile

Joined Aug 30, 2013
167
Thanks David and @ebeowulf17!

I don't need dimming functionality so much as just being able to turn the supply on and off through an MCU but it makes sense to keep this in mind when I'd need something that can control the current through the laser diode thus varying its output power. After ebeowulf17's suggestions I started thinking and did more research. This is what I came up with which I'll test in a day or so. The INH pin can now be controlled through an Arduino with opto isolation. I simulated the opto isolation bit and that works great. Essentially the INH pin needs to be kept floating or connected to Vin for the device to be ON. In this schematic, the device is normally OFF and is turned on only when the MCU enables it.
 

Attachments

Thread Starter

electrophile

Joined Aug 30, 2013
167
Pin 11 is a PWM pin on the Arduino; the Arduino PWM pins are 3, 5, 6, 9, 10, or 11.
Yep! I'm controlling the steppers with grbl and pin 11 is the PWM spindle control which in this case is being repurposed to turn the laser on and off.
The circuit can work with an opto, but the opto isn't necessary.
Yes you are right. The optocoupler is to get better noise rejection and essentially protect the Arduino from mishaps (which I'm quite likely to make).
 

ebeowulf17

Joined Aug 12, 2014
3,307
Yep! I'm controlling the steppers with grbl and pin 11 is the PWM spindle control which in this case is being repurposed to turn the laser on and off.

Yes you are right. The optocoupler is to get better noise rejection and essentially protect the Arduino from mishaps (which I'm quite likely to make).
One small concern: I see you've added a jumper so that you can manually force it on or off, but there's risk of creating a short. If you use the jumper to tie inhibit to ground and the Arduino tries to activate the power supply, there will be a short from power supply through opto, through jumper to ground. I think one extra resistor between the power supply and the opto would limit current to acceptable levels in the event of such a short.
 

ebeowulf17

Joined Aug 12, 2014
3,307
...or was I misreading your schematic? What is P2? I just realized you have jumpers elsewhere in your schematic and they're represented differently, so I probably misread that portion.
 

Thread Starter

electrophile

Joined Aug 30, 2013
167
One small concern: I see you've added a jumper so that you can manually force it on or off, but there's risk of creating a short. If you use the jumper to tie inhibit to ground and the Arduino tries to activate the power supply, there will be a short from power supply through opto, through jumper to ground. I think one extra resistor between the power supply and the opto would limit current to acceptable levels in the event of such a short.
Yes you are right. The P2 is when you want to use the board as a constant ON device. When this happens, the device should not be connected to an Arduino or any other MCU and would operate as a standalone system. This resistor is between the collector of the opto output and Vin right? How big would that resistor have to be?
 

ebeowulf17

Joined Aug 12, 2014
3,307
Yes you are right. The P2 is when you want to use the board as a constant ON device. When this happens, the device should not be connected to an Arduino or any other MCU and would operate as a standalone system. This resistor is between the collector of the opto output and Vin right? How big would that resistor have to be?
It depends on how much current the relevant parts can handle:
1) power supply
2) opto isolator
3) wires/traces/jumpers, etc.

If it were me, I'd probably use a bigger resistor than the bare minimum and reduce the potential short circuit current a lot more, down to 100mA or lower. If this is on the 12V supply, that would only require a 120 ohm resistor between Vin and the opto. The other related number is your R5 pull down resistor, since the added resistor will create a voltage divider. If you kept R5 at least ten times the value of your new short circuit current limiting resistor, the voltage reduction would be negligible and have no effect on functionality.

To me, those values feel like minimums. If this is a one-off that you're building yourself, I'd probably go much higher on both resistor values, like 1k current limiting and 10k pull down. Off the top of my head, I'd expect that to work just fine. But if this will be hard to change (surface mount parts on custom pcb or some such thing) then it might be worth doing better calculations than my guesstimates!
 

Thread Starter

electrophile

Joined Aug 30, 2013
167
It depends on how much current the relevant parts can handle:
1) power supply
2) opto isolator
3) wires/traces/jumpers, etc.

If it were me, I'd probably use a bigger resistor than the bare minimum and reduce the potential short circuit current a lot more, down to 100mA or lower. If this is on the 12V supply, that would only require a 120 ohm resistor between Vin and the opto. The other related number is your R5 pull down resistor, since the added resistor will create a voltage divider. If you kept R5 at least ten times the value of your new short circuit current limiting resistor, the voltage reduction would be negligible and have no effect on functionality.

To me, those values feel like minimums. If this is a one-off that you're building yourself, I'd probably go much higher on both resistor values, like 1k current limiting and 10k pull down. Off the top of my head, I'd expect that to work just fine. But if this will be hard to change (surface mount parts on custom pcb or some such thing) then it might be worth doing better calculations than my guesstimates!
Got it! Thanks!
 
Top