Showing posts with label using. Show all posts
Showing posts with label using. Show all posts

Tuesday, November 18, 2014

60W inverter using transistors

Here is the circuit diagram of a fully transistorized inverter that can drive up to 60W loads. Transistors Q1 and Q2 forms a 50Hz astable multivibrator. The output from the collector of Q2 is connected to the input of the Darlington pair formed by Q3 and Q4.Similarly the output of Q1 is coupled to the input of the pair Q5 and Q6. The output from the Darlington pairs drive the final output transistors Q7 and Q8 which are wired in the push pull configuration to drive the output transformer.
Circuit diagram.


Notes.
The circuit can be assembled on a vero board.
T1 can be a 230V primary to 9-0-9V, 6A secondary transformer.
Transistors Q4, Q6, Q7 and Q8 must be fitted with heat sinks.
Use a 12V, 7Ah battery for powering the inverter.
Slight adjustments can be made on the value of R3 and R4 to get exact 50Hz output.

Saturday, November 15, 2014

STEREO HEADPHONE AMPLIFIER USING LM4910

LM4910 belonging to the Boomer series of National Semiconductors is an integrated stereo amplifier primarily intended for stereo headphone applications. The IC can be operated from 3.3V ans its can deliver 0.35mW output power into a 32 ohm load. The LM4910 has very low distortion ( less than 1%)   and the shutdown current is less than 1uA. This low shut down current makes it suitable for battery operated applications. The IC is so designed that there is no need of the output coupling capacitors, half supply by-pass capacitors and bootstrap capacitors. Other features of the IC are   turn ON/OFF click elimination, externally programmable gain etc.

Circuit Diagram



Circuit diagram of the LM4910  stereo headphone amplifier is shown above.C1 and C2 are the input DC decoupling capacitors for the left and right input channels. R1 and R2 are the respective input resistors. R3 is the feed back resistor for left channel while R4 is the feed back resistor for the right channel. C3 is the power supply filter capacitor. The feedback resistors also sets the closed loop gain in conjunction with the corresponding input resistors.

Notes

  • The IC is available only  in SMD packages and care must be taken while soldering.
  • The circuit can be powered from anything between 2.2V to 5V DC.
  • The load can be a 32 ohm headphone.
  • Absolute maximum supply voltage is 6V  and anything above it will destroy the IC.
  • A logic low voltage at the shutdown pins shut downs the IC and a logic high voltage at the same pin activates the IC.

Thursday, November 13, 2014

230V Led Flasher Circuit using DIAC

This is a very simple LED flasher circuit diagram that is powered from AC 230V mains. This Flasher can be used as a power indicator for the AC 230V mains supply. This circuit is made with few numbers of parts namely, a LED, two Resistors, one Capacitor, one Diode and one DIAC.  The DIAC act the main role to flashing the LED. DIAC is a bidirectional device. It conducts current only after its breakover voltage has been reached its threshold. Most DIACs break-over voltage is around 30 V.

230V Mains Power Indicator LED Flasher Circuit Diagram


230V
Fig: Circuit Diagram of 230V Led Flasher

When mains is connect to the circuit, the Capacitor(C1) starts charging through Diode(D1) and Resistor(R1). When the voltage on the capacitor reached the DIAC’s threshold voltage, the DIAC get turn on. And LED gets Lights(flash). At the same time Capacitor(C1) goes discharges and breakover voltage of DIAC also decrease and LED turns OFF. The on off time of the LED depends on the value of Capacitor(C1)  and Resistor(R1).
Note that the flashing time of the LED shown in the animating figure is not the exact timing of ON/OFF.

Friday, October 31, 2014

Diagram IR Remote Control Circuit using Op amp 741

IR circuit is called Infrared Circuit. Remote controlsare
very much popular now-a-days. It is specially called cordless circuit.
This circuit is very simple and low cost cordless remote control circuit
which is based on
infrared   rays.

Figure 1 shows thetransmitter circuit. The transmitter produces infrared rays and that can be easily transmitted up to 4 meters with a special convex lens and a twin LEDarrangements.
Figure 2 shows thereceiver circuit. Op amp IC1-741 generates high frequency squire wave which provides the gate pulses for SCR1. IC1’s output current flows through  SRC1 and it is conducting current and enables the LED to emits infrared rays. The output frequency of Op amp IC1 depends on the variable resistor VR1, which in turns varies the output radiations of the LED.


When IR rays
fall on the photo-transistor T1 of the receiver, then base of the
photo-transistor’s base produces charge carriers at a rate depending on
the rate of arrival of incident
radiationsat
the pn junction of the transistor. Then the resulting emitter voltage
is amplified by Op amp IC-2 . The amplified signal is rectified by D2.
Finally the amplified signal is to drive the relay.

