For a more thorough explanation of this circuit and how
            it works, be sure to read the original article, "A 'Mini'
              full-featured Pulse Width Modulator for high-power LEDs
              and laser diodes" found at this Link.
          
          
          The reason for this updated version:
          
        This updated version of the "Mini" PWM LED/Laser modulator
        addresses two issues:
        
        - It slightly simplifies the original schematic diagram by
        removing the transistor-based microphone preamplifier.
        - Additional operational modes were added to the PIC's firmware
        that allow "Fixed" mode operation in which audio gain and tone
        selections may be made by setting the appropriate I/O pins to
        the appropriate state.
        - By removing the AGC capability, a manual gain control can also
        be added, which can also allow further simplification of the
        circuitry by 
(optimal) removal of the low-pass 
(anti-aliasing)
        filter.
        
        
          Prototype used to test the version
              2/3 circuit of the "Mini" PWM LED/Laser modulator.
              Click on the image for a larger version.
            
            
              |  
 | 
          
  
  
        
        The prototype 
(see the picture to the right) was
        built to accommodate either the Version 2 or Version 3 circuit
        for testing of the firmware on phenolic prototype board of the
        sort with etched copper rings on the bottom side.  Using a
        single high-brightness LED, its output was sufficient to go
        across the room - or just a few inches - during testing to
        verify operation of the AGC algorithms, the various tone modes,
        the audio gain settings and the modulation of the circuitry and
        the modified firmware.
        
        
Three circuit diagrams:
        
        Three circuit diagrams may be found on the right:  
Click
            on a diagram for a large, printable version.
        
        Version 2:  Updated Audio AGC circuit
        
        
          This circuit, depicted in 
Figure 2, is
        functionally identical to the original circuit found on the page
        linked above in that it uses the PIC to set the gain of the
        first Op Amp stage - as well as internal gain switching in
        software - to provide about 25 dB of audio AGC
 (Automatic Gain
        Control) range.  This causes the audio from the microphone
        or line input to be always be adjusted such the overall audio
        gain is modulating the LED or laser at or near 100% all of the
        time to provide the highest possible signal-noise ratio.
        
        Another feature of this firmware is a "Tone" mode in which one
        can vary a potentiometer from a low voltage, at which a 1 kHz
        tone is produce, up slightly to produce a variable audio tone
        from a few 10's of Hz to several kHz, up to the top end of the
        potentiometer at which point a dissonant tone sequence is
        produced that is designed to be heard amongst noise and be
        resistant to "ear fatigue."
        
        
The features of this firmware are described fully on the
            page of the original article noted above, linked again
              here for your convenience.
        
        One minor disadvantage of this original firmware was that the
        AGC could not be disabled:  While one could have installed
        a potentiometer in lieu of the switchable gain resistors, the
        internal +12dB step in the firmware would still be in effect.
        
        
The updated circuit:
        
        
          Top - Figure 1: 
              Version 2 of the Simplified PWM LED/Laser modulator with
              Audio AGC and potentiometer tone control.
              Center - Figure 2:  Version 3 with manually
              adjustable audio modes and modes selectable via CPU pin
              logic stats.
              Bottom - Figure 3:  "Minimized" version of the
              Version 3 PWM LED/Laser modulator.
              Click on a diagram for a larger version.
             
            
              |  
 | 
            
              |  
 | 
            
              |  
 | 
          
  
  
        
        
        The circuit depicted in 
Figure 1 has been simplified
        in that the original transistor-based microphone preamplifier
        has been removed.  Instead, the low pass filter has been
        re-worked to increase the gain by more than 10dB, providing most
        of the original system gain.
        
        This circuit is completely compatible with both the original and
        updated firmware.
        
        
Version 3:  Manual audio gain control and "Fixed"
            tone modes
        
        The circuit depicted in 
Figure 2 shows the variant in
        which the audio AGC has been removed and replaced with R309, a
        manual gain control.  In addition to this, the various
        modes - audio and tone - are selected by setting the logic
        levels on the pins of the PIC as follows:
        
        If, when the PIC powers up, it finds that GP1 
(pin 6) is tied to
        either GND 
or +5V, it will assume that the user
        does 
NOT want the original Audio AGC and tone
        modes 
(e.g. selected by potentiometer) but rather, to
        select audio and tone modes with logic levels on the pins.
        
        The "Audio" mode and "Tone" mode is then determine by the state
        of GP3, pin 4:
        
        
