Author Topic: Attiny85 High Current MOSFET Board  (Read 3015 times)

0 Members and 1 Guest are viewing this topic.

Offline mebaTopic starter

  • Contributor
  • Posts: 17
  • Country: de
Attiny85 High Current MOSFET Board
« on: October 22, 2020, 04:15:48 pm »
Hi,

I am getting started with designing my own PCB and I have a few questions regarding my schematics and the PCB layout.

My goal is to create a PCB with a small button that will allow me to switch a high current (up to 25A). Everything will be powered by a single 18650 battery - which is rated for a continuous current draw of 30A. However the circuit won't be switched on permanentely - only for a few seconds at a time. Maybe I will also use PWM to adjust the output.

To switch the load I am going to use a BUK9Y19-55B N-Channel MOSFET. The traces handling the high current have a width of 4.5mm and the copper will be 70µm thick. So 25A should be fine, since the power will never be on for longer than 10s at a time.

There is a small LED to indicate the status of the board. I chose the WS2813 mini since it does not need a capacitor and resistor like the WS2812 does - However due to the availability I might go back to the WS2812 and add the capacitor in front of it.

As the brain I am using an Attiny85. It reads the button input, controls the LED and switches the MOSFET. For programming and maybe adding more features later on, I added through holes which are connected to the Attinys pins.

Now I wonder if there are there any obvious faults I have made so far or things I can do to improve the PCB?
I wonder how the Attiny will behave if I switch on the power. Might the sudden voltage drop of the battery (caused by the high current draw) cause problems? Could I add a capacitor to solve this?
Should I be worried about interference at such a high current so close to the Attiny?

Schematic:


PCB layout:


I will add ground planes later on, but I decided to not include them yet, so it is easier to see where all the traces go.
 

Offline drvtech

  • Regular Contributor
  • *
  • Posts: 111
  • Country: gb
Re: Attiny85 High Current MOSFET Board
« Reply #1 on: October 22, 2020, 06:07:36 pm »
My concern would be heat dissipation in the transistor. Let's say your supply voltage drops to 3.5V when on.  You now have a Rds of around 20-25mOhms. Actually the line on the graph disappears at that point and is heading north rather rapidly. At 25A that gives nearly 16W dissipation. OK for a second maybe with a nice rest before the next one but "a few seconds"? How many is a few? Will you have some way of getting that heat away from the transistor? Will your Attiny have a duty cycle limit built in?
 
The following users thanked this post: meba

Offline mebaTopic starter

  • Contributor
  • Posts: 17
  • Country: de
Re: Attiny85 High Current MOSFET Board
« Reply #2 on: October 22, 2020, 07:32:52 pm »
Thanks for the response.
The Attiny will measure the battery voltage and won't accept any more button presses if the voltage is below ~3.6V.

I did a quick check and it will be on for 2-5 seconds at a time. If the button is pressed for longer than 6s, it will automatically turn off. And then rest for at least 15 seconds. 25A also is the absolute maximum, I think most of the time it will be more like 15-20A. If 25A is too much, I could also limit it to a maximum of 20A.
So far I am not planning on adding a heat sink to the transistor. Some of the heat might be dissipated by the ground plane and then spread across the board, but of course that's not a proper cooling solution.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Attiny85 High Current MOSFET Board
« Reply #3 on: October 22, 2020, 08:26:43 pm »
The circuit is trivially simple, I would knock it up on a piece of perfboard or manhattan on some copperclad to try it out. That ought to catch most of the potential issues with the design. It will also give you a platform on which to develop and debug the firmware while you're waiting for the proper PCBs to turn up.
 

Offline homebrew

  • Frequent Contributor
  • **
  • Posts: 293
  • Country: ch
Re: Attiny85 High Current MOSFET Board
« Reply #4 on: October 22, 2020, 09:13:46 pm »
Actually there are several things that could be improved ...