Parts List:

Thursday, October 30, 2014

10V Switching Regulator Using LM5007

10V
10V Switching Regulator Using LM5007 Circuit Diagram

The circuit diagram shown here is of a 10V switching regulator based on the LM5007 from National Semiconductors. The LM5007 is an integrated step down switching regulator which has all necessary systems required for making a cost effective and reliable switching regulator circuit. The IC is available in MSOP-8, LLp-8 packages and has a lot of built in features like thermal shut down, under voltage lock out, duty cycle limiting, current limiting etc.

The output voltage of this regulator can be adjusted using the resistor R3 and R4. For the given values of R3 and R4 in the circuit diagram, the output voltage will be 10V. The equation governing the output voltage is Vout = 2.5 x (R3+R4)/R4. Resistor R1 sets the switch on time and C4 is the boost boot strap capacitor. Resistor R2 determines the variation of OFF time and C3 is a decoupling capacitor.

Notes.

* The supply voltage can be anything between 12 to 72V DC.
* Output voltage can be adjusted using R3 and R4.
* C1 and C5 are polyester capacitors.
* C1 and C2 must be rated at least 100V.
* R5 and C5 forms a filter network.
* The output current limit of LM5007 is 700mA.

Wednesday, October 29, 2014

Using LV47011P car audio amplifier Diagram Circuit

Using the LV47011P audio power amplifier IC designed for 4-channel BTL power amplifier that developed for car audio system we can implement a very simple car audio amplifier electronic project that can produce an output power between 22 and 50 watts on a 4 ohms load .
This LV47011P car audio amplifier electronic project will provide a maximum 22 watts output power per channel on a 4 ohms load using a 14,4 volts DC power supply at 1% THD .
In same conditions , this car audio amplifier electronic circuit project will provide 29 watts output power at 10% THD .
This IC incorporate various functions (standby switch, muting function, and various protection circuit) necessary for car
audio system and also, it has a self-diagnosis function.
For pop noise prevention, it is recommended to use the muting function at the same time when the amplifier is turned on.
When the amplifier is turn off, turn off the power supply after turning on the muting function .
The muted state is obtained by setting pin 22 to the ground potential, enabling audio muting.
The muting function is turned on by the applied voltage of 1V or less to the resistance of pin 22. And the muting function is turn off when this pin opens.
The circuit is packaged in a Sanyo HZIP 25 package and must be heat sinked , to prevent the damage due to over heating .

Sunday, October 26, 2014

Car Parking Sensor circuit Using Infra Red LED

This circuit can be used for an assist in parking the car near the garage wall backing up Pls. LED D7 illuminates Pls bumper-wall distance is about 20 cm., D7 + D6 illuminate at about 10 cm. and D7 + D6 + D5 at about 6 cm. In this manner you are alerted Pls approaching too close to the wall.

Car Parking Sensor circuit

All distances mentioned before can vary, depending on infra-red transmitting and receiving LEDs used and are mostly affected by the color of the reflecting surface. Black surfaces lower greatly the device sensitivity. Obviously, you can use this circuit in other applications like liquids level detection, proximity devices etc.

Note:
  • The infra-red Photo Diode D2, should be of the type incorporating an optical sunlight filter: these components appear in black plastic cases. Some of them resemble TO92 transistors: in this case, please note that the sensitive surface is the curved, not the flat one.
  • Avoid sun or artificial light hitting directly D1 & D2.
  • If your car has black bumpers, you can line-up the infra-red diodes with the (mostly white) license or number plate.
  • It is wiser to place all the circuitry near the infra-red LEDs in a small box. The 3 signaling LEDs can be placed far from the main box at an height making them well visible by the car driver.
  • The best setup is obtained bringing D2 nearer to D1 (without a reflecting object) until D5 illuminates; then moving it a bit until D5 is clearly off. Usually D1-D2 optimum distance lies in the range 1.5-3 cm.
List Component of Car Parking Sensor circuit:
R1 : 10K
R2,R5,R6,R9 : 1K
R3 : 33R
R4,R11 : 1M
R7 : 4K7
R8 : 1K5
R10,R12-R14 : 1K
C1,C4 : 1µF/63V
C2 : 47pF
C3,C5 : 100µF
D1 : Infra-red LED
D2 : Infra-red Photo Diode (see Notes)
D3,D4 : 1N4148
D5-7 : LEDs (Any color and size)
IC1 : NE555
IC2 : LM324
IC3 : LM7812

Saturday, October 4, 2014

Metronome Generator using NE555

