Sunday, 22 May 2016

DIY audio amplifier using lm386

In this post, we will make a diy audio amplifier using lm386.

LM386 is low voltage audio amplifier and it's gain is in the range of 20 to 200

Parts required:

  1. LM386
  2. Breadboard/ perfboard/ stripboard
  3. 10k pot
  4. 8 Ω speaker
  5. 9 volt battery
  6. 220 uF capacitor
  7. connecting wires
Circuit diagram:

fritzing circuit diagram audio amplifier
Circuit Diagram
In this circuit, pot of 10k is used for controlling the volume. Gain in this circuit is 20. You can also also power supply of 5 volt. This is the basic circuit having gain equals to 20 and there is no bass in this circuit. You can give audio input from mobile/laptop.

Hope you had enjoyed the tutorial.

Stay tuned for more updates !!

Monday, 16 May 2016

How to burn hex files in avr microcontrollers

In this post we will learn, how to burn hex file in avr microcontroller using programmer and burner software.

List of components/software:

1. USBasp programmer
2. Target circuit board having microcontroller (mine have atmega8)
3. Avrdudes (Burner software)

USBasp driver installed in your system.
If it is not installed, then read instructions about installation from my previous post.
USBasp driver installation

Default fuse byte for atmega8a is: HFUSE = 0XC9 and LFUSE = 0X1F
This corresponds to internal rc oscillator having frequency 1 MHz

HFUSE = 0XC6 and LFUSE = 0XE4
This corresponds to internal rc oscillator having frequency 8 MHz

Tuesday, 10 May 2016

Temperature controlled dc fan

In this post, we will control the speed of dc fan based on the temperature.

List of components:

1. Arduino Uno
2. LM 35 temperature sensor
3. LCD 16*2
4. 10k potentiometer
5. ULN 2003
6. DC motor
7. Breadboard/ perfboard

First of all, we will monitor the temperature by using lm35 i.e. temperature sensor. It's scale factor is +10mV/°C which means with increment in temperature by 1° Celsius, the voltage is rise by 10 mV.
We can read adc count by analogRead(A0); // we are using channel A0

This will give us a digital count of adc which varies from 0 to 1023, we have to convert these count into voltage and then into temperature. First of all, we will convert into voltage:
In arduino uno, adc is of 10-bit.
Resolution = Vref/(2^n-1), where n is bit (in our case it's 10)
Resolution = 5000 / 1023, ( Verf = 5000 mV and 2^10 is 1024 minus 1 is 1023)

Resolution = 4.887 mV
Now, we have to convert voltage into temperature:
Temperature (in °C) = Voltage (in mV) / 10.0
With this temperature monitoring is over.

LCD interfacing is simple since we have library for the same with proper documentation.

Now coming to pwm part. In arduino, we can control output voltage by pulse width modulation (pwm).
Duty Cycle = Ton / (Ton + Toff)
Duty Cycle = Ton / T

Duty Cycle (in %age) = (Ton / T)*100

In arduino, for pwm we have analogWrite function :

In arduino uno, we have six pwm channels viz, pin no. 3, 5, 6, 9, 10 and 11.

analogWrite(pin no, value)

Pin no may be 3, 5, 6, 9, 10 and 11
Value varies from 0 to 255 since pwm resolution is of 8-bit (2^8-1)

0 for 0% duty cycle                  0 volts
64 for 25% duty cycle              1.25 volts            if(val<=40.0)
127 for 50% duty cycle            2.50 volts            if(val>40.0 && val<=50.0)
192 for 75% duty cycle            3.75 volts            if(val>50.0 && val<=60.0)
255 for 100% duty cycle          5.00 volts            if(val>60.0)

where val is temperature in °C

Vavg = Duty Cycle  * 5.0 volts
temperature controlled dc fan proteus simulation
Schematic of temperature controlled fan
Download the source code from the link below:

Stay tuned for more updates !!

Thursday, 5 May 2016

Driver for usbasp programmer

How to install usbasp driver in your pc/laptop?

Download driver from the above link. Extract the file, now you have two folders:

 windows-8-and-windows-10-usbasp-drivers-libusb_1.2.4.0-x86-and-x64-bit and  Win-Driver.
Former is for windows 8 and windows 10 while latter is for windows 7.

Open device manager after connecting the programmer you can see the yellow triangular icon which indicates that no driver is installed.

Device Manager
Right click on usbasp, you have two options of installing the driver, click on browse my computer for installation of driver.
Browse the following directory in your computer:

After extraction, you have two files. Let's suppose you have usbasp_driver folder in E drive.
Browse E:\usbasp_driver\Win-Driver if you are using Windows 7.

After selecting it will ask for driver installation, click on install this driver anyway.
Installing the driver
If the driver is installed successfully, you can check its status in device manager.
This post was for installing usbasp driver in windows 7. If you are using windows 8 or 10.

If you want to install usbasp driver in windows 8/10. You can do it by disabling driver signature option. You can google it for the detailed procedure.

Stay tuned for more updates !!

Tuesday, 3 May 2016

Interfacing SIM900 with arduino uno

In this post, we will learn how to interface SIM900 with arduino uno.

First of all, insert sim in sim socket of GSM module. Power it up by 12V 2A dc adapter.

Now, we have to make connections as follows:

Arduino Side                       GSM module
Tx                =====>          Rx
Rx                =====>          Tx
GND            =====>          GND

The source code is given below:

    boolean bOK = HIGH;

    void setup()
    void loop()
    Serial.println("AT+CMGF=1"); // sets the SMS mode to text
    Serial.print("AT+CMGS=\""); // send the SMS number
    Serial.print("+9199XXXXXXXX"); // +91 for india
    Serial.print("Hello World "); // SMS body


The source code is self-explanatory.

Thanks for visiting this blog.

Stay tuned for more projects !!