re; any help mppt

hgmjr

Joined Jan 28, 2005
9,027
DAC and Op Amps
on testing, i noticed the voltage from the first op-amp being inveted, so i'm using the 2nd op-amp to invert it .
...

Olu
If the polarity of the hardware is not what you need from the DAC, keep in mind that the beauty of using a microcontroller is the flexibility it gives you. You can always arrange to invert the binary data that you are inputting to the DAC to achieve an inversion in its output.

hgmjr
 

Thread Starter

olusola

Joined May 21, 2007
74
hi,
thanks again. well the circuit diagram is just an almost complete sketch. sorry about that. wel l they are all connected to ground, both the solar cell and the mosfet (well from tehsource to the shunt to ground).

about inverting.. wow. you're the expert. you tell me, and i do. thanks .
just trying to sort it asap too .

thanks

Olu
 

hgmjr

Joined Jan 28, 2005
9,027
The opamp that is driving the MOSFET's gate has a capacitor from its output to its positive input. That is not the correct way to connect up an opamp as an integrator if that was your intent. You will need to swap the connections between the positive and negative inputs on this opamp if an integrator stage is what you were aiming for.

In any case it is rare that an opamp is hooked up with positive feedback in this way.

BTW, sorry for sprinkling you with these stream-of-conciousness replies.

hgmjr

PS. Time for some shuteye.....
 

Thread Starter

olusola

Joined May 21, 2007
74
hi,
thanks. em, that op-amp is to be used as a comparator. oh wot do u suggest?

pls feel free with the replies. with as much as i have, i'm not sure how much shut eye i can get?

thanks but yea, pls keep the suggestions coming.

regards

Olu

....if i dont reply soon .......
 

hgmjr

Joined Jan 28, 2005
9,027
I'm not sure if a comparator is what is needed there.

It would be helpful to the troubleshooting process if you could write a brief outline of the way you envision your mppt design to work with the hardware setup you have.

It appears from the circuitry that your basic idea is to measure a voltage proportional to the output of the solarcell and measure/calculate the associated current and then calculate a value that equates to the power from the solarcell. Based on this power value, you would then tailor the loading on the solarcell for optimum power output using the MOSFET as an adjustable load.

hgmjr
 

hgmjr

Joined Jan 28, 2005
9,027
Rich (BB code):
//***** First Conversion - Discard)
// Measure Voltage
    ldi Temp, (1<<REFS1)|(1<<REFS0)|(0<<MUX0); set voltage meausurement channel and internal referece
    out ADMUX, Temp;
    sbi ADCSRA, ADSC; start A-D conversion
ADC_wait_K:; wait until A-D conversion finished
    sbis ADCSRA, ADIF;
    rjmp ADC_wait_K;
    in Voltage_L, ADCL; Store Converted Low Bit value
    in Voltage_H, ADCH; Store Converted High Bit value
//sbi ADCSRA, ADIF;
 
sei;  // Enable Global Interrupts...
 
//  Idle in  this "do-nothing"  loop waiting for next interrupt....
 
Loop_here:  
rjmp Loop_here
 
//============================================================================
// Timer 1 interrupt routinte - MPPT
MPPT:
// Reset Timer 1 clock counter
    clr Temp;
    out TCNT1H, Temp;
    out TCNT1L, Temp;
I foresee a potential problem in your coding (reference the excerpted code snippet) .

The code execution appear to be fine up to the point just after your throw-away ADC read. After execution of this ADC read there is nothing to prevent execution from crashing into the timer1 interrupt. This is bound to lead to unpredictable behavior by the program.

I have added a do-nothing loop (shown in red) that will prevent this from happening and give the micro a place to idle between Timer1 interrupts.

You may also want to consider postponing your enabling of global interrupts (sei) until you have completed the throw-away ADC read.

The strategy you are using that puts all of the heavy-lifting of your program inside the timer1 interrupt service routine my not be the most efficient way to go. That is a lot of processing to be done between interrupts which means you will need to make sure that the interrupt service routine has ample time to complete all of the work and clear out before another timer1 interrupt takes place. You can leave it that way for the moment and then decide whether you will benefit by changing it later. It just means that you will need to set the timer1 interrupt rate to say 5 to 10 times per second to be very conservative.

