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.
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’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!
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.
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.
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.
I think I’m getting the hang of this. I got STAR momentary working on the first try. Here it is.
I would still prefer direct access to ‘off’, so tomorrow I think I’ll try some of toykeepers versions.
2.4khz pwm: Low fuse is set to 0x65 and using Fast PWM in firmware OR Low fuse is set to 0x6a and using Phase Correct PWM in the firmware 4.7khz pwm: Low fuse is set to 0x6a and using Fast PWM in firmware.
Ok I tried flashing the exact same momentary configuration as I posted earlier, but this time I used 0x6a for the low fuse.
My eyes may be deceiving me, but every mode seems brighter. I know for sure that the 37pwm mode that was a firefly, is now 5-10x brighter than before. It is too bright to be used as a moon mode. I’ll keep playing with it to see how low i can take the pwm.
edit:
after doing the simple “wave paper in front of the light” test, the PWM with this fuse setting is actually much slower than with the 0x75 fuse. Comparing the original (0x75 fuse) vs the PZL driver I just built using the standard Fast PWM, the PZL Pwm is roughly 2 times faster (to my eye, take with a grain of salt)
You probably did not change the :8 we set earlier, so maybe you have a total of :64 right now? I’m on my phone, not easy to consult charts etc. There are 4 factors which affect freq: CPU clock, divider, presenter, and PWM type.
I honestly still have no idea how those relate. I can only report what I’ve found. I used the same momentary build I linked in post #151, and then changed the fuse value in the avrdude command.
Now that I have a momentary FW that I like (thanks wight and toykeeper), I’ll be putting this in my L5 (hopefully tonight). I’ll measure and report parasitic drain and if it’s pulling the current that it should.
I’ve been confusing you by referring to the divider and prescaler interchangeably. They are two separate things! The divider in that chart is set with fuses. That is the only divider there is.
The thing I had you adjust earlier (by setting the 0x02) is the prescaler. With both set your total is :64, not :8.
LinusHofmann wanted you to try:
4.8Mhz
:1 prescaler
:8 divider (0x65 fuse)
FastPWM
…which gives 2.4Khz. If you set the prescaler to :8 instead of :1 you get 300Hz (0.3Khz).