No matter if you are a beginner or a professional developer, these AVR practical projects helps you to accelerate your projects with these sample projects. Each of these AVR practical projects contains everything you need to understand the project e.g. schematics, project files and codes and simulation projects.
In this project, by holding the button for 5 seconds, the LED becomes on. If we hold it for less than 5 seconds, it does not affect.
In this case, if not hold the key, the 20th line won’t run.
While (PINA. 1 = = 1)
And therefore, x becomes 0 constantly.
Now, if we hold it, program will enter the loop in 20th line and adds one every 0.1 seconds to X.
In this case, if we release the key as early as 5 seconds, X will be zero again.
After 5 seconds, X is more than 50, and the 24th line runs and the LED is on.
And until we hold the key, the LED will remain on and it won’t turn off. to turn it off, release the button and then we should hold 5 seconds again to turn it on back.
In this project, we can control the blinking speed by pushing these buttons.
the x variable can be between 1 and 30. When X is 1, the LED blinks every 10ms and when it is 30, the LED blinks every 300ms. Of course, when X is more, to reduce it you should hold the button longer!
This program, can measure the frequency up to 10KHz using external interrupt.
This program is suitable for measuring frequencies of less than 10KHz.
At high frequencies because the number of interruptions becomes so huge, the microcontroller must come out from 1 second delay function and go to interrupt function and then return to delay function again. And this may increase the duration of delay function execution. For solving this problem, we should create a delay function using a timer.
The LDR that we use in this project, is a light sensor and its resistance in the darkness is about 1M ohm and under the sunlight is about 1K ohm.
In this program, when the resistance of the sensor is about 100K ohm, the LED is on and when is about 50K ohm, the LED is off.
The below figure, describes the circuit of this project.
Also, for measuring the light, we use a 1M ohm resistor with LDR to use the voltage division rule to measure the voltage on the ADC pin. So, duo to the voltage division rule, when the LDR resistance is 100K ohm, the voltage on ADC pin is 0.45V and when the resistance is 50K ohm, the voltage is around 0.23V and the ADC measured values are 93 and 48.
In this program, when the temperature is above 30C, output is 1 and when the temperature is under 27 degrees, output is 0. Between 27C and 30C, output stays at its last sate. In the 30C, the sensor output is about 0.30V(ADC value: 61) and in 27C degrees, sensor output is 0.27V(ADC value: 55)
In this project, the microcontroller frequency is 8MHz. The USART baud rate is 9600 due to 51 or 33 UBBR register value.
In this program, the received data display in binary and ASCII form on the LCD.
In this program, the microcontroller frequency is 4MHz and the timer0 freq divider value is 1024. Duo to the calculations, the timer should count up to 7812 to spend 2 seconds and for counting up to 7812, 31.51 overflow happens. In this case the timer fully overflows 30 times and for that 0.51, counts around 132. For solving this problem (extra 132 counts), we load the timer value with 132.
The LED blinks every 2 seconds.
Because there are two different times in the program, one of these times will be approximate and one of the times will be accurate. In this program, the 3 seconds time is considered to be accurate. The frequency of the microcontroller is 2MHz. The frequency divider value is 1024 and to create 3 seconds a timer must count 5859 times, in this case, the timer overflows 22.88 times and duo to calculations the timer has 29 counts up to 23, and we should load this number in TCNT0.
In this program, the LED that is connected to port A0 blinks every 0.2 seconds (a bit more). The LED that is connected to PORT A.1 blinks every 3 seconds. Also, once the PORTA. 1 is turned on the “Welcome” is sent via USART by the printf() function. To set the baud rate to 9600, write 12 in the UBRR register, in this condition there is 0.16% error.
Also, don’t forget to checkout our Ultimate ARM Projects Pack.