1) The aforementioned high R_DS_ON at low V_SG. (Select different FET?)
2) Missing decoupling caps at the ATMega and on the LED.
3) Lack of any separation/filtering of MCU power supply. Reasoning: Depending on what you are switching, there could be a high current spike (i.e. large capacitor on the device) that will practically act as a dead short the first us or so. If that loads down your VCC at the ATTiny it might spontaneousely reset.
4) Missing reset circuit. Give it at least an R to VCC and maybe also a C to GND. At the very least put just the footprints there ...
5) Will the LED work on these low voltages at all?
6) Your design seems not to be safe for firmware updates. Never do firmware updates with that circuit when the load is connected. It might go up in flames :-)
7) Does your cell have internal protection? If not, add one ... and if you don't trust that one - add a real fuse, too.

Optional:
8) Debounce of the switch: Simple R/C
9) External pull-ups. Resistors practically cost nothing - so why take any chances?

Layout:
10) Fat tracks are fine but when you have both layers - use them! Fat tracks on top and bottom with a ton of vias sticking them together. More vias near the mosfet to spread the heat.
 
The following users thanked this post: meba

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 3024
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: Attiny85 High Current MOSFET Board
« Reply #5 on: October 22, 2020, 10:11:15 pm »
I'm going to guess from the details that you are maybe making a DIY Vape thing.  In which case your load is coil of resistance wire.  Slamming that shut at 25A might produce some problematic inductive spikes maybe.
~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 

Offline mebaTopic starter

  • Contributor
  • Posts: 17
  • Country: de
Re: Attiny85 High Current MOSFET Board
« Reply #6 on: October 23, 2020, 04:03:56 pm »
The circuit is trivially simple, I would knock it up on a piece of perfboard or manhattan on some copperclad to try it out. That ought to catch most of the potential issues with the design. It will also give you a platform on which to develop and debug the firmware while you're waiting for the proper PCBs to turn up.

That would have been the next step. I just wanted to get some input on things that could or even should be improved.



Actually there are several things that could be improved ...

1) The aforementioned high R_DS_ON at low V_SG. (Select different FET?)
   I will have a look if I can find a different MOSFET that is better suited and readily available
2) Missing decoupling caps at the ATMega and on the LED.
  The WS2813 LEDs don't need a capacitor, they have them build into them. For the Attiny I will add a capacitor on the input - but I am not that familar with capacitors yet and am not sure how to properly select one
3) Lack of any separation/filtering of MCU power supply. Reasoning: Depending on what you are switching, there could be a high current spike (i.e. large capacitor on the device) that will practically act as a dead short the first us or so. If that loads down your VCC at the ATTiny it might spontaneousely reset.
  I will be switching a heating element. So the current draw will be relatively consistent. But since I might use PWM with up to 25A, I have to do some research on how I can improve the stability
4) Missing reset circuit. Give it at least an R to VCC and maybe also a C to GND. At the very least put just the footprints there ...
  I don't fully understand what you mean here. I have all the pins of the Attiny as through holes on the PCB, so I could access them later on to reset or reprogram
5) Will the LED work on these low voltages at all?
  Yes, they are rated for 3.5-5.3V. I even tested them at 3.3V and they worked just fine
6) Your design seems not to be safe for firmware updates. Never do firmware updates with that circuit when the load is connected. It might go up in flames :-)
  Again, I don't know what you mean by this one :D If I update the firmware, the heating element on the output can be removed. And the MOSFET has a pull down resistor, so there shouldn't be any problems even if the Pins of the Attiny are floating. Or what do you mean by that?
7) Does your cell have internal protection? If not, add one ... and if you don't trust that one - add a real fuse, too.
  No battery protection. I will think about it

Optional:
8 ) Debounce of the switch: Simple R/C
  I wanted to do that in software, but I will do some testing and might do it with a simple RC circuit
9) External pull-ups. Resistors practically cost nothing - so why take any chances?
  You don't trust the internal ones?  :D

Layout:
10) Fat tracks are fine but when you have both layers - use them! Fat tracks on top and bottom with a ton of vias sticking them together. More vias near the mosfet to spread the heat.
  Thats a good suggestion, I will definitely do that

Thank you for all these recommendations! I want to keep the circuit somewhat minimal and keep the amount of needed parts low, but of course, it should still be safe to use.



I'm going to guess from the details that you are maybe making a DIY Vape thing.  In which case your load is coil of resistance wire.  Slamming that shut at 25A might produce some problematic inductive spikes maybe.

