Friday, October 31, 2014

How to Interface IR Remotes with Arduino

No comments:
                                How to Interface IR Remotes with Arduino

I'm tired of these complicated tutorials on how to use certain things. I like simple, easy to understand, step by step instructions. My biggest problem was with IR and POV*. I've finally mastered how to control my project with any TV remote in a few minutes. In this i'ble I'm going to show you simple, step by step instructions on how to control just about anything with your IR remote.

Step 1: Ingredients:

Components :
For Interfacing IR Remotes with Arduino
  • Arduino
  • Any IR remote
  • IR receiver
  • Breadboard
  • Jumper Cables
  • LED

And here is the Make-To-Learn contest questions! - don't forget to vote!

Sunday, October 26, 2014

Build Your Own Arduino Board

No comments:
                                                 Build Your Own  Arduino  Board

Build Your Own  Arduino  Board  is a very very Fantastic Tutorial .....................

After having fun and experimenting with your Arduino board, you will most likely think of various projects that could be self-contained, if only they didn't rely on using a whole Arduino or compatible board. Or you may wish to experiment with the Arduino platform at a lower cost. In these and many other cases you can in fact build your own Arduino-compatible circuit using a solderless breadboard.
After looking at your full-sized Arduino or Eleven board you may think that the circuitry is quite complex, however in reality it is very simple… and by following the instructions detailed below you'll have your own version operating in a short period of time.

Required Parts  
for build your own Arduino Board ....
As well as a solderless breadboard, you will need a few basic parts as shown in the image below:

Sunday, March 30, 2014

Ultrasonic Distance Finder By Using 89c51

No comments:

Ultrasonic Distance Finder By Using  89c51

                                                       Bismiallah Hirahman Niraheem 







As you see below there are two code one is main code and another is a external function code and this is for serial transmit ...when main code call this function then serial transmission is occur .
Important thing is that i use cyrstal oscillator of   11.0592 Mhz    for serial communication ...12Mhz oscillator not worked .


Tuesday, March 25, 2014

How To Read The Timer Value Of 89c51 When Program Running

1 comment:

How To Read The Timer Value Of 89c51 When Program Running

Ok this very difficult to find the Timer values of Microcontroller when a program is running but no problem im here ......
first of all i use Timer 1 in mode 2 for serial data transmission ( Means Read the timer value to serial port )
Now i use the Timer 0 in mode 1 and Start the initial value from 00H .In my given code the Port 1 is reserved for starting and stopping the Timer 0 .As in given code 




#include <reg51.h>
#include <stdio.h>
extern void MSDelay(unsigned int);
extern void SerialTx(signed int);

void main (void)
 {
      int x;
      SerialTx(-3);
    TMOD=0xA1;    //use Timer 1 in mode 2 and Timer 0 in mode 1 both are start and stop from externally
      TH0=0x00;
    TL0=0x00;
     
while(1)

{
    if( P1==0)
  {
          TR0=1;
        TI=1;
      
          x=TH0;
            x=x<<8;
        x=x+TL0;
      
          printf("The Timer 0 is ON.   And The Value Is : ");
          printf("%x, \n",x);
          MSDelay(60);
    }
      
    else
    {
      
        TI=1;
          printf("The Timer 0 is OFF. \n");
          MSDelay(60);
    }

}

}



As you see the blue colored code is my main code but in the main code there are two external Functions 
extern void MSDelay(unsigned int);
extern void SerialTx(signed int);

the First Function is Delay Function And This is given below



#include <reg51.h>
#include <stdio.h>
void MsDelay( unsigned int);
void MsDelay( unsigned int itime)
{
unsigned int i , j ;
for (i=0;i<itime;i++)
{
for (j=0;j<1275;j++);
}
}


And another Function is Serial  Data Transmit Function which is also given Below

#include <reg51.h>
#include <stdio.h>
void SerialTx(signed int );
void SerialTx(signed int a)
{
TMOD=0xA0;
TH1=a; //9600 baud rate  FD = -3
SCON=0x50;
TR1=1;   
}

Now  Proteuos Work 

When The Project is stopped
 





When Project is On But Button is Off no data received from Timer 0







When Button is On and data received from Timer 0 ........






Thanks for watching you know my english is week but i think you understand my code ....but if any problem so Inform me   





Tuesday, March 18, 2014

GETTING STARTED WITH 8051/AT89C51 USING KEIL uVISION 4 AND PROTEUS

1 comment:

In this step-by-step tutorial you will find:



--Basic connection diagram of 8051 micro-controller

--Stuff about how to write your very basic program for 8051 micro-controller using Keil uVision software and making final .HEX file with it 

--Using Proteus simulation software to simulate 4-bit counter circuit behavior and program

-- A example video showing 4-Bit counter program

