Saturday, March 17, 2012

Turn your PC into a Web Server and host your web-site for free


In this article, I am going to explain how to use your computer with Internet connection as a Web Server to host your own web-site.

Overview

Generally, if you want to host a web-site, you need to either buy a domain or look for some free web hosting services.You put your web-site's code there and then it can be accessed from anywhere through Internet. This way, whenever you type in the address of the web-site, it is redirected to that server's location (its IP address) and its corresponding port (which is mostly port 80). So, if we want to say, host our web-site at home, we need to make sure that whenever someone types your IP address, it should reach your PC's localhost server.

If you don't know anything about IP address, Port, DNS etc, please go through following links before reading this article. It will help you in understanding this article better.

Internet Protocol (IP)
Port Numbers
Domain Name System

Now, the things you are going to need are :

1). A PC with an Internet connection
2). Global IP address
3). Any web-server software

Set up your web-server 

To host a web-site at your home, first thing you need is of course your web-site running on your own PC. I use Apache-Tomcat for this as it is free. Other web servers are WAMP and Oracle etc. You can use any of them. All web servers run on a specified port no, which can be configured from the web-server settings (for Apache Tomcat, default port no is 8080). After starting your web server, start your web site on the server. You can check if your site is working or not by typing localhost/your-website-link. This depends on the configuration of your web-site and web server. So after this step, you are able to view your web-site on your own PC.

Next thing is to make your web-site accessible to the whole world so that when anyone type your IP address with appropriate port no, the request should reach your local server to corresponding port no. For this, you must have a Global and preferably a static IP address. So, you need to determine that whether your IP address is local or Global. Check your IP address by going to command prompt and typing IPconfig (in Mac OS, you can do this by going to Network Utility ). Also, go to google and type "what is my IP". If in both case your IP is same and your IP address is "NOT" in the following IP ranges, it means that you have a Global IP address.


10.0.0.0 through 10.255.255.255
169.254.0.0 through 169.254.255.255
172.16.0.0 through 172.31.255.255
192.168.0.0 through 192.168.255.255

If you have a global IP address, you just have to type in aaa.bbb.ccc.ddd:portno/your-website-link and you will able to access your web-site from anywhere as long as you keep the web-server software running on your PC and your IP doesn't change. If you have Global IP address, you can skip the next step and continue reading.

In this Video, I have explained how to start Apache Web Server and run your web-site on localhost. For testing purpose, I have created a simple page named "test.htm". After starting the Apache web-server, this page can be accessed from localhost

Port Forwarding

But, if the IP address you found from Google is different then the IP address that you found in the command prompt (for e.g., 192.168.xxx.yyy ), it may be because you have a routing device somewhere which creates a personal network.It assigns local IPs from above range to all the PCs connected to the router and then connects that network to Internet through the Global IP address. In this case, whenever someone types your IP address, it reaches the routing device instead of your PC. So, the web site that is hosted on your PC is not accessible from Internet. To overcome this problem, most routing devices have a facility called "Port Forwarding". Like its name suggests, it forwards requests on specific ports of router to your local IP address. This way, if your local IP address is 192.168.xxx.yyy, and the web server is running on port no 'dddd' , you have to 'tell' your routing device to transfer all the request on port 'dddd' to your PC's IP address (i.e. 192.168.xxx.yyy in this case). Most routing devices have this functionality inbuilt and it can be enabled from your router configuration ( to change router configuration, refer to your router's user manual ). After you have enabled port forwarding, rest of the process is same. You can access your web site by simply typing ppp.qqq.rrr.sss:portno/your-website-link, where, ppp.qqq.rrr.sss is your router's IP address and portno is the port no on which the web server is running.


In this Video, I have explained how to enable Port Forwarding in case you have a local IP (192.168.1.100 in this case) address. After enabling Port Forwarding, you will be able to access the localhost from the Internet using the Router's Global IP address (124.125.158.5 in this case).

