Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Controlling LED sequence with switches

  • Please log in to reply
5 replies to this topic

#1 Xacyl

  • Members
  • 4 posts

Posted 07 March 2013 - 01:38 PM

I'm a total newbie at programming but a part of my university project requires me to control a sequence of LED's with switches. My supervisor suggested I use labjack with labview.
My problem seems simple compared to the other posts i have seen in this forum so i hope someone can help. I have to install 4 LED's into the a sectioned cylinder of an engine to be put on display, i have 2 switches which are triggered on or off each time the piston hits them, hence giving me 4 inputs, i need a specific coloured LED to come on with each input, something like so:

Switch 1 On, Switch 2 off: White LED (Intake stroke)
Switch 1 On, Switch 2 on: Blue LED (Compression Stroke)
Switch 1 off, Switch 2 on: Red LED (Expansion stroke)
Switch 1 Off, Switch 2 off: Green LED (Exhaust stroke)

Posted Image

This happens in all 4 cylinders but if i can get it working on just 1, i can connect the rest of the cylinders in series or parallel accordingly. I have made a basic logic circuit in labview for this:

Posted Image

The 4 LED's also require 3.9 V at 350 mA to work at their optimum, and I'm having a hard time trying to figure out how/what functions to use as well as what channels to use. I did go through some the examples given (which i downloaded from this site) and it seems i can adjust voltage on the DAC channels to 3.9 Volts but i dont know how to get it to on 350 mA or to turn off when the switch is pressed etc

I'd really really be grateful if you can help.

PS. I have a Labjack U3-HV

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 07 March 2013 - 01:50 PM

You can read a switch by connecting it to a digital input:


In LabVIEW check out the easy function example "U3 eDI Example.vi".

Normally you power small LEDs with a voltage source and put some resistance in series to limit the current:


Your LEDs, however, need a lot of current. A current source would be better, but you should be able to use a voltage source as long as you use a current limiting resistor than can handle the power it is dissipating.

The control methods from the LED app note will not work for a 390mA LED. Rather you need some sort of switch that can handle the 390mA (SSR or transistor for example), and then use a digital I/O from the U3 to control that switch. If you want to buy something check out the PS12DC:


#3 Xacyl

  • Members
  • 4 posts

Posted 07 March 2013 - 01:55 PM

Thanks for the quick reply, I will look into these notes :)

#4 Xacyl

  • Members
  • 4 posts

Posted 13 March 2013 - 03:10 PM

Hey thanks to your help i got the software part working, the only problem now is the voltage. Regarding the PS12DC extension, does it work like a relay, using the same output signals (as control voltages) but using power from the external source?
And I suppose i can use just 1 battery to power all the 4 outputs, as no two LEDs light on simultaneously, right?
something like so with a 3.9 volt battery:

Posted Image

#5 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 13 March 2013 - 03:47 PM

The PS12DC does work like a relay, but with some limitations. The PS12DC is rated for minimum of 5V. So you would want to connect a 5V battery to the system, then put a current limiting resistor, in the 100s of Ohm range, between S0, and LED1, S1, and LED2 etc. If you have a powered USB hub, you may be able to just use VS on the LabJack. I would try Figure 4: Multiple Items, Single Supply of appendix A, and if that doesn't make your LEDs bright enough, you could try the battery.


As a side note, 350mA LEDs must be very very bright? 350mA seems well above average...

#6 Xacyl

  • Members
  • 4 posts

Posted 13 March 2013 - 04:59 PM

Thanks, I think I will order this :), and yes I'm using Cree MC-E Colour LEDs and they were meant to light up the sectioned engine cylinders and needed to be really bright (430 lumens):


I'll see if I can find a 12V 350A ac/dc adapter and use that instead of a battery, and then connect 4 colours in series instead of parallel, 3V across each should suffice.

Thanks a lot for all the help, you guys are great :D

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users