Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
Edward

Administrator
Registered:
Posts: 260
Reply with quote  #1 

What would be the best and least expensive way for me to control the intensity (luminance) of an LED using ML? I want to be able to turn an LED off completely (0 Volts), turn it on completely (say 3V or more), and change the intensity in increments of 0.01 Volts? I'd like to ideally be able to control in parallel 2-8 LED's this way. 

Can I avoid using the NI boards entirely, or what is the cheapest NI instrument I can use to achieve this?

What commands in ML should I use?

Can I do this on a laptop?

0
Wael.Asaad

Administrator
Registered:
Posts: 51
Reply with quote  #2 
Maybe consider trying the audio output (with the SND object in the conditions file)...?
0
Edward

Administrator
Registered:
Posts: 260
Reply with quote  #3 
Thanks I will try the waveform object. However this will limit me to only one LED, or perhaps two because the output is stereo...

0
Jaewon

Administrator
Registered:
Posts: 971
Reply with quote  #4 
It seems that you want to drive LEDs just with the current supplied by AO devices (NI, sound cards,...), but your device may not be able to provide enough current to light them in full luminance, especially if you go with sound cards. So check your LED's spec first.

MATLAB does not support any acceleration in audio output. So, if you want to light them in sync with some event, keep in mind that there will be some delay.
0
Edward

Administrator
Registered:
Posts: 260
Reply with quote  #5 
That's true, I'm assuming the maximum voltage output by my device will suffice to actuate the full intensity of the LED. I'm also assuming the voltage is output linearly. However, I am trying to avoid NI devices because they are all pretty expensive and require additional maintenance.  I do not need very precise synchronization, 60 Hz is fine. I did not consider the need for asynchronous activation. I think for basic purposes, this waveform output should do the trick so long as I can control two LED's with the stereo output. Keep in mind that I don't want to preload a wave file, but want to generate it in real time and loop it I suppose. I will be sending a constant voltage for a few seconds. However, it would be better to modulate the voltage in real-time so that I can slowly attenuate the intensity as a function of behavior. 
0
Andy Mitz

Junior Member
Registered:
Posts: 8
Reply with quote  #6 
There are essentially two ways to regulate LED brightness.  One is to control the current (not voltage) of the LED.  The second way is PWM (pulse width modulation).  You can probably do a quick, cheap job by programming an Arduino via the USB port. Arduino supports serial-over-USB and you might be able to use that connection to send commands to the Arduino.  LED control is trivial.  See the on-line examples.
0
Edward

Administrator
Registered:
Posts: 260
Reply with quote  #7 
That's right, I can also PWM which is actually the easy way to drive many LED's at once with minimal computing power.
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.