Setting up DDNS

So till now, you are able to access your web-site from anywhere using global IP address and port no of the web-server running on your PC. This works well, but you have to type numeric IP address which is hard to remember. Also, problem with most of ISPs is that they provide a dynamic IP address. This means that your IP address keeps changing from time to time. So, every time your PC's IP address changes, link to your web site changes. For these problems, DDNS is the best solution. DDNS stands for Dynamic Domain Name System. Basically, DNS is the service that gives a "name" to IP address and DDNS is a service that can be used to provide "name" to dynamic IP address. This way, by using DDNS, you can access your web-site with yourname.something.net even if your PC's IP address keeps on changing. Both free and charged DDNS service providers are available. Here, I am going to explain free DDNS service NO-IP.com and how to use it.

Go to No-IP.com and sign-up there. After you have signed up, login with your credentials. After you login, click on "Add a Host" and fill the form. In Hostname, write any name that you want to use and choose any of the free available domains (various domains that NO-IP.com provides are : "zapto.org", "ddns.me" , "sytes.net" etc.). In the host type, select "Port 80 Redirect". In the IP address field, write your Global IP address and in port no, write your web-server's port no and click on "Create Host". After that, wait for five minutes for changes to take effect.

Now you can access your web-site just by typing "yourname.zapto.org" or "yourname.ddns.me". This address will work till your IP address does not change and web-server is running on your PC. There is one last step in this process to make this address valid even if your IP address change. To enable this, go to NO-IP.com and go to downloads page (https://www.no-ip.com/downloads.php) and download the version that is suitable to your OS. After downloading it, install the software.After finishing installation of the software, start the software. It will ask for credentials that you use to login to NO-IP.com. Enter the credentials and log-in to the software. On logging in, it will display the name of the site that you just created (i.e. yourname.zapto.org or yourname.ddns.me ). Select that name and click on Save and minimize the software. This software constantly monitors your IP address and whenever it changes, it informs such change to NO-IP.com, which changes the association of "yourname.zapto.org" to newer allocate IP address.


This video explains how to setup DDNS using NO-IP.com's free DDNS service. NO-IP.com provides free DDNS client to monitor your dynamically changing IP.


So, that's it. You have created your own web server which can be used to host your web sites and that too for absolutely FREE.

Download :

1). Apache Tomcat web server
2). NO-IP.com's free client software

If you liked / didn't understand / have questions about this article, post a comment here or write to me on dmehta17@gmail.com. You can also reach me through Facebook on www.facebook.com/damehta.

Sunday, June 5, 2011

IR Remote Controlled Switchboard (RC5 protocol decoder)

In an earlier article, I explained how a single switch can be controlled by using a simple IR transmitter and a simple receiver circuit. This article explains how to extenmd the same concept to control a number of switches.

Now, as more than one switches are to be controlled, we have to transmit a number of bits through IR transmission to indicate which is key is pressed on the remote and accordingly which switch of the switch-board to control. In this project, this is done by using a ready-made IR remote control which works on RC5 protocol.
RC5 protocol was developed by Phillips for controlling consumer electronics such as TV, VCD-DVD Player,etc. through IR Remote Controller. This type remote controller can be found in Phillips' 90 channel TVs. This is a very popular IR protocol and very easy to understand.
Basically, in a RC5 protocol, when a key on the remote controller is pressed, a total of 14 bits are serially transmitted. This includes 2 Start bits, 1 Toggle bit, 5 Address bit and 6 Data bit. These 14 bits are transmitted on a carrier of 38/36 khz carrier by using Manchester Coding. High and Low time are 889 us. For more on Manchester Coding and RC5 protocol, read this.

At the receiver, TSOP1738 receiver is used. It removes the carrier and provides serial data. This serial data is applied to AT89C51 microcontroller for decoding serially transmitted data and control the output accordingly. Relays are used for switching action and they are controlled by the microcontroller through the ULN2803 IC. Circuit diagram is shown below :

 
Source code of the project is given below. It is in assembly language.