Basic connection diagram of 8051 micro-controller

Notes:
-Do not forget to connect EA pin to 5V as this pin can not be left unconnected.
-30pF capacitor are most suitable but their unavailability has moved me use 20pF capacitors.

USING KEIL uVISION 4.0 TO WRITE CODE


1)As you will open Keil software , you will see following screen:
2)Create new project as shown below:
3)Name it. Make sure that you already have made the separate folder to minimize confusion of new project files with old ones. New folder will keep all files related to only to one project hence making it easy to locate files you need afterwards.

4)Select chip manufacturer, in our case Atmel then select chip model i-e AT89c51


5) Software will ask you whether to include 8051 start up code, select NO.

6)This is how you working environment should look like till now:

6) As new project folders are created, now it is time to create a text file which will include your assembly code. Goto file drop down menu and select "New" or simply click blank paper icon in file toolbar.


7) Write your code in the new white work space that just has been created.
8) Its time to save your  assembly code file now. Go to file drop down menu and select save. Save the file into your main project folder.
NOTE: SAVE FILE WITH .ASM EXTENSION AS OUR CODE IS IN ASSEMBLY LANGUAGE.
As you will save the file, the software will detect the .asm language keywords and they become colorful to make them prominent from rest of code. 

9) Now you have to add .asm code file to your project. Right click on the source group folder(sub-folder of main target1 folder) and select "Add files to group (source group)"

10) A small window will appear asking you for location of your .asm code file. Give it the path of wherever you have saved your file, it should be in  your project folder. Select the file click "Add".


11) You may check the .asm file by clicking on the little plus sign at the left of source group.

12)There are some configuration changes that you have to make before you build the final .HEX file. 

-In target tab set the frequency that you are using with 8051, in our case 10.0MHz. So change default value 24.0MHz to 10.0Mhz

-In output tab check the "Create HEX file" box otherwise HEX file will not be created.
After all these settings click OK.

13) Its now time to get final output that HEX file.
Right click on .asm file which is in source group folder and select "Build target" .

14)If there are no errors in code your code will be compiled in couple of seconds showing progress in window at the bottom.
If there are errors in code then they will also be mentioned in same bottom window with number of line that contains error. You may recheck that line rectifying the mistake(s).

15) After successful compilation of code you can find final HEX file in same project folder that contains main project file/asm file/other files.

USING PROTEUS TO SIMULATE  4-BIT COUNTER CIRCUIT

Important: As Proteus does not bound us to connect power supply, XTAL,reset circuit,EA pin and other basic connections so we are ignoring them for sake of simplicity. The important things like Xtal frequency of micro controller can be set from properties of micro controller, as discussed below.

While in actual hardware form for you must follow basic circuit shown at very beginning of this post.



1) Open Proteus



2) Click on "P" to open up part list.
Locate AT89C51 IC as shown below:




3) Locate LEDs as shown below


4) Make connections from 8051 to LEDs




5)Locate GND terminal as shown below

6) Connect all LEDs to GND




7) Double click on 8051 IC to open up its proerties window.

--- Set the operating frequency i-e 10.0MHz
--- Give controller the desirewd HEX file.


8) Click on Play Button to start simulation



CIRCUIT SHOULD START WORKING AS SHOWN BELOW

4-BIT COUNTER CODE:


;------4 bit counter code
ORG 0
MOV P1,#0
BACK1: MOV A,#0
BACK: MOV P1,A
INC A
ACALL DELAY
CJNE A,#15,BACK
SJMP BACK1

DELAY:  MOV R1,#45
H3: MOV R2,#100
H2: MOV R3,#100
H1: DJNZ R3,H1
DJNZ R2,H2
DJNZ R1,H3
    RET

END

Sunday, March 16, 2014

TRANSISTOR CONFIGURATIONS

No comments:
TRANSISTOR CONFIGURATIONS
A transistor may be connected in any one of three basic configurations (fig. 2-16): common emitter (CE), common base (CB), and common collector (CC). The term common is used to denote the element that is common to both input and output circuits. Because the common element is often grounded, these configurations are frequently referred to as grounded emitter, grounded base, and grounded collector.
Figure 2-16. - Transistor configurations.
Each configuration, as you will see later, has particular characteristics that make it suitable for specific applications. An easy way to identify a specific transistor configuration is to follow three simple steps:
  • Identify the element (emitter, base, or collector) to which the input signal is applied.
  • Identify the element (emitter, base, or collector) from which the output signal is taken.
  • The remaining element is the common element, and gives the configuration its name.
