A "Simpler" Pulse-Width Modulator for LEDs, Lasers and whatnot and a simpler foam-core enclosure - link
As the page describes, this was intended to be comparatively simple and flexible in its operation, providing both modulation of both audio and test tones. While it worked just fine, it did bother me a bit that it did not have a "manual" gain mode - that is, one could not simply override the audio AGC - which does work quite well - and "ride" the audio level manually, instead.
That was 2009 - so flash forward to 2014 when, at the request of some fellow amateurs in Australia, I finally got the impetus to update the firmware to add the means of selecting a completely manual gain control to the PWM circuit, of so-desired, in addition to various tone modes, all by setting pins on the PIC processor to the appropriate logic levels. Of course, the original AGC audio mode is still present and may be used exactly as before, if one wishes, and one could even construct the circuit so that it could be switched between manual and AGC mode.
What it's for:
If you have ever been to the Modulatedlight.org web site link (which I'll admit to having quite a lot to do with...) you will know that it has a lot to do with optical communications - mostly using high-power LEDs, but it also touches a bit on using low-power laser modules as well.
For modulating audio onto LEDs, onto LEDs, one of the easiest ways to do this is via linear current modulation, a process that is explained on the web page Linear Modulator for high-power LEDs - link.
Figure 2: Examples of waveforms used to generate PWM signals, from the web page "The Luxeon: New Light of Hope for Optical Communications" by Chris Long |
For laser diodes such as those found in laser pointers, current modulation is NOT very good for a number of reasons, including the fact that the brightness-current curves of laser diodes isn't particularly linear over a wide range, nor is it predictable at which current a diode will start to laser under a given set of conditions (e.g. temperature, age) or up to what current a specific diode can be safely operated!
For amplitude modulation, it is always preferable that one modulates as deeply as possible to achieve the best-possible signal-noise ratio and if one is trying to current-modulate a laser diode, this becomes problematic as the bounds of safe and reliable operation are difficult to know! It is more convenient, then, to simply turn it on and off, operating it at a known, safe current when it is on and varying the duty cycle using PWM.
If the switching frequency of the PWM is sufficiently high it will be compatible with a "conventional" analog optical receiver that was intended for amplitude-modulated light sources as the PWM waveform will be integrated by the low-pass response of the receiver's front end. At the very least, the PWM frequency must be at least twice that of the highest modulating frequency of the audio to be carried and if necessary, a simple low-pass filter could be added to an existing receiver to remove any residual switching components - see Figure 2 for a pictorial of how a "slow", low-pass response can smooth out the PWM frequency components.
How it works:
Figure 3: Diagram of the version with audio AGC. Click on the diagram for a larger version. |
Audio can come from one of two places: A built-in tone generator, or an external microphone/line-in audio source.
Using DDS techniques, audio sine waves can be generated at frequencies from a few 10's of Hz to several kHz and these are applied to the PWM generator, producing tones with 100% modulation depth.
Audio from the microphone or line input is first amplified and then low-pass filtered to remove high-frequency content and applied to the 10 bit A/D input of processor where it is digitized at a rate of 31.25 kHz and also passed to the PWM output.
"AGC" mode:
In diagram depicted in Figure 3, the circuit is configured to use an audio AGC to assure that the modulation is kept at a consistently-high level. The audio level is monitored continuously to determine if its level is within 6 dB of clipping. If it exceeds that level, a counter is incremented, but if it does not, a counter is allowed to self-decrement. If the counter exceeds a pre-set value indicating that the audio level has been high recently, the processor pins that control the gain on the amplifier stage are adjusted to reduce the gain to the next, lower step. If the counter self-decrements below a pre-set value indicating that the audio level has been consistently low, the gain is adjusted to increment.
There is also a built-in 12 dB gain adjustment in software: If the audio has been low and the audio gain is near maximum, a 12 dB gain step can be switched in which is done by first limiting the A/D values in software to ostensible 8 bit values and then shifting the A/D data to the left by two bits and offsetting.
When switched to the "tone" mode, instead of audio being applied to the A/D input, the voltage from potentiometer R220 is applied instead allowing a variable voltage to be used to set the tone mode:
- <=0.5 volts: 1 kHz tone
- >0.5 to < 4.5 volts: Variable frequency audio tone
- >= 4.5 volts: Tone sequence
In the variable tone mode the frequency may be set from a few 10's of Hz (below mains frequency) to a bit over 2 kHz as desired. Finally, the "tone sequence" mode is designed to emit a musically-dissonant series of notes (C4, E5#, F4#, E6) that really stick out of the noise: By being dissonant, spanning over an octave and non-continuous they avoid "ear fatigue" and are more likely to be heard amongst other sounds that may be being heard from power mains and electric signage that might be intercepted.
Manual gain mode:
Figure 4: The version with manual gain control Click on the image for a larger version. |
While the audio AGC works quite well to assure that ones voice fully modulates the LED to maximize "talk power" and signal-to-noise ratio, one may prefer to have a manual gain control instead and manipulation of several of the pins on the processor allows the selection of that mode as depicted in Figure 4.
In this version the audio gain is set with R309, but one can effect a "software" gain setting two switch in an extra 12 dB of gain via appropriate strapping of pin GP4. As with the "AGC" version, there a variable "tone" mode is available but there are also some "fixed" tone modes that may be selected via appropriate strapping of pins GP3, GP4 and GP5 if you don't wish to use a potentiometer.
Minimalist version:
Figure 5: Minimalist version. Click on the image for a larger version. |
Finally, Figure 5 depicts a somewhat minimal approach to the circuit, using only a single op-amp section with no active low-pass filter, manual gain control and the optional selection of a tone mode if you choose to implement switch SW301.
At its very simplest, one would connect GP3 (pin 4) to the +5 volt line to put the PIC into audio mode all of the time, but the triviality of adding just one SPST switch and a resistor would provide the facility of a tone generator, doing so would be hard to resist!
Getting the code:
If you are interested in building a modulator for an LED or laser using this device and are interested in the .HEX file for programming the PIC yourself, please let me know. If you don't have a way to program the PIC and want a pre-programmed device, I can arrange that, too.
More information:
For more information about Free Space Optical Communications for the amateur, be sure to visit the Modulated Light page - http://www.modulatedlight.org
[End]
This page stolen from "ka7oei.blogspot.com".