;Program assuming following dataset from receiving side
;
;
; button    signal            hex
; 1        1 0 00000 011110 111    1E
; 2        1 1 00000 011101 111    1D
; 3        1 0 00000 011100 111   1C
; 4        1 1 00000 011011 111    1B
; 5        1 0 00000 011010 111   1A
; 6        1 1 00000 011001 111    19
; 7        1 0 00000 011000 111    18
; 8        1 1 00000 010111 111    17
; 9        1 0 00000 010110 111    16
; STDBY    1 1 00000 010011 111    13

CNT        equ r7              ;Temporary Variable
EXCNT    equ 10H                ;Count

ADDRS    equ 11H                ;Device address
CMD    equ 12H                    ;Command

ATEMP    equ    13H                ;Temperory store
TEMP     equ 14H                ;Temperory store
DLOCK    equ 15H                ;Setting lock permission

OTOG bit 00H                ;Flip bit
TOG    bit 01H                 ;Temp bit for flip

IR    equ P1.1                ;IR Receiver connected to this pin

SWPORT    equ P0                ;Port at which switches are connected
DSPPORT equ p2                ;Display port

CH1 equ p2.0                ;Signal Waiting  bit (determine whether controller is busy or not)
CH2 equ p2.1                ;Successfull command
CH3 equ p2.2                ;Lock status indicator
   
org 0000H                    ;Start of prog

mov SWport,#00H             ;switch all relays off!
mov DSPPORT,#00h            ;Setting display off
mov sp,#50H                    ;Stack pointer initialization
clr TOG                        ;Clear temp bit
mov DLOCK,#02H                ;Setting lock off
setb CH3                    ;Dispalying default status as an unlocked
   