Therefore, by applying these three simple steps to the circuit in figure 2-12, we can conclude that this circuit is more than just a basic transistor amplifier. It is a common-emitter amplifier.
Common Emitter
The common-emitter configuration (CE) shown in figure 2-16 view A is the arrangement most frequently used in practical amplifier circuits, since it provides good voltage, current, and power gain. The common emitter also has a somewhat low input resistance (500 ohms-1500 ohms), because the input is applied to the forward-biased junction, and a moderately high output resistance (30 kilohms-50 kilohms or more), because the output is taken off the reverse-biased junction. Since the input signal is applied to the base-emitter circuit and the output is taken from the collector-emitter circuit, the emitter is the element common to both input and output.
Since you have already covered what you now know to be a common-emitter amplifier (fig. 2-12), let's take a few minutes and review its operation, using the PNP common-emitter configuration shown in figure 2-16 view A.
When a transistor is connected in a common-emitter configuration, the input signal is injected between the base and emitter, which is a low resistance, low-current circuit. As the input signal swings positive, it also causes the base to swing positive with respect to the emitter. This action decreases forward bias which reduces collector current (IC) and increases collector voltage (making VC more negative). During the negative alternation of the input signal, the base is driven more negative with respect to the emitter. This increases forward bias and allows more current carriers to be released from the emitter, which results in an increase in collector current and a decrease in collector voltage (making VC less negative or swing in a positive direction). The collector current that flows through the high resistance reverse-biased junction also flows through a high resistance load (not shown), resulting in a high level of amplification.
Since the input signal to the common emitter goes positive when the output goes negative, the two signals (input and output) are 180 degrees out of phase. The common-emitter circuit is the only configuration that provides a phase reversal.
The common-emitter is the most popular of the three transistor configurations because it has the best combination of current and voltage gain. The term GAIN is used to describe the amplification capabilities of the amplifier. It is basically a ratio of output versus input. Each transistor configuration gives a different value of gain even though the same transistor is used. The transistor configuration used is a matter of design consideration. However, as a technician you will become interested in this output versus input ratio (gain) to determine whether or not the transistor is working properly in the circuit.
The current gain in the common-emitter circuit is called BETA (b). Beta is the relationship of collector current (output current) to base current (input current). To calculate beta, use the following formula:
(D is the Greek letter delta, it is used to indicate a small change)