Here is a simple circuit using IC NE555 which will be used to generate metronomes.Such a circuit is incredibly helpful to people who learns music. The circuit is nothing however an astable multivibrator wired around NE555 .The elements|parts R1,R2&C1 determines the output frequency.

Notes.

  • The circuit can be wired on a general purpose PCB or common board.
  • The circuit can be powered from a 9V PP3 battery.
  • The POT R1 can be used to adjust the rhythm of the sound.
  • The POT R2 can be used as volume control.
  • The speaker k1 can be a n 8 Ohm tweeter.

Friday, October 3, 2014

1 5Volt Led using 555 IC

1.5Volt Led using 555 IC

This LED circuit is powered only by the cell of 1.5 V with IC 555. The timer IC is used in astable mode similar to the double-circuit voltage, which is the step from 1.5V to about 2.5V. The frequency of the circuit is about 60 Hz and consumes very little left that is not a problem.

Part List:


R1- 39 kilo-ohms
R2- 100 kilo-ohms
R3-10 ohms but if no light or very dim, just short it
C1- 100nF
C2- 10nF
C3- 220uF electrolytic capacitor
C4- 100uF electrolytic capacitor
D1- preferably schotky diode but ordinary diode like 1N4001 will do
555- use the CMOS type 555
LED- red, yellow and other low power led (do not use white or blue)
1.5V- any 1.5V battery

Saturday, September 20, 2014

LED flasher Circuit using NE555

This is a LED flasher Circuit using NE555. This schema consumes more power, but its advantage is when you need a variable flash rate, like for strobe diagram. You can actually use this schema as a remote control for strobes that have a remote input. Of course, it has many other applications besides strobes.

Simple
  • R1, R2, C1 and the supply voltage determine the flash rate. Using a regulated power supply will do much to insure a stable flash rate. For a variable flash rate, replace R1 with a 1 megohm pot in series with a 22k resistor.
  • The duty cycle of the schema (the percentage of the time LED 1 is on to the time it is off during each cycle) is deterimed by the ratio of R1 to R2. If the value of R1 is low in relationship to R2, the duty cycle will be near 50 percent. If you use both LEDs, you will probably want a 50 percent duty cycle. On the other hand, if R2 is low compared to R1, the duty cycle will be less than 50 percent. This is useful to conserve battery life, or to produce a strobe type effect, when only LED1 is used.
  • The NE555 timer chip can be damaged by reverse polarity voltage being applied to it. You can make the schema goof proof by placing a diode in series with one of the supply leads.
  • The purpose of R3 and R4 is to limit current through the LEDs to the maximum they can handle (usually 20 milliamps). You should select the value of these according to the supply voltage. 470 ohms works well with a supply voltage of 9-12 volts. You will need to reduce the value for lower supply voltages.
  • Rainbow Kits offers several kits to build the above schema. You can also order these kits from RadioShack.com. The Radio Shack catalog numbers (and web pages) are as follows: standard kit with two 5mm red LEDs, (990-0067), kit with two red, two green and two yellow 3mm LEDs, (990-0063), kit with jumbo green LEDs, (990-0048), kit with jumbo red LEDs, (990-0049). You can also buy all the parts to build the schema at your local Radio Shack store, including a schema board (276-159B).
I have built a miniature strobe schema as follows. Use a 250k pot in series with a 4.7k resistor for R1. The 4.7k resistor sets the upper flash rate limit. Use 2.2k for R2. That sets a really short duty cycle. For this schema, you dont use LED 2 or R4. For LED 1, I used a two Radio Shack white LEDs in series and no R-3. The schema runs on a 9 v battery.

Thursday, September 18, 2014

Class AB Power Amplifier Circuit 30w Using Power Transistor


Class AB Power Amplifier Circuit Diagram

30W Class AB power amplifier schema diagram using power transistor. Set the above amplifier up by adjust the variable resistor R1 to maximum and R12 to zero. After this set up is done, the activate / turn on the amplifier. Adjust the R1 so that the measured output offset is between 30 and 100mV. Once set, adjust the R12 slowly to achieve a quiescent current of around 120mA. Keep checking the quiescent current as the amplifier heats up as it might change due to voltage drop changes in the output devices because of the heat. The heatsinks should be 0.6K/W or less for two amplifiers.

Power supply schema for 30W class AB power amplifier:
power
30W Class AB Power Amplifier Circuit, 

Wednesday, September 17, 2014

Using TDA7056 3W BTL Mono Audio Power Amplifier