That's exactly what I'm up to  :-+
I also thought about induction - but a heating coil with just 5-7 windings? Does that already cause inductive spikes I should be worried about?
 

Offline homebrew

  • Frequent Contributor
  • **
  • Posts: 293
  • Country: ch
Re: Attiny85 High Current MOSFET Board
« Reply #7 on: October 23, 2020, 04:32:44 pm »
I'm going to guess from the details that you are maybe making a DIY Vape thing.  In which case your load is coil of resistance wire.  Slamming that shut at 25A might produce some problematic inductive spikes maybe.

That's exactly what I'm up to  :-+
I also thought about induction - but a heating coil with just 5-7 windings? Does that already cause inductive spikes I should be worried about?

Then, I would suggest to immediately stop right there, because of https://www.nbcnews.com/health/health-news/battery-behind-dangerous-deadly-e-cigarette-explosions-n1032901

Unprotected 18650 in close proximity to mouth/head ...  :--
Unregulated heating of vapours to inhale ...  :--
Toxic fluids in (un)vapourized form ...  :--

That would be *way to much* risk to take. Certainly not something I would suggest anybody to DIY!
It's just not worth it! Your one-off prototype will likely not even be cheaper than a tested commercial one from a reputable brand.

Risk without benefit is never a risk I would be willing to accept ...

 

Offline mebaTopic starter

  • Contributor
  • Posts: 17
  • Country: de
Re: Attiny85 High Current MOSFET Board
« Reply #8 on: October 23, 2020, 04:59:37 pm »
Unprotected 18650 in close proximity to mouth/head ...  :--
Unregulated heating of vapours to inhale ...  :--
Toxic fluids in (un)vapourized form ...  :--

That would be *way to much* risk to take. Certainly not something I would suggest anybody to DIY!
It's just not worth it! Your one-off prototype will likely not even be cheaper than a tested commercial one from a reputable brand.

Risk without benefit is never a risk I would be willing to accept ...

Thanks for the suggestions, but I am aware of the dangers and I know these horror stories.
I have been vaping for over 5 years and built 10+ different mods for e-cigarettes. I never had any problems or dangerous situations. I am familiar with battery safety and these batteries dont just explode. If you create a short circuit, they first get hot, then outgas and THEN they might "explode" - and none of this ever happend to me. I have never even used protected batteries and a lot of the mods were purely mechanical - so no fuses etc - just bare copper or silver closing the contacts.

And of course it will be much more expensive to build it myself than buying a finished mod - but that's not the point of this project.

And about the unregulated e-liquids - I mix the liquid myself, I know exactly what it is made of. I have read several studies regarding this topic and it is a much less harmful alternative to smoking.
What do you mean by toxic fluids? What is toxic about glycerin? It is an ingredient in your toothpaste, you use it for baking, it is part of lots of cremes etc. As long as you just vaporize it, and don't burn it, it also does not release any toxic particles etc. Of course it is better to just inhale air instead of vapor, but it is not a toxic liquid.
« Last Edit: October 23, 2020, 05:03:23 pm by meba »
 

Offline Syntax Error

  • Frequent Contributor
  • **
  • Posts: 584
  • Country: gb
Re: Attiny85 High Current MOSFET Board
« Reply #9 on: October 23, 2020, 05:01:38 pm »
Some more thoughts. How much quiescent current is the Tiny85 drawing; is your firmware using SLEEP mode to save power? Is the LED always on? And what color codes are you using for this neopixel?
How does the Tiny85 measure the terminal voltage; are you using a potential divider/zener across ADC2 or ADC3?
A two second vape might draw enough current from VCC to brownout the Tiny85, so how does your firmware handle this situation? Also the back EMF from the coil might be a problem for the Tiny85, so are you protecting it from voltage spikes?
And yes, debounce S1 as a bare switch is likely to fire the interrupt on PB2, even when not pressed - you do not need a pocket fire :)

One last thought, could you achieve the same function using a simple monostable gate instead of a complex microcontroller? Anyway, good luck with your project.
 
The following users thanked this post: meba

Offline mebaTopic starter

  • Contributor
  • Posts: 17
  • Country: de
