Showing posts with label PWM. Show all posts
Showing posts with label PWM. Show all posts

Sunday, June 30, 2024

Reducing QRM (interference) from a Renogy 200 watt (or any other!) portable solar panel system

Figure 1:
Renogy 200 watt folding panel, in the sun
Click on the image for a larger version.

Update - 10/24: 

I recent spent most of a week in a national park where I extensively used the solar panel and charger - along with some LiFePO4 batteries - as my main power source.  The panel was set up with 3-6 feet (1-2 meters) of my portable HF antenna.  I did not notice any interference from this system at all.  I did notice a bit of QRM from my fridge/freezer cooler to which I have since added its own RF filtering.

A year or so ago I got a 200 watt foldable solar panel system.  This unit - made by Renogy - consists of two glass panels in metal frames equipped with a sort of "kickstand" assembly to allow it to be angled more favorably with the sun to improve its output.  I use this panel when "car camping" to charge the batteries to run the sorts of things that one might bring:  Lights, refrigerator, amateur radio transceivers and who knows what else.  

On that last point, I've done some "in the field" operating on the HF amateur bands while the battery is being charged and noticed that the charge controller (and not the panel itself!) produced a bit of "hash" on the radio - mostly in the form of frequent "birdies" that swished around in frequency as the solar insolation and temperature varied - as well as a general low-level noise at some frequencies.   

This problem is not specific to the Renogy panel's charge controller, but common to almost any panel+controller combination that you will find.

Nearly all "portable" and RV solar power systems cause QRM:

You will find similar systems built into RVs and campers and these are also well known (notorious, even!) for generating RFI.  The techniques described here to quiet interference from these devices applies equally to those as well - but note that one may have to "scale up" the inductors/capacitors to accommodate higher voltages and currents that may be found in those systems.

By placing the solar panel with charge controller and the battery being charged some distance away from the antenna, this interference could be reduced, but that fact that it was even there in the first place annoyed me, so I did what I have done many times before (see the links to other blog entries at the end of this article) and mitigated it by making fairly easy, reversible modifications to the panel's controller.

Portable solar panels and RFI

In my travels, I've been around other users of portable solar panels of various brands and I have yet to find any commercially-available portable panel+controller combination that does NOT produce noticeable RFI on HF/VHF among the half-dozen or so brands that I have checked. 

In comparison with most of the others that I've been around with radios, the Renogy is comparatively quiet - producing less overall QRM with fairly long wires between the panel/controller and battery - than the others - but I decided that I could make it even quieter!

Where does the QRM come from?

It is NOT the solar panel itself that produces the radio frequency noise, but rather the charge controller attached to it.

Modern charge controllers electronically convert the (usually higher) voltage from the solar panels down to something closer to the battery voltage and this is typically done using PWM (Pulse Width Modulation) which means that these devices contain high-power oscillators:  This is true for simple "PWM" types of charge controllers as well as those using "MPPT" techniques.  It's this oscillation / switching action that produces a myriad of harmonics that can extend through the HF spectrum - and even into VHF/UHF!

The "Antenna" in this case consists of two parts of the PV system as depicted in the drawing below:

Figure 2:
A typical solar charging system showing the separation of the two major components that can radiate interference:  The panel itself, connected to the input of the charge controller and the wires and load connected on the output side.
If there is even a slight amount of differential between the two at radio frequencies, the system will radiate.
Click on the image for a larger version.
 
In other words:
  • The wires connecting to the load.  Typically a battery being charged - which can be connected to other things (e.g. vehicle, inverter, etc.)  The wires connecting the panel to these other things - and those devices themselves - act as part of the "antenna" that potentially radiates noise.
  • The solar panel itself.  The solar panel consists of large plates of metal - not only the silicon of the panel, but any metal frame and wiring:  This large area of conductive material offers a suitably large aperture to permit radiation of HF RF.

The "load" and solar panel constitute two different parts of the charge controller's system when it comes to radiation of RF:  The panel is connected to the INPUT of the PWM circuitry while the wiring is connected to the OUTPUT of the PWM circuitry, effectively forming a dipole antenna.  To a degree, the electrical lengths of these two conductors - which can include power cords or even a vehicle - overall can broadly resonate, affecting certain frequency ranges more than others.

The reason for the generation of the interference is due to the fact that the PWM circuitry (which is operating at a frequency of 10s or 100s of kHz) uses square waves, rich in harmonics.  As the voltage input (from the panel) and the output (to the battery/load) are different parts of the PWM circuit, they necessarily have different waveforms on them.

