Опубликовано 2013-04-11 11:24:04 автором Ruslan

Wind turbine controller


After fabrication windmill , the question arose about the charge controller akb.Zadacha :
  • controller should output current and voltage values on the lcd display Show
  • power that produces wind turbine at a particular time , count the number of kilowatt / hours
  • Handling charge the battery , not giving up the voltage greater than 14.2 volts and the current - more than 1/10 of battery capacity
  • All excess energy that is produced by a wind turbine , the controller takes off on ballast ( it may be some ten volts at 12 kilowatts 2-3 ) Important: ballast must be selected so that when a charged battery controller can download windmill , otherwise he will go into the dressing , and you have to collect the blade to the neighbors .
The controller was made on the microcontroller avr atmega8 Internal controller kontroller iznutri wind turbine controller scheme  wind turbine controller circuitry The program is written in c CVAVR
# include
# include

/ / Alphanumeric LCD Module functions
# asm
. equ __ lcd_port = 0x12; PORTD
# endasm
# include
# include / / library which lezhyt function sprintf

int Af = 4000 , Uf = 14200 ;
unsigned long int u; / / variable to store the voltage in millivolts
unsigned long int a; / / variable to store the current
unsigned long int w; / / variable to store the power consumption
void incSkvag ()
{
if (OCR1AL! = 0 ) OCR1AL -;
}

void decSkvag ()
{
if (OCR1AL! = 255 ) OCR1AL + +;
}

# define ADC_VREF_TYPE 0x00

