Breaktru Forum

eCigarette Forum => Modding => Topic started by: norcalreballer on January 24, 2016, 03:43:25 AM

Title: Smart PWM board V2 ( Attiny85 )
Post by: norcalreballer on January 24, 2016, 03:43:25 AM
I used to post here sometimes.  I worked on and ending up finishing a 500w variable wattage mod.  Ended up selling the design...  After that I kind of went backwards.  Since I can't really sell a competing design, I decided to try to use the least amount of parts possible and add as many features as possible for a VV design without a display.  The results have been fantastic!

It's an ATtiny85 powered 16x19mm board.  Basically, all it has on the board is the MCU, a linear regulator, voltage divider, P channel MOSFET(for RPP) and a couple other resistors. It utilizes hardware PWM and switches and N channel MOSFET @ 62hz. The MOSFET is switches directly from the MCU with a gate series resistor limiting the current to 10ma.  It can switch even the beefy 3034 MOSFET with zero problems.

It rocks features like:

2s-3s input
lock/unlock
10 second fire timeout
low battery warning
low voltage cutoff
reverse polarity protection
software regulated output!  That's right! You can lock the output.  The software will automatically adjust the duty cycle up to maintain the desired RMS voltage output.  Consistent vape from a PWM mod for the life of the batteries and even after you swap batteries.  It's actually pretty sweet for such a basic board.

If you want to know more, you can join our Facebook group. 

https://www.facebook.com/groups/416421905210775

If not, no worries.  I learned quite a bit from you guys, so if you have any questions I'm willing to help any way I can.  Let me know. :thankyou:
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: SDaddy on January 24, 2016, 02:33:15 PM
Sounds interesting. I just put in to join the group.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: doobedoobedo on January 25, 2016, 05:05:00 AM
That's neat. Is the voltage fixed at compile time, or is it updateable?
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: norcalreballer on January 25, 2016, 01:09:35 PM
Do you mean the input voltage?  It's automatically detected and it changes settings based on that.  You could swap between a 2s and 3s pack if you wanted to.  4s is in the works.  I just need to swap the regulator and add 4s settings in the code.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: doobedoobedo on January 25, 2016, 01:32:39 PM
No I meant the output voltage. You obviously need to read the input voltage in order to set the duty cycle. From my understanding the attiny85 has 5 usable io pins plus the reset pin but if you use that then you can't reprogram it.

So:
1 ADC for battery voltage
1 gpIO for fire button
1 PWM out
1 low bat led?
1 for pot to adjust output voltage? But you say it's 'software controlled' and lockable, do you mean firmware controlled or fixed at some point in time or....?

It sounds like a really interesting project, but I'm afraid I don't do FB :(.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: norcalreballer on January 25, 2016, 01:40:51 PM
Oh, gotcha.  Yeah, normally the pot will adjust the duty cycle.  Once you lock the output, the software reads the loaded battery voltage when it fires and automatically adjusts the duty cycle up/down to maintain the RMS voltage that was saved.  It also saves the desired RMS voltage in EEPROM, so there's a consistent vape even after you swap batteries.

EDIT:Facebook can be very annoying, but it's actually taken over forums now. 
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: doobedoobedo on January 25, 2016, 03:34:48 PM
Cool, even just a tiny bit of EEPROM is handy :)
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: Visus on January 26, 2016, 12:14:41 AM
Wow niiice build, ya added me on fb..


 I was wondering if a 3s batt is capable of 300amps and I have .05atty @ 8v,  will it do 1250watts?   :thumbsup:
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: DIYFancyLights on January 26, 2016, 02:38:05 PM
If you use the RESET as an I/O pin, you can still reprogram them, but you have to use High Voltage Serial Programming that not all programmers support. It gets around RESET being gone by using 12V on the RESET pin. This mode does require the MCU to be operating at 4.5V - 5.5V  as well. It doesn't work with lower voltages or if any of the circuitry messes up the 12V to RESET. This is also the same mode normally used to change the Lock & Fuse bits.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: doobedoobedo on January 26, 2016, 02:43:15 PM
Cheers that's handy to know. I'd seen something about high voltage programming but hadn't delved into what it meant.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: norcalreballer on January 26, 2016, 05:48:01 PM
@Visus I wouldn't ever recommend 300a vaping. 

I'm not using the reset pin as an IO pin, but I have checked out high voltage programming for when I was thinking about the project.

I remember seeing a diy solution with an arduino board, transistor, 12v power source and some resistors. I have parts to make one but haven't needed to yet.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: Visus on January 26, 2016, 07:04:27 PM
I do agree I vape at 30-70 watts but just for bragginz.  :laughing2:

 My question was really asked on the 555 mods that been around for almost two years now.  Your build  with the programming on/off, uvlo,  would be killer.

