How to dim a string of LEDs driven by an HV9910 High Brightness LED Driver by interfacing it with the computer? (MATLAB)

10 views (last 30 days)
I'm driving a string of high power LEDs (~700 mA) using an HV9910 LED Driver.
The output current of HV9910 (and hence LED intensity) is controllable by an input PWM_D of the LED Driver. PWM_D pin needs an external PWM input whose duty cycle controls the LED intensity.
Can I use MATLAB to generate a PWM waveform and use one of the ports in my Laptop (USB/Ethernet/Audio) to send this waveform to the LED driver? I saw somewhere that computer ports do not support the bandwidth required for PWM signals. But can't I just send a sequence of binary data as PWM? Eg:
11000000 for a duty cycle of 1/4?
I'm a newbie when it comes to interfacing. Thus please forgive anything idiotic I may have said here.
Sincerely,
Abhay Mohan

Accepted Answer

Walter Roberson
Walter Roberson on 1 Sep 2013
USB and ethernet do not send bits directly. USB and ethernet send packets of bits, with headers and trailers, and the bits are never sent directly but are instead sent with check bits (e.g, 5/4 encoding) or as "constellation coding". At high speeds, ethernet uses multiple simultaneous frequency channels. USB uses differential signal encoding rather than ground + signal.
Hence sampling a USB signal or ethernet signal are not going to be useful for directly driving a motor. You can decode the signals using a USB or ethernet receiver (as appropriate) but then you have the difficulty that the bits are in bunches, that there were delays in sending and decoding the packets, and that there would be gaps between packets. This applies even if you are using a "USB serial port".
If you want to use USB or ethernet, then you should have a signal generator on the remote end and you should be sending commands to the signal generator.
Using a true serial port gets much closer, but true RS232 or RS423 serial ports send multiple bits in a group (7 to 11 depending on settings and drivers) together with a "start bit" and a "stop bit", so RS232 or RS423 serial ports are also not suitable for directly controlling a PWM.
Using a true (not USB) parallel port can get you the kind of signal that is needed. Unfortunately if you are using MS Windows, then newer versions of the operating system keep making it more difficult to access parallel ports, so Mathworks recommends that no new functionality be written for parallel ports.
Using an audio line-out is plausible. Keeping the audio queue fed correctly can be difficult in MATLAB, especially for higher rates / low latency. MATLAB R2013a (I think it was, maybe 12b) added support for the faster ASIO audio ports for MS Windows (Linux and OS-x already used them.)
So what would be recommended?
  1. use a signal generator; or
  2. use a D/A convertor card such as from National Instruments, together with the Data Acquisition toolbox

More Answers (1)

Abhay Mohan
Abhay Mohan on 2 Sep 2013
Thank you! Suppose I use a signal generator or Microcontroller. What about gathering data from the sensors? I mean I'll have 3 incoming signals (from various sensors) and 2 outgoing signals (to signal generator) at the same time. So can I multiplex all the data using a digital MUX like 74153?
If I can, can someone refer me to a procedure/algorithm to send/receive the data from the port? The sensor digital info will have to be separated to three signals from the separate sensors, won't it?
  4 Comments
Walter Roberson
Walter Roberson on 4 Sep 2013
How closely do you need the signals to be time-stamped (or are you just going to process them as they come through)? What frequency of updates do you need? What latency is acceptable ? How were you thinking of triggering the selection of the multiplex channel ?
Abhay Mohan
Abhay Mohan on 4 Sep 2013
Thank you very much for taking the time to answer. But I think I have understood the software multiplexing part now. I'm thinking of making an infinite loop at both ends: one to transmit and the other to receive in sync. I haven't fully worked out the frequency of updates yet, so I'll just try this now and I'll ask if I need further help. Thank you again!

Sign in to comment.

Categories

Find more on Periodic Waveform Generation in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!