/ / Read the AD conversion result
unsigned int read_adc (unsigned char adc_input)
{
ADMUX = adc_input | (ADC_VREF_TYPE & 0xff);
/ / Delay needed for the stabilization of the ADC input voltage
delay_us ( 10 );
/ / Start the AD conversion
ADCSRA | = 0x40;
/ / Wait for the AD conversion to complete
while ((ADCSRA & 0x10) == 0 );
ADCSRA | = 0x10;
return ADCW;
}
interrupt [TIM0_OVF] void timer0_ovf_isr (void)
{
TCNT0 = 0x64;
a = read_adc ( 3); / / Read values from the ADC port 0
u = read_adc ( 5); / / Read the ADC value from port 1
/ *
  1. measure current Current flowing through the shunt vicheslyaetsya Ohm's law I = U / R R = 0,1 Ohm , a U ( voltage drop across the shunt ) we measure . Since we ADC 10 bit the maximum number of function which returns read_adc () will be equal to 1024, the number will ekvivalentom is the input voltage adc0. For example, if read_adc () returned 512 is then input means INTO adc0 E filed half of the reference voltage Shtoby vycheslit actual voltage we need existing proportions reference voltage - 1024 desired voltage - a In our reference voltage = 5.12 Seeking voltage = 5.12 * a/1024 or Seeking voltage = 0,005 * a For simplicity translated volts millivolts Multiplying by 1000 The desired voltage = 0,005 * a * 1000 Here vs'o well but we have not considered koefitsient op amp razschityvaetsya formula Gain = 1 + R1/R2 substituting obtain Gain = (1 +4) = 5 The actual voltage = 0,005 * a * 1000/5 we obtain a simple Measure the voltage
  2. Next measure the voltage across the resistor divider Existing proportions as described above and obtain Seeking voltage = 0,005 * u * 1000 We still consider koefitsient resistor voltage divider to us it is Kdel = (R1 + R2) / R2 substituting obtain Kdel = (10 +1) / 1 = 11 Relno voltage = 0,005 * u * 1000 * 11 * /
    u = 55 * u +400; / / calculate the voltage in millivolts
    a = a * 10; / / Current value vycheslyaem Ohm's law I = U / R = a/100 * 1000 = a * 10 in miliamperah
    w = a * u; / / vycheslyaem wattage
    / / adjust the voltage and current
    if ((a> Af) | | (a> 8000) ) / / adjust current
    {
    incSkvag ();
    }
    else
    {
    if (u> Uf) / / control voltage
    {
    incSkvag ();
    }
    else
    {
    decSkvag ();
    }
    }
    }

    void main (void)
    {
    / / Declare local variables here
    unsigned char i = 2 , k [ 3] [ 32 ];
    sprintf (k [ 0 ], "Setup A =% i", Af);
    sprintf (k [ 1 ], "Setup U =% i", Uf);
    / / Input / Output Ports initialization
    PORTB = 0b00011100;
    DDRB = 0b00000010;

    / / Port C initialization
    PORTC = 0x00;
    DDRC = 0x00;

    / / Port D initialization
    PORTD = 0x00;
    DDRD = 0x00;

    / / Timer / Counter 0 initialization
    / / Clock source: System Clock
    / / Clock value: 0,977 kHz
    TCCR0 = 0x03;
    TCNT0 = 0x00;

    / / Timer / Counter 1 initialization
    / / Clock source: System Clock
    / / Clock value: 15,625 kHz
    / / Mode: Fast PWM top = 0x00FF
    / / OC1A output: Inverted
    / / OC1B output: Discon.
    / / Noise Canceler: Off
    / / Input Capture on Falling Edge
    / / Timer1 Overflow Interrupt: Off
    / / Input Capture Interrupt: Off
    / / Compare A Match Interrupt: Off
    / / Compare B Match Interrupt: Off
    TCCR1A = 0xC1;
    TCCR1B = 0x0B;
    TCNT1H = 0x00;
    TCNT1L = 0x00;
    ICR1H = 0x00;
    ICR1L = 0x00;
    OCR1AH = 0x00;
    OCR1AL = 0xff;
    OCR1BH = 0x00;
    OCR1BL = 0x00;

    / / Timer / Counter 2 initialization
    / / Clock source: System Clock
    / / Clock value: Timer2 Stopped
    / / Mode: Normal top = 0xFF
    / / OC2 output: Disconnected
    ASSR = 0x00;
    TCCR2 = 0x00;
    TCNT2 = 0x00;
    OCR2 = 0x00;

    / / External Interrupt (s) initialization
    / / INT0: Off
    / / INT1: Off
    MCUCR = 0x00;

    / / Timer (s) / Counter (s) Interrupt (s) initialization
    TIMSK = 0x01;

    / / USART initialization
    / / USART disabled
    UCSRB = 0x00;

    / / Analog Comparator initialization
    / / Analog Comparator: Off
    / / Analog Comparator Input Capture by Timer / Counter 1 : Off
    ACSR = 0x80;
    SFIOR = 0x00;

    / / ADC initialization
    / / ADC Clock frequency: 500,000 kHz
    / / ADC Voltage Reference: AREF pin
    ADMUX = ADC_VREF_TYPE & 0xff;
    ADCSRA = 0x81;

    / / SPI initialization
    / / SPI disabled
    SPCR = 0x00;

    / / TWI initialization
    / / TWI disabled
    TWCR = 0x00;

    / / Alphanumeric LCD initialization
    lcd_init ( 16 );

    / / Global enable interrupts
    # asm ("sei")

    while ( 1 )
    {
    sprintf (k [ 2 ], "I =% u,% uA U =% u,% uV \ nW =% u,% lu K =% i",
    a/1000, / / Complete honor current
    (a% 1000) / 100 / / The fractional part of the current
    u/1000, / / integer part of voltage
    (u% 1000) / 100 / / The fractional part of the voltage
    w/1000000, / / Integer part power
    (w% 1000000) / 100000 / / The fractional part of the power
    OCR1AL
    ); / / string to form the output
    / / ------------------------------------------------ ---------------
    / / work with buttons
    if (PINB.2 == 0 )
    {
    / / toggle the menu
    if (+ + i> 2 ) i = 0 ;
    }

    if (PINB.3 == 0) / / check if you pressed plus
    {
    if (i == 0 ) {Af = Af +10; sprintf (k [i], "Setup A =% i ma", Af); }
    if (i == 1 ) {Uf = Uf +10; sprintf (k [i], "Setup U =% i mv", Uf); }
    }

    if (PINB.4 == 0) / / check if you pressed minus
    {
    if (i == 0 ) {Af = Af- 10; sprintf (k [i], "Setup A =% i ma", Af); }
    if (i == 1 ) {Uf = Uf- 10; sprintf (k [i], "Setup U =% i mv", Uf);}

    }
    lcd_clear (); / / clear display before displaying
    lcd_puts (k [i]); / / display the formation of a string to the display
    delay_ms ( 100); / / do delay
    };
    }
