[retired] [WIP] 20mm single sided & 17mm double-sided ?-amp linear driver - surprisingly good!

207 posts / 0 new
Last post
wight
Offline
Last seen: 1 year 3 months ago
Joined: 11/27/2013 - 16:40
Posts: 4969
Location: Virginia, USA

pilotdog68 wrote:
I’m rebuilding it with each iteration, but if you don’t see something wrong with my code, that is still my best guess. Maybe there’s something weird going on with the avr tools cache. We’ll find out tomorrow.
I don’t see anything that would make either 4 mode config appear as 3 modes.

What procedure are you following? I do this:

  • build in AVR STudio
  • expand “output files”, double click on the hex -> save the hex file with a unique name
  • switch to the CLI (command prompt)
  • flash that particular hex file using a command formatted like this:
    avrdude -p t13 -c usbasp -u -Uflash:w:xxxxxxxxxxxxxx.hex:a -Ulfuse:w:0x75:m -Uhfuse:w:0xff:m

Still fine, still on a break. One day I’ll catch up with you folks! previous wight catchup Wink
list of my drivers & variants (A17DD, FET+1 stuff, WIP stuff, etc)

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 month 4 weeks ago
Joined: 05/30/2013 - 23:31
Posts: 6422
Location: Held against my will in IOWA, USA

That’s exactly what I’ve been doing, except for the unique name. I have been overwriting “FW.hex” with each build so I can just copy/paste the same command line. I’ll try closing studio between builds to make sure it’s actually rebuilding it, then try unique names if that doesn’t work.

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

wight
Offline
Last seen: 1 year 3 months ago
Joined: 11/27/2013 - 16:40
Posts: 4969
Location: Virginia, USA

I don’t see why you should need to do the unique names part, I was just telling you exactly what I was doing. If you are actually opening the “save” or “save as” dialog box and overwriting the file each time I think we can be confident that you do not need to do anything different there.

Still fine, still on a break. One day I’ll catch up with you folks! previous wight catchup Wink
list of my drivers & variants (A17DD, FET+1 stuff, WIP stuff, etc)

wight
Offline
Last seen: 1 year 3 months ago
Joined: 11/27/2013 - 16:40
Posts: 4969
Location: Virginia, USA

My current suggestion is to add some more modes:

  • Define MODE_MOON again, leave the other modes defined.
  • Use 10/35/50/70/255

Still fine, still on a break. One day I’ll catch up with you folks! previous wight catchup Wink
list of my drivers & variants (A17DD, FET+1 stuff, WIP stuff, etc)

LinusHofmann
LinusHofmann's picture
Offline
Last seen: 1 year 11 months ago
Joined: 09/28/2013 - 08:27
Posts: 974
Location: Switzerland

Sounds like fun Smile

If you’re unclear whether a firmware has been flashed correctly, and you’re using Phase correct PWM. Try simply changing the 8x divider fuse bit and reflashing. You can then tell by eye if the PWM frequency has changed, 1khz vs 9khz is easy to spot by waving your hand through the light. Of course you’d likely lose the lower modes as well so that should be even more obvious.
Just to quickly confirm it’s flashing correctly without having to recompile anything.

Cereal_killer
Cereal_killer's picture
Offline
Last seen: 1 year 5 months ago
Joined: 07/22/2013 - 13:10
Posts: 4005
Location: Ohio
pilotdog68 wrote:
That’s exactly what I’ve been doing, except for the unique name. I have been overwriting “FW.hex” with each build so I can just copy/paste the same command line. I’ll try closing studio between builds to make sure it’s actually rebuilding it, then try unique names if that doesn’t work.

Here’s my recommendation- recompile and name the output file something different. Before flashing, open the new file, copy it’s content and paste it into a compare tool like diffchecker https://www.diffchecker.com

Then do the same with the old hex file to the other side of the diff checker. This will tell you that you’re correctly compiling (when I was new to avrstudio I had an issue editing the wrong file, using the diff checker on your hex files will verify you’re not making that same mistake).

You must edit the .c file asscosiated with the open project, if you open the wrong .c file, make changes to it, then recompile the project the freshly compiled hex file won’t reflect the changes you made to the non-project .c file because when you hit compile it will always huild off the project’s own .c, if you accidentally opened the wrong .file to edit those changes won’t change anything so verifying the new hex is different will show you that you definitely have a different file and that you have other issues.

 RIP  SPC Joey Riley, KIA 11/24/14. Now I am become death, the destroyer of worlds.

