Attiny25/45/85 FW Development Thread

1922 posts / 0 new
Last post
Flintrock
Offline
Last seen: 3 years 3 months ago
Joined: 09/10/2016 - 20:29
Posts: 1544

Anyway.  Restart works.  I can distinguish restarts from cold starts now without corruption concers, without rewriting  the whole program or using eeprom, just some stack hacking.  I also realized I was being silly about detecting memmory decay. It's not like checksums or redundancy are a new concept.  Just write a byte 4 times and make sure they're all the same. That's not what I did here though in the end, but it could be done to make the existing OTC-less fastpresses work better or to have mid-term memory/timing over periods of say of an hour, which actually looks possible.

 

 

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 7 hours 53 min ago
Joined: 03/24/2016 - 07:44
Posts: 9036
Location: Everything is brighter in Texas

You make a habit of blinding drivers in traffic?

Flintrock
Offline
Last seen: 3 years 3 months ago
Joined: 09/10/2016 - 20:29
Posts: 1544

I think you're looking for the other light forum.  Man, you can get banned there for even discussing any kind of non-DOT approved illumination.

Flintrock
Offline
Last seen: 3 years 3 months ago
Joined: 09/10/2016 - 20:29
Posts: 1544

At some point I started getting wakes from real non-simulate restarts.  Just 128+ ms.  It doesn't sound like much but basically I think initial sleep detection and shutdown eats through a ten'er.  Every 10uF from there should add about 1.5s.   I'm at 4.2V but I'm also at 2.7V cuttoff, so not so different from 3V and 1.8V cuttoff.  I'll see how many caps I can balance on top of each other.

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 7 hours 53 min ago
Joined: 03/24/2016 - 07:44
Posts: 9036
Location: Everything is brighter in Texas

LOL, well I referring to your earlier post:

Flintrock wrote:

Yeah, 7 vs 9 won’t be a big deal.  4 vs 9 though, yeah, maybe.  1 vs 9 certainly.  Anyway,  perception and usefulness are not the same thing.  More light is more useful, especially in traffic.

I can’t come up with a situation where more lumens in traffic is a concern? I tend to try to stay out of the street, particularly at night. But thats just me. Silly

Flintrock
Offline
Last seen: 3 years 3 months ago
Joined: 09/10/2016 - 20:29
Posts: 1544

On a bicycle at high speed, you need much more "microsopic" vision of the road surface than you do in a car.  Ruts will kill you.  Not everything has to point up.  But other lights around (from traffic etc) do reduce your contrast.  It's not perceived brightness that matters.  It's actual brightness that determines how far down the road you can see well.  I don't think I was the only one saying this in the modes group discussion.  Anyway, my single 18650 lights, don't put out 3800 lumens.  

 

What you want on a bike light is to be able to set it to a fixed brightness, have it stay there, and select the appropriate such brightness based on the runtime you need to get.

Flintrock
Offline
Last seen: 3 years 3 months ago
Joined: 09/10/2016 - 20:29
Posts: 1544

 oh, and that power off wasn't quite real.. I shorted c1.  I mean that does shut power off, but it shuts it of FAST.  So it's still kind of cheating.  

Flintrock
Offline
Last seen: 3 years 3 months ago
Joined: 09/10/2016 - 20:29
Posts: 1544

