Saturday, 10 October 2015

74HC165 Shift Register and your Arduino UNO

             Today in this tutorial i'll explain you how to control 74HC165 parallel in serial out(PISO) shift register using your ARDUINO board.Here we used 74HC165 for increasing numbers of inputs of your ARDUINO board.Shift registers are often used for the purpose of saving pins on a microcontroller. Every microcontroller has a limited number of pins for general inputs and outputs (GPIO).Some time we have required more inputs and our controller does not provide such a inputs at that time parallel in serial out(PISO) shift register is used to increase inputs.

            An 8 bit shift register needs 4 lines of a microcontroller. One pin to clock for data transfer,one for clock enable,one for shifting/loading/latching the bits,and one for serial data transfer.Here we used only 3 pins of microcontroller. One pin for loading the bits,one pin to clock for data transfer,one pin to serial data transfer.In 74HC165 Clock enable pin is active low so we connect it to ground.Two 74HC165 can be cascaded to increase lots of inputs.

Saturday, 5 September 2015

Multiplexed Seven Segment Display interfacing with 8051

             We have already discuss basic about "single seven segment interface to 8051" in which seven segment is individually drive through 8 pin of microcontroller AT89S52. If we want to display two,three or more seven segment display using single MCU than there is problem that we face is lack of I/O pins in MCU, as one seven segment would take 8 I/O pin and four seven segment would take 28 I/O pins.That's why multiplexing technique is used to drive multiple seven segment display. In this tutorial i'll explain you how to interface multiple seven segment display to 8051.   
          Here we'll used "persistence of vision" to archive this multiplexing.This technique is used in cinematography to display images so fast that our brain cannot distinguish any lag between two consecutive images. Similarly, when we multiplex more than one seven segments, we display only one Seven segment at a time, and we switch between them so fast that our brain cannot distinguish between them.
            In multiplexing all the display are connected in parallel such that if you active any segment than the particular segment of all displays glow up.But we switch on and off the common line of segment very fast.

Circuit Diagram:

Multiplexed Seven Segment circuit diagram 

          In the above circuit all the similar segment of seven segment display are connected together and which is connected to the PORT0 of AT89S52 through current limiting resistors(R2 toR9).Particular segment is turn on when the corresponding pin of PORT0 is  high(1) because segment is common cathode.But it'll not glow until it's cathode is not connected to ground.But here cathode of the seven segments are not directly connected to ground.Three NPN (BC547) transistor is used as a switch to on and off the particular segment.Therefore, the transistor selects which displays is active at a time.Here base of all three transistor are connected to the P2.0, P2.1, P2.2 through base resistor don't forgot to put base resistor may your transistor stop working.Common line of segment is connected to ground when the logic high(1) is apply to the base of the transistor and disconnected when logic low(0) is apply to the base of transistor.

Saturday, 29 August 2015

Burning the Bootloader on ATMega328 using USBasp Programmer

            In this tutorial you'll learn how to burn arduino bootloader on new ATmega328 using USBasp ISP programmer.Please be noted that every Arduino Board comes with a microcontroller ATmega328 pre-program with arduino bootloader firmware. Therefore, there is no need to burn the bootloader firmware again.But if you want to make your own DIY arduino board than you need to burn arduino bootloader into ATmega328.So here i'll show you how to load arduino bootloader into atmega328 step by step.  

Required components:
  1. USBasp Programmer
  2. Bread Board 
  3. ATmega328 
  4. 2pcs 22pf Cap.
  5. 16MHz Crystal
  6. 10K Resistor 
  7. Hook up wire 
  8. AVRdude Software
     First of all wire up the circuit in breadboard as show in below diagram.Please connect all the connection carefully. 

ATmega328 connection with USPasp

      Show in above circuit JP1 is from USBasp programmer. Connect all the connection carefully as per above diagram using jumper wire.If you wire up your circuit correctly than it's time to load hex file which is located in your arduino software folder here is complete path arduino-1.0.5-windows\arduino1.0.5\hardware\arduino\bootloaders\optiboot\optiboot_atmega328.hex  you can also download from here optiboot_atmega328

Thursday, 13 August 2015

Interfacing Seven Segment Display to 8051

       Hi friends in this tutorial i'll explain you how to interface single seven segment display to 8051 micro-controller.You just need to some basic knowledge of seven segment display and 8051 programming.If your are newbie to seven segment display than you can learn basic about seven segment display from my older post about seven segment display.You can learn all about seven segment display from this post.
         Now we interface common anode seven segment display with AT89S52. I already describe basic about common anode display.

Circuit Diagram

         Here,common anode display is used to display digit 0 to 9 and some time used to display alphabets A to F,dot is use to display decimal point.Show in circuit diagram pin a to g of seven segment is connected to the port P2 of AT89S52 microcontroller through the current limiting resistors R2 to R9(330R) and common pin is connected to the Vcc(5V).Make sure that a to g pins of 7 segment are connected to the P2.0 to P2.6 respectively.Since we are using common anode seven segment display so we need to send logic-0 to the particular segment to glow. 

Seven segment interface circuit diagram

Monday, 10 August 2015

