April 26, 2018

Mini Windmill Power Generation Project code

Renewable energy has been on an increasing demand in the recent due to over stress on non-renewable resources and their increasing cost. Thus producing electricity with the use of renewable resource Wind energy has been taken up in this project. A Windmill, which rotates when there is enough wind, generates electricity owing to magnetic coupling between the rotating and stationary coil. A horizontally rotating prototype of Windmill is being used in this project. Mini Windmill Power Generation Project harnesses the Windmill i.e, Wind Turbine Generator to charge a 12V Battery. The System is based on Atmega8 microcontroller which smartly senses and charges the battery while displaying the voltage on the LCD. The Windmill, when in enough wind to drive it, generates power enough to charge a battery. Since it can work in favorable natural conditions by itself without consuming fossil fuel, it can charge the battery automatically and that too without any harmful emissions. Thus this project is an example how natural resources like the wind energy can be efficiently harnessed to produce electricity in harmony with nature.

#include
#include
#include
#include
#define F_CPU 8000000UL
float v=0;
char buffer[200]={0};

void lint( float x)
{

sprintf(buffer, “%d “,x);
lcd_str(buffer);
}
void lcd_cmd(unsigned char cmd)
{
PORTB=cmd;
PORTD&=~0x44;//rs
PORTD|=0x88; //en
_delay_ms(100);
PORTD&=~0x80;
}

void lcd_init()
{
lcd_cmd(0x01);
lcd_cmd(0x80);
lcd_cmd(0x38);
lcd_cmd(0x0c);
}

void lcd_dat(unsigned char dat)
{

PORTB=dat;
PORTD|=0x44;//rs
PORTD|=0x88; //en
_delay_ms(100);
PORTD&=~0x80;}

void lcd_int(unsigned int y)
{
unsigned char j=0,a[]={0,0,0,0};
{
while(y)
{
a[j]=10;
y=y/10;
j;
}
for(j=0;j<4;j++) lcd_dat(a[5-j]+48); } } void lcd_str(unsigned char x) { //lcd_cmd(y); while(x !='\0') { lcd_dat(*x); x++; //_delay_ms(20); } while(x) { lcd_dat(*x); x; } } int main(void) { DDRD|=0xf0; DDRB=0xff; lcd_init(); lcd_str(" Windmill "); lcd_cmd(0xc0); lcd_str("Power Generation "); Replace with your application code _delay_ms(5000); lcd_cmd(0x01); while (1) { lcd_cmd(0x80); ADMUX=0x00; ADCSRA=0xc7; while((ADCSRA & 0x10)==0x00); v=ADC; lcd_str("V="); v=((v*5)/333); sprintf(buffer,"%.2f",v); lcd_str(buffer); //lint(v); // lcd_int(v); lcd_str(" V "); ADCSRA|=0x10; { lcd_cmd(0x80); ADMUX=0x00; ADCSRA=0xc7; while((ADCSRA & 0x10)==0x00); v=ADC; lcd_str("V="); v=((v*5)/333); sprintf(buffer,"%.2f",v); lcd_str(buffer); //lint(v); // lcd_int(v); lcd_str(" V "); ADCSRA|=0x10; } }