Re: Attiny85 High Current MOSFET Board
« Reply #10 on: October 23, 2020, 05:30:12 pm »
Some more thoughts. How much quiescent current is the Tiny85 drawing; is your firmware using SLEEP mode to save power? Is the LED always on? And what color codes are you using for this neopixel?
How does the Tiny85 measure the terminal voltage; are you using a potential divider/zener across ADC2 or ADC3?
A two second vape might draw enough current from VCC to brownout the Tiny85, so how does your firmware handle this situation? Also the back EMF from the coil might be a problem for the Tiny85, so are you protecting it from voltage spikes?
And yes, debounce S1 as a bare switch is likely to fire the interrupt on PB2, even when not pressed - you do not need a pocket fire :)

One last thought, could you achieve the same function using a simple monostable gate instead of a complex microcontroller? Anyway, good luck with your project.

To save on power I would run the Attiny at 1Mhz and define all the pins as input with pullup resistors (I've heard before that floating pins consume power).
This is the first time I am using an Attiny85 - I mostly used Arduinos in the past. I will do some tests with sleep mode etc to see how it affects the power consumption.
The LED will only be on when the button is pressed and when the device is being turned on or off. I will probably even dim the LED.

Measuring the battery voltage might be a bit tricky, since I do not have a consistent reference voltage on VCC, but I found a few instructrions on how you can still measure the battery voltage - but this is something I need to do some tesing on.

I would prefer to use a microcontroller since it gives more flexibility. I could easily expand it later on - like adding a potentiometer to adjust the PWM signal or I could add more LEDs etc.
Also I want to play around with a microcontroller and see what is possible with such a tiny chip.

The brownout is something I am also worried about, which was one of the reasons why I started this thread. The Attiny85 even runs at 2.7V, but probably not if there is a sudden change in voltage. Would a simple capacitor on VCC help with this problem, since the voltage will decrease slower?
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Attiny85 High Current MOSFET Board
« Reply #11 on: October 23, 2020, 05:39:31 pm »
You can measure the battery voltage easily by either using the internal reference instead of Vcc and then have a resistor divider on the ADC pin, or you can use a trick where you measure the internal reference using Vcc as the reference and then calculate the voltage, this lets you directly measure Vcc of the AVR.

The tiny85 may be in a small package but it's quite a powerful chip. I normally use much less capable  parts like the attiny13 in small projects.
 
The following users thanked this post: meba

Offline homebrew

  • Frequent Contributor
  • **
  • Posts: 293
  • Country: ch
Re: Attiny85 High Current MOSFET Board
« Reply #12 on: October 23, 2020, 06:03:22 pm »
Thanks for the suggestions, but I am aware of the dangers and I know these horror stories.
I have been vaping for over 5 years and built 10+ different mods for e-cigarettes. I never had any problems or dangerous situations. I am familiar with battery safety and these batteries dont just explode. If you create a short circuit, they first get hot, then outgas and THEN they might "explode" - and none of this ever happend to me. I have never even used protected batteries and a lot of the mods were purely mechanical - so no fuses etc - just bare copper or silver closing the contacts.

Doing things without bad effects doesn't imply safety. It just implies that accidents might either be somewhat rare events or that you are just a lucky person.
Yes, these batteries might get hot first before bursting into a ball of flames but that timescale might go down to seconds.

And about the unregulated e-liquids - I mix the liquid myself, I know exactly what it is made of. I have read several studies regarding this topic and it is a much less harmful alternative to smoking.

I wasn't concerned that the substances are unregulated but rather that the heating occurs unregulated (i.e. without any proper control of temperature). Organic substances decompose at certain higher temperatures - often into toxic (or at least unhealthy) products. Boiling and vaporising liquids involves actually quite some fascinating physics. If you are interested, "critical heat flux" seems an interesting starting point for research.

And of course, you do whatever you like. I'm just pointing out some risks, where I see them ...
 

Offline mebaTopic starter

  • Contributor
  • Posts: 17
  • Country: de
Re: Attiny85 High Current MOSFET Board
« Reply #13 on: October 23, 2020, 06:14:48 pm »
If you heat up the glycerin too much, it will release some formaldehyd which is carcinogenic - but you definetely notice when the liquid is being burned instead of vaporizing. Of course vaping is not healthy, but in my opinion the risk is manageable.

Thanks for pointing out the risks, but lets get back to the topic :)
I would appreciate if you would still help me out with this project and my questions, but I can understand if you don't want to.
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11648
  • Country: my
  • reassessing directives...
