1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Run a Attiny85 for a few seconds on a capacitor

Discussion in 'AVR' started by JacobT, Nov 23, 2015.

  1. JacobT

    JacobT New Member

    Joined:
    Nov 23, 2015
    Messages:
    12
    Likes:
    0
    Here is how I've put it together right now (using a lm2931 voltage regulator). I've put the diode and cap after the voltage regulator so that I can use just one voltage regulator (both to power the attiny and to signal that power is on).
    Turns out that the reduction in juice in the cap (going from 12V to 5V) is mirrored by the drop in power consumption by not powering the lm2931 from the cap. So I still get 5-6sec run time after the power is cut.

    On the diagram/board I've also added a voltage divider so I can monitor the battery and I'm considering adding some sort of reverse polarity protection, while still trying to keep the overall print as small as possible (In the board ignore the overlapping screw terminals, I intend to solder the wires directly onto the board and not actually use the screw terminals)
    -Jacob
     

    Attached Files:

  2. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,253
    Likes:
    961
    Location:
    Loveland, CO USA
    ONLINE
    R2, 10k is to cause C1 to collapse when the battery is gone.
    BUT
    R1, R3 is doing the same job.
    SO
    Remove R2.

    U1 pin7 should not see a voltage greater than U1 pin8. Inside the IC there is a diode from pin7 to pin8 that might conduct current. Please add a resistor to pin 7 to limit the current. (maybe R2).

    D1 should not be a 1N821 6.2V Zener but some thing like a 1N4148.

    Batter reverse protection:
    Move C1 close to IC1, Add 1N4148 from Battery to C1. This will protect IC1 and down stream. It will not protect the heater. (OK)
     
  3. hantto

    hantto Member

    Joined:
    Oct 25, 2002
    Messages:
    380
    Likes:
    1
    Location:
    Finland
    Personally, this is the way I would do it. schema.gif

    This way you don't need the extra diode for reverse polarity protection. The quiscent current of LM2931 seems to be about 0.4mA at zero load, which the ATTiny effectively is in sleep. Assuming a total average current drain of 0.5mA a 470µF cap would yield about 6s of operating time with a stable voltage to the ATTiny. Supply voltage stability is a nice thing if you want to make measurements with the ADC since then you don't have to take the possible reference voltage variation into account. It is doable but makes things a bit more complicated. The extra connection to the 5V line is redundant in my oppinnion, since you get the same information from the voltage divider.

    Like you noticed it is true that the voltage regulator is the power hog in this case (400µA vs 7µA) so you might actually get a longer runtime by putting it after the regulator. It is up to you how you want to make your circuit :)

    Note that the LM2931 requires a 100µF cap for stability according to the datasheet.

    One word of advice: put a bit of effort into making clean schematics. It is a lot easier to read them if they are not all over the place and follow logical structure and will make it easier for people to help you.

    Do post updates on how you are progressing!
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. JacobT

    JacobT New Member

    Joined:
    Nov 23, 2015
    Messages:
    12
    Likes:
    0

    Hi Guys
    Thank you for the feedback, I really appreciate it!

    Hantto, two questions for your diagram (which is so much nicer to read than mine.. I'll make an effort next time :) ):
    Considering the close proximity of all the components on the board, is C3 (100nF) needed?
    Also I see you have changed the values for the resistors in the voltage divider.. why? The reason I had a 1/4 divider was to "allow" slightly higher battery voltages than straight 12V (think some Li-ion batteries come in around 14V). Should I use greater resistors then say 1K and 3K like 10K and 30K?

    Thanks guys
    Jacob
     
  6. hantto

    hantto Member

    Joined:
    Oct 25, 2002
    Messages:
    380
    Likes:
    1
    Location:
    Finland
    You could most likely get away with only the 100µF cap. It is nevertheless good practice to have a cap in the nF-range near a circuit that is operating on high frequency (such as the atTiny). A 100µF will have a significantly higher impedance on high frequencies than a 1-100nF cap. If you can spare the room then I'd vouch for it. If you really want to miniaturize your project, then I'd suggest to move to SMD parts. SOIC packages and 0805 sized resistors and caps are not that hard to solder by hand.

    The voltage divider isn't that critical. If the atTiny uses 5V rail as it's reference voltage, then with the resistor values I have shown you would be able to measure a max voltage of (22k+10k)/10k * 5V = 16V. The 22k and 10k are very commonly used values. Using higher resistor values you minimize the current drain of the voltage divider from 12V/(1k+3k) = 3mA to 12V/(22k+10k) = 0.4mA. The 3mA is unnecessarily high. But to be fair, that is insignificant compared to the current the heater will drain, so it has really not that much of a difference. The only case where this might have a difference is if you have disconnected the heater but forgot to disconnect the control circuit. Either way, it does not cost anything extra to make the resistor values higher and makes the circuit a tiny amount better, so why not. The only thing to keep in mind is that you shouldn't exceed the recommended minimum source impedance for the ADC converter. I'm not that familiar with the atTiny, but i'm guessing it is around 10k or more. The source impedance with 22k and 10k resistors will be the same as if they were connected in parallel (thevenin equivalent source) i.e. around 7k, so we are good.
     
  7. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,253
    Likes:
    961
    Location:
    Loveland, CO USA
    ONLINE
    BIG capacitors store much power but are not good at delivering power fast. The little cap is good for fast. (The micro might be oscillating at 8mhz but the internal switching is probably happening at nS speed) So use the small cap.

    I like the 10k because the power loss is lower.

    I like the idea of measuring the battery voltage. You can make changes to the PWM when the battery voltage gets low. You might want to stop pulling heater power when the voltage gets too low. Some batteries will die if they are discharged too much.
     
  8. JacobT

    JacobT New Member

    Joined:
    Nov 23, 2015
    Messages:
    12
    Likes:
    0
    Cool guys, I'll make room for the small cap :)

    That's the idea and using it as a "is the power on or off" indicator at the same time is clever Hantto :)

    Since I'm trying to make it as small as possible I have two potentially silly questions.
    Should I expect the mosfet to get hot? I expect the to pull around 8A maks (though some heating suits can draw up to 14A).
    I was thinking of using a FQP30N06L because I have some but was wondering if there was a mosfet with a smaller footprint I could use instead....?

    Thanks guys!
    -Jacob
     
  9. hantto

    hantto Member

    Joined:
    Oct 25, 2002
    Messages:
    380
    Likes:
    1
    Location:
    Finland
    I'd say a TO220 packaged fet is a good component for this case, since you are going to see some heating. The FQP30N06L has a typical on-resistance of 35 milli ohms with 5V gate voltage. So the fet will be heated by roughly 0.035ohm * 8A^2 = 2.2W with a 8A load. This is ignoring switching losses, which we can do if you use a very slow PWM frequency. A good rule of thumb is that 1W is about the max power you can dissipate form a TO220 without a heatsink. So you are going to need a heatsink.

    We can analyze the heating in a simplified way here to get a feeling of the fet you have chosen. The junction to ambient resistance of that device is 62.5 deg C per watt, (this is only in a well-ventilated areas, i.e not a wet-suit) which would give junction temperature of 62.5*2.2 = 140 deg C, which is going to burn your skin if you touch it. 140 deg C is still less than the maximum specified max junction temperture of the device (175deg C) but at that temperature the on-resistance is going to be higher and would result in even more heating (thermal run-away).

    You can use this heating as a part of your heater too. So you could attach a piece of flat aluminum sheet to the fet and use that to warm yourself. Another solution would be to find a fet with a lower on-resistanse. Try looking for logic level fets.
     
    Last edited: Dec 2, 2015
  10. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,253
    Likes:
    961
    Location:
    Loveland, CO USA
    ONLINE
    0.035 ohms typical, 0.045 worst case.
    I noticed that this part get worse as the temp climes. Going from 25C to 50C causes a 1.2 increase in resistance.
    If this thing is enclosed in rubber or some insulator you will have problems getting the heat out.
    I think you want to keep the temperature down. It could cause burns.
     
  11. JacobT

    JacobT New Member

    Joined:
    Nov 23, 2015
    Messages:
    12
    Likes:
    0
    So would something like a IRFB7430PBF be better then?
    Seems the on-recistance is 0.0013ohm, so that would be 0.0014ohm*8^2 = 0.0832W.

    or have I missed something? It's about 3-4x the price of the FQP30N06L, but I can live with that if it means I don't have to sink heat and perhaps can pot the whole circuit...

    Edit: perhaps a PSMN4R5-40PS would be ok and a lot cheaper ;-) Max on resistance 0.0046ohm so that would be 0.2944W....
     
    Last edited: Dec 2, 2015
  12. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,253
    Likes:
    961
    Location:
    Loveland, CO USA
    ONLINE
    1/3 of a watt looks good to me.
    BUT
    That part is not "logic level" so it really wants 10 volts on the gate to turn it on. 5v is not enough.
    See if you can find a logic level MOSFET with 0.005 ohms.
     
  13. JacobT

    JacobT New Member

    Joined:
    Nov 23, 2015
    Messages:
    12
    Likes:
    0
  14. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,253
    Likes:
    961
    Location:
    Loveland, CO USA
    ONLINE
    Looks like a good part. Looks like 2.5V on the gate will just turn the part on. (depending on temp., etc)
    You will supply 5V so :).
     

Share This Page