Whats its wattage limitation..



http://www.smokenmist.com/new/reaper/?page_id=3055
Quote
It just so happens to be the perfect battery to deliver almost unlimited power to the Reaper down to 0.025 ohms at 2880 watts.  With such a powerful battery we could not just slap in just any chip, as nothing exists to handle this range of power.  So we constructed a board from scratch that would redefine what a regulated lipo box mod is capable of.  Our patent pending board consumes almost no power and delivers the full range of voltage from 0 to 8.4 Volts using our 555 PWM and  recessed potentiometer.  Integrated Mosfet is crucial to our design.
---------------------------


 :laughing:
Jeff calls him out in comments on a youtube video on the 2kw claim on 2s cells he no answer..

http://www.youtube.com/watch?v=1P4-kfMcdYA
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: DIYFancyLights on January 26, 2016, 07:10:28 PM
What's funny is I was considering an ATTiny5/10/13 or 85 based PWM board before I settled instead on a variation of a 555 for the Timer kit I'm making. But I've never given up on looking at other things. I went with small and modular as well as something people could hack for themselves or use for other things.

But gratz on this board. The monitoring what the battery level is, I'm assuming you are using the ADC to measure the internal voltage reference so you can detect what the current voltage is as the battery drains?
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: norcalreballer on January 26, 2016, 07:31:14 PM
@Visus  The MOSFET is off the board on my design.  The current the mod could handle is dependent on the MOSFET, battery and wire used. All the board really does is switch the MOSFET.  It doesn't see any high current.  It's around 30mA-40mA max when it's firing. Around 3mA at idle.

@DIYFancyLights  I'm using the 5v version of the MC33275 to power the Attiny85 and as the voltage reference.  The tolerance is pretty tight at 1%(for an LDO) and the voltage divider resistors are both 0.1%. Normally on something like this I would use a proper voltage reference, but it's actually within those numbers, which aren't too bad at all for what it is. 

The internal voltage reference(1.1v on the Attiny85, I believe) is way too inaccurate.  Try like +/- right under 10%.  It's not meant to be a precision voltage reference.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: DIYFancyLights on January 26, 2016, 07:36:48 PM
Yws, I've heard the internal reference can vary a lot and you need to take multiple samples as well. Good that you are using %0.1% resistors and a high accuracy LDO as a work around. Ao many people over look reasonable ways to do thing.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: Visus on January 26, 2016, 07:37:01 PM
What's funny is I was considering an ATTiny5/10/13 or 85 based PWM board before I settled instead on a variation of a 555 for the Timer kit I'm making. But I've never given up on looking at other things. I went with small and modular as well as something people could hack for themselves or use for other things.

But gratz on this board. The monitoring what the battery level is, I'm assuming you are using the ADC to measure the internal voltage reference so you can detect what the current voltage is as the battery drains?

Whats wild DIYfancy, EE forum poster Craighb swears by this board for doing displays with using another pcb,  we did not vape over 30watts back when then.  Who knew like the 555 just use it as a "switcher pwm" with high power fets.  It wasn't even considered,  ya it's uber fun/entertaining seeing old school chips kick'n butt. 
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: DIYFancyLights on January 26, 2016, 07:40:16 PM
Whats wild DIYfancy, EE forum poster Craighb swears by this board for doing displays with using another pcb,  we did not vape over 30watts back when then.  Who knew like the 555 just use it as a "switcher pwm" with high power fets.  It wasn't even considered,  ya it's uber fun/entertaining seeing old school chips kick'n butt.
I actually used a high tech version that only had 5 leads in an SOT23-5 case, then fed it to a MOSFET driver chip that draw very little current from the output (which also fed back through the pot & diodes). I also used the BAT54S dual series diodes on board so people would have to solder diodes at the Pot.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: doobedoobedo on January 26, 2016, 07:41:18 PM
@Visus  The MOSFET is off the board on my design.  The current the mod could handle is dependent on the MOSFET, battery and wire used. All the board really does is switch the MOSFET.  It doesn't see any high current.  It's around 30mA-40mA max when it's firing. Around 3mA at idle.

@DIYFancyLights  I'm using the 5v version of the MC33275 to power the Attiny85 and as the voltage reference.  The tolerance is pretty tight at 1%(for an LDO) and the voltage divider resistors are both 0.1%. Normally on something like this I would use a proper voltage reference, but it's actually within those numbers, which aren't too bad at all for what it is. 

The internal voltage reference(1.1v on the Attiny85, I believe) is way too inaccurate.  Try like +/- right under 10%.  It's not meant to be a precision voltage reference.

