Posts

Interfacing Stepper Motor with 8051Microcontroller

Image
 Interfacing Stepper Motor with 8051Microcontroller A stepper motor, also known as a step motor or stepping motor, is a brushless DC electric motor that divides a full rotation into a number of equal steps. The motor's position can then be commanded to move and hold at one of these steps without any position sensor for feedback (an open-loop controller), as long as the motor is carefully sized to the application in respect to torque and speed. Interfacing Stepper Motor with 8051 Microcontroller We are using Port P0 of 8051 for connecting the stepper motor. HereULN2003 is used. This is basically a high voltage, high current Darlington transistor array. Each ULN2003 has seven NPN Darlington pairs. It can provide high voltage output with common-cathode clamp diodes for switching inductive loads. Wave Drive Mode  − In this mode, one coil is energized at a time. So all four coils are energized one after another. This mode produces less torque than the full-step drive mode. The following

Serial Interrupt Programming in 8051 Microcontroller

Image
Serial Interrupt Programming in 8051 Microcontroller Baud Rate calculation: To meet the standard baud rates generally crystal with 11.0592 MHz is used. As we know, 8051 divides crystal frequency by 12 to get a machine cycle frequency of 921.6 kHz. The internal UART block of 8051 divides this machine cycle frequency by 32, which gives the frequency of 28800 Hz which is used by UART. To achieve a baud rate of 9600, again 28800 Hz frequency should be divided by 3. This is achieved by using Timer1 in mode-2 (auto-reload mode) by putting 253 in TH1 (8-bit reg.) So 28800 Hz will get divided by 3 as the timer will overflow after every 3 cycles. we can achieve different baud rates by putting the division factor in the TH1 register. Division factor to achieve different baud rates Baud Rate TH1 (Hex) 9600 FD 4800 FA 2400 F4 1200 E8 SCON: Serial Control Register      Serial control register SCON is used to set serial communication operation modes. Also, it is used to control transmit and receive

LCD Interfacing with 8051 Microcontroller

Image
LCD Interfacing with 8051 Microcontroller Hex Code Command to LCD Instruction Register 0F LCD ON, cursor ON 01 Clear display screen 02 Return home 04 Decrement cursor (shift cursor to left) 06 Increment cursor (shift cursor to right) 05 Shift display right 07 Shift display left 0E Display ON, cursor blinking 80 Force cursor to the beginning of the first line C0 Force cursor to the beginning of the second line 38 2 lines and 5×7 matrix 83 Cursor line 1 position 3 3C Activate the second line 08 Display OFF, cursor OFF C1 Jump to the second line, position 1 OC Display ON, cursor OFF C1 Jump to the second line, position 1 C2 Jump to a second line, position 2 Circuit Diagram : Source Code: // Program for LCD Interfacing with 8051 Microcontroller (P89V51RD2) #include<reg51.h> #include <string.h> #define display_port P2 //Data pins connected to port 2 on microcontroller sbit rs = P0^0; //Register Select pin connected to pin 0 of port 0 sbit rw = P0^1; // Read/Write pin c

Control LEDs with Voice Command

Image
Control LEDs with Voice Command This is a very basic project for controlling LED (Red) using voice control. To accomplish this we have used the Bluetooth HC-05 module and android apps are available on the play store. LEDs will be On/Off on your voice command. Procedure:- Make the connections as shown in the connection image. Don’t connect the RX & TX pins WHILE/BEFORE  uploading the code! Copy the code given below. Download any app called  BT Voice Control. Open the app   (It will automatically turn on the device’s Bluetooth). Go to options. Click on  “Connect”.  Choose the device – HC 05. When you are connecting to the Bluetooth module for the first time, it will ask you for the password. Enter  0000  OR  1234.  When the device gets successfully paired with the sensor, the LED lights on the sensor will start blinking at a slower rate than usual. DONE. Copy the code given below & test it out! Source Code:- String voice; #define RED 8 void setup() { Serial.begin(9600); pinM

LM386 based audio amplifier

Image
LM386 based audio amplifier: circuit and working.   we will show you how to build LM386 Audio Amplifier Circuit. It is a very low-cost audio amplifier and can power any speaker. For the cost and size of the circuit, the sound from the LM386 Audio Amplifier can be adequately loud. There are many Audio Amplifier Circuits designed using LM386 IC. The main problem with these circuits is noise and interference. The noise from the Amplifier Circuit designed in this project is considerably less and if designed on a proper circuit board, this will make a great Audio Amplifier. Introduction to LM386 The LM386 is an all–in–one Class-AB Audio Amplifier IC that can be used in a variety of applications. LM386 IC has been in use for decades and is still being used as an Amplifier in Computer speakers and Portable Stereos. LM386 is a low voltage power amplifier with an inactive power draw of 24mW, which makes it suitable for battery-controlled applications. The most common package for LM386 is an 8 –

Interfacing LED with 8051 Microcontroller in Assembly

Image
Blinking 1 LED using 8051 This is the first project regarding 8051 and of course one of the simplest, blinking LEDs using 8051. The microcontroller used here is AT89S51 In the circuit, push-button switch S1, capacitor C3 and resistor R3 form the reset circuitry. When S1 is pressed, the voltage at the reset pin (pin9) goes high and this resets the chip. C1, C2, and X1 are related to the on-chip oscillator which produces the required clock frequency. P1.0 (pin1) is selected as the output pin. When P1.o goes high the transistor Q1 is forward biased and LED goes ON. When P1.0 goes low the transistor goes to cut off and the LED extinguishes. The transistor driver circuit for the LED can be avoided and the LED can be connected directly to the P1.0 pin with a series current limiting resistor(~1K).  The time for which P1.o goes high and low (the time period of the LED)  is determined by the program. The circuit diagram for blinking 1 LED is shown below. Program. START: CPL P1.0 ACALL WA