So 4 s 2s (didn't reset the counter, oops) with another 20uF added , my prediction wasn't that far off.  But actually that was with 1.8V cuttoff (always was)..1.25s 0.75 at 3.1V on this chip though.  Many more ifs, ands, and buts compared to a final light still some good, some bad.   One of the big ifs is that the ADC wasn't on during power off detection and power off is clearly about 10uF worth of the drain.  All this matches up reasonably well (still true after correction, was a bit high, is now a bit low) with the current measurements I made before.   I still think this is probably the cause of Mike C's observations about the ADC being so important.

 

I set the main loop to only turn on the adc before taking  readings, added idle sleep to the delay function, sped up the ADC, and added a 16ms delay (sleep) in the main loop.  This should keep power-off detection drain under control hopefully.

Tom E
Tom E's picture
Offline
Last seen: 4 hours 48 min ago
Joined: 08/19/2012 - 08:23
Posts: 14057
Location: LI NY

Oopsie, sorry guys for not keeping up with this thread. I just don't have the time I used to. Work has gotten a bit crazy, and still some doc/med issues. Wayyy behind on pm's as well.

Think you guys figured out the parasitic drain in Narsil - it's got a 10 sec delay before shutting off, unless LVP is in effect. If so, it actually stays up for 6 minutes so periodic LVP blinks can be done for a while.

Sorry, got some loose ends in Narsil 1.3, just haven't gotten to finishing the mods.

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 7 hours 53 min ago
Joined: 03/24/2016 - 07:44
Posts: 9036
Location: Everything is brighter in Texas

No problem, totally understand! I have much the same going on in my life (about about to get way crazier!).

LightRider
LightRider's picture
Offline
Last seen: 3 years 2 days ago
Joined: 08/05/2015 - 09:52
Posts: 2007
Location: U.P. MI, USA
Tom E wrote:

Oopsie, sorry guys for not keeping up with this thread. I just don’t have the time I used to. Work has gotten a bit crazy, and still some doc/med issues. Wayyy behind on pm’s as well.


Think you guys figured out the parasitic drain in Narsil – it’s got a 10 sec delay before shutting off, unless LVP is in effect. If so, it actually stays up for 6 minutes so periodic LVP blinks can be done for a while.


Sorry, got some loose ends in Narsil 1.3, just haven’t gotten to finishing the mods.

Thanks Tom. Ya, figured it out the long way:) I did some more learning atleast. I have a number of drivers built and waiting for the updated Narsiltriple. I didn’t realize you were so busy. There’s no pressure here! Your free services to blf are invaluable to the rest of us. Whatever and whenever you contribute it is greatly appreciated!!!

Tom E
Tom E's picture
Offline
Last seen: 4 hours 48 min ago
Joined: 08/19/2012 - 08:23
Posts: 14057
Location: LI NY

K, I'm gonna make it a priority to clean up the latest Narsil soon, because I need to update my Manker U11, and really want to get a Lumintop SD26 modded with a TA triple as well. The U11 came out just plain awesome - it's a GREAT host, no matter what you think of Manker. Mine has a XPL2 V5 4000K LED that can do 2,000 lumens.

The U11 was a challenge to customize with a OSHPark driver, to say the least, but it came out really, really nice. I trimmed the TA driver to fit, then epoxied on the vertical switch mount board, and with the switch LED support, ramping, triple channels, in a great pocket size 18650 light that can throw some.

Getting Narsil in a OTR M3 was tricky, and came out great, but I think the U11 might be the best light I've done w/Narsil. I got a 2nd U11 but would like to do a triple in it - need to work it out with a spacer though.

LightRider
LightRider's picture
Offline
Last seen: 3 years 2 days ago
Joined: 08/05/2015 - 09:52
Posts: 2007
Location: U.P. MI, USA

I’m about to finish a build that uses a charging circuit along with a TA driver running Narsil. You can read about it here. It would be awesome to get the u11 running with Narsil and with charging. It would be pretty tight in there though!

It may be possible if I can get an integrated driver/charger board designed successfully. I am on a mission to get charging onto our blf drivers. Of course I’m way under qualified but…

Flintrock
Offline
Last seen: 3 years 3 months ago
Joined: 09/10/2016 - 20:29
Posts: 1544

Getting better and better.  I forgot that I have a trim pot in my drawer so I can mock up a bleeder. Those power saving tricks I mentioned above seem to have worked unless I just confused myself with the low readings earlier.  Anyway, I'm getting 1.5s now at 3.1V  with a real power shutoff (disconnecting the wires to the supply) with a 1.2Kohm bleeder.  I'd expect that to go at minimum 2.25s, maybe more at 47uF.    We can still play with lower C1 and lower bleeder resistance, but I think this is basically licked.  Of course quality caps will keep that from dropping too badly when hot but it will drop.  There's only so hot you can get at 3.1V though, and you get more time at  higher volts anyway.

 

I'm still tweaking the code a bit to try to get the size a touch lower.  Changing the wake counter to register saved 30 bytes or so, but is for some reason (probably optimizations) unstable.  Changing a couple of other things to register already saved 50 to maybe 75 bytes though, by reducing i/o instructions.

 

Basically I'm calling this mission accomplished.  Just decoration now.  For any catching up, the mission was watchdog based off-timing working in bistro fitting into a 47uF cap and an attiny 25 using BODS, long sleeps with dual wake interrupts, and more,  to reduce power drain, 

 

Oh and I'd say adding the pin change final wake noticably improved the feel of the reponsiveness even at 128ms sleeps but as it's sort of built in to this method I didn't really pay attention to directly compare.  It obviously helps at 250ms sleep and that saves power if we find quarter second timing resolution to be good enough.  I think it is.