Re: Attiny85 High Current MOSFET Board
« Reply #14 on: October 23, 2020, 08:24:13 pm »
there are few improvements, mostly mentioned by homebrew, take serious attention to point 3&4 (no reset pin pull up = dead mcu unless you want to program in HVP no ICSP, no separating diode to power supply pin = drunken mcu on the street (keep resetted once load is powered)) i know i've built motor driver just in 1-5A surge range with its little sibling atiiny13. with no decoupling capacitor and separating diode, supplying 30A is guaranteed drunken ninja mcu. dont argue inductor or no inductor, everything has inductance even straight wire or resistor, "switching" noise is another fun, 30A is no joke.

technical aside, i can propose handCAD improvement but (1st attached, eventually i did for you after this long post longer than i expected :palm: thats the minimal you have to do or a dead circuit)... fwiw i'm vaper myself (to cure from real danger tobacco + tar) if you are not real smoker, i'll go against this, if you think just because its cool, its not. but if you want to get rid of real cigarette, go for it its 100X safer than cigarette (if you ask people with experience) but still of course 100X useless than if you have nothing from the beginning, smoking 0% NIC just because its cool is total nonsense imho, vape with some degree of NIC is an invitation to real tobacco and road asphalt tar craving and consumption. i have 2x 18650 just few cm from my mouth always atm. but this one has thicker cast iron body with most probable explosion vector through the opening lid underneath, opposite to my mouth vector, keep that in mind when designing yours. but my real point is this... my alien smok here is boost converted to get more power up to 220W. i have an old  mechanical mod that i always keep in case of emergency (damaged ee mod) i can say mechanical mod is not so powerful, more or less like 15-20W setting when using ee-mod. mechanical mod was fun before i experience ee-mod, just make a suitable coil/atomizer for that. ee-mod i can boost to 40W for more puff, and can be up to 80W for dual or quad core coils.

so the real point is... i guarantee your circuit (if without boost technology) will work worse than my mechanical mod, you have 0.5-1V Vds mosfet drop (2.7-3.2V left for the coil), Vg is marginal, once battery depleted below 3.2V, you mosfet will go linear region, nasty Vds and eventually smok too. maybe ok if you are planning pod instead of full size mod, maybe  you have tool to diy tiny pod atomizer? but 25-30A i dont think it is it. with 3V left for atomizer, you need ~0.1ohm atomizer to get 20-30A, something we rarely do, 0.3ohm and up is the common. 0.1ohm sounds like quad core coils, pretty fun boiling and carbon deposit generator, but only if your circuit and components are up to it. there are few option to deal with this...

1) use 2x 18650 to get more voltage without boost complexity.
2) be realistic with 2-3V limitation, meaning building mini atomizer. forget 20-30A
3) just build mechanical mod or buy one if they still exist. will work much better than your circuit.
4) just buy ready made either boosted mod or pod for more puff... they are cheap now like $20-50, then you can do something else more useful, save the frustration.

attached: 2nd, from your mosfet datasheet
later: my alien smok, circuit for your pet crave :P

cheers, ymmv.

edit: errata: that reset pin pull up should go direct to Vcc mcu pin (after diode), not before.
« Last Edit: October 23, 2020, 08:30:00 pm by Mechatrommer »
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 
The following users thanked this post: meba

Offline homebrew

  • Frequent Contributor
  • **
  • Posts: 293
  • Country: ch
Re: Attiny85 High Current MOSFET Board
« Reply #15 on: October 24, 2020, 10:42:30 am »
So as I've absolutely no knowledge on that vaping stuff I cannot help you with your specific project whatsoever any further. However, we can still discuss the electronics part from the perspective of design and engineering aspects in general.

Here are some rules that I like to apply to my personal projects:

Actually there are several things that could be improved ...

2) Missing decoupling caps at the ATMega and on the LED.
  The WS2813 LEDs don't need a capacitor, they have them build into them. For the Attiny I will add a capacitor on the input - but I am not that familar with capacitors yet and am not sure how to properly select one