First we need to get your hardware sorted out.

I will be at my work soon so I will have to leave you to consider all my comments thus far.

hgmjr
 

Thread Starter

olusola

Joined May 21, 2007
74
hi,
thanks for your comments .
so what do you recommend apart for the comparator?

you have pretty much the idea of the circuitry. yes measure a voltage and also a proportional voltage to get the current in the circuit, then calculate the power in the circuit.
then Based on this power value,adjust the loading on the solarcell for optimum power output using the MOSFET as an adjustable load.

as for the interrupts, i just put in that code after reading that the first conversion value of the ADC in the ATMEga16 might be inaccurate.
should i remove it?

also , should i change the timer values to the ones you suggested earlier?
I am still trying to fully understand the workings of these timers.

thanks. have a nice day at work.
still hoping to hear from you

cheers
 

Thread Starter

olusola

Joined May 21, 2007
74
the reason for the comparator being is to respond to the the control voltage from the ADC with respect to the present voltage from the circuit
 

hgmjr

Joined Jan 28, 2005
9,027
hi,
thanks for your comments .
so what do you recommend apart for the comparator?
A comparator at this point in the circuit would mean that the gate voltage on the MOSFET active load would be either high or low. This would mean that he mosfet would either be on or off. This would result in the load to the solarcell being either the resistance in series with the mosfet of an open circuit. Since you are feeding the voltage at the mosfet's source into one of the mux'ed inputs to the ATMEGA16's 10-bit ADC, then I suspect you are looking for linear changes in the mosfet's source voltage and therefore I conclude that you are looking for linear changes in the gate voltage. For that reason, I suspect you will want to use something other than a comparator.

Can you confirm this assessment of your intent?

as for the interrupts, i just put in that code after reading that the first conversion value of the ADC in the ATMEga16 might be inaccurate.
should i remove it?
The throw-away read of the ADC's first conversion is probably a good thing to do as a precaution and it cost little in the way of code so I would hang onto it.

also , should i change the timer values to the ones you suggested earlier?
I am still trying to fully understand the workings of these timers.
Once we get a better grip on the hardware setup we can then deal with the timer1 setup. I will be happy to recommend a timer1 configuration for your consideration once we reach that point.

Can I assume that you are under no time schedule crunch to solve this problem?

Did my comment on the need for an idle loop in my previous reply make sense?

hgmjr
 

Thread Starter

olusola

Joined May 21, 2007
74
hi,
wow, thanks again.
oh, i think i then made a wrong decision on the comparator. yes what i want is a linear change in the gate voltage. and thought the op-amp used as a comparator will enable this. thanks for spotting that.
what do you then recommend? i am trying to enable a swing between resistance from about 10ohms to say about 300ohms.

on the ideal loop, i would appreciate if you could throw more light on it.

i am actually on a time schedule for this as i need a demo working for next week.

thanks
 

hgmjr

Joined Jan 28, 2005
9,027
hi,

i am trying to enable a swing between resistance from about 10ohms to say about 300ohms.
The value of the resistor in series with the mosfet is not that clear on your attached schematic diagram. Can you tell me what the value is?

on the ideal loop, i would appreciate if you could throw more light on it.
I will help you with the software once we get your hardware sorted out.

i am actually on a time schedule for this as i need a demo working for next week.
Less than a week to sort this out and get you up and running on a demo is going to cut it close.

hgmjr
 

Thread Starter

olusola

Joined May 21, 2007
74
Hi,
wow, i am really grateful for your help.

the value is 1.25ohms 5W - shunt resistance .

i actually have all the components and circuit temporarily built up, and so i'm really hoping i can get the errors out of the way.

thanks so much .

olu
 

hgmjr

Joined Jan 28, 2005
9,027
Can you provide me with some insight into what you had in mind by providing the connection between the pickoff point from the solarcell and the opamp that feeds the mosfet bypassing the micro?

hgmjr
 

hgmjr

Joined Jan 28, 2005
9,027
A. What is the optimum power you are trying to obtain from the solarcell?

B. What is the open circuit voltage?

C. What is the short circuit current?

hgmjr
 

Thread Starter

olusola