wight
Offline
Last seen: 1 year 3 months ago
Joined: 11/27/2013 - 16:40
Posts: 4969
Location: Virginia, USA

That’s a good sanity check Cereal_killer. Doing diffs is never a bad idea.

Still fine, still on a break. One day I’ll catch up with you folks! previous wight catchup Wink
list of my drivers & variants (A17DD, FET+1 stuff, WIP stuff, etc)

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 month 4 weeks ago
Joined: 05/30/2013 - 23:31
Posts: 6422
Location: Held against my will in IOWA, USA

Ok I started over from a virgin copy of STAR. I am now getting light on 4 closely-spaced modes. There are no “dead modes” in the UI, but according to the FW there should be a fifth mode. Is it possible it’s just entirely skipping over ‘moon’ for some reason?
This is where I am now. if I try to “build” it with “define Fast_PWM start” commented out, AVR studio gives an error that it is undefined.
At one point, I got a really nice firefly mode (as in you could stare directly at the die without hurting your eyes) but with all the confusion over the mode order I’m not sure what PWM setting produced it.

edit: I’ve been making my changes in wordpad starting a new project in AVRStudio with each revision to ensure they are actually taking affect. It seems to be working in that regard.

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

wight
Offline
Last seen: 1 year 3 months ago
Joined: 11/27/2013 - 16:40
Posts: 4969
Location: Virginia, USA

Firefly and moonlight will probably both be somewhere in the 10 to 45 range.

Are you saying that you previously commented out “define Fast_PWM start” and were able to compile, but it doesn’t work now with your fresh copy?

For now let’s switch you to a non-dual-PWM version. Keep things simple and all that. Use this: http://www.jcapsolutions.com/wp-content/uploads/2014/05/STAR_off_time_1.3.c

Still fine, still on a break. One day I’ll catch up with you folks! previous wight catchup Wink
list of my drivers & variants (A17DD, FET+1 stuff, WIP stuff, etc)

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 month 4 weeks ago
Joined: 05/30/2013 - 23:31
Posts: 6422
Location: Held against my will in IOWA, USA

Quote:
Are you saying that you previously commented out “define Fast_PWM start” and were able to compile, but it doesn’t work now with your fresh copy?

I think so. With the first 2 revisions, I had it the way it is now, later I commented it out. So either I fudged something deeper in the code that allowed it to go through before, or AVRStudio wasn’t actually building my revisions and I was flashing the same FW over and over.

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 month 4 weeks ago
Joined: 05/30/2013 - 23:31
Posts: 6422
Location: Held against my will in IOWA, USA

It actually seems like it’s skipping turbo in my last build, because all of the modes were tightly spaced and the highest one was still kind of dim. I’m testing with an XM-L U2 and a laptop pull panasonic.

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

wight
Offline
Last seen: 1 year 3 months ago
Joined: 11/27/2013 - 16:40
Posts: 4969
Location: Virginia, USA

pilotdog68 wrote:
It actually seems like it’s skipping turbo in my last build, because all of the modes were tightly spaced and the highest one was still kind of dim. I’m testing with an XM-L U2 and a laptop pull panasonic.
Please test with the code I linked to above:
  • Be sure to set your modes up.
  • This uses the old turbo style. I’d leave turbo disabled. (That gives 4 modes.)
  • I normally disable voltage monitoring while testing this sort of thing.

Still fine, still on a break. One day I’ll catch up with you folks! previous wight catchup Wink
list of my drivers & variants (A17DD, FET+1 stuff, WIP stuff, etc)

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 month 4 weeks ago
Joined: 05/30/2013 - 23:31
Posts: 6422
Location: Held against my will in IOWA, USA

Quote:
For now let’s switch you to a non-dual-PWM version. Keep things simple and all that. Use this: http://www.jcapsolutions.com/wp-content/uploads/2014/05/STAR_off_time_1.3.c

From what I can tell that didn’t make any difference. Also, I think it has been skipping moon because I commented it out and that also appears to have no difference in the result. Now I’m just playing around with different combinations of the settings to see what I can get.

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

wight
Offline
Last seen: 1 year 3 months ago
Joined: 11/27/2013 - 16:40
Posts: 4969
Location: Virginia, USA