I'd be surprised it was even drawing that much. My 328P board draws just over 20mA to run the electronic side and most of that is the screen.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: Visus on January 26, 2016, 07:44:03 PM
@Visus  The MOSFET is off the board on my design.  The current the mod could handle is dependent on the MOSFET, battery and wire used. All the board really does is switch the MOSFET.  It doesn't see any high current.  It's around 30mA-40mA max when it's firing. Around 3mA at idle.

@DIYFancyLights  I'm using the 5v version of the MC33275 to power the Attiny85 and as the voltage reference.  The tolerance is pretty tight at 1%(for an LDO) and the voltage divider resistors are both 0.1%. Normally on something like this I would use a proper voltage reference, but it's actually within those numbers, which aren't too bad at all for what it is. 

The internal voltage reference(1.1v on the Attiny85, I believe) is way too inaccurate.  Try like +/- right under 10%.  It's not meant to be a precision voltage reference.

Woot so it as is as built by the builder and fet, heatsink, battery choice;   :laughing2: :thumbsup:
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: DIYFancyLights on January 26, 2016, 07:50:14 PM
Fora MOSFET option, might I offer my microFET's? Very low RDSon, mounted on a PCB with a pulldown resistor, stackable for higher current (they are half the thickness of a TO-220). An engineer from reddit make a quick calculation that one can handle 30A. They are part of my modular approach to help builders.

http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=261960134586 (http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=261960134586)

Yeah, this is an Ad, but it is a nice already assembled PCB for easy installation in a variety of mods.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: norcalreballer on January 26, 2016, 08:15:01 PM
Ha!  I think we all know each other.  I prefer IRLS3813 for my builds, but that's cool.  The new verison I'll have out(working on it with someone else) will be using two of those on the board.  Keep in mind Vgs ends up ~4.5v with my board, which is what those are optimized for, IIRC.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: DIYFancyLights on January 26, 2016, 08:21:13 PM
Ha!  I think we all know each other.  I prefer IRLS3813 for my builds, but that's cool.  The new verison I'll have out(working on it with someone else) will be using two of those on the board.  Keep in mind Vgs ends up ~4.5v with my board, which is what those are optimized for, IIRC.
The PSMN0R9-25YLC I used on those boards has 0.95 mOhm typical resistance at 4.5V (max of 1.25 mOhms). There are other things as well, but we're starting go off topic a bit much. I initally was mentioning them because pf the modular approach of combining what you want to get the desired results.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: norcalreballer on January 26, 2016, 08:44:59 PM
It's still relevant.  :)  It's all good.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: DIYFancyLights on January 26, 2016, 09:33:13 PM
It's still relevant.  :)  It's all good.
Ok, then how's this for a small simple N-Channel MOSFET board? Build using 2oz copper to help it handle the current & potential heat:

(http://www.diyfancylights.com/files/microFET-1-size.png) (the To-220 in that picture for comparison is an IRLB3034, board size id 0.7"x0.4", has several spare holes on the Sourcee & Drain for options, and a place for a through hole resistor (to connect to an LED). Designed and built in the US!
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: norcalreballer on January 26, 2016, 09:38:15 PM
I've seen them.  They're cool. :)
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: DIYFancyLights on January 26, 2016, 09:42:47 PM
I've seen them.  They're cool. :)
Yes, that picture has been posted in several places because of how will it works for many people. Even with the PCB there, it's still half the thickness of a TO-220. In the next couple months I'm going to have to order another batch from the factory since sales have been continuing to climb.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: norcalreballer on January 26, 2016, 09:54:58 PM
I'd show you a pic of some prototypes I have of a MOSFET board, but they're downstairs somewhere.  Pretty much the same thing, but it has two of those in parallel.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: DIYFancyLights on January 26, 2016, 09:58:38 PM
When I first designed the board I wasn't even thinking about parallel, then it dawned on me afterwards with the through hole design and how thin they are, you just stack a couple up, with maybe a slight gap between them and solder filling the wires between the boards to make a solid connection. Afterall, the large holes are designed for 14awg stranded wire.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: Visus on January 27, 2016, 09:53:50 PM
I did a little research on gate capacitance/amp load at gate and is perhaps  the reason why some of the 555 timers are failing.

Do you know the gate capacitance from the 85 and which fet can handle it.  While it will work for a while with the wrong fet it will eventually fail @ the fet or the 85 if not within specs of capacitance or amp load being used as a driver.. 

Maybe off base question but maybe relevant..


Where I said hmn
Quote

http://electronicdesign.com/power/informed-analysis-picks-better-555-timer-drive-power-mosfet

