Custom Search

Monday, October 18, 2010

Sound Pressure Level Meter

This electronic circuit project is to setup home-cinema set adjusting all the loudspeaker outputs to the same level when heard from the listening position.In practice this device is a simple (though linear and precise) ac millivoltmeter, using an existing multimeter set to 50 or 100µA fsd with the probes connected to J1 and J2 to read the results.

The precision of the measure is entirely depending on the frequency response of the microphone used but, fortunately, for the main purpose of this circuit an absolutely flat response is not required. Therefore, a cheap miniature electret microphone can be used.
Parts List:
R1 - 10K 1/4W Resistor
R2,R3 - 22K 1/4W Resistors
R4 - 100K 1/4W Resistor
R5 - 100R 1/4W Resistor
C1 - 1µF 63V Polyester or Electrolytic Capacitor
C2 - 100µF 25V Electrolytic Capacitor
C3 - 220µF 25V Electrolytic Capacitor
D1-D4 - BAT46 100V 150mA Schottky-barrier Diodes
IC1 - CA3140 Op-Amp IC
MIC - Miniature electret microphone (See Notes)
J1,J2 - 4mm Output sockets
SW1 - SPST Toggle or Slider Switch
B1 - 9V PP3 Battery
Clip for PP3 Battery
The amplifiers driving the loudspeakers must be fed, one at a time, with a sine wave in the 400Hz - 1KHz range, but different values can also be chosen. For this purpose you can use a simple signal generator circuit like one of those available on this site, namely: 1KHz Sine wave Generator or, better still, Spot-frequency Sine wave Generator.
As an alternative, the input sine wave can be provided by a CD test track, a cassette-tape or a personal computer. Please be careful and set the volume control very low, to avoid loudspeakers' damage. Switch-on the Sound Pressure Level Meter and increase the volume of the amplifier in order to obtain an approximate center-scale reading. Repeat the same steps with all channels.

2.4 GHz Spectrum Analyser-CYM6935 Module

