Toroids and MOSFETs and firmware, oh my! (aka:'Tiny13+N-FET=???')

247 posts / 0 new
Last post

Pages

comfychair
comfychair's picture
Offline
Last seen: 5 years 6 months ago
Joined: 01/12/2013 - 05:39
Posts: 6198
Toroids and MOSFETs and firmware, oh my! (aka:'Tiny13+N-FET=???')

OK smart guys, I'm in over my head here. Is this even possible, do I need something else in the middle? Or just a different FET (this one (38N03) sucks anyway, just trying it as-is to see what happens)? What happens is, not much. Very erratic. Sometimes it comes on bright, then turns itself off after a few seconds, and no longer responds to switch inputs, power has to be cycled before it'll do anything again. Sometimes it'll change modes 2-3 times (but the levels are not what they should be), then lock up again, but the LED stays lit. Sometimes it does nothing.

The firmware is Werner's beta, it does work properly on a plain 105c using the 7135s. Just not driving the FET.

http://75.65.123.78/6XL2/Dsc06966.jpg

http://75.65.123.78/6XL2/Dsc06963.jpg

I've removed the 10k resistor after the gate since photos were taken, it did make some difference - before it would rarely work at all, now it's reliably erratic. (lol, I know...)

Edited by: comfychair on 02/10/2014 - 23:51
saypat
saypat's picture
Offline
Last seen: 5 hours 57 min ago
Joined: 07/13/2011 - 20:32
Posts: 3580
Location: Calif

subscribed

Pulsar13
Pulsar13's picture
Offline
Last seen: 3 days 15 hours ago
Joined: 02/05/2012 - 10:23
Posts: 1909
Location: Malaysia

Interesting…

Can’t help though. Smile

comfychair
comfychair's picture
Offline
Last seen: 5 years 6 months ago
Joined: 01/12/2013 - 05:39
Posts: 6198

HA! HA HA! But this works flawlessly...

http://75.65.123.78/6XL2/Dsc06970.jpg