The input capacitance of the IRF 4905 is typically 3500 pF. Using the well-known current-charging equation I = C dV/dt, we find that the gate charging and discharging current with a 12-V square wave is about 21 mA, twice the rated output of the CMOS 555. That explains the failures.

The solution was simple. The timer chip was changed to a bipolar NE555 (rated for 200-mA sink and source current), an 82-? resistor was added to guarantee that the current would always be below 150 mA, and the switching frequency was reduced to 3 kHz to reduce the proportion of time spent “on the slope.” The resulting circuit performed more reliably, and the MOSFET did not even get warm.

fainting:
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: norcalreballer on January 27, 2016, 10:20:36 PM
This is actually a really good question.  ;) I went over app note after app note about switching MOSFETs(I'm tired or I would link a bunch of stuff :/ ).  Gate charge is actually what you want to use in your calculations, not gate capacitance. Anyways, when you need to limit current what do you do?  It's simple. :)  You can add a series gate resistor to limit the current.  That's no issue, but the side effect is that if you limit the current to say 10ma, it severly slows down the rise/fall times of the MOSFET.  If we tried to switch the MOSFET even at 1.5khz, we'd have an issue since the MOSFET would be in the linear region for long each period...

What do we do then?  We can lower the frequency to say 62hz(That's what my board is running at) so the MOSFET is in linear region for less of the time each period.  This idea would actually work for the 555 timers as well, but no one does that for some reason.  As long as the MOSFET Rds(on) is low enough @ 4.5v Vgs or so I didn't see a need for an actual driver circuit.   The popular 3034/3813 and those little NXP LFPAK MOSFETs are all OK @ 4.5v Vgs.  They work great. I'm talking like the MOSFET is in the linear region for 0.1%-0.3% of each period total(rise and fall).  It's no problem. 

To test my idea and calculations, I came up with a calculator to make it quick for me to calculate MOSFET rise/fall times and to see how long each period the MOSFET would be in the linear region.  I actually checked waveforms with my scope and the results are very, very close.  For example, one calculation was 6.1µS and the actual was like 6.3µS rise time.  The calculator is an Excel spreadsheet. I added directions on it.  If anyone wants to try for themselves, please go for it.  Post some waveforms and calculated values. :)

Here's a link to the calculator.  Let me know if you have any questions or issues with it. You'll have to download it and use Excel or an online app. The google drive thing isn't working for me.  If you have a better idea, please let me know.

https://drive.google.com/file/d/0B3TT1nuEw_baUjRlNU1oVG5fc1E/view?usp=sharing
 
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: Visus on January 27, 2016, 10:46:16 PM
 freaked_out:

Wow thats a lot of work you put into your build.  I myself would have been  scared: if someone asked me the same question lol. Me: 'Um it werks ok;   :thumbsup:..   Niiice.

Ya I really do understand why the 555 fail now when being mega chain vaped with your answer. 


Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: norcalreballer on January 27, 2016, 11:24:49 PM
Wow, that looks like quite a bit on my phone. I actually have the night off from work, which is medium rare.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: DIYFancyLights on January 28, 2016, 08:52:04 AM
Based on the max rating per I/O pin & for the entire chip (per I/O absolute max is 40mA), you could probably run at 20mA safely. This would give you a better MOSFET performance.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: norcalreballer on January 28, 2016, 06:42:22 PM
The only better performance would be having the MOSFET in the linear region for a less amount of time.  Even if we cut that 0.1%-0.3% in half, it's not going to make any noticeable difference. That's almost nothing.  Another thing to remember is the pin voltage will drop when it sources current. The voltage drop is porptional to the load(and temp).  10mA @ room temp will drop the pin voltage down to 4.7v.  20mA could be under 4.5v(before the voltage divider). That would probably still be OK, but my target Vgs is 4.5v minimum.

We also need to keep the total current consumption as low as possible, as it's being powered with a linear regulator.  When it fires as it is, the board can draw 33mA(~3mA idle W/ a 10k pot).  I'm still planning on using this design for some 4s boards. 

Basically, the benefits from keeping it at 10mA outweighs the benefits of the doubling the gate current to 20mA, IMHO.  That's why I designed it like that.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: DIYFancyLights on January 28, 2016, 06:50:29 PM
I considered the voltage drop specification, but since you are charging the integral capacitor in the MOSFET, the current will drop off naturally as approach Voh. In both cases you should reach the same max voltage.
Title: Re: Smart PWM board V2 ( Attiny85 )
Post by: norcalreballer on January 28, 2016, 06:54:02 PM
Either way why add another 10mA? It's already very efficient.  It doesn't heat up in a least bit.