All About Circuits Forum  

Go Back   All About Circuits Forum > Software, Microcomputing, and Communications Forums > Embedded Systems and Microcontrollers

Notices

Embedded Systems and Microcontrollers Discussion forum for projects and working with embedded systems and microcontrollers (FPGAs, PICs, AVRs). Get help with hardware issues and embedded programming.

Reply   Post New Thread
 
Thread Tools Display Modes
  #21  
Old 05-22-2007, 02:34 AM
hgmjr's Avatar
hgmjr hgmjr is offline
Super Moderator
 
Join Date: Jan 2005
Location: Tennessee, USA (GMT-6)
Posts: 9,030
Blog Entries: 11
Default

Quote:
Originally Posted by olusola View Post
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
Reply With Quote
  #22  
Old 05-22-2007, 02:56 AM
olusola olusola is offline
Member
 
Join Date: May 2007
Posts: 74
Default re

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
Reply With Quote
  #23  
Old 05-22-2007, 03:00 AM
hgmjr's Avatar
hgmjr hgmjr is offline
Super Moderator
 
Join Date: Jan 2005
Location: Tennessee, USA (GMT-6)
Posts: 9,030
Blog Entries: 11
Default

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.....

Last edited by hgmjr; 05-22-2007 at 03:03 AM. Reason: apology added
Reply With Quote
  #24  
Old 05-22-2007, 03:23 AM
olusola olusola is offline
Member
 
Join Date: May 2007
Posts: 74
Default

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 .......
Reply With Quote
  #25  
Old 05-22-2007, 10:05 AM
hgmjr's Avatar
hgmjr hgmjr is offline
Super Moderator
 
Join Date: Jan 2005
Location: Tennessee, USA (GMT-6)
Posts: 9,030
Blog Entries: 11
Default

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
Reply With Quote
  #26  
Old 05-22-2007, 11:33 AM
hgmjr's Avatar
hgmjr hgmjr is offline
Super Moderator
 
Join Date: Jan 2005
Location: Tennessee, USA (GMT-6)
Posts: 9,030
Blog Entries: 11
Default

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;
Select All
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

Last edited by hgmjr; 05-22-2007 at 11:42 AM. Reason: clarifying rewrite
Reply With Quote
  #27  
Old 05-22-2007, 12:10 PM
olusola olusola is offline
Member
 
Join Date: May 2007
Posts: 74
Default

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
Reply With Quote
  #28  
Old 05-22-2007, 12:14 PM
olusola olusola is offline
Member
 
Join Date: May 2007
Posts: 74
Default

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
Reply With Quote
  #29  
Old 05-22-2007, 04:52 PM
hgmjr's Avatar
hgmjr hgmjr is offline
Super Moderator
 
Join Date: Jan 2005
Location: Tennessee, USA (GMT-6)
Posts: 9,030
Blog Entries: 11
Default

Quote:
Originally Posted by olusola View Post
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?

Quote:

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.

Quote:
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

Last edited by hgmjr; 05-22-2007 at 04:56 PM.
Reply With Quote
  #30  
Old 05-22-2007, 08:39 PM
olusola olusola is offline
Member
 
Join Date: May 2007
Posts: 74
Default

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
Reply With Quote
Reply   Post New Thread

Tags


Similar Threads
Thread Thread Starter Forum Replies Last Post
Efficient use of power by MPPT charger Billy4184 The Projects Forum 33 06-30-2014 01:21 PM
Need help with new MPPT design theory lunds1990 The Projects Forum 1 10-17-2013 01:34 AM
Need advise for MPPT solar charger rabiuls The Projects Forum 8 08-18-2012 07:49 AM
Dual input MPPT on inverter Cerkit The Projects Forum 0 04-17-2012 10:45 AM
Help regarding MPPT rajasekarsmvec The Projects Forum 1 08-18-2011 06:20 PM

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:34 PM.


User-posted content, unless source quoted, is licensed under a Creative Commons Public Domain License.
Powered by vBulletin
Copyright ©2000 - 2014, vBulletin Solutions, Inc.