Figure 3:
Charge controller with additional filtering showing added
bifilar-wound chokes/caps on both the input and output leads.
Click on the image for a larger version.

While this device does have some filtering to provide a degree of input impedance reduction (fairly high capacitance) and smoothing of the PWM waveform of the output (more capacitors and likely some inductance) the extent to which this filtering is implemented is suitable for the purpose of providing clean DC power to the load and maximize power conversion efficiency.  This filtering - and likely the controller's circuit board itself - was likely not intended to provide the high degree of RF suppression needed to make it quiet enough to avoid the conduction of RF energy onto its conductors which is then picked up by a nearby receiver.

Containing the RF energy
 
As the controller itself is potted with a silicone material, it's not practical to modify it directly to make it RF-quiet - and there is no need to do so:  Instead, we must take steps to eliminate any differential RF currents that may exist between DC Input and DC output terminals.

Ferrite alone is NOT the answer!

One may presume that the answer to this problem is the implementation of RF device such as snap-on or toroidal ferrite devices - and you would be partially correct.  Any practical inductor - such as that formed by the introduction of a ferrite device onto an existing wire - will have rather limited efficacy in quashing RF currents.

Snap-on devices (e.g. those through which a wire passes) have very limited usefulness at HF frequencies (<30 MHz) - especially on the lower bands - as they simply cannot impart a significant amount of reactance in the conductor onto which they are installed.  At higher frequencies (VHF, UHF) they can have a greater effect - but their efficacy will usually be disappointing at HF.

Using a device that can accommodate multiple turns through its center such as a toroid (or even a larger snap-on device) it may be possible to get up to a few hundred ohms of reactance on a conductor across a fairly wide frequency range - but even this will be capable of reducing the amount of RF by 10-20 dB (2-3 "S" units) at most:  Depending on the intensity of the RFI from the solar controller, this may not be enough to quash the interfering energy to inaudibility - particularly in a remote and otherwise "RF Quiet" location.

To be sure, it's worth trying just the ferrite devices by themselves to see if - in your situation - it reduces the RF interference from the controller to your satisfaction, but remember that the location where you are likely to be using this panel is probably far quieter (RF-wise) than your home QTH:  A "quiet" Solar charging system may seem quiet enough at your noisy home QTH, but could still be noisy in the middle of nowhere.

The addition of capacitors to the circuit can improve the efficacy over ferrite alone by orders of magnitude.  Consider the diagram below:

Figure 4:
Diagram, including additional filtering.  L1 and L2 are the bifilar chokes seen in Figure 3, above while the capacitors (C1a, C1b, C1c and C2a, C2b and C2c) and their implementation are described below.
Click on the image for a larger version.
 
Ferrite devices L1 and L2 are comprised of bifilar-wound inductors on the DC input/output lines, respectively.  These inductors will suppress common-mode RF energy that may appear - but these alone are not likely to be quite enough.
 
In order to force the RF energy to common mode to maximize L1/L2's effectiveness, capacitors C1a, C1b do so for the "external" connections (e.g. those connected to large devices, long wires) while C2a and C2b do so for any RFI emanating from the controller itself.
 
C2c - which is placed between the DC input and output of the charge controller - effectively shunt RF energy differences between the in/out terminals to minimize the differential currents.  Figure 3 shows C2a placed between the two positive terminals, but it could have been placed in any combination (+ to -, - to -, etc.) and been just as effective since the capacitors C2a and C2b effectively short the + and - terminals together at RF frequencies.  If your OCD bothers you, could could add additional capacitor combinations, but the three shown above for C1 and C2 proved to be adequate.
 
The real work for our filtering magic is actually done by C1c.  As seen from the diagram it's shunting RF currents that might appear on the "external" sides of L1 and L2 - which will have been significantly reduced in amplitude by L1 and L2 anyway:  The low impedance of the C1c at RF (a few ohms) coupled with the high RF impedance of the conductors through L1 and L2 work together to make sure that differential RF currents that might exist between the input and output of the charge controller are minuscule, and thus there is effectively no RF energy that can be radiated.
 
Figure 5:
Three 0.1uF monolithic capacitors placed across the
controller's terminals (C2a, C2b, C2c).
Click on the image for a larger version.
Implementation