For mono output amplifier application,  TDA7056  IC can be your option. Compact but powerful, this integrated schema is contained in a 9 pin medium power package. This device is designed for battery fed portable equipments such as mono recorders, radios and television. To attract the market, TDA7056 has many features such as low power consumption. For more reliable operation, TDA7056 also has short schema proof and ESD (Electro Static Discharge) protected on all pins.  Designing application with this IC should be easy since no external components is needed. To make sure you’ll love this chip, this device also has no switch on/off clicks. Overall, TDA7056 has good stability.

 TDA7056 3W BTL Mono Audio Power Amplifier Circuit Diagram


 tda7056 3w btl mono audio power amplifier

Tuesday, September 16, 2014

7 Watt Audio Amplifier Using TDA2003

Amplifier Circuits Diagram

Schematic diagram of a simple 7 watt audio amplifier using TDA2003 Amplifier IC. This is a good IC with many built in features like low harmonic distortion, short circuit protection,thermal overload protection etc. This IC is a upgrade version of TDA 2002 amplifier IC.

7 Watt Audio Amplifier Circuit Diagram :

The circuit is small and using only few components and it is able to deliver 7w output on 12V DC. Assamble the circuit on PCB or veroboard and use heatsink with IC. Input voltage can be between 8 to 18 volt / 0.5A DC.

Wednesday, September 10, 2014

Using IFR Voltage Regulator Wiring diagram Schematic

The IFR EW a MOSFET transistor, such as transistor has higher feature high input impedance. In this schema we used an IFR as transistor voltage regulator, which is not common, but it is very good to learn about their behavior in a schema.

 Using IFR Voltage Regulator Circuit Diagram


Using



This voltage regulator schema uses a MOSFET is
IRF4905 (Vdss =-55V, RDS (on) = 0.02ohm, Id =-74A),
but any other can be tested.

Saturday, August 30, 2014

Small Audio Amplifiers Using LM386 and NE5534

Many electronic projects require the use of a small audio amplifier. Be it a radio transceiver, a digital voice recorder, or an intercom, they all call for an audio amp that is small, cheap, and has enough power to provide adequate loudness to fill a room, without pretending to serve a disco! About one Watt RMS seems to be a convenient size, and this is also about the highest power that a simple amplifier fed from 12V can put into an 8 Ohm speaker. A very low saturation amplifier may go as high up as 2 Watt, but any higher power requires the use of a higher voltage power supply, lower speaker impedance, a bridge schema, or a combination of those.

During my many years building electronic things I have needed small audio amps many times, and have pretty much standardized on a few IC solutions, first and and foremost the LM386, which is small, cheap, and very easy to use. But it does not produce high quality audio... For many applications, the advantages weigh more than the distortion and noise of this chip, so that I used it anyway. In other cases I used different chips, which perform better but need more complex diagram. Often these chips were no longer available the next time I needed a small amplifier.

When I last upgraded my computer, I replaced the old and trusty Soundblaster AWE 32 by a Soundblaster Audigy. The new card is better in many regards, but while the old one had an internal audio power amplifier, the new one doesnt! Thats bad news, because I have some pretty decent speakers for the PC, which are fully passive. So, I built a little stereo amp using two LM386 chips and installed it inside the computer, fed by the 12V available internally.

But then I wasnt satisfied. The LM386 might be suitable for "communication quality" audio, which is roughly the fidelity you get over a telephone, but for music its pretty poor! The distortion was awful. So, the day came when I decided to play a little more scientifically with small audio amps, looking for a way to get good performance with simple and inexpensive means.

I set up a test bench with a sine wave oscillator running at 1 kHz, an 8 Ohm speaker, 12V power supply, and the computer with the soundcard and Fast Fourier Transform software. One channel was connected to the oscillator together with the amplifier input, the other channel to the output and speaker. With this setup I measured the harmonic content of the audio signals. I did the tests at an output level of 0.1W, which is typical for moderately loud sound from a reasonably efficient speaker. Also, I used a music signal from a CD player to test the actual sound of each amplifier.

Circuit

As already said above, the main attraction of the LM386 is the extreme simplicity of its application schema. You can even eliminate R1 if the signal source is DC-grounded. If the speaker leads are long, you should add an RC snubber across the output to aid stability. Additionally, if you need higher gain (not necessary if the input is at line level), you can connect a 10uF capacitor between pins 1 and 8. Thats about all there is to it.

Now the bad news: This schema produced a very high level of distortion! The second harmonic measured just -28dB from the main output. The third harmonic was at -35dB, while the noise level was at -82dB. There were assorted high harmonics at roughly -45dB. With music, the distortion was really disturbing, and also the noise level was uncomfortably high. The power supply rejection is poor, so that some hum and other supply noise gets through. In short, this was a lousy performance!