Joined May 21, 2007
74
hi, thanks
well i guess this follows from the comparator side of things.
the voltage divider across the solar-cell (170k and 10k) ,voltage divides to get a maximum of 2.5V. this is the maximum for the microcontroller.
this is first amplified to a maximum of 5V with the first op-amp, then it is brought to the comparator. i guess was thinking of much more of like a feedback loop in which the circuit is readjusted (mosfet resistance changed -voltage controlled) to the voltage set by the microcontroller.

from what you have been able to highlight, it is looking like this is an error. i saw someone use this method though his own was connected to a computer, so i thought i could use the idea.

do you think i dont need it anymore? or ?


also the second branch that has the mosfet is similarly voltage divided for a maximum of 2.5V over the 1.25ohm resistor. (solar cell max expected current 2A); now it is expected the mosfet to be able to range from say about 10ohm (well probably in low light condition) to about 300-400ohms


thanks
 

hgmjr

Joined Jan 28, 2005
9,027
hi, thanks
well i guess this follows from the comparator side of things.
the voltage divider across the solar-cell (170k and 10k) ,voltage divides to get a maximum of 2.5V. this is the maximum for the microcontroller.
I have crunched the numbers on your voltage divider. With the 170K and 10K as you indicated, I calculate that you would need 45V out of the solarcell to get 2.5V.

Is that what you actually expect to see as an open circuit output from the solarcell?

this is first amplified to a maximum of 5V with the first op-amp, then it is brought to the comparator. i guess was thinking of much more of like a feedback loop in which the circuit is readjusted (mosfet resistance changed -voltage controlled) to the voltage set by the microcontroller.

from what you have been able to highlight, it is looking like this is an error. i saw someone use this method though his own was connected to a computer, so i thought i could use the idea.

do you think i dont need it anymore? or ?
I recommend you ditch the comparator.

also the second branch that has the mosfet is similarly voltage divided for a maximum of 2.5V over the 1.25ohm resistor. (solar cell max expected current 2A); now it is expected the mosfet to be able to range from say about 10ohm (well probably in low light condition) to about 300-400ohms
So I gather you are looking at a short circuit current of 2 amps and possibly an open circuit voltage of 45 volts?

Is that correct?

It would be useful to know what the optimum power point you will be trying set as your operating point.

hgmjr
 

Thread Starter

olusola

Joined May 21, 2007
74
yes this is true.
45V and 2A

so if i ditch the comparator, do i also ditch the amplifier before it?


Optimum power point should i say about 10watts for now?
but yes, the sun intensity (irradiance) , varies, and hence looking at using the mosfet to vary the resistance in order to get maximum power from the solar cell.
 

hgmjr

Joined Jan 28, 2005
9,027
I have noticed that you have no direct way of measuring the current flowing through the solarcell.

What I believe is needed is a current sense resistor in series with the solarcell. Placing one of your 1.25 ohm resistors is probably too large as it would drop way too much voltage at the upper current limit of your solarcell. Now you could get away with say five of these resistors in parallel. That would give you 0.25 ohms. That might be reasonable. You could then use one of the spare opamps to provide you a gain of around 10 to get 5 volts that would correspond to 2 amps. You could then feed this signal to one of your unused ADC mux inputs and then measure the solarcell current that way.

Your schematic does not indicate that you are attaching a load to the solarcell but I assume that is the case. Right?

hgmjr
 

Thread Starter

olusola

Joined May 21, 2007
74
i have no direct way of measuring the current.
the plan is to measure the voltage across the shunt resistor and then calculate the current by dividing by the resistor.

i am not attaching any load; right now the first design is to dissipate the power in the mosfet - hence such a mosfet (oh i have heat sinks ready).

thanks
 

hgmjr

Joined Jan 28, 2005
9,027
yes this is true.
45V and 2A

so if i ditch the comparator, do i also ditch the amplifier before it?
Very possibly yes. It depends on the output voltage level of your DAC which I think is going to be ample.

The mosfet has a Vgs MAX value of 5V. I hesitate to recommend powering the DAC with 5 volts as I think that might cause problems if the output of the DAC opamp can't swing close to +5V rail.

Optimum power point should i say about 10watts for now?
but yes, the sun intensity (irradiance) , varies, and hence looking at using the mosfet to vary the resistance in order to get maximum power from the solar cell.
For now, I will assume 10W in any of the calculations that I make.

hgmjr
 
Top