A glimpse of what was done may be seen in Figure 3.  Some 14 AWG paired copper wire (red/black) was wound on two FT140-43 ferrite toroids - about 6 bifilar turns in this case:  Individual wires could have been used other than "zip" cord - just be sure that the two parallel conductors are laid in parallel to maximize the effectiveness of the bifilar configuration.  Two of these wire/bifilar devices were constructed - one for the DC from the panel and the other for the output to the battery/load.  "Spade" lugs were installed on one end of the red/black wires - two lugs per wire/bifilar assembly.  (FT240-43 or FT240-31 toroids could also have been used, but the FT140-43 is a fraction of the cost, half the diameter, and perfectly suitable for this application.  The FT240 size may be more appropriate if such a filter network is constructed for a higher-current system with larger-gauge wire.)

On the solar controller itself, small 0.1uF, 50 volt monolithic capacitors were installed (C2a, C2b, C2c) to form part of the filter circuitry:  Minimal lead length is important for maximum effectiveness.  While monolithic ceramic capacitors are preferred because they are small (and will fit more easily in tight spaces) and have very low ESR (Effective Series Resistance) one could use disk ceramic capacitors instead.  Film/plastic capacitors are less effective at higher frequencies.

Figure 6:
Terminal strip with capacitors C1a, C1b and C1c.
As described, these capacitors do much of the "bypassing"
of RF differential currents between the input and output.
Click on the image for a larger version.

As can be seen from this picture and Figure 5, the terminals are the "clamp" type and are connected in the same manner as the lugs on the cable on the bifilar toroid assembly. - and also note that this "modification" is completely reversible as nothing at all was changed on the controller itself.

The other end of the red/black wires were soldered to a four-position screw terminal strip as seen in Figure 6 - similar to the one on the back of the charge controller.  As with the terminal strip on the controller, three 0.1uF 50 volt capacitors were soldered (C1a, C1b, C1c) on the back for RF bypassing.  It is possible to have connected the capacitors under the clamps as was done on the controller, but soldering them to the back means that they would not be prone to falling out or being lost if the cables were changed.
 
With these connections made, the wire on the toroids and the connections to the added terminal strip were covered with "Shoe Goo" - a robust rubber adhesive (which may be used to fix shoes, as the name suggests) both as mean of strain relief and to provide electrical insulation.
 
The reader may have noted that we have physically brought together the input/output cables again at this terminal strip - and this was intentional.  By keeping the leads with the bifilar inductors as short as possible and then bringing them back together, we can use the shortest-possible leads on our capacitors to effectively "short" the input and output cables together at radio frequencies, making it impossible for the wires to radiate effectively at HF.  With this, the RF energy is contained within the area of the charge controller itself and the terminal strip/cables and since this is a very small aperture at HF, it can't radiate effectively and additional metallic shielding is unneeded.
 