Since I had used so many LM386s in my projects, I had several different variations. In my material box I found a slightly newer LM386N-1. So I plugged it into my test amplifier. It was even worse! The second harmonic was at -24dB, the third harmonic at -31dB, while the noise was a tad better at -84dB. Folks, thats a total harmonic distortion of almost 7%! And the 0.1W output level at which this was measured is where such a schema is about at its best...  The distortion can be plainly seen on the oscilloscope, and a visibly distorted waveform is about the most offending thing an audio designer can ever see!

Looking through my projects, I found one where I had used a GL386 chip. This is just a 386 made by another company. I unsoldered it and put it in my test amplifier. Surprise! It was dramatically better, with the second harmonic at -45dB, and the third at -57dB! The noise floor was -84dB, just like the LM386N-1. But even this level of distortion was plainly audible when listening to music. Thats roughly 0.6% THD. Some folks may consider it acceptable for music. I dont, but for communication equipment its fine. At this point, I decided to see if I could build a better amplifier, that doesnt become too complex nor expensive.

Circuit

This was the first attempt. A low distortion, fast slew rate, but easy to find and rather inexpensive operational amplifier, driving a simple source follower made of two small transistors. These transistors are not biased, so they work at zero quiescent current, in full class B. The only mechanism that works against crossover distortion here is the high slew rate of the OpAmp, which is able to make the distortion bursts during crossover very short. To say the truth, I didnt expect to get usable performance from this schema, and was really surprised when it worked much better than the 386! The second harmonic was at -77dB, the third at -79dB!

Also there were many high harmonics at roughly -84dB. That means a THD of about 0.015%.  The noise floor was down at the -120dB level! The power supply rejection was excellent, with no detectable feedtrough. Playing music, this amplifier sounded really good: No audible noise, and the distortion could be heard when paying attention to it, but I doubt that the average person would detect it! Not bad, for a bias-less design!

Just to see how important the slew rate of the OpAmp is, I pulled out the NE5534 and replaced it by a humble 741, which is many times slower. The result was dramatic: The second harmonic still good at -70dB, but the third harmonic was much worse, at -48dB. Also there were many high harmonics at the same -48dB level. Given that second harmonic distortion doesnt sound bad to most people, but third harmonic does, and high harmonics are even worse, it came as no surprise that the amplifier with the 741 sounded bad.

At low volume it sounded particularly bad! So I returned to the oscillator and measurement setup, testing at lower output power, and found that while the second and third harmonics followed the output, the high harmonics stayed mostly constant! So, at very low output, the high harmonics became very strong relative to the output. All this is the effect of the slower slew rate of the 741, which makes it less effective correcting the crossover distortion of the unbiased transistors. Interestingly, the noise floor of the 741 schema wasnt bad: -118dB.

Just for fun, I tried this schema with a third OpAmp: The TL071, which is good, but not as good as the 5534. The results: Second harmonic at -72dB, third and the high ones at -60dB, and the noise at -120dB. Its interesting that the second harmonic is much more suppressed than the third one. That must be a balancing effect of the symmetric output stage, and the better symmetry in the TL071 compared to other OpAmps.

Its worthwhile to note that this amplifier can be simplified a lot by using a split power supply. R1, R2, C1, C2 and C4 would be eliminated! But then you need the capacitor removed from C4 to bypass the negative supply line. The positive input of the chip goes to ground, while pin 4 and the collector of Q2 go to the negative supply. The rest stays the same. If you use a +-15V supply, the available RMS output power grows to over 10 Watt! Of course, you then need larger transistors. And since larger transistors are slower, the distortion will rise somewhat. An added benefit of a split supply is that the popping noise when switching on and off is eliminated.

Circuit

As the next experiment, I decided to get rid of the crossover distortion. For this purpose, I added a traditional adjustable bias schema with a transistor and a trimpot. Now I also had to add a current source, because with the bias schema there is no single point into which the OpAmp could put its drive current into both bases! I adjusted the bias for the best distortion, and this was really  a good one! The second harmonic was down right where the test oscillator delivered it, about -80dB, so I couldnt really measure it!

The third harmonic was at -84dB, and the best improvement was that the higher harmonics had simply disappeared! They were all below the noise floor, which stayed at -120dB. Actually, this noise floor seems to come from the soundcard A/D converter, so that the actual noise of this and the above amplifier may even be better! With music, this amplifier sounded perfect - clean and smooth. And Im pretty confident that the THD is well below the limits of my measurement setup, which is 0.01%.

The quiescent current was around 10mA. When lowering it to about 3mA, the high harmonics started to rise out of the noise floor. If you want to adjust the bias for the exact best quiescent current, there is a simple trick: Lift R4 from the output, and connect it to pin 6. Now the output stage has been left outside the feedback loop, and all its distortion will show up at the output. Watching the signal on an oscilloscope, or even better on a real time spectrum analyzer (soundcard and software), adjust the trimpot to the lowest distortion level.