GP3 is Low - Tone mode:
              GP4 - Low
                  GP5 - Low:  1000 Hz
          (nominal)
                  GP5 - High:  1020
          Hz (nominal)
              GP4 - High
                  GP5 - Low:  Tone
          sequence (C4, A5#, F4#, E6)
                  GP5 - High: 
          Variable tone, according to voltage on Pin 7
          
          GP3 is High - Audio mode:
              (GP5:  Don't care)
              GP4 - Low - Normal audio gain
              GP4 - High - High audio gain (+12dB)
          
        A bit of explanation is in order:
        
          - 1000Hz and 1020Hz are both available as 1000 Hz, exactly,
            is a harmonic of the 100Hz mains frequency in many parts of
            the world, but because the PIC12F683 is operating from an
            internal clock, its accuracy is typically +/-2%, so it can
            vary by several 10's of Hz.  Both frequencies are
            available to allow at least one of them to be far enough
            away from the harmonic of a mains frequency to avoid
            problems.
- The variable tone frequency is adjustable in the same
            manner as on the original firmware, as in:
            - <= 0.5 volts:  1000Hz tone (nominal)
- > 0.5 volts to < 4.5 volts:  Variable, from a
              few 10's of Hz to approximately 2500 Hz.
- >=4.5 volts:  Tone sequence (C4, A5#, F4#, E6)
- The "Tone Sequence" is, as noted above, is designed to
            sound dissonant and as such, it sticks out of noise and
            interference, unlike a constant tone to which one's ear can
            become "fatigued".
Because this mode uses a potentiometer (R309) to set the
          audio gain it is imperative that the operator
          pays close attention to the transmitted audio level by
          monitoring the quality of the transmitted signal by listening
          to a sample of the emitted signal on a local optical receiver
          or listening via the "Audio Monitor" point.  During
          normal operation, the audio gain should be kept as high
              as possible without causing
              objectionable distortion.  Without an
          automatic gain control to keep the levels constant, it would
          be normal to hear the occasional bit of clipping on audio
          peaks.
        
        
Remember:  For the purposes of intelligibility it
          is always preferable to have a bit too much audio and a bit of
          distortion than too little audio and have your voice lost in
          the noise!
        
        
At any point, switching to a "Tone" mode can give a quick
          comparison as the modulation of the audio tones is always at
          100%:  While it is difficult to judge solely by "ear",
          the audio peaks should sound about as loud as the tone.
        
        
          Minimized Version 3 circuit:
        
          The circuit depicted in 
Figure 3 shows how one
        can strip it down even more by removing the low-pass filter and
        a few of the features, leaving it nearly "bare bones."  By
        removing the low-pass filter a bit of audio distortion may be
        noted due to aliasing effects, particularly if pre-recorded
        audio or music is played back via the "Line" input, but this
        effect should generally be tolerable, but if it bothers you, you
        may be able to utilize the graphic equalizer feature of your
        audio player to remove frequencies above 5 kHz.  For most
        speech, the lack of the low-pass filter isn't generally noticed
        except, perhaps, on certain consonants which may start to sound
        a bit "spitty" - but this is highly dependent on both the person
        speaking and the microphone being used.
        
        Because the low-pass filter provides about 16 dB of audio gain,
        removing it will require that R309 be adjusted to make up for
        the difference, and it is likely that one may also need to run
        software in the "High Gain" mode as well.  In the diagram
        in 
Figure 3 the pinout shows one half of dual op amp
        being used, but a single section op amp could also be used
        instead - but the pinout would, of course, be different that
        what is shown!
        
        
        
Interfacing this circuit to an LED, Laser or other
              devices:
        
        The original page, linked below and to the right, includes quite
        a bit of information about how to interface this circuit to an
        LED, Laser diode or even a light bulb as well as information
        about how to use lenses and other optics to cast the light over
        a great distance.
        
        For convenience, part of that information may be found in 
Figure
          4, to the left - make sure that you click on the diagram
        for a larger, readable version.
        
          Information about interfacing the
              PWM driver to LEDs and laser diode modules.
              Click on the diagram for a larger version.
            
            
              |  
 | 
          
  
  
        
        
        For a more thorough explanation of this circuit and how
            it works, be sure to read the original article, "A
              'Mini' full-featured Pulse Width Modulator for high-power
              LEDs and laser diodes" found at this
                Link.
        
        Return to the KA7OEI Optical
              communications Index page.
        
          If you have questions or comments concerning the
          contents of this page, or are interested in this circuit, feel
          free to contact me using the information at this URL.
        Keywords: 
Lightbeam
communications,
light
beam,
lightbeam,
laser
                    beam, modulated light, optical communications,
                    through-the-air optical communications, FSO
                    communications, Free-Space Optical communications,
                    LED communications, laser communications, LED,
                    laser, light-emitting diode, lens, fresnel, fresnel
                    lens, photodiode, photomultiplier, PMT,
                    phototransistor, laser tube, laser diode, high power
                    LED, luxeon, cree, phlatlight, lumileds, modulator,
                    detector
        
This page and contents
                copyright 2009-2016 by Clint, KA7OEI.  Last
                update:  20160119