Flintrock
Offline
Last seen: 3 years 3 months ago
Joined: 09/10/2016 - 20:29
Posts: 1544

Accepting to just put voltage readout  on Vcc sure helped to move this along.  Multi-S lights will be another issue and in this technique will require using the LDO as a reference voltage, and well selected R2 and R1, but there's a working place to start from to get there now instead of trying to solve everything at once.  The software change for that is simple, just need to us the READ_VOLTAGE_DIVIDER define and redefine the voltage reference somewhere else.  Will just have to layout a new calibration and or rules for resistor values.

 

 I can let someone else work all that out but I'm reading full input voltage on pin 7 now, so 4.2V max, and I'd say you'd want to keep it about like  that, or close. Votltage reading can reference off a 5.0V LDO anyway, so it's fine.  So for a two s light I would just use equal R1 and R2, and either go big, and use a separate bleeder to control power down speed or set the total resistance in R1 and R2 to what's needed for that (maybe 1K) and leave off the bleeder.  Either  way.  Tail-caps light will probably modify the math.  For a 3S light, obviously R1 should be twice R2 etc.  One calibration should work for all of it, but probably not the same one that's in there now.

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 7 hours 53 min ago
Joined: 03/24/2016 - 07:44
Posts: 9036
Location: Everything is brighter in Texas

It sounds very promising. So the OTSM is working, now the only real issue left to figure out is how to allow it to work with multi-cell lights with few/no changes?

For reference I will be moving away from the zeners and to LDO’s almost exclusively. In fact the new driver design has a 3.3V LDO built into the design for all drivers. I also recently added an LDO version of the TA 17mm as well.

So with an LDO being used for multi-cell lights would allowing it to work with any voltage input be that hard to work out? I assume a change in the voltage divider but that is a pretty simple thing to change for most people compared to a firmware change.

Flintrock
Offline
Last seen: 3 years 3 months ago
Joined: 09/10/2016 - 20:29
Posts: 1544

Actually I keep lousing the measurements when in a hurry.  It seemed like those were fast seconds, but I made up for it by going to 500ohms.  1.25S at 3.1 V, I think that will still work out, but I was looking at 47uF caps in  more detail and man, those DC voltage vs capacitance curves for 10V and 6.3V caps (only ones available in 0805) are nasty, so it will need testing with a real CAP (but a v-chip can still help too).  Also I wonder what our rules are.  TA you're the driver arranger.  What are you interested in trying here.  I'm betting that adding capacitance to the traditional OTC slot helps almost every bit as much as adding it to the C2, but I'm not sure.  Possibly matters how pin states are set (something I haven't understood or played with enough).  It depends if we're thinking new boards or just keeping the ones you have.  If keeping them, might as well use the spot.  Then you can get 100uF anyway. 

 

I think 5.0V LDO is a much better choice. 5.0V gives you much more off-time power.  PLENTY in fact, but 3.3 is down on the low end.  Of course we want it to work at 3.3 anyway, but's no need to cause issues for people with multi-cell lights and lousy caps. More importanly I'd like to keep the resistor divider simple, so two equal resistors for 2S, no divider for 1S,  two to one for 3S etc.  If you have a 3.3V ldo, you can't put 4.2V on the sense pin, it's way past spec.  You can only go to Vcc +0.5 V.   So that makes resistors more complicated and at the same time reduces the margin for error in them before hitting the cuttoff voltage.  There's enough margin, but then you really have to get it all right.  With 5.0, 2-S, just use any two equal resistors and you're set.    5.0 would also allow auto detect but that's not going to happen in a 2048 byte bistro anyway.  

 