7 Segment Display

      Seven segment display is widely use to display digit 0 to 9 and alphabets A to F. They find wide application in devices that display numeric information like digital clocks,Electronics meters etc.

     In this tutorial you'll learn how to drive single seven segment display.First off all we'll learn basic about seven segment display and how to drive seven segment display.

Sunday, 2 August 2015

I2C protocol

I2C (Inter-integrated Circuit)


In this tutorial, you will learn all about the I2C communication protocol, why you would want to use it, and how it’s implemented on microcontroller. I2C is a serial protocol for two-wire interface to connect low-speed devices like microcontrollers, EEPROMs, A/D and D/A converters, I/O interfaces and other similar peripherals in embedded systems.

Serial, 8-bit, bidirectional data transfer can occur at speeds up to 3.4Mbps, though 400kHz is usually sufficient. Since only two bus lines are required, a serial data line (SDA) and serial clock line (SCL), building a system with multiple master or slave devices is relatively simple. The number of I2C devices that can be connected to a single I2C bus segment is limited only by a maximum bus capacitance (400pF) and address space.

Sunday, 12 July 2015

Ultrasonic Distance Sensor HC-SR04 Interfacing with 8051

          In this tutorial you will learn how to interface Ultrasonic Distance Measurement Sensor with AT89S52. Ultrasonic ranging module HC - SR04 provides 2cm - 400cm non-contact measurement function.the ranging accuracy can reach to 3mm. The modules includes ultrasonic transmitters, receiver and control circuit.I also Provide you complete Project code you can download it from the bottom of the page.

Now working of HC-SR04 as follow:

  1. Send 10us HIGH pulse on TRIG pin of HC-SR04.
  2. The sensor sends out a “sonic burst” of 8 cycles.and detect whether there is a pulse signal back.If there is an obstacle in-front of the module, it will reflect the ultrasonic burst.
  3. If the signal is back, ECHO output of the sensor will be in HIGH state (5V) for a duration of time taken for sending and receiving ultrasonic burst. Pulse width ranges from about 150μS to 25mS and if no obstacle is detected, the echo pulse width will be about 38ms.

Tuesday, 30 June 2015

Interfacing Push button switch with AT89S52 Microcontroller.

      This tutorial is for beginners in the field of micro-controller.The purpose of this tutorial is use of push button switch with the micro-controller. It will be useful whenever a decision is to be made according to the press of a switch.

         Input/output devices are very critical components of an embedded system. The first input device we will study is the switch. It allows the human to input binary information into the microcontroller. Typically we define the Two state, logic true, when the switch is pressed. logic false, when the switch in not pressed. A single pole single throw (SPST) switch has two connections. The switches are shown as open circuit in Figure 1.which is a normally open switch (NO), the resistance between the connections is infinite (over 1000 MΩ) if the switch is not pressed and zero (under 0.1 Ω) if the switch is pressed. 

Switch interface circuit 

Sunday, 14 June 2015

How to install USBasp Driver in Window 7

           In This tutorial you'll learn how to install USBasp programmer driver on your laptop/desktop.Here i'll explain you step by step to install driver. If you have any trouble in installing driver than post your problem in comment below box.  

In order to complete the installation, you need to follow several steps:

           The first step is to connect the USB ISP programmer to the USB port of your PC through USB-A to B cable. The USB ISP programmer will work on a wide variety of operating systems, this procedure will only focus on Window 7.

Required items:
  1. USBasp programmer.
  2. USB cable.
  3. USBasp drivers can be downloaded from here.

Tutorial 3: How to burn HEX file into Microcontroller using ProgISP

In this tutorial, you will learn how to use the USB ISP Programmer for burning HEX file in your microcontroller by using ProgISP Flashing tool.

Connect the USB ISP Programmer to your Desktop PC or Laptop USB Port. Make sure you  connect it to that USB Port in you installed it during its installation. Wait for a “Ding” sound from PC. Now the programmer is installed correctly. The GREEN LED will glow to show programmer is ready.
  1. Note:

  • If windows says “USB Device not recognized” make sure the USB cables are not broken.        
  • If windows says “New hardware found” you have connected the programmer to a different port than which you have installed. Or you have not yet installed the USB ISP Programmer driver.

Launch ProgISP.exe and check in Program state function PRG ISP function should be enable if it is showing if disable than check USB ISP Programmer device is connected with Desktop PC or Laptop and its driver are properly installed.

The software is very easy to use
·        From Select Chip Menu Select the MCU  ,say AT89S52
·        Select  File -> Load Flash
·        Select the HEX file

 From Select Chip Menu, Select the MCU here i select AT89S52 which is 8051 Based Micorocontroller

Now Select Load Flash from File menu 

Now select HEX file that you want to burn into microcontroller.
 Select the HEX file

For final flashing target device after selecting chip & uploading hex file Click on Auto.
Note: Please ensure Lock Chip before programming
If you want to lock chip than checked the Lock Chip option.

Now your chip is programmed successfully. When programmer is busy RED LED will on.

8051 & AVR USB ISP Programmer Support AT89S51,AT89S52,AT89SXXXX