There many wireless devices available on the market now that broadcast in the 2.4 GHz spectrum including Bluetooth, 802.11a/b ethernet (WiFi), Zigbee, wireless USB, cordless phones, wireless mice and keyboards and the humble microwave oven. Depending where you live in the world your government has allocated a roughly 80 MHz block for transmitting all manner of data starting at 2.4 GHz. It's getting a bit crowded in this band, especially if you live in a built up urban area. With this project you can monitor what's going on and figure out what channel to change your WiFi network to in order for it to keep working when your neighbor rudely sets up their wireless network on the same channel as you (that'd be channel 6, you lazy sod).

How to do it? Quite a few companies are now making 2.4 GHz data transceivers crammed into a single chip. These chips are very cheap but pack quite a bit of functionality. One thing they have in common is an RSSI (Receive Signal Strength Indicator) register that lets the chip monitor how much signal power it's receiving. In practice before the chip transmits it's generally a good idea to spend a few milliseconds listening to see if there is anything else broadcasting on the same channel. If the RSSI level is below a certain level it's safe to assume the channel is clear to transmit on.
Taking advantage of this RSSI register allows one to construct a crude but effective spectrum analyser. Cypress Semiconductor make a range of 2.4 GHz transceiver chips intended for short range use such as wireless keyboards and mice. The chip CYWUSB6935 contains an RSSI register with 32 magnitude levels. It also has a radio that starts at 2.4 GHz and is tunable in 1 MHz steps. Unfortunately the chip comes in a "QFN" package with the pins secreted away under the casing of the chip. This make it impossible to hand solder. Fortunately Cypress saw fit to produce the CYM6935 module - it's a little circuit board with the chip, support components and antennas conveniently integrated together. All we need to add is a parallel port, power and software to read the RSSI and see what the pesky neighbor is up to.
2.4 GHz Spectrum Analyser Components
- CYM6935 Module - Can be obtained from Cypress as a sample or purchase through their website and distributors
- 4 10kohm resistors
- 4 15kohm resistors
- 3 silicon diodes
- Ribbon cable

- Male DB-25 connector and backshell
- Hookup wire
- Prototype circuit board (such as Veroboard or a ready made PCB from Elektor
- USB cable (for power only, not data)


2.4 GHz Spectrum Analyser Construction

The CYWUSB6935 is a 2.7V to 3.6V device. The three diodes are designed to drop 5V down to about 3V. My PC PSU only puts out 4.7V so I am using only 2 diodes to get 3.3V. I originally tried to wire all 8 data outs in parallel through a diode each so I could turn the device on and off from software. The current wasn't anywhere near enough in spite of the data sheet for the I/O chip on my motherboard claiming to be able to. As an alternative I chopped up a USB cable and derive my 4.7V from the USB supply. You could be a pedant and use a 3.3V regulator instead of some diodes.


The resistors divide the signal output levels from TTL to 3V CMOS compatible levels. The parallel port is TTL compatible so the 3V signals from the chip can directly drive the parallel port signal inputs.
The module itself uses a header with a 2mm pitch which isn't readily available from your local electronics shop. You can see in the photo below I had to improvise with a cutout, bent wires and bluetack to mount and connect the module onto the main board.

2.4 GHz Spectrum Analyser Software
The provided QTScan Linux and QTScan Windows software I have written is a basic driver and display for the CYWUSB6935. It is a QT application written to run under Linux and Windows. Little or no tweaking of the parallel port driver may mean it will also work in various BSD's and OSX (with a USB-Parallel port device). The QT viewer part shouldn't need changing under any platform.
Building The Software
To build the software ensure you have the QT4.x development and runtime libraries and kernel headers installed. I have already supplied a binary that should work on an Ubuntu Feisty based system. Otherwise, simply run make to build your own copy.
The parallel port driver is a bit banging SPI driver. I have designed it to work in standard (SPP) parallel port mode and have set my BIOS to force SPP mode. The driver also initialises the chip and also provides the scanning function.
The scanning function starts by setting the radio frequency channel to 0. This sets the receive frequency to 2.4 GHz. The RSSI value is then read and the channel number incremented. Each increment corresponds to 1MHz step and a complete scan ends at 2.483 GHz. The radio can go a bit higher but there isn't much point as it's outside of the ISM band. The chip obtains an RSSI value by taking a snapshot of of power levels at the channel in question for 50 microseconds.
By taking successive 50us snapshots of each frequency a complete scan is performed. Unfortunately, reading and writing the parallel port is a very slow process as the port hardware deliberately runs at only several hundred kHz for historical and compatibility reasons. On my system I measure about 600,000 ioctls/sec can be performed. This means that the inb and outb instructions when accessing the parallel port are stalled for a very long duration compared to the clock speed of the CPU. You will notice because of the instruction stalling the System load will peak at close to 100% when running qtscan. In spite of this I get about 23 scans/sec which is a useful speed. The SPI port on the radio chip can run about 10 times faster than what I am able to do with the parallel port - this would translate to well over 200 scans a second. This could be achieved with a dedicated GPIO or SPI port as found in many embedded microprocessors.
You can run qtscan even without any of the hardware as the program blindly drives the parallel port. The scans/sec result upon exiting should be in the low 20's,
The parallel port driver and hardware provide a good start into getting this module to do data transmissions as well as performing the trivial RSSI application.
The qtscan application will display the current scan as a red line. Absolute peak levels are displayed as green bars behind the red line. The ticks on the x-axis are each channel at 1MHz intervals. The span is from 2.4 GHz to 2.483 GHz. The yellow lines are the 13 802.11b channels. The y-axis ticks represent the 32 levels from the RSSI register. Unfortunately I haven't been able to calibrate what each magnitude tick translates to in received power dBm. The data sheet says RSSI values in the range of 28-31 are -40dBm and 0-10 are <-95dBm. I don't think it's a precision measurement nor did Cypress intend it to be.
Because each scan only takes successive 50us snapshots the program needs to be left running to collect peak magnitudes. This peak magnitude plot builds up to give a good indication of the bandwidth and relative magnitude of a signal under observation.
Image 1: This shows my microwave oven about 5 metres away merrily spamming a greater portion of the 2.4GHz band. This was a 50 second observation.
Image 2: This shows my access point centred nicely on channel 9 using 802.11b. You can see how the spectrum bleeds over into the adjacent channels (which is fine). This is a 2 minute observation of just the beacon and associated chatter from the access point with no actual data being sent. The magnitude peaks at maximum level (31) which is no surprise as the AP is only 2 metres away.
Image 3: This shows what I suspect the beacon carrier from a 2.4GHz phone next door at centred around 2.411GHz. I have observed it to jitter and even disappear on occasion but it's usually present. My /proc/cpuinfo says my Athlon's internal clock is at 2.31GHz so I don't think it's my computer.
Image 4: This shows shows the sudden burst of traffic from my USB Bluetooth dongle (about 1m away) when I ran the KDE OBEX client. It must be a broadcast of some kind. This scan lasted about 10 seconds.
In all the images the overall noise floor occupies the first 7 or so levels which I think is a function of the device.

Source: DIY 2.4GHz Spectrum Analyser

Variable RF attenuator with PIN diode

Variable RF attenuators are often used to control the level of a radio frequency signal using a control voltage in RF design. These variable RF attenuators can even be used in programmable RF attenuators. Here the known voltage generated by a computer for example can be applied to the circuit and in this way create a programmable RF attenuator.

Often when designing or using variable or programmable RF attenuators, it is necessary to ensure that the RF attenuator retains a constant impedance over its operating range to ensure the correct operation of the interfacing circuitry. This RF attenuator circuit shown below provides a good match to 50 ohms over its operating range.


RF attenuator circuit description
The PIN diode variable attenuator is used to give attenuation over a range of about 20 dB and can be used in 50 ohm systems. The inductor L1 along with the capacitors C4 and C5 are included to prevent signal leakage from D1 to D2 that would impair the performance of the circuit.
The maximum attenuation is achieved when Vin is at a minimum. At this point current from the supply V+ turns the diodes D1 and D2 on effectively shorting the signal to ground. D3 is then reverse biased. When Vin is increased the diodes D1 and D2 become reverse biased, and D3 becomes forward biased, allowing the signal to pass through the circuit.
Typical values for the variable RF attenuator circuit might be: +V : 5 volts; Vin : 0 - 6 volts; D1 to D3 HP5082-3080 PIN diodes; R1 2k2; R2 : 1k; R3 2k7; L1 is self resonant above the operating frequency, but sufficient to give isolation between the diodes D1 and D2.
These values are only a starting point for an experimental design, and are only provided as such. The circuit may not be suitable in all instances.
Choice of PIN diode
Although in theory any diode could be used in variable RF attenuators, PIN diodes have a number of advantages. In the first place they are more linear than ordinary PN junction diodes. This means that in their action as a radio frequency switch they do not create as many spurious products and additionally as an attenuator they have a more useful curve. Secondly when reverse biased and switched off, the depletion layer is wider than with an ordinary diode and this provides for greater isolation when switching or providing higher levels of attenuation.
Source: PIN diode variable RF attenuator circuit

High Voltage Power Supply for Geiger Tubes


power supply circuits are generating 500 volts but they may be modified to supply a couple of hundred to nearly 1000 volts by changing the zener diodes. These circuits generate high voltages and can cause dangerous shocks! Do not build these devices unless you are experienced and qualified to work onhigh voltage devices

The difference is subtle; the feedback signal increases the voltage on the base of the 2N4403 to stop the oscillator instead of stealing current from the capacitor on the emitter. The result is much lower power dissipation when there is little or no load on the high voltage. The new circuit draws less than 1/2 mA when operating at 9 volts without a load using a 1:1 600 ohm audio isolation transformer.

The 3 volt circuit may be modified in the same way but make sure to switch to a MPSA18 (or a similar very high gain transistor). The 120 volt zeners are also an improvement over trying to grade ordinary diodes; grading is just too much trouble! A 1N5273A is a typical type to try. Remember, this circuit can only supply a few microamperes so an ordinary 10 megohm voltmeter will load the output too much. (500 volts/10 megohms = 50 uA.)
With some transformers and zeners, the circuit will work better if the 10 megohm resistor is moved up to be in series with the diodes (see next schematic). It is a good idea to add a resistor in series with the diodes anyway, perhaps 100 k, to prevent damage when probing around. When operating properly, the current should drop down to below 1/2 mA with no load. The series 10 megohm resistor will make gas discharge devices work well in place of the zeners, too (neon bulbs, for example). Also try a .1 uF capacitor from base to emitter of the MPSA18. This capacitor modification combined with the series 10 megohm allowed a single Lumex gas discharge tube to regulate the output voltage of the circuit at 600 volts while drawing only 300 uA, unloaded.
The transformer in the prototype is a small isolation transformer with opposite ends of the primary and secondary connected together to boost the output voltage. Other transformers will also work, including tiny audio interstage transformers, as long as the impedance is relatively high on both windings. If you don't get a high voltage, try reversing one of the winding connections. If the current doesn't cut back with no load, try the techniques mentioned in the note above. The circuit will work without the secondary connection simply by connecting the collector of the MPSA42 directly to the first .02 uF cap. and diode and leaving the secondary winding disconnected. Using the two winding voltage boost is recommended when attempting to run the circuit on a lower supply voltage.
Source: High Voltage Generator for Geiger Tubes

Regulated Power Supply 20A

A heavy duty 13.8V regulated power supply is a fine thing to have in the shack, but unless you acquire one secondhand, is an expensive little beastie to buy. This means building one should be considered, not only for the cost savings, but also because you can brag about it on air to your mates. Of course, careful consideration must be given to the properties of the completed supply, and after talking to a few of my friends who have built their own and fallen into all the traps, here are the printable ones : RF proof, easy to make, commonly available parts used, but above all CHEAP.

The details published provide a transformer and rectifier structure capable of providing 8 amps DC continuously (and short current peaks up to 20 amps). This is sufficient to adequately power SSB transceivers with 100W PEP outputs, BUT WILL NOT power a transceiver providing a continuous carrier of greater than about 40 watts.e.g. AM, FM, continuous key down morse, single tone SSB testing etc. Demanding a continuous output of more than 8 amps will result in the transformer secondary overheating, with a possible fire risk. The reason we can get away with a supply with an 8 amp continuous rating is simply that speech is very "peaky" data, and so SSB has the odd high power peak but a very low average power level (usually about 20 -30% of peak value). It is on this basis that transformer and heatsink sizes are usually selected for domestic hi-fi equipment.

The winding resistances of the transformer have been very carefully chosen to avoid excessive current peaks which will cause failure of the 35 amp bridge rectifier. If you wish to use a transformer with higher current ratings to make a continuously rated 20 amp supply, you MUST use more heavily rated diodes with peak repetitive surge current ratings of around 800 amp.The second part of the circuit (filter caps and regulator) will supply 20 amps continuously and can be used unchanged in a heavier duty supply. The transformer, rectifiers, and regulator circuit all generate large amounts of heat, and fan cooling MUST BE PROVIDED for safe and satisfactory operation.