Tag Archives: pwm

AVR RGB LED and Sound Show

Here is a nice and entertaining project created by http://www.ermicro.com . The author has a very good programming, teaching, drawing and artistic skills. The tutorial is well planned and executed. I really liked the RGB LED and Sound show given at the end. I will try it and tell how it works. Till then you can read the rest of the article here. Working with Atmel AVR Microcontroller Basic Pulse Width Modulation (PWM) Peripheral AVR RGB LED and Sound Show. The article also explain various PWM techniques like Fast PWM, Phase correct pwm, phase and frequency correct pwm. You will also learn tone generation using PWM technique. Here is a Video for Various PWM Experiments

AVR Project – ATmega8 Based Smart Code Lock

Here is a project for beginners using Atmel AVR ATmega8. The project uses some techniques that are very useful for designers to learn and utilize. Alphanumeric LCD Module Interfacing. 4×4 Keypad interfacing. PWM Control of LED (Used to dim the back-light of LCD, like in some Nokia Phones) Basic Circuit design for AVR MCUs Connecting relays and other current demanding devices. AVR Studio and project management. compiling using free avr-gcc compiler. Using eXtreme Burner – AVR to burn hex code to AVR MCU. NOTE: Don’t waste time finding each part running from shop to shop. Get all the parts with exact specification in a ready to use kit! Purchase ATmega8 based smart code lock KIT.   Fig.: ATmega8 Based Code Lock Fig.: ATmega8 Based Code Lock Project     Functions of the Project. This device can be used to code protect any electrical device (like an electronic door, lock or safe). The user must enter a correct password to gain access. The password is entered using the built in 4×4 keypad matrix. The main LCD Module is used to display messages to the user. As soon as correct password is entered the relay is activated. This is indicated by a LED which is placed near the relay. The relay remains on as long as the user wishes. You just need […]

Servo Motor Control by Using AVR ATmega32 Microcontroller

Servo motors are a type of electromechanical actuators that do not rotate continuously like DC/AC or stepper motors, rather they used to position and hold some object. They are used where continuous rotation is not required so they are not used to drive wheels (unless a servo is modified). In contrast they are used where something is needed to move to particular position and then stopped and hold there. Most common use is to position the rudder of aircrafts and boats etc. Servos can be used effectively here because the rudder do not need to move full 360 degrees nor they require continuous rotation like a wheel. The servo can be commanded to rotate to a particular angle (say 30) and then hold the rudder there. Servos also employs a feedback mechanism, so it can sense an error in its positioning and correct it. This is called servomechanism. So if the air flow exerts pressure on rudder and deflects it the servo will apply force in opposite direction and try to correct the error. Say if you ask servo to go and lock itself to 30 degrees and then try to rotate it with your hand, the servo will try hard and its best to overcome the force and keep servo locked in its specified angle. Servos are also used […]

Obstacle Avoiding Robot using AVR ATmega32 – Part III

Hello All, Welcome to the third part of the Obstacle Avoiding Robot Tutorial. Till now we have completed the mechanical construction and made the sensor for our robot. I have shown you how to control the motors and read values from sensor in last two parts of the tutorial. In this tutorial we create the master program for our robot. The job of the program is simple, to read values from the sensors, make a decision and command two motors. In this way our robot will roam about the room avoiding obstacles in its path. In our program we define three constants, namely RTHRES,CTHRES and LTHRES in the following way :- //Threshold Values For Sensor Triggering #define RTHRES 195 #define CTHRES 275 #define LTHRES 195 The constant value next to them is the triggering values. You can get this values as described in previous tutorial. Simply run the IR Sensor Test program and bring any obstacle near the sensor at about 15cm (6 inches) and note down these values against respective sensor threshold values. Do same for all three sensor. Now the program knows when the value comes near this threshold value, the sensor has a obstacle in front of it. Note that the value shown above is may not match with the values you obtained, that OK. In our […]

PWM Signal Generation by Using AVR Timers.

In the last tutorial you saw how the PWM technique helps us generate analog signals from a microcontroller. In this tutorial we will see how PWM generation is implemented with microcontrollers. Before you begin please see Introduction to PWM Introduction to AVR Timers Generation of PWM signals is such a common need that all modern microcontrollers like AVR has dedicated hardware for that. The dedicated hardware eliminates the load of generation of PWM signal from software (thus frees the CPU ). Its like asking the hardware to generate a PWM signal of a specific duty cycle and the task of CPU is over. The PWM hardware with start delivering the required signal from one of its PINs while the CPU can continue with other tasks. In AVR microcontrolers PWM signals are generated by the TIMER units. (See AVR Timer Tutorials) . In this tutorial I will give you the basic idea of how PWM signals are generated by AVR timers. Their are two methods by which you can generate PWM from AVR TIMER0 (for ATmega16 and ATmega32 MCUs). Fast PWM Phase Correct PWM Don’t worry from their names they will become clear to you as we go on. First we will be considering the Fast PWM mode. PWM Generation Fundas We will use the simplest timer, TIMER0 for PWM generation.(Note […]

Introduction to PWM – Pulse Width Modulation.

A digital device like a microcontroller can easily work with inputs and outputs that has only two state, on and off. So you can easily use it to control a LED’s state i.e. on or off. In the same way you can use it to control any electrical device on/off by using proper drivers (transistor,triac, relays etc). But sometimes you need more than just "on" & "off " control over the device. Like if you wanna control the brightness of a LED (or any lamp) or the speed of DC motor then digital (on/off) signals simply can’t do it. This situation is very smartly handled by a technique called PWM or Pulse Width Modulation. PWM is the technique used to generate analogue signals from a digital device like a MCU. Almost all modern MCUs have dedicated hardware for PWM signal generation. In this tutorial we will learn the basics of PWM technique and later on we will see how to implement PWM generation with AVR microcontrollers. PWM : Pulse Width Modulation A digital device, like a microcontroller can only generate two levels on its output lines, HIGH=5v and LOW=0V. But what if we want to generate 2.5v or 3.1v or any voltage between 0-5 volt output ? For these kinds of requirement, instead of generating a constant DC voltage output […]