Antenna Handbook: 10/09/24

*SCAP' AVR Programmer

 By Michael Gaus (Germany)

Many newcomers to AVR programming would love to build their own low-cost programming device, but they face a chicken-and-egg problem: many of the designs themselves use an AVR microcontroller; this needs to be programmed, and so they first need to make a programmer...

This is where the SCAP (Serial Cheap AVR Programmer) can come in handy. It is a very simple programming device using a minimum of components, and it can be connected either directly to a PC's RS-232 interface or to a USB interface via a USB-to-RS232 converter.

The circuit includes a nine-way D-sub socket (K1) which can be connected to the PC's serial port or to the USB-to-RS232 converter. The circuit takes advantage of the internal protection diodes on the AVR's I/O pins to V cc and GND, and the two series resistors R1 and R2 are thus needed to limit the current flowing through these diodes. The values are chosen to keep this current below 1 mA. The RS-232 interface can be as high as ±15 V. At -15 V the AVR's internal protection diode to GND limits the voltage on the I/O pin to a minimum value of -0.7 V, while at +15 Vthe protection diode to V cc limits the pin voltage to a maximum value of V cc +0.7 V. Now, because the values of the series resistors R1 and R2 are relatively high, the charging and discharging of the AVR's input capacitance is considerably slower than if it had been driven directly by a push-pull stage, and this limits the maximum permissible frequency on SCK for reliable operation. The wiring of K2 corresponds to the standard six-way Atmel ISP connector.

The well-known open source program AVRDUDE is an essentially universal programming tool that can very easily be configured to work with SCAP: see [1] and [2]. The configuration file avrdude.conf needs to have the following section added to it:

This adds a new programmer called 'scap', which can then be selected as the device to be used for programming using the command-line option '-c scap'.

Even though the reset pin of the microcontroller is tied permanently to GND in the circuit, it must still be defined for AVRDUDE. If AVRDUDE fails to establish a connection with the AVR device to be programmed, the power to the device must be interrupted briefly to cause it to perform a power-on reset. Here is a sample command to invoke AVRDUDE. We have assumed that SCAP is connected to COM1 with an ATmega8 as the taret device (this corresponds to the commandline option '-p m8') and thatthe hex file to be programmed istest.hex.


avrdude 300 -


-P coml -p m8 -c scap U f lash : w : test . hex : i


The instruction to slow down SCK is specified by the command-line option '-i 300', which gives a delay of 300 jlls. This makes the programming operation rather slow. Depending on the type of interface used (normal RS-232 or a USB-to-RS-232 converter) it may be possible to reduce the delay value to as little as 50, which will make programming faster. If SCAP is being used just to solve the chicken-andegg problem mentioned at the start of this article, then programming speed will not be of any great concern

Internet Links

[1] AVRDUDE:

www.nongnu.org/avrdude/

[2] AVRDUDE version for Windows: www.mikrocontroller.net/ attachment/69851 /avrdude-5.1 0.zip

Power Controller for Convector Heaters


In Fall or Spring, the weather may be warm enough that we'd like to save money by shutting down the main heating system in our home and just use supplementary heating based on one or more electric convector heaters.

Even though these convectors are quite heavy consumers of electricity, this can be reduced by fitting a power controller between the heaters and the AC power outlet, which will affect the effective power consumption of the convectors.

The circuit diagram is based around the use of the emblematic NE555 IC, used here as an astable multivibrator with variable duty cycle (D = t high / T), but at a fixed operating frequency, given by:

f = 1 / (0.693 x PI x C6) = 0.0654 Hz

The duty cycle D of the signal at the output (pin 3) of IC2 will change depending on the position of the wiper of potentiometer PI :

• If the wiper is at mid-travel, the duty cycle D will be 0.5;

• If the wiper is at the +12 V end, the IC2 output signal is zero and hence D = 0;

• If the wiper position takes it down to the voltage on C6, IC2's output supplies a constant voltage of around 11 V and D = 1.

By way of transistor T1, IC2 drives two MOC3021 phototriacs (IC3 & IC4) which provide the isolation between the circuit's 'driver' section and the 'power' section, which is directly connected to the AC powerlines.

Each phototriac drives a power triac (TRI1 & TRI2). These two triacs are fitted in parallel and share the task of supplying the convector (R L ): one triac supplies the positive half-cycle while the other triac supplies the negative

A Few DC Solid-state Relays

 By Georges Treels (France) (Elektor Electronics)

Good old electromechanical relays are relatively expensive where any significant current has to be switched and switching times must be short. One solution is to go over to solidstate relays (SSRs). In DC mode, MOSFETs offer a very interesting solution, and the various manufacturers today offer devices at less than £4 with amazing performance, in terms of both current and low R DS ( on y They're relatively simple to use, in both monostable and bistable modes, so why stint ourselves?



The following circuits will let you switch 10-60 A (or even more if you use configurations with MOSFETs in parallel), with very short switching times. Several configurations are shown, monostable and bistable, capable of switching a load with one side returned to either ground (high side switching) or the positive rail (low side switching). In addition, the monostable configurations offer galvanic isolation and can be driven by signals from 5-24 V, DC or AC. The bistable SSRs are controlled using a simple push-button and a little bit of logic.



Let's start with the monostable SSRs. Bridge B1 makes it possible to accept any input polarity in the case of a DC control signal, and rectifies the signal in the case of an AC control signal. The network R1, R2, D1 limits the LED current in opto-isolator IC1 . The base of the phototransistor in IC1 is connected to ground via R3; its emitter is connected directly to ground.



In the case of a load returned to ground, the gate of T1, a P-channel MOSFET, is driven directly from the collector of IC1. If the load is returned to the positive rail, the gate of T1, this time an N-channel MOSFET, is driven via T2, which inverts the output from IC1 .


C2, C3, D2, and D3 protect the MOSFET in the event of loads that are not purely resistive. Both bistable configurations use the same power stages as the monostables, with an N-MOSFET for loads connected to the positive rail and a P-MOSFETfor loads connected to ground.


IC1.A is wired as a simple flip-flop: with the switching threshold set by PI , IC1 .A output will change state each time button SI is pressed. R1 and CI avoid rapid oscillations while SI is pressed. IC1 gates B, C, and D directly drive the gate of the P-MOSFET in the case of a load returned to ground. IC1 .B inverts IC1 .A output when an N-MOSFET has to be driven (load returned to the positive rail). In both configurations, the relay remains off at power-on (safety feature).


Concerning the MOSFETs, the table lists a number of possible types. This list is far from being exhaustive and new devices come out regularly. Give preference to a low value of R DS(on) (dissipation) and a good dv/dt specification in the case of 'dirty' loads. Pay attention also to the V DS . Even though most of these transistors can take 60 V, this is not the case for either the optoisolators or the bipolar transistors used.

If you are designing a PCB for this type of relay, pay attention to the possibility of heavy currents being carried by the PCB track. For example, three SUP75P03-07 wired in parallel can pass over 200 A! Bear in mind that a PCB track with a copper layer 35 jam thick (i.e. standard) has a resistance of 48* 10 5 x L/ Wohms, where L(ength) and W(idth) are in mm.



Wideband PC Radio

 

PC radios are certainly nothing unusual. However, unless you are prepared to spend a lot of cash you can't buy a wideband PC radio that receives short-wave signals — if you want one that will not break the bank, you will have to build it yourself. There's no need for a battery or power supply, since power can be drawn directly from the PC serial interface. The audio signal is fed into the PC sound card. The circuit diagram in Figure 1 shows this simple audion receiver. The transistor in the common-emitter circuit demodulates AM signals, thanks to its exponential characteristic curve. Since the base-emitter junction is already biased, RF potentials of a few millivolts are sufficient to achieve demodulation. For this reason, the audion circuit is significantly more sensitive than a simple diode detector.


So where is the tuning capacitor? It's not needed, since the receiver has an extremely wide bandwidth and (simultaneously!) receives all strong signals ranging from the 49-m band to the 19-m band. The coil is wound in two layers with 15 turns on a pencil. This yields an inductance of around 2 uH. The resonant circuit capacitance of around 100 pF is composed of the base capacitance of the transistor and the aerial capacitance. This places the resonant frequency at around 11 M Hz. The low input impedance of the transistor damps the resonant circuitto the pointthat its Q factor is 1, so the bandwidth is also around 11 M Hz. The receiver thus picks up everything between 6 MHz and 17 MHz. This complete elimination of the usual selection leads to surprising results.


Less is more. For communications technicians, this means: less selectivity = more bandwidth = more information. Indeed, here you dive into a sea of waves and tones. The special propagation conditions for short-wave signals cause first one signal and then another signal to predominate. You hear messages in several languages atthe same time, music ranging from classical to pop and folk songs from distant countries. Without the bother of the usual dial spinning, you can roam at your leisure through the entire short-wave region.


The supply voltage for the radio must be first switched on by using a program (HyperTerminal is adequate) to switch the DTR lead of the serial interface from -10 V to +10 V. If you want to avoid this trouble, you can use a PNP transistor. The alternative circuit diagram shown in Figure 2 shows some additional improvements. The coupling capacitor prevents the dc component from reaching the input of the sound card, and residual HF components are shorted out by the parallel capacitor. With these modifications, the radio is also quite suitable for direct connection to a stereo system, final amplifier or active speaker. In such cases, you can do without the PC and use a battery (1.5 to 12 V) instead. A downpipe from the eavestrough can be used as an aerial if it is insulated at its lower end (where it connects to the sewer system) by a rubber ring or concrete. If you are not so fortunate as to have access to such an arrangement, you will have to rig a wire aerial (at least 5 m long).

source : Elektor Circuit Collections 



Pressure Switch

 

A simple pressure switch with a range of 50 to 350 mbar can be made using a pressure sensor. If you can accept somewhat reduced linearity, the sensor can even be used up to 500 mbar. As shown in the schematic diagram, the circuit contains very few components other than the sensor. Dl, Rl, CI and D5 form a simple voltage stabiliser that holds the supply voltage for the sensor and opamps at 5 V The three diodes in series with the sensor provide temperature compensation (more on this later). The differential output signal from the sensor is amplified 30 x by an instrumentation amplifier composed of opamps ICla, IClb and IClc. 


The amplification factor can be adjusted if necessary by modifying the value of R10. The amplified output signal is compared to the voltage on the wiper of PI. If the voltage that results from the pressure being measured is less than the value set by PI, the output of comparator ICld is High and LED D4 is on. An external load can be switched via the open-collector output of T2. 

We used a Melexis MLX90240 sensor (www.melexis.com), but unless you work in the automotive industry, you won't be able to obtain this sensor. An Exar sensor (such as the SM5310-005-G-P; see www.exar.com) or a Motorola type can be used instead. If necessary, the circuit can bemodified as described below. Start with the sensor sensitivity specification from the data sheet (approximately 60 mV/bar/volt in our case). Since the supply voltage of the sensor is 5 V minus 3 diode drops, or around 3 V, the net sensitivity is thus 180 mV/bar. 

The range of the sensor is 0 to 350 mbar, so the maximum output voltage is 63 mV. The following amplifier has a gain of approximately 30, so the output signal ranges between 0 and 1.89 V. This voltage is compared to the voltage on the wiper of PI, which can be varied between 0 and 2.5 V. If the sensitivity differs from the nominal value, the amplification can be adjusted as necessary using R10. 

Finally, a remark on the temperature compensation. The sensor used here has a temperature coefficient of 2100 ppm/degree. 

Other types of sensor will have somewhat different values (consult the data sheet). The supply voltage should thus increase by 2100 ppm of 3 V for every degree, which is 6.3 mV per degree. The voltage across a silicon diode drops approximately 2 mV per degree, so the supply voltage of the sensor increases as the temperature increases. This compensates for its decreased sensitivity. With the indicated sensor, three diodes in series are needed to just about fully compensate for its temperature coefficient. Two diodes are sufficient for the previously mentioned Exar sensor.

PC Battery Charger

 Some workbenches can't help ending up looking like a rats nest of cables and equipment, so its always an advantage if a piece of mains equipment can be removed from somewhere to free up an extra mains socket. Here we are using the ubiquitous PC as a battery charger. An unused serial interface port can supply enough current to charge (or trickle charge) lowcapacity Nickel Cadmium (NiCd) batteries. You could for example, use the batteries in a radio and charge them during use.

The three serial port connections TxD, DTR, and RTS, when not in use, are at -10 V and can supply a current of around 10 to 20 mA (they are short-circuit protected). The circuit shown supplies a charging current of approximately 30 mA. If it is necessary to alter the polarity of the charging circuit then it is a simple job to reverse the diodes and using software, switch the port signals +10 V. Those interested could also write a software routine to automatically recharge the batteries.

Universal Symmetric Power Supply

 


This power supply has been specially designed for the 20 th -order filter described elsewhere in this issue, but it can also be used for a legion of other opamp circuits. The supply voltage is set to ± 17.5 V, in light of the maximum output level of the filter. This benefits the signal to noise ratio. The specified absolute maximum supply voltage for most opamps is ± 18 V, and we have intentionally kept a bit below this limit. The transformer is one of a series made by Hahn (model UI 30), so the circuit can be easily adapted for higher power levels by using a different transformer. All transformers in this series have the same footprint (53 X 44 mm), with only the height changing according to the power capacity. The series consists of 3, 4, 6, 10 and 16-VA models, which are respectively 16.3, 18.3, 21.8, 27.7 and 37.6 mm high. There are two secondary windings, with standard voltages of 2 X 6, 2 X 9, 2 X 12, 2 X 15 and 2 X 18 V. We chose a 4 VA transformer with 2x18V secondaries for this application. Certain models are also available from other manufactures, but the locations of the secondary connections are different. The circuit board layout can accommodate two different types.

The circuit is based on the well-known LM317 and LM337 voltage regulators. Since the output voltages are set by voltage dividers, any voltage between 1.25 V and 40 V is possible. In case you don't already know, the formula for the positive output voltage (LM317) is

V out = 1.25*(1+R2/R1) + I adj *R2

The same formula applies to the negative regulator, using R3

and R4 instead. Capacitors C5 and C6 increase the ripple suppression to 80 dB. Depending on the application and the output power, it may be necessary to use heat sinks for the regulator ICs. The power supply has a simple mains filter to suppress common-mode interference. This is primarily needed if the supply is used to power sensitive circuits. The coil is a Siemens type that has been used in many other Elektor Electronics projects. Dl acts as a mains voltage indicator. The indicated value of the fuse, both in the diagram and on the circuit board, is 32 mA (slow). This value will have to be modified for higher power levels (as will the label on the circuit board!). With lower output voltages and larger output currents, the filter capacitors C9 and CIO must be made larger. The working voltage can then be reduced, so the physical dimensions will probably remain the same. 


The PCB shown here is available ready-made through the Publishers' Readers Services.







Analog Opto Coupler

 


It is sometimes necessary to make an electrically isolated connection in a circuit. An optocoupler is usually the key component in such a situation. In most optocouplers, a single lightemitting diode (transmitter) and a single photodiode (receiver) are optically coupled inside the package. This solution is satisfactory for transferring digital levels (such as the control signals for a thyristor), since only two logical states (LED on or LED off) have to be transferred. An exact (analogue) coupling is thus not necessary.

If an analogue voltage must be transferred, then it is important that the voltages at the input and the output closely track each other. To make this possible, the transmitter and receiver must employ comparable components that are incorporated into an analogue circuit. The type CNR200 and CNR201 opto-couplers that are available from Agilent (formerly HewlettPackard) contain all the essential components for such a function. There are two photodiodes and one LED in a single package, with an optical coupling between the LED and one of the photodiodes. The schematic diagram shows how the transmitter LED is optically coupled to the photodiode in the receiver. The remaining photodiode is incorporated into the transmitter and ensures that the characteristic of the transmitter amplifier is the same as that of the receiver. Assuming a supply voltage of 5 V, analogue voltages in the range of 0 to 3 V can be readily transferred. The isolation voltage between the input and output of this optocoupler is 1000 V. The value that can be achieved in practice depends on the printed circuit board layout

Single-Opamp 10-MHz Bandpass Filter

 


A bandpass filter is usually used to pass frequencies within a certain frequency range. If a high-performance opamp is used, such a filter can also be used at relatively high frequencies. As shown in the schematic diagram, here we have chosen an OPA603, which is a fast current-feedback opamp with a 100 MHz bandwidth for gain values between 1 and 10 (0 to 20 dB). If the circuit only has to handle a narrow range of frequencies, as in this case, the gain can be increased.


 With a current-feedback opamp, just as with an ordinary opamp, the negative feedback between the output and the inverting input determines the gain. In addition, the impedance of the feedback network determines the open-loop gain and the frequency response. With the component values shown in the schematic diagram, signals outside the passband are attenuated by 22 dB. The centre frequency of the filter is 10 MHz. As indicated by the printed formula, the centre frequency can easily be altered. However, keep in mind that 10 MHz is roughly the maximum frequency at which this circuit can be used. The circuit can be powered by a supply voltage of ± 15 V.

Infra-Red Light Barrier

 

This is a short-range light barrier for use as an intruder alarm in doorposts, etc. The 555 in the transmitter (Figure 1) oscillates at about 4.5 kHz, supplying pulses with a duty cycle of about 13% to keep power consumption within reason. Just about any infra-red LED (also called IRED) may be used. Suggested, commonly available types are the LD271 and SFH485. The exact pulse frequency is adjusted with preset PI. The LEDs are pulsed at a peak current of about 100 mA, determined by the 47 Q series resistor.



In the receiver (Figure 2), the maximum sensitivity of photodiode D2 should occur at the wavelength of the IREDs used in the transmitter. You should be okay if you use an SFH205F, BPW34 or BP104. Note that the photodiode is connected reverse-biased! So, if you measure about 0.45 V across this device, it is almost certainly fitted the wrong way around. The received pulses are first amplified by Tl and T2. Next comes a PLL (phase lock loop) built with the reverenced NE567 (or LM567). The PLL chip pulls its output, pin 8, Low when it is locked onto the 4.5 kHz 'tone' received from the transmitter. When the (normally invisible) light beam is interrupted (for example, by someone walking into the room), the received signal disappears and IC1 will pull its output pin High. This enables oscillator IC2 in the receiver, and an audible alarm is produced.

The two-transistor amplifier in the receiver is purposely overdriven to some extent to ensure that the duty cycle of the output pulses is roughly 50%. If the 2 transmitter is too far away from the receiver, overdriving will no longer be guaranteed, hence IC1 will not be enabled by an alarm condition. If you want to get the most out of the circuit in respect of distance covered, start by modifying the value of R2 until the amplifier output signal again has a duty cycle of about 50%. The circuit is simple to adjust. Switch on the receiver, the buzzer should sound. Then switch on the transmitter. Point the transmitter LEDs to the receiver input. Use a relatively small distance, say, 30 cm. Adjust PI on the transmitter until the buzzer is silenced

Switch the receiver off and on again a few times to make sure it locks onto the transmitter carrier under all circumstances. If necessary, re-adjust PI, slowly increasing the distance between the transmitter and the receiver

Battery Discharger

 


The battery discharger published in the June 1998 issue of this magazine may be improved by adding a Schottky diode (D 3 ). This ensures that a NiCd cell is discharged not to 0.6-0.7 V, but to just under 1 V as recommended by the manufacturers. An additional effect is then that light-emitting diode D 2 flashes when the battery connected to the terminals is flat.

The circuit in the diagram is based on an astable multivibrator operating at a frequency of about 25 kHz. When transistor T 2 conducts, a current flows through inductor L lf whereupon energy is stored in the resulting electromagnetic field. When T 2 is cut off, the field collapses, whereupon a counteremf is produced at a level that exceeds the forward voltage (about 1.6 V) of D 2 . A current then flows through the diode so that this lights. Diode D 1 prevents the current flowing through R 4 and C 2 . This process is halted only when the battery voltage no longer provides a sufficient base potential for the transistors. In the original circuit, this happened at about 0.65 V. The addition of the forward bias of D 3 (about 0.3 V), the final discharge voltage of the battery is raised to 0.9-1.0 V. Additional resistors R 5 and R 6 ensure that sufficient current flows through D 3 . When the battery is discharged to the recommended level, it must be removed from the discharger since, in contrast to the original circuit, a small current continues to flow through D 3 , R 2 _ R 3, and R5.R6 until the battery is totally discharged

The flashing of D 2 when the battery is nearing recommended discharge is caused by the increasing internal resistance of the battery lowering the terminal voltage to below the threshold level. If no current flows, the internal resistance is of no consequence since the terminal voltage rises to the threshold voltage by taking some energy from the battery. When the discharge is complete to the recommended level, the LED goes out. It should therefore be noted that the battery is discharged sufficiently when the LED begins to flash.