Solar tracker

Discussion in 'The Projects Forum' started by odinhg, Oct 23, 2009.

  1. odinhg

    Thread Starter Active Member

    Jul 22, 2009
    65
    15
    Hi! I'm building a solar tracker which uses 2 LDRs, placed on the sides of the box the circuit is in, which sense where the sun is. Then an Atmega168 is driving the trackermotor until both LDRs get the same amount of light.

    There is also a fan motor, which gets turned on and of if the temperature is getting too high.

    Anyways, when I gave the circuit 12VDC from a power supply it drew over 1A without any of the motors connected. Just the on-board circuit.

    The 7812 got really hot. Luckily the power supply stops when the current gets to high, so I think the circuit survived.

    I've attached the schematics.

    Does anyone see what the problem can be?

    I'll be grateful for any replies! Thanks in advance.
     
  2. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Looks to me that Q4 and Q5 are upside down.
     
  3. odinhg

    Thread Starter Active Member

    Jul 22, 2009
    65
    15
    Thanks for the quick reply MikeML. It can absolutely be the case. I haven't built a H-bridge with mosfets before this.

    Do you think any of the parts can have taken damage of this? (Maybe hard to say without seeing the actual circuit, but theoretically). The only thing which got hot was the 7812, not the mosfets, op-amps nor the micro.

    Thanks again!
     
    Last edited: Oct 23, 2009
  4. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    You are trying to use a 7812 regulator with a 12v input. That won't work well, because a 7812 regulator has a dropout of 2v. The output from the regulator will be Vin-2v or 12v, whichever is lower.

    You are feeding the 5v regulator from the output of the 12v regulator, and the 12v output is being used to supply the motors. If the motors are brushed type, you will have very large transients on the 12v supply.

    You're going to wind up with the dreaded "shoot-through" condition, because you're trying to control the gates of the high and low side MOSFETS using a single signal.

    At some point, both the high and low side MOSFETs will be conducting, which will act as a dead short across the 12v supply. This will cause the 5v supply to drop off, and your uC will reset.

    The LF356 is an opamp, and does not have rail-to-rail outputs. I briefly tried simulating that portion of your circuit, and it performed very poorly.

    Anyway, to avoid the dreaded shoot-through condition, you need to turn off the MOSFET that is currently conducting and wait for a period of time (a millisecond should be enough time) before turning on the other MOSFET.
     
    Last edited: Oct 23, 2009
  5. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Continuing...

    Your H-bridge doesn't have provisions for "all off" nor "brake".
    This means that your uC will have to constantly reverse the direction of current through the motor in order to maintain a somewhat stable position. This will be hard on the motor. You should stop the motor before reversing it's direction.

    To effect a braking condition, you would turn on just the two lower MOSFETs, or just the two upper MOSFETs.

    [eta]
    Your R8/R9 voltage divider across 12v will give a reference input voltage of around 4.31v.
    Since you are providing the other input from TTL levels (0v-5v), it would be better to use 2.5v for the reference input. It would also be better to use a divider across the 5v supply instead of the 12v supply.

    If your motor's current requirements are 1A or less (which it seems it would be; as you're using a 1A regulator for 12v) you might consider looking at an L2720, L2722 or L2724 dual power opamp. ST Microelectronics makes them. Download the datasheet, and look at figure 8 on page 5. It's using the dual power opamp itself as an H-bridge, with control inputs provided by a uC.
     
    Last edited: Oct 23, 2009
  6. odinhg

    Thread Starter Active Member

    Jul 22, 2009
    65
    15
    SgtWookie, Thanks you so much for taking time to analyze the circuit!!

    It isn't my schematic, I just got a defect circuit and assumed the schematic they came with was working. So I guess I've to do some changes to make the next revision performe better.

    Since I was in a hurry, I didn't check the schematics good enough before printing the PCB. Heh.

    But is there any way I can make the current circuit work with some dirty wire fixes and cutting traces? Or do I have to throw the whole thing and start from scratch?

    I'm sorry if I'm asking too stupid questions, please bear with me.
     
  7. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    There are so many problems with the circuit that you would be better off to start over.

    As I mentioned before, the performance of the LF356 opamp was quite poor for your application. It would've been better to have used a comparator.

    Take a look in ST Microelectronics' datasheet for the L2720/L2722/L2724; the schematic for using that power opamp as an H-bridge driven by a uC is very simple.
     
  8. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    I'd omit the comparators, and use the uC for controlling the H-Bridge. Another way to boost efficiency would be to use a solar cell on each side in place of the LDR. The output of which can be read by the ADC of the uC, eliminating the need for a voltage divider on the LDRs - Self powered sensors, if you will.

    Re-Designing it, the system would need only 2 inputs and 2 outputs of the uC, 1 ADC for each solar cell, and 2 lines to control the H-Bridge. Use an L293D or similar H-Bridge depending on power requirements to not overload the uC.
     
  9. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Our OP would have to use driver circuits for the MOSFET gates.
    The lower N-ch MOSFETs are not logic level; they require 0v to be fully turned off, and 10v to be turned fully on. The person who drew the schematic originally thought the LF356 opamps would take care of that, but it was a poor choice as their outputs are not rail-to-rail, and rise/fall times would be slow.

    Also, there would still be a problem with shoot-through. In order to avoid the shoot-through condition completely without lots of extra hardware, our OP could simply use one I/O port per MOSFET. That was the whole reason for suggesting the L2720/L2722/L2724 power MOSFET; then there would be no concerns about shoot-through, and they could be controlled directly by two uC output pins. Only a single voltage divider across +5v would be required to provide a Vref.

    Well, solar cells are comparatively large, fragile and expensive. If our OP already has the LDR's, they might as well use them.
     
    Last edited: Oct 25, 2009
  10. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    Since you have many unused IO lines, you can implement the features "all-off" and "braking" that sgtwookie mentioned by allocating an IO line through whatever interface device you use to buffer the 5V logic signals from the AVR to the 12V control lines required by the mosfets to each of the for legs of the H-bridge.

    hgmjr
     
  11. odinhg

    Thread Starter Active Member

    Jul 22, 2009
    65
    15
    Thanks guys! I really appreciate your inputs.

    thatoneguy: That's not a bad idea, but using solar cells for sensors is not an option in my case.

    Since the motor(s) is drawing so little current, the SN754410 looks intresting. And I've used it for some small motors before with success.

    I've designed a new circuit. I'm still a newbie when it comes to circuit design, so I would be very thankful for any feedback on the new schematic. :)
     
Loading...