main:

    jb IR,main                ;Wait for first bit   
    clr CH1                    ;Reseting to indicate Busy
   
        mov CNT,#225        ;Reading the start bit
        djnz CNT,$
        mov CNT,#207
        djnz CNT,$
        mov CNT,#216
        djnz CNT,$
   
    mov c,IR
   
        mov CNT,#225        ;Reading the toggle bit
        djnz CNT,$
        mov CNT,#207
        djnz CNT,$
        mov CNT,#225       
        djnz CNT,$
        mov CNT,#207
        djnz CNT,$
   
    mov c,IR
    mov TOG,c
   
    mov EXCNT,#04h            ;Reading 4 address bits
    mov a,#00h
    adloop:
   
        mov CNT,#225       
        djnz CNT,$
        mov CNT,#207
        djnz CNT,$
        mov CNT,#225       
        djnz CNT,$
        mov CNT,#207
        djnz CNT,$
   
    mov c,IR
    rlc a
    djnz EXCNT,adloop
   
        mov CNT,#225        ;Reading 5th address bit
        djnz CNT,$
        mov CNT,#207
        djnz CNT,$
        mov CNT,#225       
        djnz CNT,$
        mov CNT,#180
        djnz CNT,$
   
    mov c,IR
    rlc a
   
    mov ADDRS,a                ;Storing ADDRESS
   
    mov a,#00h
   
        mov CNT,#225        ;Reading first data bit
        djnz CNT,$
        mov CNT,#207
        djnz CNT,$
        mov CNT,#225       
        djnz CNT,$
        mov CNT,#207
        djnz CNT,$
       
    clr c                    ; It is always 0 received
    rlc a

        mov CNT,#225        ;Reading second data bit
        djnz CNT,$
        mov CNT,#207
        djnz CNT,$
        mov CNT,#225       
        djnz CNT,$
        mov CNT,#207
        djnz CNT,$
   
    setb c                    ;It is always 1 received
    rlc a

        mov CNT,#225        ;Reading third data bit
        djnz CNT,$
        mov CNT,#207
        djnz CNT,$
        mov CNT,#225       
        djnz CNT,$
        mov CNT,#207
        djnz CNT,$
   
    mov c,IR
    rlc a

        mov CNT,#225        ;Reading forth data bit
        djnz CNT,$
        mov CNT,#207
        djnz CNT,$
        mov CNT,#225       
        djnz CNT,$
        mov CNT,#207
        djnz CNT,$
   
    mov c,IR
    rlc a

        mov CNT,#225        ;Reading fifth data bit
        djnz CNT,$
        mov CNT,#207
        djnz CNT,$
        mov CNT,#225       
        djnz CNT,$
        mov CNT,#207
        djnz CNT,$
   
    mov c,IR
    rlc a

        mov CNT,#225        ; Reading sixth data bit
        djnz CNT,$
        mov CNT,#207
        djnz CNT,$
        mov CNT,#225       
        djnz CNT,$
        mov CNT,#207
        djnz CNT,$
   
    mov c,IR
    rlc a

    mov CMD,a                ;Storing command
   
    mov a,ADDRS                ;Validation 1
    cjne a,#00h,eop1

   
    mov a,#00h                ;Converting both toggles to byte
    mov c,OTOG
    rlc a
    mov TEMP,a
    mov c,TOG
    mov a,#00h
    rlc a
   
    cjne a,TEMP,cont1        ;Validation 2
    jmp eop1
    cont1:

    mov c,TOG
    mov OTOG,c
   
    mov TEMP,#00h
   
    mov a,CMD                ;Converting command to equivalent decimal count
    cjne a,#1Eh,skip1
    mov TEMP,#01h
    skip1:
    cjne a,#1Dh,skip2
    mov TEMP,#02h
    skip2:
    cjne a,#1Ch,skip3
    mov TEMP,#03h
    skip3:
    cjne a,#1Bh,skip4
    mov TEMP,#04h
    skip4:
    cjne a,#1Ah,skip5
    mov TEMP,#05h
    skip5:
    cjne a,#19h,skip6
    mov TEMP,#06h
    skip6:
    cjne a,#18h,skip7
    mov TEMP,#07h
    skip7:
    cjne a,#17h,skip8
    mov TEMP,#08h
    skip8:

    cjne a,#13h,cont2        ;Switching off SWPORT
        jmp offall
    cont2:
   
    cjne a,#1Fh,cont5        ;Checking for lock signal
        jmp checklock
    cont5:
   
    mov a,TEMP                ;Validation 3
    cjne a,#00h,cont3
       
    eop1:
        jmp eop
    cont3:
   
   
    mov a,DLOCK                ;Validation 4
    cjne a,#02h,eop
   
   
    clr c                    ;Inverting SWPORT bit as per count
    mov a,TEMP
    mov CNT,a
    mov a,SWPORT
    again1:
        rrc a
    djnz CNT,again1
    mov ATEMP,a
    mov a,#00h
    rlc a
    cpl a
    rrc a
    mov a,TEMP
    mov CNT,a
    mov a,ATEMP
    again2:
        rlc a
    djnz CNT,again2
    mov SWPORT,a
   
    setb CH2                ;SWPORT written indicator
   
    jmp cont4
    offall:                    ;SWPORT off sub module
   
        mov a,#00h
        mov SWPORT,a
    cont4:
   
    jmp cont6                ;Check lock sub module
    checklock:
       
        mov a,DLOCK
        cjne a,#02h,incmt
            mov DLOCK,#00h
            clr CH3
            jmp cont7
        incmt:
            inc DLOCK
            cjne a,#01,cont8
                setb CH3
            cont8:
        cont7:
    cont6:
   
    eop:
   
    mov EXCNT,#40
    loop1:
        mov CNT,#255
        djnz CNT,$
    djnz EXCNT,loop1

    setb CH1                ;Seting to indicate as Ready
    clr CH2                    ;Clearing as default state
   
   
    ljmp main