Have a current meter in the supply line and make sure that you dont exceed 30mA or so of quiescent current, in order to keep the small transistors cool. But most likely the best distortion will be at a current lower than that. Once the adjustment is complete, return R4 to its normal position. Now the full gain and slew rate of the operational amplifier is used to correct the small remaining cross-over distortion of the output stage, and the distortion will certainly disappear from the scope screen, from your ears, and possibly fall below the detection level of the spectrum analyzer!

This schema can also be run from a split power supply, by exactly the same mods as for the previous schema. And since the transistors are properly biased, there isnt any significant distortion increase when using larger transistors. Be sure to use some that have enough gain - you have only a few mA of driving available, and with a +-15V power supply and an 8 Ohm speaker, there can be almost 2A of output current! So, you need a gain of 300 at least. There are power transistors in the 4A class that provide such gain, and these are good candidates. The other option is using Darlington transistors, which far exceed the gain needed here. But they will again increase the distortion, not very much, but perhaps enough to make it audible again.
Source: Humo Luden

Friday, August 29, 2014

Build a Voltage Regulator 12v to 24v using 7812

How to build a voltage regulator 12v to 24v using 7812. What many people do not know is it possible for a voltage regulator IC to provide an output voltage higher than its actual value. One method to achieve this is by connecting the "common" terminal to the middle point of a potential divider, but the problem with this method is that the regulators IC has a small quiescent current (~ 10 mA) flowing out the common terminal to ground.

The schema presented here avoids the problems of using the IC regulator to raise the voltage via the transistor Q1 to generate a low impedance to the common terminal video controller during the transfer of the voltage divider from a resistor divider network relatively high. The value of R3 is not critical, but should be low enough to accept the higher quiescent current without causing problems for T1.

Voltage Regulator 12v to 24v Circuit Diagram 

Voltage

Thursday, August 28, 2014

Long range Burglar Alarm Using Laser Torch

Laser torch-based burglar alarms normally work in darkness only. But this long-range photoelectric alarm can work reliably in daytime also to warn you against intruders in your big compounds, etc. The alarm comprises laser transmitter and receiver units, which are to be mounted on the opposite pillars of the entry gate. Whenever anyone enters to interrupt the transmitted laser beam falling on the receiver, the buzzer in the receiver schema sounds an alarm.

The range of this burglar alarm is around 30 metres, which means you can place the transmitter and the receiver up to 30 metres apart. Since the laser torch can transmit light up to a distance of 500 metres, this range can be increased by orienting the phototransistor sensor properly. To avoid false triggering by sunlight, mount the phototransistor sensor such that it doesn’t directly face sunlight.

Circuit
Fig. 1: Circuit of laser torch based transmitter

The transmitter schema is powered by 3V DC. The astable multivibrator built around timer 7555 (IC1) produces 5.25kHz frequency. CMOS version of timer 7555 is used for low-voltage operation. The body of the laser torch is connected to the emitter of npn transistor T1 and the spring-loaded lead protruding from inside the torch is connected to the ground.

The receiver schema is powered by 12V DC. It uses photoDarlington 2N5777 (T2) to sense the laser beam transmitted from the laser torch. The output beam signals from photoDarlington are given to the two-stage amplifier followed by switching schema, etc. As long as the laser beam falls on photoDarlington T2, relay RL1 remains un-energised and the buzzer does not sound. Also, LED1 doesn’t glow.

Receiver
Fig. 2: Receiver schema

When anyone interrupts the laser beam falling on photoDarlington T2, npn transistor T6 stops conducting and npn transistor T7 is driven into conduction. As a result, LED1 glows and relay RL1 energises to sound the buzzer for a few seconds (determined by the values of resistor R15 and capacitor C10). At the same time, the large indication load (230V AC alarm for louder sounds or any other device for momentary indication) also gets activated as it is connected to 230V AC mains via normally opened (N/O) contact of relay RL1.


Sourced By: EFY Author: Pradeep G.

Monday, August 18, 2014

Interfacing xbee with PIC microcontroller using MikroC

imageIn this tutorial, I will show how to interface an xbee module with PIC microcontroller.Here MikroC Pro for PIC compiler is used to write the code.
Xbee modules communicates with host devices using serial communication.Most of the PIC microcontroller have UART module to support serial communication.