To repeat , we need:

                                                                                                                                   
Radiodetal Model Number The main characteristic Shop
The microcontroller Atmega8 1 Buy
lcd 16x2 1 znakosinteziruyuschy Buy
Transistor Field 1 N-Channel Buy
resistor 1 10k Buy
resistor 1 0.1 ohm Buy
resistor 1 100 ohms Buy
Operational amplifier TL074CN or

lm358

1 Buy

Buy

Schottky diode 10CTQ150PBF 1 Buy

Principle of operation . The controller dynamically check the current and voltage of the battery . When the battery is discharged , its resistance is small , so when charging through it can go high current ( greater than 1/ 10 of the container ) . Therefore, in the initial charge cycle CORRECT BATTERY controller ensures that the current does not exceed 1/10 capacity batarei.Po least resistance CORRECT BATTERY extend their charge , the current decreases and begins to increase the voltage on the battery. Controller ensures that the voltage does not exceed 14.2 . If the current or voltage within the established limits , the duty cycle of the PWM signal on pin PB1 growing and excess energy is thrown off to the ballast . Generator produces three-phase AC voltage , and we need to charge the battery DC voltage . Used to straighten the bridge collected under the scheme three-phase rectifier diode Larionov on three half-mile ( 6 diodes ) most Larionova To control scheme operated by the generator when there is wind and wasted not discharge the battery , I added three more bridge diode , and thus unleashed two plus power . most Larionov bipolar pitanie One plus is powered ballast and control system from the other battery is charging , so the energy of the battery can not get into the ballast control system works directly from the windmill .
Wiring controller
skhema controller connection vetrogeneratora skhema controller vetrogeneratora kak connect the controller vetrogeneratora To the input of a three-phase bridge connect our generator if the DC generator is connected to two vyvodam.Po any default controller is set for current 4 amps and 14.2 volts naprizhenie , if you need other size of their buttons , you can set the voltage and LCD toka.Na Screen displays current and naprizheniya zyaryadki battery , the power that goes to the battery and the duty cycle PWM signal (0 - maximum duty cycle of 255- minimum duty cycle ) . Proteus scheme and program for the microcontroller are archived Wind Controller.rar

Комментарии - (9)

  • as9 говорит:
    Здравствуйте. Собираю ваш контроллер, есть пара вопросов. 1. У вас максимальный ток - котрорый может измерить микроконтроллер 10 ампер (судя про протеусу), что нужно сделать чтобы при входе в мк 5вольт с операционника максимальный ток был 25А где подправить программку. Шунт и резисторы коэффициента усиления я конечно переделаю. 2. Во втором пункте в вашей программе напряжение расчитывается по формуле u=55*u+400. Мне не понятно что это за +400, откуда это взялось. 3. На какую частоту нужен кварц. Спасибо за помощь
  • as9 говорит:
    Во всем разобрался, спасибо вам за схему и прошивку, остался один вопрос, контроллер не сохраняет настройки при сбросе питания
    • AdminRu говорит:
      Настройки не сохраняет. Нужно сохранять настройки в переменные eeeprom, а при запуске проверять если в них чтото сохранено грузим настройки с eeeprom переменных, иначе ставим настройки по умолчанию.
  • Imtoo3gpvc говорит:
    А почему схема представленная а скришоте и та что во вложенном файле отличаются и перечень элементов не полный
  • sanya говорит:
    ответьте пожалуйста))) скачал я файл а ето не контроллер а ваттметр не могли б вы помочь с достоверными файлами етой статьи?) спасибо заранее)))
  • Vit1963 говорит:
    Как выставить фюзы в AVRDUDE

Добавить комментарий

Для отправки комментария вы должны авторизоваться.