RULE1 (At least for prototypes and on-offs): When you can fix a potential problem with a dirt cheap component, simply do it. A hour of your time wasted on debugging is three to four magnitudes more valuable!

I only managed to find a data sheet (https://www.elecrow.com/download/WS2813_LED_Datasheet.pdf) that does look quite ... yeah whatever.
No mentioning of a built in decoupling capacitor at all there.

Simply add one (or at the very least ad a footprint onto the board). A good value would be 100n. Maybe add another 1u as the led might draw some current. See Daves video on decoupling capacitors.

RULE2: Select proper components matching your design parameters and keep reasonable margins.

That LED is not! Yes, it might work at 3.3V on the bench at cozy 21°C. But will it still work in the cold outside or when it is very hot?
It is specified as a 5V device and their test conditions are given for a range of 4.5V < VDD < 5.5V (see datasheet, page 4). Which is funny in itself as their absolute maximum rating for VDD is 5.3V  :-//

But 3.5V is specified as the absolute minimum allowable voltage to stay within specification. "Absolute Maximums Ratings" are given as absolute extremes and NOT as general conditions for device operations. That said, even if your supply would stay above 3.6V on average that would still be insufficient due to transients and noise etc. etc. So keep your margins and make them as large as possible!

In this specific case I would simply ask myself it I really need an "intelligent" LED and not just a simple single, or bi-color one.

6) Your design seems not to be safe for firmware updates. Never do firmware updates with that circuit when the load is connected. It might go up in flames :-)
  Again, I don't know what you mean by this one :D If I update the firmware, the heating element on the output can be removed. And the MOSFET has a pull down resistor, so there shouldn't be any problems even if the Pins of the Attiny are floating. Or what do you mean by that?
Looking at your circuit diagram, your MOSI line is used to switch the power transistor during normal operation. Hence, when doing a firmware update with any load connected, the transistor will turn on and off repetitively during the time programming. The switching losses would then probably quickly destroy the device (with smoke & flames) if a load is connected.

RULE 3: Use components that ease your design, even if they are slightly more expensive. No need to skimp off cost in the cent range. Just select a larger microcontroller that has enough pins so you don't need to use the programming pins for other purposes. Alternatively make absolutely sure that the programming operation cannot have any bad side effects.

7) Does your cell have internal protection? If not, add one ... and if you don't trust that one - add a real fuse, too.
  No battery protection. I will think about it
From my perspective an absolute MUST. LiPo cells cannot handle uncontrolled high (or fault) currents and further cannot handle deep discharges either.

RULE 4: Use common industry-accepted solutions/practices to well known problems. Protecting LiPo Cells is such a common task that there are tons of specialized components on the market to do so. 

Optional:
8 ) Debounce of the switch: Simple R/C
  I wanted to do that in software, but I will do some testing and might do it with a simple RC circuit

Apply rule number 1. Why make your life any harder than it needs to be?

9) External pull-ups. Resistors practically cost nothing - so why take any chances?
  You don't trust the internal ones?  :D

Oh yes, I do trust them. But I don't trust myself :-) I want all my projects to operate safely even in the event of stupid programming mistakes as far as possible. Forgetting to turn on an internal pullup might even go undetected during initial bench testing but will lead to erratic behaviour later on.

Again, apply rule 1.

Then some general thoughts and hints:

1) Get yourself a very good cad package and learn how to use it. KiCad is absolutely free of cost (and open source, too) and will serve you well for most of the projects that can be done on a hobby level (and even more).

2) There is this old quote apparently from Einstein: "Everything should be made as simple as possible, but no simpler." Thus, skimp on unnecessary complexity (e.g. multicolour digital controlled LEDs) but not on decoupling, debouncing etc.

There is one fundamental advantage on building your own stuff: You don't have any pressure on cost! Now take advantage of that. Therefore, your devices can be (and should be) better than the ones on the market, because you can take your time to come up with the best possible design for you, select the best possible components, build the most rigid/safe/nice-looking enclosure. All your design artefacts (like schematics and PCB layouts, CAD drawings) should look as a piece of art to you (it is sometimes called PCB artwork for a reason).

Anything less is a complete waste of time and resources ...
« Last Edit: October 24, 2020, 10:45:15 am by homebrew »
 