For example, if the input current (IB) in a common emitter changes from 75 mA to 100 mA and the output current (IC) changes from 1.5 mA to 2.6 mA, the current gain (b) will be 44.
This simply means that a change in base current produces a change in collector current which is 44 times as large.
You may also see the term hfe used in place of b. The terms hfe and b are equivalent and may be used interchangeably. This is because "hfe" means: h = hybrid (meaning mixture)
f = forward current transfer ratio
e = common emitter configuration
The resistance gain of the common emitter can be found in a method similar to the one used for finding beta:
Once the resistance gain is known, the voltage gain is easy to calculate since it is equal to the current gain (b) multiplied by the resistance gain (E = bR). And, the power gain is equal to the voltage gain multiplied by the current gain b (P = bE).
Common Base
The common-base configuration (CB) shown in figure 2-16, view B is mainly used for impedance matching, since it has a low input resistance (30 ohms-160 ohms) and a high output resistance (250 kilohms-550 kilohms). However, two factors limit its usefulness in some circuit applications: (1) its low input resistance and (2) its current gain of less than 1. Since the CB configuration will give voltage amplification, there are some additional applications, which require both a low-input resistance and voltage amplification, that could use a circuit configuration of this type; for example, some microphone amplifiers.
In the common-base configuration, the input signal is applied to the emitter, the output is taken from the collector, and the base is the element common to both input and output. Since the input is applied to the emitter, it causes the emitter-base junction to react in the same manner as it did in the common-emitter circuit. For example, an input that aids the bias will increase transistor current, and one that opposes the bias will decrease transistor current.
Unlike the common-emitter circuit, the input and output signals in the common-base circuit are in phase. To illustrate this point, assume the input to the PNP version of the common-base circuit in figure 2-16 view B is positive. The signal adds to the forward bias, since it is applied to the emitter, causing the collector current to increase. This increase in Ic results in a greater voltage drop across the load resistor RL (not shown), thus lowering the collector voltage VC. The collector voltage, in becoming less negative, is swinging in a positive direction, and is therefore in phase with the incoming positive signal.
The current gain in the common-base circuit is calculated in a method similar to that of the common emitter except that the input current is I E not IB and the term ALPHA (a) is used in place of beta for gain. Alpha is the relationship of collector current (output current) to emitter current (input current). Alpha is calculated using the formula:
For example, if the input current (IE) in a common base changes from 1 mA to 3 mA and the output current (IC) changes from 1 mA to 2.8 mA, the current gain (a) will be 0.90 or:
This is a current gain of less than 1.
Since part of the emitter current flows into the base and does not appear as collector current, collector current will always be less than the emitter current that causes it. (Remember, IE = IB + IC) Therefore, ALPHA is ALWAYS LESS THAN ONE FOR A COMMON-BASE CONFIGURATION.
Another term for "a" is hfb. These terms (and hfb) are equivalent and may be used interchangeably. The meaning for the term hfb is derived in the same manner as the term hfe mentioned earlier, except that the last letter "e" has been replaced with "b" to stand for common- base configuration.
Many transistor manuals and data sheets only list transistor current gain characteristics in terms of b or hfe. To find alpha (a) when given beta (b), use the following formula to convert b to a for use with the common-base configuration:
To calculate the other gains (voltage and power) in the common-base configuration when the current gain (a) is known, follow the procedures described earlier under the common-emitter section.
Common Collector
The common-collector configuration (CC) shown in figure 2-16 view C is used mostly for impedance matching. It is also used as a current driver, because of its substantial current gain. It is particularly useful in switching circuitry, since it has the ability to pass signals in either direction (bilateral operation).
In the common-collector circuit, the input signal is applied to the base, the output is taken from the emitter, and the collector is the element common to both input and output. The common collector is equivalent to our old friend the electron-tube cathode follower. Both have high input and low output resistance. The input resistance for the common collector ranges from 2 kilohms to 500 kilohms, and the output resistance varies from 50 ohms to 1500 ohms. The current gain is higher than that in the common emitter, but it has a lower power gain than either the common base or common emitter. Like the common base, the output signal from the common collector is in phase with the input signal. The common collector is also referred to as an emitter-follower because the output developed on the emitter follows the input signal applied to the base.
Transistor action in the common collector is similar to the operation explained for the common base, except that the current gain is not based on the emitter-to-collector current ratio, alpha (a). Instead, it is based on the emitter-to-base current ratio called GAMMA (g), because the output is taken off the emitter. Since a small change in base current controls a large change in emitter current, it is still possible to obtain high current gain in the common collector. However, since the emitter current gain is offset by the low output resistance, the voltage gain is always less than 1 (unity), exactly as in the electron-tube cathode follower
The common-collector current gain, gamma (g), is defined as
and is related to collector-to-base current gain, beta (b), of the common-emitter circuit by the formula:
Since a given transistor may be connected in any of three basic configurations, there is a definite relationship, as pointed out earlier, between alpha (a), beta (b), and gamma (g). These relationships are listed again for your convenience:
Take, for example, a transistor that is listed on a manufacturer's data sheet as having an alpha of 0.90. We wish to use it in a common emitter configuration. This means we must find beta. The calculations are:
Therefore, a change in base current in this transistor will produce a change in collector current that will be 9 times as large.
If we wish to use this same transistor in a common collector, we can find gamma (g) by:
To summarize the properties of the three transistor configurations, a comparison chart is provided in table 2-1 for your convenience.
Table 2-1. - Transistor Configuration Comparison Chart
AMPLIFIER TYPE COMMON BASE COMMON EMITTER COMMON COLLECTOR
INPUT/OUTPUT PHASE RELATIONSHIP 180°
VOLTAGE GAIN HIGH MEDIUM LOW
CURRENT GAIN LOW(a) MEDIUM(b) HIGH(g)
POWER GAIN LOW HIGH MEDIUM
INPUT RESISTANCE LOW MEDIUM HIGH
OUTPUT RESISTANCE HIGH MEDIUM LOW
Now that we have analyzed the basic transistor amplifier in terms of bias, class of operation, and circuit configuration, let's apply what has been covered to figure 2-12. A reproduction of figure 2-12 is shown below for your convenience.
This illustration is not just the basic transistor amplifier shown earlier in figure 2-12 but a class A amplifier configured as a common emitter using fixed bias. From this, you should be able to conclude the following:
  • Because of its fixed bias, the amplifier is thermally unstable.
  • Because of its class A operation, the amplifier has low efficiency but good fidelity.
  • Because it is configured as a common emitter, the amplifier has good voltage, current, and power gain.
In conclusion, the type of bias, class of operation, and circuit configuration are all clues to the function and possible application of the amplifier.
Q.26 What are the three transistor configurations?answer.gif (214 bytes)

Q.27 Which transistor configuration provides a phase reversal between the input and output signals? answer.gif (214 bytes)
Q.28 What is the input current in the common-emitter circuit?answer.gif (214 bytes)
Q.29 What is the current gain in a common-base circuit called? answer.gif (214 bytes)
Q.30 Which transistor configuration has a current gain of less than 1? answer.gif (214 bytes)
Q.31 What is the output current in the common-collector circuit? answer.gif (214 bytes)
Q.32 Which transistor configuration has the highest input resistance? answer.gif (214 bytes)
Q.33 What is the formula for GAMMA (g)? answer.gif (214 bytes)