Remind me which board revision (version) you are using please. EDIT: nevermind, it’s 20mm v007.

Still fine, still on a break. One day I’ll catch up with you folks! previous wight catchup Wink
list of my drivers & variants (A17DD, FET+1 stuff, WIP stuff, etc)

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 month 4 weeks ago
Joined: 05/30/2013 - 23:31
Posts: 6422
Location: Held against my will in IOWA, USA

wight wrote:
Remind me which board revision (version) you are using please. EDIT: nevermind, it’s v007.

20mm v007

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

wight
Offline
Last seen: 1 year 3 months ago
Joined: 11/27/2013 - 16:40
Posts: 4969
Location: Virginia, USA

In that case I’m not sure what the problem is.

Still fine, still on a break. One day I’ll catch up with you folks! previous wight catchup Wink
list of my drivers & variants (A17DD, FET+1 stuff, WIP stuff, etc)

wight
Offline
Last seen: 1 year 3 months ago
Joined: 11/27/2013 - 16:40
Posts: 4969
Location: Virginia, USA

It should be pretty easy to identify which modes are present or not present by using clearly dissimilar values and/or disabling a bunch of stuff.

I did forget to mention that you’ll need to setup that firmware I linked you to with the :8 divider and Phase Correct PWM.

Still fine, still on a break. One day I’ll catch up with you folks! previous wight catchup Wink
list of my drivers & variants (A17DD, FET+1 stuff, WIP stuff, etc)

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 month 4 weeks ago
Joined: 05/30/2013 - 23:31
Posts: 6422
Location: Held against my will in IOWA, USA

I’m fairly certain moon mode is a no go, idk why though. I have it working with this code.
At least with these settings, 37 PWM is the lowest it can light up a first-gen XM-L. At 37 you can look straight at it and still see the lines on the die. It needs some tweaking on the mode spacing, but otherwise it is working as designed. There is some buzzing on Medium and High, so hopefully tweaking PWM levels can alleviate that.
…………..
I have to run to Home Depot now, I’ll play some more when I get back.

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

LinusHofmann
LinusHofmann's picture
Offline
Last seen: 1 year 11 months ago
Joined: 09/28/2013 - 08:27
Posts: 974
Location: Switzerland
pilotdog68 wrote:
I’m fairly certain moon mode is a no go, idk why though.

Maybe i’ve got the wrong end of the stick here but I think I know what’s causing the confusion regarding Moon mode.
That version of STAR (probably every version?) requires a soldered star to enable Moon mode, ie. A particular pin on the MCU needs to be connected to ground. It looks to me like that particular pin on this driver is left open/ungrounded. Right?

Obviously seeing as there’s no star available to connect it here you’d have to hard code “moon mode” to be on by default. ie. change the 0 in the following bit of code to 1. That should give you the expected number of modes.

“#ifdef MODE_MOON if ((PINB & (1 << STAR2_PIN)) == 0) { modes[mode_cnt++] = MODE_MOON;”

Possibly you were seeing a medium mode at some point confusing it with an actual moon mode which caused the confusion? Seems likely since the actual minimum output level is ~37 pwm as you said.

-

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 month 4 weeks ago
Joined: 05/30/2013 - 23:31
Posts: 6422
Location: Held against my will in IOWA, USA

Yeah I was just thinking about the star/pin needing to be grounded. I’ll try that after dinner tonight.

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

wight
Offline
Last seen: 1 year 3 months ago
Joined: 11/27/2013 - 16:40
Posts: 4969
Location: Virginia, USA

My mistake, I should have known better. I got confused.

Still fine, still on a break. One day I’ll catch up with you folks! previous wight catchup Wink
list of my drivers & variants (A17DD, FET+1 stuff, WIP stuff, etc)

DB Custom
DB Custom's picture
Offline
Last seen: 2 days 17 hours ago
Joined: 01/13/2013 - 22:28
Posts: 20718
Location: Heart of Texas

Probably nothing but should you have both of these lines commented out?

//#define FAST_PWM_START 255 // Above what output level should we switch from phase correct to fast-PWM?
//#define DUAL_PWM_START 8 // Above what output level should we switch from the alternate PWM output to both PWM outputs? Comment out to disable alternate PWM output