The following users thanked this post: meba

Offline mebaTopic starter

  • Contributor
  • Posts: 17
  • Country: de
Re: Attiny85 High Current MOSFET Board
« Reply #16 on: October 24, 2020, 11:29:08 am »
there are few improvements, mostly mentioned by homebrew, take serious attention to point 3&4 (no reset pin pull up = dead mcu unless you want to program in HVP no ICSP, no separating diode to power supply pin = drunken mcu on the street (keep resetted once load is powered)) i know i've built motor driver just in 1-5A surge range with its little sibling atiiny13. with no decoupling capacitor and separating diode, supplying 30A is guaranteed drunken ninja mcu. dont argue inductor or no inductor, everything has inductance even straight wire or resistor, "switching" noise is another fun, 30A is no joke.
.....
edit: errata: that reset pin pull up should go direct to Vcc mcu pin (after diode), not before.

Thanks for your answer and the additions to the schematic!


I have made many mechanical mods before and a few with a simple mosfet circuit. But I wanted to step up the game and do something a bit more advanced - and just learn how to design my own PCB.
Most of the time I only build down to 0.3 Ohm, so it is more like 12A - but I want to have some reserve, so I could go go down to 0.15-0.2 Ohm if I ever want to do so.


Changes I have made so far:

-For the traces that handle hight current, I added traces on the back as well and placed vias underneath the MOSFET to better dissipate the heat.

-added a 10k reset pullup resistor

-added a placeholder for a separating diode
By adding a diode in front of the Attiny, I further decrease the voltage by ~0.7V and therefore decrease the gate voltage on the MOSFET - right? Is there anything I can do about that? How do I pick a suited diode?

-added a placeholder for a decoupling capacitor
For now I added a 10uF capacitor rated for 6V. How to determine the right capacity for this capacitor?



I found another MOSFET that might be better suited. It has a lower resistance and in generel works better with lower voltages on the gate, almost down to 2.5V
PSMN8R0-80YL

This one should be fine, right?
 

Offline Syntax Error

  • Frequent Contributor
  • **
  • Posts: 584
  • Country: gb
Re: Attiny85 High Current MOSFET Board
« Reply #17 on: October 24, 2020, 11:57:59 am »
Change D2 from the IN4148 small signal diode to a IN4001 rectifier diode. And place a 100nF (0.1uF) capacitor in parallel to the 10uF cap. Remember VCC is now 0.7 volts lower.
« Last Edit: October 24, 2020, 12:04:18 pm by Syntax Error »
 
The following users thanked this post: meba

Offline mebaTopic starter

  • Contributor
  • Posts: 17
  • Country: de
Re: Attiny85 High Current MOSFET Board
« Reply #18 on: October 24, 2020, 12:03:28 pm »
@homebrew

Thanks again for your answer.

Rule1:
I read somewhere that you don't need a capacitor for WS2813 anymore (compared to the WS2812 etc) and the WS2813 LED strips you can buy, also don't have capacitors anymore. But you are right - the capacitor is such a small and cheap component, I will include it in the schematics.

Rule2:
I will do some more testing with these LEDs. To indicate the battery level and different modes of the board, I need at least 2 or even 3 colors, but I don't want to waste all the pins on the Attiny just for an LED. That's why I picked an addressable one.

About the MOSI pin, unfortunately only Pin 5 and 6 support PWM, So I either have to use the MOSI or MISO Pin.

Rule3:
I would prefer to stick with the Attiny85, but I will do my research, on what changes need to be done, to safely allow firmware updates.

The board will shut off or at least enter sleep mode, when the voltage is below 3.6V. Also you notice when the voltage is low, since there is much less output from the e-cigarette.

Rule4:
I thought it would be easier in software, since I need less components and instead just a few lines of code :D But a hardware solution is definetely more reliable.

The reset-pin is now connected to an external pullup resistor. I might add one to the other pins as well.


At the moment I am using Target3001 which is also free for personal use. The free version has some limitations, but still can do much more than I need.
 

Offline mebaTopic starter

  • Contributor
  • Posts: 17
  • Country: de