end

The code works by sampling data input pin at certain intervals and stores data in registers. After that, according to received data bits, switches are controlled. For example, if '1A' is received, then switch no 5 will be toggled. Similarly, if '17' is received, then switch no 8 will be toggled. Apart form this, if a '0' is pressed once, then it locks the device. If a device is locked, status of switches cannot be changed. For unlocking device, you have to press '0' button twice. After that, it will resume normal operation. Also, when 'STD BY' key of remote is pressed, then all the switches are turned off regardless of their previous state.

This is a very easy to make and fun to use project. You can use it in your house for controlling switches of the switchboard. If you have any problem regarding making this project or want to give Feedback, then post a comment here or mail me at dmehta17@gmail.com.



Thursday, April 21, 2011

Interfacing Touch Screen with microcontroller

Please Read : This article was posted by me a long time ago, I am not able to monitor the comments regularly. So, if you need my help regarding any article, please write to me at dmehta17@gmail.com . I will try to answer the queries as quickly as possible.  Also, please don't ask me for the code for any other controller except LPC2148, because I only have code for that controller. For any other controller, you will have to develop the code on your own based on the algorithm explained here. If you've created such code, I request you to share it with me via e-mail. I will publish it here with full credits to its original author.

--------------------------------------------------------------------------------------------------------------

I've always wanted to add something new to my projects. That's why in the 7th semester, when I saw a touch screen just lying in my college, I decided to go for it. Touch screens add an X-factor to otherwise ordinary projects. They are fun to use and more important, their applications are endless. In this article, I will explain how to interface a 4-wire resistive touch screen with microrocntrollers.

Resistive Touch Screens
Of all the kinds of touch screens available, Resistive touch screens are easy to interface, cheap and they have fair sensitivity.Resistive Touch screens are simply transducers. This touch screen has a resistive layers in both X and Y directions. According to the position of the touch, Their X channel and Y channel resistance changes. So, what we have to do is we have to determine the X and Y Channel resistance to get the position of the touch in terms of X and Y co-ordinates.
Here is an Image of simple resistive touch screen. 
 How To Interface Touch Screen with Microcontroller
To Interface Resistive touch screen with a microcontroller, you will need a microcontroller with inbuilt Analog-to-Digital converter having two or more channels. This is needed because, the touch screen will provide data in terms of an analog voltage on two different pins, using which, we have to determine position of the touch. Also, ADC input pins of the microcontroller should be configurable as General Purpose I/O (GPIO). As shown, in the figure, the touch screen has total of 4 wires coming out. Pin configuration is shown in the fig. To read the position of the touch, we have to first read touch position sequentially i.e. first read X position and then read the Y position. To do this, connect X1 and Y2 pins of touch screen to ADC multiplexed GPIO pins of the controller. And connect X2 and Y1 pins of touch screen to simple GPIO pins of the microcontroller.  


 
 
  
Now first, we have to read X position of the touch, for that, u have to program the pin X1 as Logic high (+5v or +3.3v in some cases) and configure pin X2 as logic low (GND). Now, as I told earlier, touch screen contains a resistive layer in both direction. So, when we apply +5v and GND to its pins, it will create a voltage gradient in X direction. Voltage on the X channel will vary according to the X position of the touch. We have to measure this voltage to determine the X position.For that, configure Y2 as ADC input and configure Y1 to high impedance state (in most controller, configuring Y1 as "Input" will work). Then read the value from the ADC. It will give the relative value of the touch. For example, if you have an 8-bit ADC in the controller, when you touch near the right most end, it will give you a value of 255 and when you touch near the left most end, it will give you a value near 0. After reading X position, you will have to read the Y position. For that, configure Y2 as Logic High, Y2 as Logic Low, and X1 as ADC input and X2 as High Impedance state. After that, whole procedure is the same. 