That’s all I saw that looked odd to me. But I’m not the one to ask on these things. Wight, RMM or ToyKeeper , by the way, where’s Comfy?

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 month 4 weeks ago
Joined: 05/30/2013 - 23:31
Posts: 6422
Location: Held against my will in IOWA, USA
LinusHofmann wrote:
pilotdog68 wrote:
I’m fairly certain moon mode is a no go, idk why though.

Maybe i’ve got the wrong end of the stick here but I think I know what’s causing the confusion regarding Moon mode.
That version of STAR (probably every version?) requires a soldered star to enable Moon mode, ie. A particular pin on the MCU needs to be connected to ground. It looks to me like that particular pin on this driver is left open/ungrounded. Right?

Obviously seeing as there’s no star available to connect it here you’d have to hard code “moon mode” to be on by default. ie. change the 0 in the following bit of code to 1. That should give you the expected number of modes.

“#ifdef MODE_MOON if ((PINB & (1 << STAR2_PIN)) == 0) { modes[mode_cnt++] = MODE_MOON;”

Possibly you were seeing a medium mode at some point confusing it with an actual moon mode which caused the confusion? Seems likely since the actual minimum output level is ~37 pwm as you said.

-


I don’t have that exact line of code, I have this:
Quote:
#ifdef MODE_MOON
#ifndef DUAL_PWM_START if ((PINB & (1 << STAR2_PIN)) == 0) {
#endif modes[mode_cnt++] = MODE_MOON;
#ifndef DUAL_PWM_START }
#endif
#endif

It’s not a big deal to me, I would only use 4-modes anyways

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 month 4 weeks ago
Joined: 05/30/2013 - 23:31
Posts: 6422
Location: Held against my will in IOWA, USA

DBCstm wrote:
Probably nothing but should you have both of these lines commented out?

//#define FAST_PWM_START 255 // Above what output level should we switch from phase correct to fast-PWM?
//#define DUAL_PWM_START 8 // Above what output level should we switch from the alternate PWM output to both PWM outputs? Comment out to disable alternate PWM output

That’s all I saw that looked odd to me. But I’m not the one to ask on these things. Wight, RMM or ToyKeeper , by the way, where’s Comfy?


I think they technically should be, but AVRStudio won’t compile it if both are commented out.

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

wight
Offline
Last seen: 1 year 3 months ago
Joined: 11/27/2013 - 16:40
Posts: 4969
Location: Virginia, USA

As I said before, it’s much easier to work with the older version since you don’t use either of the dual PWM features here.

Still fine, still on a break. One day I’ll catch up with you folks! previous wight catchup Wink
list of my drivers & variants (A17DD, FET+1 stuff, WIP stuff, etc)

wight
Offline
Last seen: 1 year 3 months ago
Joined: 11/27/2013 - 16:40
Posts: 4969
Location: Virginia, USA

I also had trouble understanding the code you quoted pilotdog68. I posted about it in post #769 over here: http://budgetlightforum.com/node/29150?page=25#comment-694243

EDIT: so if you go to that post and read the code comments in the example code I posted it should be more easy to understand what that very strangely formatted section of code does. The intention is to allow DUAL_PWM_START to force MOON_MODE on. We need to do that since we can’t turn PWM on with the star because we’re using that star for the secondary PWM output! BUT if someone has commented out MOON_MODE it still won’t get turned on. That’s the intention of that convoluted thing.

In the end, you still just make the same change.

Still fine, still on a break. One day I’ll catch up with you folks! previous wight catchup Wink
list of my drivers & variants (A17DD, FET+1 stuff, WIP stuff, etc)

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 month 4 weeks ago
Joined: 05/30/2013 - 23:31
Posts: 6422
Location: Held against my will in IOWA, USA

wight wrote:
I also had trouble understanding the code you quoted pilotdog68. I posted about it in post #769 over here: http://budgetlightforum.com/node/29150?page=25#comment-694243

EDIT: so if you go to that post and read the code comments in the example code I posted it should be more easy to understand what that very strangely formatted section of code does. The intention is to allow DUAL_PWM_START to force MOON_MODE on. We need to do that since we can’t turn PWM on with the star because we’re using that star for the secondary PWM output! BUT if someone has commented out MOON_MODE it still won’t get turned on. That’s the intention of that convoluted thing.

In the end, you still just make the same change.