Old-style SRK drivers have 3 PWM-out pins on the MCU (#s 5, 6, & 7), only piggybacked onto one of them here, and using the corresponding L2 channel, testing with just a single LED for now. The mode spacing needs fixin' but it ramps up and down and turns on/off like it should.

I didn't even disable anything on the original driver - if there were two switches connected, you could choose whether you wanted the stock SRK UI, or the one in the 105c....

comfychair
comfychair's picture
Offline
Last seen: 5 years 6 months ago
Joined: 01/12/2013 - 05:39
Posts: 6198

OK, similar issue when it's tied to all 3 PWM lines at the same time - doesn't work. It has enough grunt to run one channel at a time, but not two or more. Using the stock MCU it works fine with the 3 PWM pins bridged so that's not the issue, and it's not a firmware issue.

Hopback
Hopback's picture
Offline
Last seen: 5 years 1 week ago
Joined: 04/19/2012 - 15:32
Posts: 564
Location: West Sussex

Hi comfy, have you tried driving the three pwm inputs from the output of the 105 board with just one 7135?

It might give it enough omph to work…

comfychair
comfychair's picture
Offline
Last seen: 5 years 6 months ago
Joined: 01/12/2013 - 05:39
Posts: 6198

The gate on the single FET driver (or the PWM pads on the SRK driver) needs a positive signal, 7135 works backwards. Or is there another way to wire it up?

comfychair
comfychair's picture
Offline
Last seen: 5 years 6 months ago
Joined: 01/12/2013 - 05:39
Posts: 6198

I'm assuming it needs a P-channel somethingorother that can be driven by the tiny13, is fast enough for the modes to work properly, and that can then drive the FET's gate with higher current.

Back to the single FET board for just a sec...

http://75.65.123.78/6XL2/Dsc06957.jpg

Does the resistor at R13 help or hinder in this setup? I've removed it and tied straight onto the gate, never tried it with the resistor in place. Is it worth trying different FETs from the junk box? It'll need a different one anyway, not sure if anything I have here would be better.

comfychair
comfychair's picture
Offline
Last seen: 5 years 6 months ago
Joined: 01/12/2013 - 05:39
Posts: 6198

Tried something called 'APM3055L' from the junk box, the Tiny13 drives it just fine. Off to try a few others...

comfychair
comfychair's picture
Offline
Last seen: 5 years 6 months ago
Joined: 01/12/2013 - 05:39
Posts: 6198

Aaaaaand... the FETs that work great stop working when they're soldered to the driver. Wired up with alligator clip test leads and hanging in midair they work. I even lifted the gate pin and soldered the PWM out from the 105c straight to the pin, still doesn't work.

comfychair
comfychair's picture
Offline
Last seen: 5 years 6 months ago
Joined: 01/12/2013 - 05:39
Posts: 6198

I need a 'gate driver', right? (whatever that is...) Mainly for the old-style SRK drivers (since it works driving only one channel, but gives up when trying to drive all 3). The single-FET drivers can probably work as-is, with the right FET (which I don't have and don't know how to tell the ones that'll work from the ones that won't).

Not only do the FETs from the junk box work off the board and not work on it, they stop working when the wires are soldered to the pins instead of using alligator clip leads. What does that mean? Does the ATTiny require some resistance in the circuit? Are low resistance connections overloading the MCU, causing it to shut down/lock up?

I'm trying to search and find stuff that might be relevant, but that's probably not a good idea since I don't understand nearly all of it... :~

dave_
Offline
Last seen: 9 months 4 days ago
Joined: 04/19/2013 - 08:45
Posts: 457
Location: Schleswig-Holstein, Germany

If you have a multimeter at hand, can you measure any voltate at the L- pad?
For the fun of it, you could disconnect the gate from the Attiny and turn the FET on directly by connecting the gate to a battery or something.
If it doesn’t turn on the LED then, there can’t be to much reasons why.

(Resistance in the gate path is usually there to limit the gate charge/discharge current, manipulate turn on/off time or suppress ringing at faster switching speeds. But it shouldn’t be important for this problem )

Hopback
Hopback's picture
Offline
Last seen: 5 years 1 week ago
Joined: 04/19/2012 - 15:32
Posts: 564
Location: West Sussex

I thought that when I returned from work you would have this working by now! Sorry you’re still having probs Sad

The resistor R13 is to stop the gate sucking more current than the mcu can deliver. Maybe the croc clips are providing just enough resistance for it to work?

Im not an electronics expert though!

comfychair
comfychair's picture
Offline
Last seen: 5 years 6 months ago
Joined: 01/12/2013 - 05:39
Posts: 6198

Oh, yeah, it works when jumped, either gate to BAT+ or LED- to GND. The FET part itself is reliable, just not when it's being driven directly by the ATTiny. When it stops responding there's still power to the ATTiny (it's hardwired, after all) and there's nothing present at the gate/105c's output, appears to be exactly the same as when the 105c is switched off (it doesn't really have an 'off', just a mode that's 0%).

Sometimes it locks up and no number of button presses will make it do anything at all, while the LED is stuck on at whatever level it was when it froze. Sometimes it shuts off right after changing modes and never comes back until after a hard reset (I have a clicky switch on the side of my battery box).

That same 105c when piggybacked onto only one of the 3 channels on the old SRK driver works perfectly - never locks up, modes always change, it turns on/off every time like it should. But connect the 105c's PWM-out to two or more channels, and it does nothing, ever. And it works on any of the 3 channels, but just one at a time.

comfychair
comfychair's picture
Offline
Last seen: 5 years 6 months ago
Joined: 01/12/2013 - 05:39
Posts: 6198

Hopback wrote:
I thought that when I returned from work you would have this working by now! Sorry you're still having probs Sad The resistor R13 is to stop the gate sucking more current than the mcu can deliver. Maybe the croc clips are providing just enough resistance for it to work? Im not an electronics expert though!

I even added that resistor back, didn't change it. Tried with all combinations of both resistors, too (the other one, 10K, over at the right going from gate to GND, but I don't think that one's needed, the ATTiny has an internal drain to take care of any leftovers on the gate when the output's switched off).

But like I said, I'm pretty sure the single-FET drivers will work fine, if I can nail down which FET will work with this combo.

Pulsar13
Pulsar13's picture
Offline
Last seen: 3 days 15 hours ago
Joined: 02/05/2012 - 10:23
Posts: 1909
Location: Malaysia

Curious. Have you tried removing the 10k R14? If not, maybe you can try that, or at least change to something higher e.g 50k or so. Seems like the board itself is sinking some of the signal current.

comfychair
comfychair's picture
Offline
Last seen: 5 years 6 months ago
Joined: 01/12/2013 - 05:39
Posts: 6198

Yup, tried with & without both resistors, the one inline with the gate and the one from gate to ground. Haven't tried a different value resistor at R13 yet and I'm pretty sure R14 isn't needed.

JackCY
JackCY's picture
Offline
Last seen: 6 years 6 months ago
Joined: 12/28/2012 - 16:30
Posts: 588
Location: Czech

How many amps do you need? And how many outputs? 1 output or 3 separately controlled outputs?

As noted, why not use a 7135 or something else, don’t you have those tiny mosfets to use as gate drivers for this big beast?

What about the inline resistor to the gate?

Werner
Werner's picture
Offline
Last seen: 2 years 2 months ago
Joined: 10/19/2012 - 15:00
Posts: 3679
Location: Germany

The original driver has some different kinds of security aspects.
gate pulldown
Controller to gate resistor
Capacitor between GND and VCC
Diode between VCC and controllerVCC
Resistor between VCC and controllerVCC
Capacitor against GND on Controller VCC

I know it’s too late but maybe you should have just removed the Stock controller and wire the tiny 13 on its place with all the features the stock driver came with…

Try some bigger cap between GND and VCC first, I had this issue before on my 15mm driver.

comfychair
comfychair's picture
Offline
Last seen: 5 years 6 months ago
Joined: 01/12/2013 - 05:39
Posts: 6198

Doesn't the 105c host board have all the parts the attiny needs?

I think I read somewhere that it doesn't need a pulldown resistor on the gate, 'cause the attiny handles that internally - could be totally wrong though. Either way with resistor/without resistor it still didn't work.

What's weird is that the setup that did work with the FET not mounted, was just the PWM wire from the 105c soldered to the gate pin, BAT+ to the 105c & LED+, GND to 105c & FET's source (with an alligator clip), and LED- to FET's drain (again with alligator clip). No resistors anywhere. But solder the FET to the board, and solder the GND & LED- connections, and it goes back to being erratic and locking up/shutting down. There's no other components on the original board, and I've verified none of the PCB traces is funky. Everything's isolated like it should be.

comfychair
comfychair's picture
Offline
Last seen: 5 years 6 months ago
Joined: 01/12/2013 - 05:39
Posts: 6198

http://75.65.123.78/Dsc06989.jpg

It works! Replaced the 10 ohm at R13 with a 68 ohm, no other changes. I don't know if that's too high to fully drive the gate, or if it'll stop working again later when I replace the original FET with one capable of some real current, but I'll burn that bridge when I come to it.

comfychair
comfychair's picture
Offline
Last seen: 5 years 6 months ago
Joined: 01/12/2013 - 05:39
Posts: 6198

Standby current with the stock driver was 1.32mA, with the hybrid thing it's down to .77mA.

reliant_turbo
Offline
Last seen: 1 month 4 days ago
Joined: 02/16/2012 - 16:01
Posts: 165
Location: Warsaw, NY

you could put a potentiometer into the circuit rather than the 68ohm resistor and adjust it to find out the resistance that limits current enough for the attiny to function and allows enough current to flow to fully charge the FET.

if you probe the output pin of the attiny and decrease resistance, at some point the voltage will drop as the gate current gets too high for it to source.

there is a way to calculate all of this to get the exact resistance value but the last time i did that was 7 years ago and it was for a op amp being used as a comparator, driving a BPJ transistor so im super rusty.

looks like i need a refresher. ill get out the books again and my 2 FET SRK clone driver and play. Smile

Brian

comfychair
comfychair's picture
Offline
Last seen: 5 years 6 months ago
Joined: 01/12/2013 - 05:39
Posts: 6198

Think more resistance will be the solution for the 3-channel SRK driver too? It still has the original resistors in the line, one for each channel.

SRK mouseover for anybody else who wants to play along...

 

Werner
Werner's picture
Offline
Last seen: 2 years 2 months ago
Joined: 10/19/2012 - 15:00
Posts: 3679
Location: Germany

That are very good news. Smile

Yes gate pulldown is not needed in theory because the pulldown is already build in the tiny. I had once problems so I made space for a gate pulldown and a resistor between controller and gate on my custom PCBs.
I read that without the other inline resistor the gate trace could work as an antenna and do some fancy emv crap….
In the 15mm driver thread some said that I only had need for bigger capacitors because I had no voltage protection diode, I guess this is what you meant with that the nanjg had all parts, but it isn’t totally confirmed yet(maybe we should call the myth busters). I had two boards one with the FET and one with the controller if I connected them via breadboard it worked if I soldered them together with jumper wire it worked, but assembled on the same PCB it didn’t work. The bigger cap solved the problem.
——
My tests showed that it can work without the inline resistor so I just bridged the pads, maybe you found now a case where it is necessary. I also read that the size should be around 100 ohm for the inline and 10kohm for the pulldown.

If the inline resistor is too big it could happen that the FET isn’t switched fast enough(RC circuit needs to long to charge)so it stays longer in linear mode where the FET has higher resistance. I also read that the FET will get very hot in this case and will die…
If the gate capacity is too big the tiny isn’t able too give the needed chargecurrent and this could also make weird things. Maybe this happened here…
——-
Thanks for the current measuring. As I had wrote I have now added sleep modes to the firmware which brings it down in the uA range. The voltage divider is the biggest power eater.
——-
Sadly my soic clip is still on strike, I will resolder all wires and clean contacts tomorow. I hope this will bring him back to life.
I don’t want to send you the new firmware without testing it myself before.
I added 3 stage battmon if voltage falls below a declared value (I choosed 3.2Volt or so)it goes to mode 3(low) if voltage sinks further it goes to mode2(moon) and if it reaches the next voltage it switches off. This should give light for a long time and a defined switch off(which I miss often in the other firmwares which will suck the battery till death).
——
Reliant turbo I believe I have found what you meant:
This is the formula for the current which is needed to charge the gate capacitor:
I=C*du/dt

We want the Resistance so we use ohms law R=U/I, the du(which is U in this case because we switch from 0 to VCC) falls away and the others are inverted.
R=dt/C
R is the maximum resistor which will allow the gate to get charged fast enough
If you choose dt=100nS( seems to be a good value) and C=800pF(value from 35n03 datasheet)
(100×10^(-9))÷(800×10^(-12))=125ohm

comfychair
comfychair's picture
Offline
Last seen: 5 years 6 months ago
Joined: 01/12/2013 - 05:39
Posts: 6198

Wow, something written in normal human English that I can nearly halfway understand! "How P-Channel MOSFETs Can Simplify Your Circuit" - http://www.irf.com/technical-info/appnotes/an-940.pdf

Werner
Werner's picture
Offline
Last seen: 2 years 2 months ago
Joined: 10/19/2012 - 15:00
Posts: 3679
Location: Germany

I have read the PDF but don’t see how this helps…?
Now we know that Pfets need more material and are more expensive but there are applications where they could come in handy…but nothing which is suitable for this situation…
What have I missed?

saypat
saypat's picture
Offline
Last seen: 5 hours 57 min ago
Joined: 07/13/2011 - 20:32
Posts: 3580
Location: Calif

I can’t follow this thread any longer. I don’t know what language is being spoken, and it is giving me headaches. I’m happy that there are a few of you who are on the same page..

best wishes….

18sixfifty
18sixfifty's picture
Offline
Last seen: 2 years 1 month ago
Joined: 12/25/2012 - 20:19
Posts: 4161

I don’t know much about these and not enough to really help but I can tell you a little bit of the work I did with the same driver. I tried two different FET’s. The first was off of a ZY-T08 and it acted goofy like the one you are talking about. No second driver hooked up but what it did was it had a low and high but both were very dim, I’m talking about dim enough to look at. If I held down the switch for a period of time it would give me a very bright blinky mode. That was it. I then put a DTU FET similar to the one of the black SRK driver on and The output was amazing but still once in a while it wouldn’t turn off correctly.

I have a couple different FET’s on the way so I’ll post my results here (if you don’t mind) when I try them out, with this driver. On of them on the way is the one that was mentioned for modding the DRY driver.

The DTU FET output had to have been very close to full direct drive.

I’m a junky, I mod lights so I can sell lights so I can buy more light to mod so I can sell lights to buy more lights to mod.

comfychair
comfychair's picture
Offline
Last seen: 5 years 6 months ago
Joined: 01/12/2013 - 05:39
Posts: 6198

The one I have yet to get to is the red 'JB' driver in the Securitying SRK clones. FET is a K4212 and does, best I can estimate, 14-15 amps from 4 20Rs into 3 XML2s on copper. If the attiny is happy driving it I think that FET will be the one I stick with... it's available on aliexpress for sure, maybe on ebay, I don't remember. But it's out there and works well. I'd also like to test it with a single cell & single LED, see if it still puts out good numbers.

http://75.65.123.78/JBdriver.jpg

----------

Couldn't this attiny/105c trick be used with just about any other momentary switch driver? Specifically thinking about the S1100/S2200, the output part of the driver is fine but it's sorely lacking anything like a useful UI. It'd need a zener regulator or a 7805 to drop the voltage for the attiny, but the output should still be able to control the rest of the driver just the same. There's plenty of space inside for extra components.

maciex93
Offline
Last seen: 4 years 2 months ago
Joined: 10/15/2013 - 06:32
Posts: 118
Location: Poland

Maybe toggle switch? http://www.mosaic-industries.com/embedded-systems/_detail/microcontrolle...

I made it for my SRK.

Momentary switch ON and OFF the attiny, so it working the same like in flashlight with normal clicky switch.

Working video http://www.youtube.com/watch?v=Foc9R0dC2iI

I tested both circuits, and in my opinion the first one is better, no oscillating and after power connection is still OFF.

Pages