- use a signal generator; or
- use a D/A convertor card such as from National Instruments, together with the Data Acquisition toolbox
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)
Show older comments
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
0 Comments
Accepted Answer
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?
0 Comments
More Answers (1)
Abhay Mohan
on 2 Sep 2013
4 Comments
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 ?
See Also
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!