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.
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.
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.
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?
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.