This way, you can interface touch screens with microcontrollers and add something new to your projects. I made a "Touch Screen Calculator" using the LPC2148 microcontroller. Below is the video of the Touch screen Calculator in action. If you need any help regarding this or have any suggestion/feedback, then write a comment here or mail me at dmehta17@gmail.com or you can connect with me on facebook at "http://www.facebook.com/damehta"


 


Here is the 'C' code I've created for reading X and Y positions from the touch screen. The code is for Phillips LPC2148 controller.I've crated two functions : "xcoordinate" and "ycoordinate".When called, functions wait for a touch and when touch screen is touched, returns X and Y co-ordinate respectively.

int xcoordinate(void)
{
 int x;
 PINSEL0 = (PINSEL0 & 0x3FFF3FF0) | 0x00000005; // Configure pins for touch screen
 PINSEL1 = (PINSEL1 & 0xC3FFFFFF) | 0x10000000;
 IO0DIR =  (IO0DIR &  0xDFFF7F7F) | 0x00008080;

 IO0SET = IO0SET | 0x00000080;     // Set pin to '1'
 IO0CLR = IO0CLR | 0x00008000;    // Set pin to '0'

 AD0CR = ( AD0CR & 0xFFD00000 ) | 0x00200208 ;  // Start the ADC

 while(1)
 {
   delayms(10);
   AD0CR = ( AD0CR & 0xF8FFFFFF ) | 0x01000000 ;

 xchkadc:

   x = AD0DR3 & 0x80000000 ;

   if(x == 0x80000000)  // Check if A-D conversion is complete
    {
     
      x = 0x00000000;
      x = AD0DR3 & 0x0000FFC0;
      x = x >> 6;
      x = x & 0x000003FF;
      if(x <= 10)
      {
        goto xexit;
      }
     
      AD0CR = AD0CR & 0xF8FFFFFF;
      return x;     // return the value of touch in x direction
     
    }

   goto xchkadc;

  xexit:  
  AD0CR = AD0CR & 0xF8FFFFFF;  
  }
  return 0;
}

int ycoordinate(void)
{
 int y;

 PINSEL0 = (PINSEL0 & 0x3FFF3FF0) | 0xC0000005;    // Configure pins for touch screen
 PINSEL1 = (PINSEL1 & 0xC3FFFFFF) | 0x00000000;

 IO0DIR = (IO0DIR & 0x9FFFFF7F) | 0x60000000;

 IO0SET = IO0SET | 0x40000000;    //// Set pin to '1'
 IO0CLR = IO0CLR | 0x20000000;    //// Set pin to '0'

 AD1CR = (AD1CR & 0xF0D00000) | 0x00200220 ;    //// Start the ADC

 while(1)
 {

  delayms(10);
  AD1CR = ( AD1CR & 0xF8FFFFFF ) | 0x01000000 ;

   ychkadc:

   y = AD1DR5 & 0x80000000 ;

   if(y == 0x80000000)    // Check if A-D conversion is complete
    {
     
      y = 0x00000000;
      y = AD1DR5 & 0x0000FFC0;
      y = y >> 6;
      y = y & 0x000003FF;
      if(y <= 10)
      {
        goto yexit1;
      }
     
      AD1CR = AD1CR & 0xF8FFFFFF;
      return y;            // return the value of touch in y direction
     
    }

   goto ychkadc;

   yexit1:
  
    AD1CR = AD1CR & 0xF8FFFFFF;
  }

 return 0;
}

Thursday, January 27, 2011

Digital Volume control using CD4066

For any audio amplifier circuit, a volume control is necessary. Basically, volume control circuit is a voltage divider circuit. Output from it is given to the main amplifier or to the mixer circuit. Generally, it is done by using a potentiometer to attenuate the input signal.


In digital systems, the volume control is done digitally, i.e. there is a kind of voltage divider circuit which can be controlled digitally. For sophisticated systems, there are special ICs available, but there is an easy way to do this.