Ah. Makes sense.
Nevertheless, before I read your post I was already working on it using the old version of STAR. Here is my final revison.
All five modes work. The lowest firefly is basically just a novelty, but the other modes are spaced nicely. The PWM is still a bit audible, but it’s faint enough that I’m not sure you would hear it at all once it is inside a light. The only other issue is that some people would prefer the OTC setting be a little faster, it’s about 3 seconds right now.
…………………………
I don’t have a light to put this in yet, so it’ll probably just go in my tacklebox while I try some of your other designs. I think I’m going to try the 12mm dual-pwm fet driver next.

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

LinusHofmann
LinusHofmann's picture
Offline
Last seen: 1 year 11 months ago
Joined: 09/28/2013 - 08:27
Posts: 974
Location: Switzerland

I’m wondering if the driver modes would still work at the slightly higher 2.4khz or 4.7khz pwm frequencies ( using the 9.6Mhz clock combined with Phase correct / fast and 8x divider combinations)

If you’re up for testing that before you pop this thing in the tackle box that would be awesome! Smile

I’ve been playing around a bit with the 1khz pwm on other drivers and it’s bugging me a bit too much to consider putting it in a light. Visually annoying rather than the sound.

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 month 4 weeks ago
Joined: 05/30/2013 - 23:31
Posts: 6422
Location: Held against my will in IOWA, USA

LinusHofmann wrote:
I’m wondering if there is any chance the driver modes would still work at the slightly higher 2.4khz or 4.7khz pwm frequencies ( using the 9.6Mhz clock combined with Phase correct / fast and 8x divider combinations)

If you’re up for testing that before you pop this thing in the tackle box that would be awesome! Smile

I’ve been playing around a bit with the 1khz pwm on other drivers and it’s bugging me a bit too much to consider putting it in a light. Visually annoying rather than the sound.


Well I just realized my Supfire L5 will fit a 20mm driver, so this one will remain on my desk a bit longer.

I can try it, but I’m not sure I follow what you mean. What settings do you want me to change?

edit: are you talking about changing the low fuse to “0×6a” ?

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

wight
Offline
Last seen: 1 year 3 months ago
Joined: 11/27/2013 - 16:40
Posts: 4969
Location: Virginia, USA

pilotdog68 wrote:
Ah. Makes sense. Nevertheless, before I read your post I was already working on it using the old version of STAR. Here is my final revison. All five modes work. The lowest firefly is basically just a novelty, but the other modes are spaced nicely. The PWM is still a bit audible, but it’s faint enough that I’m not sure you would hear it at all once it is inside a light. The only other issue is that some people would prefer the OTC setting be a little faster, it’s about 3 seconds right now. ………………………… I don’t have a light to put this in yet, so it’ll probably just go in my tacklebox while I try some of your other designs. I think I’m going to try the 12mm dual-pwm fet driver next.
I’d double check to make sure your firefly mode works on depleted cells. It would be disappointing to try whipping that out to show off to someone and have the LED not light at all.

I’ve been thinking that putting in a hidden firefly mode would be best. That way there is no annoying basically-fully-off mode plunked into your rotation, but you can still bring out firefly to impress folks. With a hidden moon mode (like TheSTAR has) I’d think putting firefly right after moon would be good.

I find 3 seconds totally unacceptable. If cranking it to 250 or so doesn’t get it to around 0.5s I’d consider adding a pulldown resistor stacked on the OTC. LinusHofmann ran into a similar problem and stacked a 220kOhm resistor.

LinusHofmann wrote:
I’m wondering if the driver modes would still work at the slightly higher 2.4khz or 4.7khz pwm frequencies ( using the 9.6Mhz clock combined with Phase correct / fast and 8x divider combinations) If you’re up for testing that before you pop this thing in the tackle box that would be awesome! Smile I’ve been playing around a bit with the 1khz pwm on other drivers and it’s bugging me a bit too much to consider putting it in a light. Visually annoying rather than the sound.
Higher freqs will just compress the modes higher. Notice that the current range of modes is ~40-255. Doubling the freq will compress the modes higher, something like 80-255 for example (I don’t know exactly how much upwards compression to expect).

This is all a function of FET selection. An FET with more ideal properties for this driver would function at higher freq. DTU30N02 does.

Still fine, still on a break. One day I’ll catch up with you folks! previous wight catchup Wink
list of my drivers & variants (A17DD, FET+1 stuff, WIP stuff, etc)

Pages