At VHF/UHF frequencies - where the physical size of the controller+bifilar chokes is a larger proportion of the size of the wavelength (plus the fact that the components used won't work as well at these frequencies) means that some RF energy could radiate, but testing shows that the amount of VHF/UHF RF energy conveyed by the panel and cables was reduced below the point of detection more than a few feet (a meter) or so away from the system.

Spectrum analysis plots - updated 12/24

In the original version of this post I "loosely coupled" a spectrum analyzer (the "Tiny SA Ultra") to the leads to/from the controller by wrapping them around - but this only tells part of the story, showing the worst of the interference.  In this update, I connected  to the DC leads "directly" - using a 0.0022uF capacitor as a DC block - before and after the filtering to show the difference.  (Ignore the markers in the following plots - I forgot to shut them off)

First, the bad (no filtering):
 
Figure 7:
Un-filtered 0-30 MHz spectrum from the controller, directly coupled.

Figure 7 shows what the spectrum looks like from 0 to 30 MHz - each horizontal division representing 5 MHz - covering the extent of the HF spectrum but as expected, the worst of it is found in the first several MHz as shown in the next plot:
 
Figure 8:
Un-filtered 0-10 MHz spectrum from the controller, directly coupled.

Figure 8 shows from 0 to 10 MHz - with each horizontal division representing 1 MHz - and we can see that the peak energy at around 5 MHz is stronger than -40dBm - a level which correlates with an S-meter reading of about "30 over S-9".  This plot along with that of Figure 7 show that even as high as 20 meters (14 MHz) the noise can exceed "10 over S-9".

Remember that we are connecting the analyzer directly to the terminals of the equipment - something that you would not normally do, but these plots give you an idea as to how much energy is available to be radiated on the wires that go between the panel and the battery:  Even if the signals at 5 MHz were down by 30dB (1000-fold) due to coupling, they would still be about "S-9" in strength (e.g. pretty strong).

Below are the same plots - this time with the filtering depicted in figures 4-6:

Figure 9:
0-30 MHz, directly coupled to the controller - after filtering.
 
This shows a dramatic decrease in the amount of RF present from 0-30 MHz and as can be seen above, the noise floor above 5 MHz is VERY much reduced.  Let's look at the 0-10 MHz range, below:

Figure 10:
0-10 MHz, directly coupled to the controller - after filtering.
 
As expected, the filtering is less effective at frequencies below 1.5 MHz (more inductance and larger capacitors could help with that) but even at 2 MHz we see that the "grunge" is attenuated by about 20dB (100-fold, around 3 S-units worth), and is further reduced to be down by roughly 40dB (10000-fold, or about 7 S-units) around 80 meters (3.5-4.0 MHz) and higher, approaching the noise floor of the spectrum analyzer (approx. -100dBm with an RBW of 100 or 300 kHz) around 7 MHz, rising slightly in the 13-16 MHz range.  As can be seen in Figure 9, the worst-case noise output anywhere above 7 MHz are only around -85 dBm (S-7) and this would be with the receiver connected directly to the solar panel leads:  Again, no-one would ever do that!
 
The above measurements show how much RF energy is inputted into the wires connecting the panel and the battery bank - both of which will act as halves of a dipole antenna - and these measurements show that we can very significantly reduce this energy, likely reducing it to the point of inaudibility. 

Figure 11:
The same filtering - this time, applied to a Renogy
Rover 20 amp MPPT solar controller.
Click on the image for a larger version.
As noted in the update at the top of this posting, I've operated the solar panel and controller right next to my HF antenna and could not hear any interference from it!
 
Figure 11 shows the techniques depicted in figures 4, 5 and 6 applied to a different Renogy controller, also using FT140-43 toroids and 0.1uF monolithic capacitors.  In this case, the only capacitors used were those attached directly to the back side of the four-screw terminal strip (C1a, C1b, C1c) which works because this particular controller already has the other set of capacitors (C2a, C2b, C2c) on its circuit board.
 
Conclusion:
 
Prior to the modification, getting within several feet/meters of the solar panel with a portable shortwave receiver equipped with SSB revealed drifting "birdies" from the controller's normal operation and holding the antenna against either the panel or the output cable made this orders of magnitude worse.

After the modification these "birdies" were inaudible on the cables:  It took holding the portable receiver's antenna within a few inches/cm of the charge controller to hear its operation.  By the addition of these nine components (two bifilar inductors, six capacitors and the terminal strip) the RF energy is confined to the (small!) physical space of the controller itself and is no longer being introduced differentially to the panel and output cable, causing it to be unable to radiate effectively at HF, making it very quiet and "Radio Friendly".

While the supplied charge controller for the Renogy panel was a simple PWM type rather than an MPPT (Maximum Power Point Tracking) and is thus somewhat less effective at extracting all-possible energy from it, there is no reason why this sort of filtering could not be applied to either types.
 
This shows how a typical portable solar panel+charge controller can be made to be RF-quiet and "POTA" or "SOTA" compatible.  This (reversible!) modification has rendered this panel completely quiet across the HF spectrum and inaudible on VHF/UHF frequencies as well at distances of more than a few feet (a meter or so) as well.

* * * * *
Related articles:

This page stolen from ka7oei.blogspot.com
 
[End]

Tuesday, August 30, 2022

Making a "Word Metronome" for pacing of speech

Figure 1:
The completed "Word Metronome".  There are two recessed
buttons on the front and the lights on on the left side.
Click on the image for a larger version.
One of the things that my younger brother's job entails is to provide teaching materials - and this often includes some narration.  To assure consistency - and to fall within the required timeline - such presentations must be carefully designed in terms of timing to assure that everything that should be said is within the time window of the presentation itself.

Thus, he asked me to make a "word metronome" - a stand-alone device that would provide a visual cue for speaking cadence.  The idea wasn't to make the speech robotic and staccato in its nature, but rather providing a mental cue to provide pacing - something that is always a concern when trying to make a given amount of material fit in a specific time window:  You don't want to go too fast - and you certainly don't want to be too slow and run over the desired time and, of course, you don't want to randomly change your rate of speech over time - unless there's a dramatic or context-sensitive reason to do so.

To be sure, there are likely phone apps to do this, but I tend to think of a phone as a general-purpose device, not super-well suited for most of the things done with it, so a purpose-built, simple-to-operate device with visual indicators on its side that could just sit on a shelf or desk (rather than a phone, which would have to be propped up) couldn't be beat in terms of ease-of-use.

Circuitry:

The schematic of the Word Metronome is depicted in Figure 2, below:

Figure 2:
Schematic of the "Word Metronome"
(As noted in the text, the LiIon "cell protection" board is not included in the drawing).
Click on the image for a larger version.

This device was built around the PIC16F688, a 14 pin device with a built-in oscillator.  This oscillator isn't super-accurate - probably within +/-3% or so - but it's plenty good for this application.

One of the complications of this circuit is that of the LEDs:  Of the five LEDs, three of them are of the silicon nitride "blue-green" type (which includes "white" LEDs) and the other two are high-brightness red and yellow - and this mix of LED types poses a problem:  How does one maintain consistent brightness over varying voltage.

As seen in Figure 3, below, this unit is powered by a single lithium-ion cell, which can have a voltage ranging from 4.2 volts while on the charger to less than 3 volts when it is (mostly) discharged.  What this means is that the range of voltage - at least for the silicon nitride types of LEDs - can range from "more than enough to light it" to "being so dim that you may need to strike a match to see if it's on".  For the red and yellow LEDs, which need only a bit above two volts, this isn't quite the issue, but if one used a simple dropping resistor, the LED brightness would change dramatically over the range of voltages available from the battery during its discharge curve.

As one of the goals of this device was to have the LEDs be both of consistent brightness - and to be dimmable -  a different approach was required - and this required several bits of circuity and a bit of attention to detail in the programming.

The Charge Pump:

Perhaps the most obvious feature of this circuit is the "Charge Pump".  Popularized by the well-known ICL7660 and its many (many!) clones, this type of circuit may also be driven by a microcontroller and implemented using common parts.  Like its hardware equivalent, it uses a "flying capacitor" to step up the voltage - specifically, that surrounding Q1 and Q2.  In software - at a rate of several kHz - a pulse train is created, and its operation is thus:

  • Let is start by assuming that pin RC4 is set high (which turns off Q1) and pin RA4 is set low (which turns off Q2.)
  • Pin RA4 is set high, turning on Q2, which drags the negative side of capacitor C2 to ground.  This capacitor is charged to nearly the power supply voltage (minus the "diode drop") via D1 when this happens.
  • Pin RA4 is then set low and Q2 is turned off.
  • At this point nothing else is done for a brief moment, allowing both transistors to turn themselves off.  This very brief pause is necessary as pulling RC4 low the instant RA4 is set low would result in both Q1 and Q2 being on for an instant, causing "shoot through" - a condition where the power supply is momentarily shorted out when both transistors are on, resulting in a loss of efficiency.  This "pause" need only be a few hundred nanoseconds, so waiting for a few instruction cycles to go by in the processor is enough.
  • After just a brief moment pin RC4 is pulled low, turning on Q1, which then drags the negative side of C2 high.  When this happens the positive side of C2 - which already has (approximately) the power supply voltage is listed to a potential well above that of the power supply voltage.
  • This higher voltage flows through diode D3 and charges capacitor C4, which acts as a reservoir:  This voltage on the positive side of C4 is now a volt or so less than twice the battery voltage.
  • Pin RC4 is then pulled high, turning of Q1.
  • There is a brief pause, as described above to prevent "shoot through", before we set RA4 high and turn Q2 on for the next cycle.

It is by this method that we generate a voltage several volts higher than that of the battery voltage, and this gives us a bit of "headroom" in our control of the LED current - and thus the brightness.

Current limiter:

Transistors Q3 and Q4 form a very simple current limiter:  In this case it is "upside-down" from the more familiar configuration as it uses PNP transistors - something that I did for no particular reason as the NPN configuration would have been just fine.

Figure 3:
Inside the "Word Metronome".  The 18650 LiIon cell is on
the right - a cast-off from an old computer battery pack.  The
buttons on the board are in parallel with those on the case and
were used during initial construction/debugging.
Click on the image for a larger version.

This circuit works by monitoring the voltage across R3:  If this voltage exceeds the turn-on threshold of Q3 - around 0.6 volts - it will turn on, and when this does it pulls the base voltage, provided by R5, toward Q4's emitter, turning off Q3.  By this action, the current will actually come to equilibrium at that which results in about 0.6 volts across R3 - and in this case, Ohm's law tells us that 0.6 volts across 47 ohms implies (0.6/47=0.0128 amps) around 13 milliamps:  At room temperature, this current was measured to be  a bit above 14 milliamps - very close to that predicted.

With this current being limited, the voltage of the power supply has very little effect on the current - in this case, that through the LEDs which means that it didn't matter whether the LED was of the 2 or 3 volt type, or the state-of-of charge of the battery:  The most that could ever flow through an LED no matter what was 14 milliamps.

With the current fixed in this manner, brightness could be adjusted using PWM (Pulse Width Modulation) techniques.  In this method, the duty cycle ("On" time) of the LED is varied to adjust the brightness.  If the duty cycle is 100% (on all of the time) the LED will be at maximum brightness, but if the duty cycle is 50% (on half of the time) the LED will be at half-brightness - and so-on.  Because the current is held constant, no matter what by the current limiter circuit, we know that the only think that affects brightness of the LED is the duty cycle.

LED multiplexing:

The final aspect of the LED drive circuitry is the fact that the LEDs are all connected in parallel, with transistors Q5-Q9 being used to turn them on.  When wiring LEDs in parallel, one must make absolutely sure that each LED is of the exact-same type or else that with the lowest voltage will consume the most current.

In this case, we definitely do NOT have same-type of LEDs (they are ALL different from each other) which means that if we were to turn on two LEDs at once, it's likely that only one of them would illuminate:  That would certainly be the case if, say, the red and blue LEDs would turn on:  With the red's forward voltage being in the 2.5 volt area, the voltage would be too low for the green, blue or white to even light up.

What this means is that only ONE LED must be turned on at any given instant - but this is fine, considering how the LEDs are used.  The red, yellow or green are intended to be on constantly to indicate the current beat rate (100, 130 or 160 BPM, respectively) with the blue LED being flashed to the beat (and the white LED flashing once-per-minute) - but by blanking the "rate" LED (red, yellow or green) LED when we want to flash the blue or white one, we avoid the problem altogether.

Battery charging:

Not shown in the schematic is the USB battery charging circuit.  Implementing this was very easy:  I just bought some LiIon charger boards from Amazon.  These small circuit boards came with a small USB connector (visible in the video, below) and a chip that controlled both charging and "cell protection" - that is, they would disconnect the cell if the battery voltage got too low (below 2.5-2.7 volts) to protect it.  Since its use is so straightforward - and covered by others - I'm only mentioning it in passing.

Software:

Because of its familiarity to me, I wrote the code for this device in C using the "PICC" compiler by CCS Computer Systems.  As it is my practice, this code was written for the "bare metal" meaning that it interfaces directly with the PIC's built-in peripherals and porting it to other platforms would require a bit of work.

The unit is controlled via two pushbuttons, using the PIC's own pull-up resistors.  One button primarily controls the rate while the other sets the brightness level between several steps, and pressing and holding the rate button will turn it off and on.  When "off", the processor isn't really off, but rather the internal clock is switched to 31 kHz and the charge pump and LED drivers are turned off, reducing the operating current of the processor to a few microamps at most.

Built into the software, there is a timer that, if there is no button press within 90 minutes or so, will cause the unit to automatically power down.  This "auto power off" feature is important as this device makes no noise and it would be very easy to accidentally leave it running.

Below is a short (wordless!) video showing the operation of the "Word Metronome" - enjoy!

 


This page stolen from ka7oei.blogspot.com

[END]


Friday, January 30, 2015

Updated version of the "Simple" PWM LED/Laser modulator

A few years ago, for our friends in the Tucson area, I threw together a "simple" PWM circuit for audio modulation of high power LEDs (but it works just as well for laser pointers) for an optical transmitter - you can read about that here:

A "Simpler" Pulse-Width Modulator for LEDs, Lasers and whatnot and a simpler foam-core enclosure - link
Figure 1:
As-built prototype of the updated PWM transmitter designed to test both
 the AGC and manual gain/tone configurations.
There is currently no circuit board pattern:  If you design one,
please let me know!
Click on the image for a larger version.

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

Another way that LEDs may be modulated is by turning them on and off in a manner that simulates linear modulation using a method called PWM, or Pulse Width Modulation - a system that is very easy to do using digital hardware such as counters and is often found in microcontrollers.

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.
This circuit uses a PIC12F683, an 8 pin microcontroller internally clocked at 8 MHz.  Using its PWM hardware, it generates a waveform with a clock rate of 31.25 kHz that is pulse-width modulated at a resolution of 8 bits - suitable for voice.

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
Having a fixed 1 kHz tone is useful if using a computer or other device when setting up end-to-end alignment of an optical path as narrow detection bandwidths may be employed to maximize the overall sensitivity of the detection scheme.  Because this PIC's oscillator is not crystal-based, the actual frequency can vary by several percent, but it should be easily spotted with spectral analysis programs such as "Spectrum Lab" by DL4YHF, Spectran or Argo (to name but a few).

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".

Wednesday, September 5, 2012

Voice on a laser beam...


Sending voice over light is nothing new.  The first wireless voice communications system - using light - was the PhotoPhone, demonstrated in 1878 by Alexander Graham Bell - a full 25 years before Fessenden demonstrated the same feat using radio waves.  To be sure, optical communications has certain practical limitations, namely the blinding presence of the sun and the occasional opacity of the atmosphere due to weather, but it's still a fascinating and fun topic of discussion.

I'm one of those people who find wireless communications of any sort to be interesting and I have a particularly keen fascination with optical wireless communications - that is, using "radio waves" that I can see with my own eyes.

For short-range experimentation it's hard to beat a cheap laser pointer - and here is a bit of info on how one might go about this.

Modulating the laser pointer:

The laser pointer consists of a laser diode and like any diode, it has a maximum current rating that should be observed with more caution than its voltage.  What this means is that you cannot connect a laser diode to any sort of battery and expect it to work properly:  Too little voltage and it won't lase while too much voltage, it will never lase again!  What is needed is a simple circuit that limits the amount of current fed into the laser diode to a safe level and fortunately, cheap laser pointers always have something that does this.

Increasingly, cheap laser pointers simply rely on a combination of a simple circuit (or even a single resistor!) and the internal resistance of the battery powering it to keep the laser current at a safe level and since a laser pointer already has the necessary parts, why not use them?

In my opinion, one mistake that I often see on web pages that describe the modulation of a laser pointer is to attempt to modulate by varying the voltage/current of operation - typically using a transformer in series with the power source.  There are several things wrong with this:
  • It's not certain how far down in current one can go before the laser drops out of its "laser" mode or how high one can go before it gets "blowed up."
  • Laser current versus output isn't terribly linear which means that distortion can occur.
  • With the min/max current uncertainty, one can't fully modulate the laser's output safely which means that the audio on the beam will be somewhat "quiet" - something that reduces the efficacy of the link!
The better way to modulate a laser is to simply turn it on and off using Pulse With Modulation (PWM)  and taking advantage of the circuit already present to safely operate the laser from its intended power source - say, a pair of AAA cells (or 3.0 volts.)  While more complicated than simply putting the laser's power supply in series with a transformer, it's pretty much bulletproof and can sound pretty darn good!
 
Figure 1: Laser transmitter/receiver by K7RJ.
For a diagram of this unit, see Figure 4 at the bottom of this page.
Click on the image for a larger version.

A simple circuit to do this may be found in the diagram in figure 4 at the bottom of the page..

I won't take credit for this circuit which was thrown together by my friend Ron, K7RJ.  When built, this circuit was intended to be quick and easy and high performance was NOT in mind - just enough effort was put into it to make it work for demonstration purposes.

Contained within the diagram is enough information to connect your cheap, 3-volt laser pointer - just be sure to pay close attention to its positive and negative battery connections when you take it apart!

Also contained in this diagram is a very simple, low-performance receiver intended solely for across-the-room (or across-the-parking lot) testing of the transmitter to make sure that it works.  It should be emphasized that this receiver is not at all intended for longer-distance use - say, more than a few hundred meters at most, and its performance can be spectacularly enhanced with the careful installation of a small magnifying glass lens with the phototransistor at its focus.  Even when enhanced thusly, other optical receiver circuits will still run circles around it!  A link to a web page describing a far more sensitive circuit may be found at the bottom of this page.

At this point I'll make a few comments about laser safety and legality:
  • Make certain that your "laser range" is end-stopped - that is, when the beam goes beyond the receiver it does not cross a road or have any likelihood of being intercepted by aircraft in flight or landing/taking off where they can dazzle and distract!  In other words, the receive end should be against the side of a building or hill.
  • While cheap, red laser pointers are probably too weak to cause permanent eye damage, it's best not to stare into it or point it directly at people!  A standard, cheap red laser pointer will, at its worst, probably just dazzle and maybe cause a brief headache or eye pain as well as a temporary loss of night vision.  The farther you are away from it, the less dangerous it will be.
  • In some states and areas laser pointers are highly regulated or even illegal - including some U.S. and Australian states/localities - check your local listings!
  • It is NOT recommended that any but cheap, red laser pointers be used for this purpose.  Why?  First, they are the cheapest and secondly, they are fairly safe and low power.  It's also worth considering that typical electronic detectors respond far better (e.g. are more sensitive) to red light than green or blue - not to mention there being less atmospheric attenuation at "red" wavelengths!  Some of these "fancier" laser pointers of other colors have electronic circuits in them that can prevent them from being modulated effectively.

Figure 2:
Cheap laser pointer on a tripod
Click on the image for a larger version.
One thing that you'll immediately notice about laser pointers is that despite their name, they can be fiendishly difficult to aim them - particularly as the distance increases!  For this reason it's best to contrive a means by which a camera tripod can be used to hold a laser pointer - but even this can be tricky since even a fairly expensive tripod is quite "touchy"!  To the left you can see Ron's laser pointer mount with the pointer module itself being contained within a cheap project box from Radio Shack and connected by a short cable to the rest of the circuitry.

This brings up another point as well:  Do not put both the modulator electronics and your laser pointer in the same box.  By connecting them with a cable you will be able to make adjustments and turn the thing on and off without touching the tripod and possibly disturbing your carefully-aimed beam!

Another example of a laser pointer modified for such use may be seen on the right.  When I got this pointer I couldn't see how I could remove the laser module without the possibility of damaging it so I simply used it as-is:  A wooden dowel, the same diameter as AAA cells was used and at the inside end of the dowel was a small screw to which the minus (-) side connection was made.  The connection to this screw was made via a wire laid in a shallow groove along the length of the dowel and the positive (+) side was connected to the case of the pointer itself by using some copper foil wrapped around the end of the dowel opposite the screw.  The dowel was tack-glued into place, pushing against the internal battery spring and the laser's "on" button was simply taped down.  The entire pointer was then "hot-glued" to a cheap project box that itself has inside it a 1/4"-20 bolt glued into place to allow attaching to a tripod mount while electrically insulating the laser pointer's positively-connected case from the tripod.

Figure 3:
Minimally-modified pointer on a tripod mount.  This just happens to
be mounted atop an 8" astronomical telescope (a Celestron C8)
  with a equatorial mount which allows
precise aiming - and it also includes a telescope!
Click on the image for a larger version.
A lot has been glossed over in this brief article - namely techniques about how to accomplish a laser communication over longer distances including links to descriptions of higher-performance gear and methods of precisely aiming - and if you are really interested, you can take a look at my page:

 "Using Laser Pointers for Voice Communications" (see the link below) for a lot more detail than can be covered here.

How far can a lowly laser pointer go?

Under clear-air conditions on a line-of-sight path and using the very same lasers pictured above I've had a 2-way laser pointer to laser pointer communications on a 107 mile (173 km) path with fairly good signals.  This was, of course, using high-performance receivers with orders of magnitudes better sensitivity than the one shown it Figures 1 and 4 on this page!  In the "Using Laser Pointers..." link just above one can even find additional links to actual "off the air" recordings made via long-distance laser-pointer communications systems.

There are other problems with using lasers over distance, however, namely that of scintillation - the rapid fading or "twinkling" caused by the irregularities in the atmosphere.  While this affects all types of light sources the combination of the coherent laser light and the small diameter of the beam as it exits the laser greatly exacerbates the problem - but that's a topic for another article!

Links from the "Modulated Light" (link) web site:
Figure 4:
Schematic diagrams of a simple (but deaf) receiver for testing and a simple PWM laser/LED transmitter, described
in the text above.  This unit was designed by Ron, K7RJ and is shown in Figure 1, above.
Click on the image for a larger version.
[End]

This page stolen from ka7oei.blogspot.com