image
First of all we have to understand the two operating mode of xbee.


  • Transparent Mode
  • API Mode

    Interfacing xbee in Transparent Mode

    In transparent mode two xbee module makes just simple bridge of  serial communication.This is like just remove the wire of serial port and place two xbee module.In this mode if you send ‘A’ then another module will receive ‘A’.
    To send data write this code
    void main() {
    UART1_Init(9600);   // Initialize UART module at 9600 bps
    Delay_ms(100);      // Wait for UART module to stabilize

    UART1_Write(‘A’);
    }
    To receive this data on the other side write this code
    char receive;
    void main() {
    UART1_Init(9600);  // Initialize UART module at 9600 bps
    Delay_ms(100);   //Wait for UART module to stabilize
    // If data is ready, read it:
    if (UART1_Data_Ready() == 1) {
    receive = UART1_Read();
    }

    }



    Interfacing xbee in API Mode


    API mode is main thing of a xbee module.You can make mesh networking,use of analog to digital pins(IO pins).In this mode all communications take place as structured data frame.Here some examples of data frame are shown:

    AT Commands


    The following image shows the API frame exchange that takes place at the UART when sending an AT command request to read or set a module parameter. The response can be disabled by setting the frame ID to 0 in the request.

    image

    Transmitting and Receiving RF Data


    The following image shows the API exchanges that take place at the UART when sending RF data to another device. The transmit status frame is always sent at the end of a data transmission unless the frame ID is set to 0 in the transmit request. If the packet cannot be delivered to the destination, the transmit status frame will indicate the cause of failure. The received data frame (0x90 or 0x91) is set by the AP command.

    image


    you can get all the frames structures in datasheet.So we don’t proceed to explain each data frame.Our concern is to send these frames or receive these frames using PIC microcontroller.


    Sending API Frames


    First we will learn how to send data frames from one xbee modules to other.Suppose you have two xbee module.First configure one xbee module as coordinator say it has id 0013 A200 4000 CF30.Another module has id 0013 A200 4000 CF31 is configured as router.Both xbee module is connected with two PIC microcontroller (say two PIC16F73) via uart (Tx and Rx pin).

    Now we will send some API frame frame coordinator to router xbee.Before sending API Frame it will be good practice to learn the use of DIGI API Frame Maker.This is an HTML page to build API frames.You can select your desired Frame and it will show you the structure of the frame with its functions.You can also put the desired values in various fields and it will build frame packet that you can use to write code.Another way to make data frame is to read xbee data sheet,each data frame is explained in data sheet.But I highly recommend you to use DIGI API Frame Maker as it is easy to use.

    Transmit Request Frame


    This frame is used to send any data to remote module.Suppose we want send “txdata” from coordinator to the router.All will be sent as hex.So we have to convert it in hex format.From DIGI API Frame Maker the data frame will be

    7E 00 14 10 01 00 13 A2 00 40 00 CF 31 00 00 00 00 74 78 64 61 74 61 73

    7E is the delimiter.Every frame contains this hex value first.

    00 14 is Number of bytes between length and checksum fields.

    Next byte 10 is API id of Transmit Request frame.

    00 13 A2 00 40 00 CF 31 is ou router’s id which is destination address where data will be sent.

    Next look at the 74 78 64 61 74 61 is desired data to be sent. This is hex format of ”txdata”.

    Now we will write code to PIC which is connected with coordinator xbee to send this frame to router module.



    void main() {

    UART1_Init(9600);   // Initialize UART module at 9600 bps
    Delay_ms(100);      // Wait for UART module to stabilize


    UART1_Write(0x7E);

    UART1_Write(0x00);

    UART1_Write(0x14);

    UART1_Write(0x10);

    UART1_Write(0x01);

    UART1_Write(0x00);

    UART1_Write(0x13);

    UART1_Write(0xA2);

    UART1_Write(0x00);

    UART1_Write(0x40);

    UART1_Write(0x00);

    UART1_Write(0xCF);

    UART1_Write(0x31);

    UART1_Write(0x00);

    UART1_Write(0x00);

    UART1_Write(0x00);

    UART1_Write(0x00);

    UART1_Write(0x74);

    UART1_Write(0x78);

    UART1_Write(0x64);

    UART1_Write(0x61);

    UART1_Write(0x74);

    UART1_Write(0x61);

    UART1_Write(0x73);

    }

    This code simply sends a data frame with data “txdata” from coordinator  to router.Now  router module will receive this frame as Receive Packet Frame(frame id 0x90).We will discuss later how to write code to receive this data in the PIC microcontroller  connected with the router module.

  •  


    Remote AT Command


    This frame is used to change any setting of an xbee module from a remote xbee module.Suppose you want to change the state of a digital IO pin(from high to low or vice versa) of your router module from your coordinator module.Here a data frame is shown to make the DIO4 pin to high.

    7E 00 10 17 01 00 13 A2 00 40 00 CF 31 00 00 00 44 34 05 75

    Look at 44 34 05.

    44 34 means D4 which is defined AT command DIO4 configuration.

    05 stands for output high.If you want to make it output low then it will be 04.

    17 is the Remote AT Command Frame ID.

    00 13 A2 00 40 00 CF 31 is the ID of our router module.

    Now write the following code in PIC which connected to the coordinator module 

    void main() {

    UART1_Init(9600);   // Initialize UART module at 9600 bps
    Delay_ms(100);      // Wait for UART module to stabilize


    UART1_Write(0x7E);

    UART1_Write(0x00);

    UART1_Write(0x10);

    UART1_Write(0x17);

    UART1_Write(0x01);

    UART1_Write(0x00);

    UART1_Write(0x13);

    UART1_Write(0xA2);

    UART1_Write(0x00);

    UART1_Write(0x40);

    UART1_Write(0x00);

    UART1_Write(0xCF);

    UART1_Write(0x31);

    UART1_Write(0x00);

    UART1_Write(0x00);

    UART1_Write(0x00);

    UART1_Write(0x44);

    UART1_Write(0x34);

    UART1_Write(0x05);

    UART1_Write(0x75);

    }

    If you place a led in DIO4 pin of router module then it will glow.

    Receiving API Frames


    Let’s talk about how to this frames we already sent.Recall the data frame Transmit Request.When you send this frame to router from coordinator,after receiving this frame router module send a frame to PIC microcontroller via uart called Receive Packet Frame(ID 0x90).The structure of the received frame will be

    7E 00 12 90 00 13 A2 00 40 00 CF 30 00 00 00 74 78 64 61 74 61 F5

    Look at the frame.

    90 is the frame id.

    00 13 A2 00 40 00 CF 30 is sender address(Our Coordinator address)

    74 78 64 61 74 61 is desired data which is received(recall “tadata”).

    Now we write code to receive our data from the frame.

    MikroC gives a built in function called

    void UARTx_Read_Text(char *Output, char *Delimiter, char Attempts);
    It reads characters received via UART until the delimiter sequence is detected. The read sequence is stored in the parameter output; delimiter sequence is stored in the parameter delimiter.For example:
    UART1_Read_Text(output, "OK", 10); // reads text until OK is found

    Here our delimeter is ‘~’ sign.So we will write the code


    // LCD module connections

    sbit LCD_RS at RB4_bit;

    sbit LCD_EN at RB5_bit;

    sbit LCD_D4 at RB0_bit;

    sbit LCD_D5 at RB1_bit;

    sbit LCD_D6 at RB2_bit;

    sbit LCD_D7 at RB3_bit;

    sbit LCD_RS_Direction at TRISB4_bit;

    sbit LCD_EN_Direction at TRISB5_bit;

    sbit LCD_D4_Direction at TRISB0_bit;

    sbit LCD_D5_Direction at TRISB1_bit;

    sbit LCD_D6_Direction at TRISB2_bit

    sbit LCD_D7_Direction at TRISB3_bit;

    // End LCD module connections




    char output[30];

    void main() {

    Lcd_Init(); // Initialize LCD

    UART1_Init(9600);   // Initialize UART module at 9600 bps
    Delay_ms(100);      // Wait for UART module to stabilize

    while(UART_Data_Ready() == 1)

    {

    UART1_Read_Text(output, "~", 35); // reads text until OK is found

    Lcd_Chr(1, 1, output[14]);

    Lcd_Chr(1, 2, output[15]);

    Lcd_Chr(1, 3, output[16]);

    Lcd_Chr(1, 4, output[17]);

    Lcd_Chr(1, 5, output[18]);

    Lcd_Chr(1, 6, output[19]);

    }

    When the frame is received output[] array will be filled with the frame data.Our frame was

    7E 00 12 90 00 13 A2 00 40 00 CF 30 00 00 00 74 78 64 61 74 61 F5

    So output[] sequence will be

    output[o]=0x00

    output[1]=0x12

    output[2]=0x90

    output[3]=0x00

    output[4]=0x13

    output[5]=0xA2

    output[6]=0x00

    output[7]=0x40

    output[8]=0x00

    output[9]=0xCF

    output[10]=0x30

    output[11]=0x00

    output[12]=0x00

    output[13]=0x00

    output[14]=0x74

    output[15]=0x78

    output[16]=0x64

    output[17]=0x61

    output[18]=0x74

    output[19]=0x61

    output[20]=0xF5

    So we just need


    output[14]=0x74

    output[15]=0x78

    output[16]=0x64

    output[17]=0x61

    output[18]=0x74

    output[19]=0x61

    Which is printed in LCD in the above code.