Otherwise, setting this up for multi S won't be a big deal.  Forget tailcap lights for right now, I'm too lazy at the moment to think about them, but without that and with a 5.0V LDO, you just need to divide the voltage by two for two cells.  If you want to skip a bleeder then you'll want the total R1+R2 to be low and within some window, but there's still a ton of flexibility there.  No more of this 19.1 vs 20 vs 22 nonsense.  That won't matter, so long as they're both the same and both in the right ballpark (I'd say two 250 ohms each is looking pretty good).    You could instead have them higher(but still equal)  and use a 500 ohm bleeder, but it's probably completely unnecessary.  

 

As for the software, it's just one config option and getting the right calibration table in place, which will depend on the LDO voltage so best to choose one and stick with it.

 

At the moment I'm using no R2 resistor for 1S.  That's probably fine and even R1 could be shorted, but to bring the voltage down slightly farther into spec a 10x R2/R1 would be ok too (so backwards from the past). It probably really doesn't matter though.

 

 

 

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 7 hours 53 min ago
Joined: 03/24/2016 - 07:44
Posts: 9036
Location: Everything is brighter in Texas

For the first question, I assumed from the start that a PCB change would be needed, if it works with the stock setup that is great but a change is what I saw coming. Although at best on the current TA design it might fit an 0805 cap, I don’t see a 1206 fitting but since these would be hand made anyways you could put a 1206 on the 0805 pad.

Overall the number one goal is to make it as universal as possible with preferably only voltage divider changes needed for different inputs ect. Also needs to be able to work with both clicky and e-switch.

The reason for the 3.3v ldo is that for the opamp to work it needs a reference voltage which it gets from the LDO output. at 3.3v the circuit will work fine till it drops out of regulation around 3.4v or so, then the driver current will start dropping due to the reference dropping. This is fine at those low voltages since it would not be able to maintain full power down there anyways but a higher voltage LDO would be a different story. This is another case of a compromise that has to be made in the interest of space and cost.

The LDO could be swapped out for a 5V LDO in 2S setups with resistor changes all around but I would prefer to only have the voltage divider change for simplicity sake.

Flintrock
Offline
Last seen: 3 years 3 months ago
Joined: 09/10/2016 - 20:29
Posts: 1544

Oh well you're talking about an op amp driver now.  That's a whole different story.  Are you abondoning the tripple driver entirely? 

 

 

Anwyay, both will work.  We can define choices.  In 1S it doesn't matter.  In n-S you can use 5.0V and matching resistors, or 3.3V and some well selected resistors as before, with lower maximum off-time calibrations.   It's up to whoever is setting it up.

 

As for using the existing hardware, for 1S I think this will work other than we'll see about capacitance.  The C2 is now 0603 so no cramming 1206 on that.  Might be possibly on the OTC pad though, and as I said, I guess that will still buy time too. I'll test when I can.  A 100uF 1206 will hit this thing out of the park. The BODS does make real gains.  We won't need 200 real uF's  to operate it.   I'll try really low resistance soon as that will simulate what a lower C1 would be like, so I'll see how much that matters.  I don't think realistically we can go below 500ohms and stay compatible with tail cap lights.  Also the drain starts becoming a little  meaningful in moon mode at some point down there, but I can test at 50 and it's the same as using a lower cap.

 

I'm not sure about just aiming at hand made though.  It seems some of the software has showed up places like GB hasn't it?  So there may be copies if it's made to be reasonable to build, and that's great.

Flintrock
Offline
Last seen: 3 years 3 months ago
Joined: 09/10/2016 - 20:29
Posts: 1544

I did forget about the need for a diode and LDO  (or combo) in 2S, so yes, that probably needs a board modification.

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 7 hours 53 min ago
Joined: 03/24/2016 - 07:44
Posts: 9036
Location: Everything is brighter in Texas

Not really giving up on the TA series as moving on to better things. There is just not much left to do with the TA setup besides possibly cramming an 0805 C2 on it and frankly the TA will never go anywhere past hand made drivers (at least not the 17mm version, the larger versions could I suppose), the backside 7135’s just make it impractical to use it in a production light.

The new driver will be designed from the ground up to be production ready, which is why I am moving the focus to it. Plus it is simply a better setup and even more efficient then the 7135’s since you can have true non-pwm regulation at any current that it can dissipate the heat from instead of just 2 channels of pre-selected current.

So While they should share the same firmware setup I am moving focus to the new driver. Anything that works on the new driver should be backwards compatible with the Texas Avenger but not necessarily the other way around.

One reason I want as few changes to the hardware as possible is that I do see these drivers being produced by a china company in bulk for a cheap and effective option for us modders. As such I want the hardware to be as complete as possible for as many setups as possible out of the box. The voltage divider is the one thing that I don’t think we can get around but luckily that is a fairly simple item to swap out and/or disable in the firmware. I suppose we could always go back to the 1.1V reference for the LVP? or will that not work with the OTSM?

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 7 hours 53 min ago
Joined: 03/24/2016 - 07:44
Posts: 9036
Location: Everything is brighter in Texas
Flintrock wrote:

I did forget about the need for a diode and LDO  (or combo) in 2S, so yes, that probably needs a board modification.

The new driver will always use an LDO with built in diode.

The TA driver will be able to do the same.

Flintrock
Offline
Last seen: 3 years 3 months ago
Joined: 09/10/2016 - 20:29
Posts: 1544

So the one issue there, is for OTSM it's a bit of a bummer to see a 1S forced to a 3.3V LDO.  I said we need OTSM to work at 3.3V anyway, but that's not quite true.  It needs to work at 3.3V but for a standard 1-S setup it doesn't need to work there hot. You just can't get as hot at 3.3V battery as at 3.9V anyway, so a 3.3V LDO is actually placing more demand on the OTSM cap.  Especially in the TA driver, there's just no need for the LDO in a 1S other than conformity, but it might turn out it's better to use generation 1 in that case anyway.  Well I guess for the TA there's no downside, other than maybe a few cents in price, to just using the 5.0V LDO for 1S, so that works too. 

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 7 hours 53 min ago
Joined: 03/24/2016 - 07:44
Posts: 9036
Location: Everything is brighter in Texas

Like I said, the op-amp needs an LDO for the voltage reference and there is not enough space for a separate diode. Plus it would be nice to have everything setup around a single LDO voltage, then no changes would be needed for any input voltage outside the divider.

Flintrock
Offline
Last seen: 3 years 3 months ago
Joined: 09/10/2016 - 20:29
Posts: 1544

Well I'm going to have to order an assortment of caps for the sake of science and maybe even build a light.  I don't like the power saving I programmed in bistro now.  It's too unreliable with 16ms minimum watchdog idles.  It needs 1ms resolution to make sure it's always engaged when you need it.  I think I have code for that too using the internal clock timer, but it's a few lines longer and it would help if that other space savings trick works out.

Flintrock
Offline
Last seen: 3 years 3 months ago
Joined: 09/10/2016 - 20:29
Posts: 1544

Texas_Ace wrote:
Like I said, the op-amp needs an LDO for the voltage reference and there is not enough space for a separate diode. Plus it would be nice to have everything setup around a single LDO voltage, then no changes would be needed for any input voltage outside the divider.

 

I don't see any downside to recommending  5.0V LDO for 1S TA (non op-amp) style.  It comes in both flavors probably no?  Does 5.0V require a substanitally different part or it's just a choice in the series?  If building a 1S tripple, I'd just buy the 5.0V and use it as if it's just a diode.   Actually, I'd use the 1st gen board at the moment, because I know it works, but assuming the LDO works out (and does actually act like a diode), then 5.0V for 1S, and well, for tripple drivers also for multi-S.  Yeah, 5.0 V for any TA tripple.  Sure if you ordered a bunch of 3.3's for other builds they might work ok too, but you usually know what you're building when you buy the part.  1S op-amps are a different issue. I'd use whatever is best for the build.  It's the same effort either way.

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 7 hours 53 min ago
Joined: 03/24/2016 - 07:44
Posts: 9036
Location: Everything is brighter in Texas

You can use a normal diode on the TA drivers for 1S operation but like I said, I am not worried about them directly. Anything that works on the new driver is backwards compatible. So all development should be focused on the new opamp driver as that will be the long term winner here.

I can’t really think of a reason to use the TA series anymore once the opamp is working as it should, while they basically do the same thing the opamp will be the better one to use due to it fitting in lights easier and being more adjustable. Plus it could be machine made for group buy lights / cheap mass produced driver option compared to the TA series which would not work well outside hand built setups.

Tom E
Tom E's picture
Offline
Last seen: 4 hours 48 min ago
Joined: 08/19/2012 - 08:23
Posts: 14057
Location: LI NY

This is the driver planned to use in the Lumintop SD26. I took a 30mm LDO and converted to std diode setup. I think it would work. I added a wire jumper and a 0 resistor to make the connection of Batt+ to the MCU and C2. If anyone gets a chance, can you review/comment? Thanx!

Basic parts:

 

 

 

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 7 hours 53 min ago
Joined: 03/24/2016 - 07:44
Posts: 9036
Location: Everything is brighter in Texas

It should work like that. I think I actually said in the TA thread that you could put the diode across the far inner set of LDO pins facing towards the MCU and it would work fine.

The way you did it would be fine as well though, same thing, different placement. Although I did figure out a way to remove those jumpers but can’t bring myself to update all the drivers with the minor change when I have a new driver in the works that should render LDO versions of the Texas avenger moot.

Tom E
Tom E's picture
Offline
Last seen: 4 hours 48 min ago
Joined: 08/19/2012 - 08:23
Posts: 14057
Location: LI NY

K, thanx!!

Pages