Re: Attiny85 High Current MOSFET Board
« Reply #19 on: October 24, 2020, 12:05:26 pm »
Change D2 from the IN4148 small signal diode to a IN4001 rectifier diode. And place a 100nF (0.1uF) capacitor in parallel to the 10uF cap.

What is the benefit of having two different sized capacitors in parallel? Will the smaller one be better for handling high frequent changes or what is the deal with it?
 

Offline homebrew

  • Frequent Contributor
  • **
  • Posts: 293
  • Country: ch
Re: Attiny85 High Current MOSFET Board
« Reply #20 on: October 24, 2020, 12:18:36 pm »
Change D2 from the IN4148 small signal diode to a IN4001 rectifier diode. And place a 100nF (0.1uF) capacitor in parallel to the 10uF cap.

What is the benefit of having two different sized capacitors in parallel? Will the smaller one be better for handling high frequent changes or what is the deal with it?

This will answer it:
EEVblog #859 - Bypass Capacitor Tutorial


And of course, you need to place the cap in close proximity to the controller.
 
The following users thanked this post: meba

Offline homebrew

  • Frequent Contributor
  • **
  • Posts: 293
  • Country: ch
Re: Attiny85 High Current MOSFET Board
« Reply #21 on: October 24, 2020, 02:00:53 pm »

-added a placeholder for a separating diode
By adding a diode in front of the Attiny, I further decrease the voltage by ~0.7V and therefore decrease the gate voltage on the MOSFET - right? Is there anything I can do about that? How do I pick a suited diode?

Yes sure, lots of options for you to evaluate:

- Schottky diodes have lower forward voltages
- There are LDO regulators available with dropout of <=300mV
- You could use a step-up regulator and get rid of the low voltage problem for your MCU altogether.
- Instead of the diode, you might design an R/C or L/C filter. (No trivial task, as you need some power to properly switch your fet)


About the MOSI pin, unfortunately only Pin 5 and 6 support PWM, So I either have to use the MOSI or MISO Pin.

You want do hardware pwm? Hopefully not too fast! The more often you switch, the more switching-losses (== heat) you will have in your mosfet. This is not so much of a question of R_DS_ON but rather of how fast you can turn on the switch (slewrate dV/dt). Without higher gate voltages and/or a proper FET driver this will be severely limited. Remember that you ATTiny will only deliver some mA. The gate has a capacitance and thus it takes some time to bring it up to the voltage level desired. 
 

Offline mebaTopic starter

  • Contributor
  • Posts: 17
  • Country: de
Re: Attiny85 High Current MOSFET Board
« Reply #22 on: October 24, 2020, 04:59:29 pm »
You want do hardware pwm? Hopefully not too fast! The more often you switch, the more switching-losses (== heat) you will have in your mosfet. This is not so much of a question of R_DS_ON but rather of how fast you can turn on the switch (slewrate dV/dt). Without higher gate voltages and/or a proper FET driver this will be severely limited. Remember that you ATTiny will only deliver some mA. The gate has a capacitance and thus it takes some time to bring it up to the voltage level desired.

I might want to use PWM to reduce the output. Since the MOSFET ist just turning the heating coil on and off, I don't need a high frequency. 20Hz probably is more than enough. At such a slow frequency I could theoretically use any other pin of the Attiny and use software PWM.
 

Offline homebrew

  • Frequent Contributor
  • **
  • Posts: 293
  • Country: ch
Re: Attiny85 High Current MOSFET Board
« Reply #23 on: October 25, 2020, 02:02:08 pm »
I might want to use PWM to reduce the output. Since the MOSFET ist just turning the heating coil on and off, I don't need a high frequency. 20Hz probably is more than enough. At such a slow frequency I could theoretically use any other pin of the Attiny and use software PWM.

Another day, another risk :-)

What is you fallback safety if something (hardware, or software) goes wrong and the MOSFET gets stuck in on position?
How would you prevent the thing to turn on accidentely?

Maybe a solid mechanical, momentary switch before the whole circuitry would be more reasonable ...

As expressed with the other posts: The more you dig into the design, the more risks will surface, that would all needed to be mitigated.
So likely whatever you design, might easily be even more dangerous than the purely mechanical versions you have built before.
« Last Edit: October 25, 2020, 02:06:58 pm by homebrew »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf