Monday, September 30, 2013

Programming The Propeller IC

Parallax, well known for its successful Basic Stamp IC, has recently introduced the Propeller: a new microcontroller with a certain difference. It packs no less than eight 32-bit processors (referred to as COGs in Propeller jargon) into a single package with only 40 pins. That design takes genuine simultaneous multiprocessing possible, and the sophisticated internal structure of the device makes it relatively easy to implement video and signal-processing applications. The Propeller can be programmed in assembly language or the high-level Spin language. The processor and the programming tools were developed entirely in-house by Parallax, with the hardware being designed from scratch starting at the transistor level.

Circuit diagram:

programming-the-propeller-ic-circuit-diagramw

Programming The Propeller IC Circuit Diagram

The basic idea behind that was to avoid becoming involved in all sorts of patent disputes with other manufacturers. The result is astounding, and for software developers it certainly requires a change in mental gears. As is customary with modern microprocessors, the Propeller has a simple serial programming interface. The developer’s toolkit from Parallax has a modern USB port for that purpose, but a reasonably simple alternative (illustrated here) is also possible for anyone who prefers to work with the familiar RS232 port. Don’t forget that the Propeller works with a 3.3-V supply voltage.

Copyright: Elektor Electronics

Continue Read...

Sunday, September 29, 2013

Battery Juicer

More and more electronic devices are portable and run off batteries. It is no surprise, then, that so many flat batteries find their way into the bin - and often far too early. When a set of batteries can no longer run some device - for example, a flashgun - the cells are not necessarily completely discharged. If you put an apparently unserviceable AA-size cell into a radio-controlled clock with an LCD display it will run for months if not years. Of course not every partially discharged cell can be put in a clock. The circuit presented here lets you squeeze the last Watt-second out of your batteries, providing a bright ‘night light’ - for free!

The circuit features a TBA820M, a cheap audio power amplifier capable of operating from a very low supply voltage. Here it is connected as an astable multivibrator running at a frequency of around 13 kHz. Together with the two diodes and electrolytic capacitor this forms a DC-DC converter which can almost double the voltage from between four and eight series-connected AA-, C- or D-size cells, or from a PP3-style battery. The DC-DC converter is followed by a constant current source which drives the LED. This protects the expensive white LED: the voltages obtained from old batteries can vary considerably.

Battery Juicer Circuit DiagramWith the use of the DC-DC converter and 20 mA constant current source a much greater range of usable input voltages is achieved, particularly helpful at the lower end of the range when old batteries are used. With the constant current source on its own the white LED would not be adequately bright when run from low voltages. An additional feature is the ‘automatic eye’. The LDR detects when the normal room lighting is switched on or when the room is lit by sunlight: its resistance decreases. This reduces the UBE of the transistor below 0.7 V, the BC337 turns off and deactivates the LED.

This prolongs further the life of the old batteries. A further LDR across capacitor C reduces the quiescent current of the circuit to just 4mA (at 4V). Light from the white LED must of course not fall on the LDR, or the current saving function will not work.
Continue Read...

Friday, September 27, 2013

Simple Audio Peak Detector

This audio peak detector allows a pair of stereo channels to be monitored on a single LED. Identical circuitry is used in the left and right channels. Use is made of the switching levels of Schmitt trigger NAND gates inside the familiar 4093 IC. The threshold level for gate IC1.A (IC1.B) is set with the aid of preset P1, which supplies a high impedance bias level via R2 (R1). When, owing to the instantaneous level of the audio signal superimposed on the bias voltage by C3 (C2), the dc level at pins 1 and 2 (5 and 6) of the Schmitt trigger gate drops below a certain level, the output of IC1.A (IC1.B) will go High.

Simple Audio Peak Detector circuit schematic

This level is copied to the input of IC1.C via D2 (D1) and due to the inverting action of IC1.C, LED D3 will light. Network R3-C1 provides some delay to enable very short audio peaks to be reliably indicated. Initially turn the wiper of P1 to the +12 V extreme — LED D3 should remain out. Then apply ‘line’ level audio to K1 and K3, preferably music with lots of peaks (for example, drum ‘n bass). Carefully adjust P1 until the peaks in the music are indicated by D3. The circuit has double RCA connectors for the left and right channels to obviate the use of those rare and expensive audio splitter (‘Y’) cables.
Continue Read...

Thursday, September 26, 2013

Isolated 1 Hz Clock Circuit

One of the author’s physics projects required an accurate 1-Hz (seconds) clock signal. Unfortunately, precision 10-MHz quartz crystals are expensive, while another problem was found in the inability of most common or garden 40xx CMOS logic chips to work at such a high frequency. However, a typical CMOS counter like the 4017 has such a high input resistance that its clock input has ‘radio’ properties.

Circuit diagram :

Isolated 1-Hz Clock_Circuit Diagram Isolated 1-Hz Clock Circuit Diagram

The effect is exploited here to convert the stray magnetic field picked up from a mains transformer into a clock signal. Here, the signal is induced in a short piece of wire (approx. 5 cm) connected to the clock input of a CD4017 decade counter for division by 10. The resulting 5-Hz signal is then divided by 5 by a second 4017 (IC2) to give an output of 1 Hz. LED D1 flashes to indicate the presence of a sufficiently strong magnetic field. The pickup wire should be placed close to the mains transformer, without compromising electrical safety. Always use the greatest distance at which a clock signal is reliably generated. For 1-Hz output from 60-Hz power systems, use output 6 of IC2 (pin 5).

Continue Read...

Tuesday, September 24, 2013

Cat and Dog Repeller

Nowadays, just about every house has an outside lamp with a motion sensor. Such a device eliminates the need to feel your way to the front door, and it apparently also scares away intruders. The only problem is that free-running dogs and cats in the neighborhood have little regard for such lamps and continue to deposit their excrement in the garden, once they have found a habitual location there for this purpose. This gave rise to the idea of connecting a sort of siren in parallel with the outside lamp to clearly advise dogs and cats that they are not welcome.

Naturally, it would be nice to avoid startling the entire neighborhood with this alarm signal. Here we can take advantage of the fact that dogs and cats have a significantly better sense of hearing than people. Not only are their ears more sensitive, they can also perceive significantly higher frequencies. With people, the upper limit is around 18 kHz, but dogs and cats can hear frequencies in excess of 20 kHz. We can take advantage of this by building a siren that emits a frequency just above 20 kHz. This will scare off dogs and cats, but people will simply not hear it.

All we need for this is an oscillator with an amplifier stage and a tweeter that can reproduce such high frequencies, such as a piezoelectric tweeter. The schematic diagram shows how easily this can be implemented. The power supply for the entire circuit is formed by the components up to and including C2. The 230-V leads are connected in parallel with the motion-sensor lamp. C1 and R1 provide capacitive coupling to reduce the 230 V to an acceptable voltage. A DC voltage of approximately 9.1 V is generated from this voltage using a bridge rectifier and D1, filtered and buffered by C2. The oscillator is built around R3, C3 and IC1a.

Cat and Dog Repeller Circuit DiagramThe frequency of this oscillator is rather dependent on the specific characteristics of IC1, so the values shown here should be regarded as guidelines. If the oscillator frequency is too high, it can be reduced by increasing the value of R3 and/or C3. If the frequency is too low (which means that the siren tone it is audible), the value of R3 and/or C3 should be increased. The square-wave signal from the oscillator is applied to the input of an H bridge composed of several Schmitt triggers in combination with the final output stages (T1–T4). This approach causes the peak-to-peak value of the square wave signal to be twice the supply voltage.

As a result, a respectable 18 V is obtained across the piezoelectric tweeter, which is sufficient to produce a quite loud whistle tone. When building the circuit, you should bear in mind that it is directly powered from 230 V and not electrically isolated from the mains network. It is thus necessary to avoid contact with all of the components when the circuit is in use. In practice, this means that the circuit must be fitted into a well-insulated, waterproof box. If you want to test the circuit, it is a good idea to first discharge C1 using a resistor, since it can hold a dangerous charge. You must also ensure that components F1, C1, R1 and B1 all have a mutual insulation separation of at least 6 mm!
Continue Read...

Monday, September 23, 2013

Intelligent Presence Simulator

However effective a domestic alarm system may be, it’s invariably better if it never goes off, and the best way to ensure this is to make potential burglars think the premises are occupied. Indeed, unless you own old masters or objects of great value likely to attract ‘professional’ burglars, it has to be acknowledged that the majority of burglaries are committed by ‘petty’ thieves who are going to be looking more than anything else for simplicity and will prefer to break into homes whose occupants are away.
Rather than simply not going on holiday – which is also one solution to the problem (!) – we’re going to suggest building this intelligent presence simulator which ought to put potential burglars off, even if your home is subjected to close scrutiny. Like all its counterparts, the proposed circuit turns one or more lights on and off when the ambient light falls, but while many devices are content to generate fixed timings, this one works using randomly variable durations.
Circuit diagram:
 intelligent-presence-simulator-circuit-diagramw
So while other devices are very soon caught out simply by daily observation (often from a car) because of their too-perfect regularity, this one is much more credible due to the fact that its operating times are irregular. The circuit is very simple, as we have employed a microcontroller – a ‘little’ 12C508 from Microchip, which is more than adequate for such an application. It is mains powered and uses rudimentary voltage regulation by a zener diode.
A relay is used to control the light(s); though this is less elegant than a triac solution, it does avoid any interference from the mains reaching the microcontroller, for example, during thunderstorms. We mustn’t forget this project needs to work very reliably during our absence, whatever happens. The ambient light level is measured by a conventional LDR (light dependent resistor), and the lighting switching threshold is adjustable via P1 to suit the characteristics and positioning of the LDR.
Note that input GP4 of the PIC12C508 is not analogue, but its logic switching threshold is very suitable for this kind of use. The LED connected to GP1 indicates the circuit’s operating mode, selected by grounding or not of GP2 or GP3 via override switch S1. So there are three possible states: permanently off, permanently on, and automatic mode, which is the one normally used. Given the software programmed into the 12C508 (‘firmware’) and the need to generate very long delays so as to arrive at lighting times or an hour or more, it has been necessary to make the MCU operate at a vastly reduced clock frequency.
PCB Layout:
pcb-layout-of-intelligent-presence-sim
In that case, a crystal-controlled clock is no longer suitable, so the R-C network R5/C3 is used instead. For sure, such a clock source is less stable than a crystal, but then in an application like this, that may well be what we’re after as a degree of randomness is a design target instead of a disadvantage. Our suggested PCB shown here takes all the components for this project except of course for S1, S2, and the LDR, which will need to be positioned on the front panel of the case in order to sense the ambient light intensity.
The PCB has been designed for a Finder relay capable of switching 10 A, which ought to prove adequate for lighting your home, unless you live in a replica of the Palace of Versailles. The program to be loaded into the 12C508 is available for free download from the Elektor website as file number 080231-11.zip or from the author’s own website: www.tavernier-c.com. On completion of the solder work the circuit should work immediately and can be checked by switching to manual mode.
The relay should be released in the ‘off’ position and energized in the ‘on’ position. Then all that remains is to adjust the day/night threshold by adjusting potentiometer P1. To do this, you can either use a lot of patience, or else use a voltmeter – digital or analogue, but the latter will need to be electronic so as to be high impedance – connected between GP4 and ground. When the light level below which you want the lighting to be allowed to come on is reached, adjust P1 to read approximately 1.4 V on the voltmeter.
If this value cannot be achieved, owing to the characteristics of your LDR, reduce or increase R8 if necessary to achieve it (LDRs are known to have rather wide production tolerances). Equipped with this inexpensive accessory, your home of course hasn’t become an impregnable fortress, but at least it ought to appear less attractive to burglars than houses that are plunged into darkness for long periods of time, especially in the middle of summer. (www.tavernier-c.com)
COMPONENTS LIST
Resistors
R1 = 1k 500mW
R2 = 4k7
R3 = 560R
R4,R6 = 10k
R5 = 7k5
R 7 = LDR
R8 = 470k to 1 M
P1 = 470k potentiometer
Capacitors
C1 = 470µF 25V
C2 = 10µF 25V
C3 = 1nF5
C4 = 10nF
Semiconductors
D1,D2 = 1N4004
D3 = diode zener 4V7 400 mW
LED1 = LED, red
D4 = 1N4148
T1 = BC547
IC1 = PIC12C508, programmed, see Downloads
Miscellaneous
RE1 = relay, 10A contact
S1 = 1-pole 3-way rotary switch
F1 = fuse 100 mA
TR1 = Mains transformer 2x9 V, 1.2 -3 VA
4 PCB terminal blocks, 5 mm lead pitch
5 solder pins
Downloads:
The PCB layout can be downloaded free from our website www.elektor.com; file # 080231-1.
The source code and .hex files for this project are available free on www.elektor.com; file # 080231-11.zip.
Continue Read...

Sunday, September 22, 2013

Digital Isolation up to 100 Mbits

When it is necessary to send a digital signal between two electrically isolated circuits you would normally choose an optoisolator or some form of transformer coupling. Neither of these solutions is ideal; optocouplers run out of steam beyond about 10 MHz and transformers do not have a good low frequency (in the region of Hertz) response.
The company NVE Corporation (www.nve.com) produces a range of coupler devices using an innovative ‘IsoLoop’ technology allowing data rates up to 110 Mbaud. The example shown here uses the IL715 type coupler providing four TTL or CMOS compatible channels with a data rate of 100 Mbit/s. Inputs and outputs are compatible with 3.3 V or 5 V systems. The maximum isolation voltage is 2.5 kV and the device can cope with input transients up to 20 kV/µs.
Circuit diagram:
digital-isolation-up-to-100 -bits-circuit-diagramw

Digital Isolation up to 100 Mbits Circuit Diagram

The company produce many other configurations including bidirectional versions that would be suitable for RS485 interfacing. The IsoLoop coupler is based on relatively new GMR (GiantMagnetoResistive) technology. The input signal produces a current in a planar coil. This current generates a magnetic field that produces a change in resistance of the GMR material.
This material is isolated from the planar coil by a thin film high voltage insulating layer. The change in resistance is amplified and fed to a comparator to produce a digital output signal. Differences in the ground potential of either the input or output stage will not produce any current flow in the planar coil and therefore no magnetic field changes to affect the GMR material. Altogether the circuit provides a good electrical isolation between input and output and also protects against input signal transients (EMV).
Author: Gregor Kleine - Copyright: Elektor July-August 2004
Continue Read...