A simple digital volume control can be done using CD4066 IC. CD 4066 is a quad CMOS Bi-lateral switch (For datasheet, click here). It is equivalent to 4 analog switches which can be con
trolled digitally. I used it to vary the attenuation of the signal by using a resistor bank.



As shown in the circuit diagram, the four switches are used to select the total resistance by turning the resistor on or off. As the resistance changes, the attenuation changes accordingly. When all the input bit are high, all resistances are bypassed by the switch and the attenuation is zero. Similarly, when all bits are low, it provides maximum attenuation. Also, this maximum attenuation can be changed by changing the resistor values. As there are four switches, there are a total of 16 (2^4) combinations or levels of attenuation.

This simple circuit is very useful in case when you need a simple yet good digital volume control.

Wednesday, January 20, 2010

Speakers

What are speakers? You might say they're the ones from where the sound comes. Quite right. In technical terms, it is a transducer which converts electrical signals into their equivalent acoustic (mechanical waves) signals. This waves are produced by a diaphragm which moves back and fourth. There is a coil connected with diaphragm. In this way, it acts as a electromagnet and when current is passed through it, it moves back and fourth. So when we pass a signal of audio frequency, the speaker produces mechanical wave (or vibration) which is equivalent to the electric signal.

Cross section of a speaker

That's the basic of how speakers work. Now there are many type of different speakers. But regardless of its type, all do the same work : produce audible sound according to the electric signal fed.

Speakers can be classified in mainly ways : According to frequency they can work on and according to their impedance.

(1)According to frequency, there are three types: Woofers,mid-range and tweeters. Woofers work on low frequency audio signal. Mid-range are good for medium frequency and tweeters are good for high frequency audio signals.

Woofer

Mid-range

Tweeter

(2)Each speaker has impedance. It can be 32 ohm, 16 ohm, 8 ohm, and 4 ohm. 32 ohm speakers are generally used in headphones. 16 ohm speakers are used in telephones etc. 8 ohm speakers are used in general purpose music systems like the one we use in our home. And 4 0hm speakers are used in loudspeakers where loudness is required.

To drive the speakers, an adequate signal is required in terms of the power. We have to amplify the weak signals to be able to drive the speakers. That's where audio amplifiers are used.

Thursday, January 7, 2010

6W class A Audio Amplifier

When I have nothing to do, I like to listen to songs, so for long time I wanted to make my own audio amplifier that can drive two 4 ohm speakers(i.e. stereo). I wanted it to be compact so I was in search of suiatable IC that has stereo amplifier and able to be driven from PC sound o/p or mp3 player o/p. I ended with the IC known as TPA 1517 from Texas Instruments. This is a 6 W stereo audio amplifier IC and requires very less external components. It can be driven from power supply ranging from 9-18 v. The circuit diagram from the datasheet is as shown below.

For more information on the IC and its internal construction, download datasheet from here.

All you have to do is just join the circuit and enjoy the amplifier. I have made it and tested it with my two 4 ohm speakers. Its quality is quite good. It can be driven from the PC as well as mobile phone (with 3.5 mm jack output) and also from TV's audio out pins. One more thing is that use only regulated power supply otherwise it would produce a annoying background humming sound. I used my variable regulated power supply made using LM 317 IC. You can supply voltage to be between 9v to 18v. I used RCA female jack for both input and output. Although volume control is not shown in the circuit diagram you can add volume control just by adding two 10k potentiometers in two input channels as shown in figure below. Repeat this for the second channel.


This amplifier is quite easy to build and very compact. I have mounted it in a visiting card box with input and output female jacks taken out. To connect supply, I have used a 3 pin circuit board mounted header.

So what are you waiting for? Just make it and enjoy your favourite music.

If you have any doubts or problem making this thing or have anything to say to me then write a comment or mail me at dmehta17@gmail.com.