I am still debating the 2.3 kHz PWM. I can see it when flicking a credit card, otherwise not. But I much prefer the resulting signal on the oscilloscope. Power consumption also seems lower actually. I get ~1 mA in between the flashes of a 5 s beacon. A 4.8 MHz clock gives ~2 mA. (I am running the MCU with the 9.6 MHz and 8 pre-scale fuses set, so 1.2 MHz.)
With an oscilloscope it is of course easy to measure the frequency. I also have a few FFT apps on the phone that seem to be reasonable accurate (E.g. FrequenSee HD and Speedy Spectrum). FFT with logarithmic amplitude scaling is the way to detect frequencies. The base and harmonics really pop out. They have no problem picking up the BLF A6, especially using your black cloth trick.
Using a regular 5 mm diode as a photo detector does work with the oscilloscope (I use a green or red one). Mode 2/7 on the A6 gives a ~0.5 Vpp signal with ~1.5 V DC offset. Just the bare LED between the scope probe and ground at 2” from the light. Neat to check strobe frequencies etc. without opening the light.
I just tried it on 3 different multimeters, it only worked on an older one.
I posted on my other thread that I just tried nlite.hex and that seems to work well (3 modes) on one of my NANJGs.
Does anyone know which ones are designed to work with NANJGs/7135 drivers? I’ve tried a few and many behave similar to the BLF-VLD with NANJG, i.e., the modes are somewhat inconsistent.
I didn’t look at the code very closely, so I’m not sure how the UI works. However, I think it uses on-time memory… so the only “clicks” which really count are the ones which happen immediately after it gets power. I’m not sure what the on-time timeout is though, or how exactly it handles memory.
Mostly, I noticed that Tido used some interesting code techniques which are totally different than STAR. It looks like he has done a lot more C programming than I have; mostly I use Python and shell so my C is rusty.
Something else I noticed is that it only uses 3 slots for wear-levelling… so it’ll wear out the eeprom about 10X as fast as STAR or 20X as fast as blf-a6. Most of the eeprom is used to store the mode table, instead of putting that in regular ROM or RAM.
Anything tagged with attiny13a and ‘ontime’ memory should work fine on a nanjg.
Yeah, 2.3 kHz seems too slow. Even 4.5 kHz stands out to me during regular use, and I can see up to about 20 kHz with the credit card trick. (if I look really closely, I can just barely see the 31.25 kHz PWM on attiny25)
I wonder if the clock divider puts the MCU to sleep for 7 of every 8 cycles. That would explain the lower power use. Given Atmel’s design goals, I bet it does something like that. Or, it could actually be running at a slower speed, underclocked.
Now that you’ve confirmed it works, I really want to try the LED photosensor trick. Until today it was just a random idea I had, but hadn’t actually tried… I’m pretty sure my DMM has some sort of relevant mode for that, though I haven’t explored that yet. It’s a Fluke 8846A which is mostly used for automated testing at work, but I can do other stuff with it between tests.
The more I look at this, the more I realize full power PWM is not the way to go.
LEDs really crave current regulation. If only we had an LD-2 with an ATMEL MCU
In the meantime I will hack an 8x7135 into two or three controllable groups of 7135s, as others have done. Only first group with PWM to get the very low modes.
For the photosensor, just connect the LED between the ‘LO’ and ‘HI’ inputs on your meter and select frequency. If the signal is large enough for the frequency counter to trigger, you will have a reading. If not, the LED signal will need to amplified and the DC offset removed.
I’ve been able to build a .hex - just using the minidrv for now.
I’ve been messing around with the modes, and I was wondering what is the minimum value for that in the array? From the comments, it looks like minimum is 5, but is that the lowest mode I can get? If so, it still seems kind of bright, so how do they get those moonlight modes that are lower than that?
Ah, good. It looks like you figured out the build process.
The PWM values can go from 0 to 255, but the minimum depends on your exact hardware. For moon on a 7135 chip, I normally use a value of 3/255 or sometimes even 2/255, both running with phase-correct PWM. For fast PWM, the minimum will be a bit higher. For a FET driver, the minimum will be lower.
Maybe. However, it’s only an alpha debug version and there is no source code available.
‘Fast’ is not necessarily fast, it is just ~double the frequency of the other option, called ‘phase-correct’.
Change
TCCR0A=0b00100001
to
TCCR0A=0b00100011
to get fast mode.
Phase-correct mode runs at 1/510 the frequency of the MCU clock.
Fast mode runs at 1/256 the frequency of the MCU clock.
(Both assuming your PWM clock pre-scale is 1 as per above.)
In theory the light output corresponds to the average current.
And average current = x/255 the full current capability of the 7135s.
(where x = your PWM setting)
In practice x has to be larger than 1-6, depending on the frequency of the PWM.
At 9 kHz, the 7135s only start to turn on after ~4/255 of the PWM period has already passed. This number depends heavily on cell voltage. At 3.4 V they may not turn on at all at 4/255.
For your 12x7135 driver you can approximate average current draw as about (x-5)/255 * 350 *12 at 9kHz.
And (x-10)/255 * 350 *12 at 18 kHz.
The 5 or 10 offset is to accommodate the delay of the 7135 to turn on at each PWM pulse.
It is a compromise, do you want high frequency PWM to avoid flicker and noise, or do you want to have more precise current control?
You can always run moon at 1-2 kHz and the medium modes faster.
I understand. So, basically, with that many 7135s (x12), and with 380mA 7135s, and set to 6, it would be average current of (1/255) x 380 x 12, that is 17.88mA at the original 9kHz PWM?
Yeah… that was what I was wondering/curious/messing around about, and whether it was even possible to get a reasonable moonlight with 12 380 mA 7135s. So far, from my testing, it seems like if I set the PWM to the point that the emitter lights, it’d have to be way too bright to be called “moonlight”.
Kind of. Your calculation is right on.
But it is very non-linear when you are at the edge of switching on the 7138s.
Your batch of 7138s may have slightly different gate characteristics, the MCU output as well.
And we are so close to the edge that the cell voltage makes a difference.
Something that worked for me was to bump the level by one at 3.6 V and again at 3.4 V.
The trick is to only go up with the bumping, otherwise you get a flickering candle.
That is not really the LED.
Try it at a low enough PWM frequency (below lets say 1 kHz) and any LED that lights up at 255/255 will also light up at 1/255.
The 7135s I looked at only start to turn on after about 2 us. They are only fully on after about 6 us.
So we want PWM pulses at least 6 us long to get semi-consistent operation.
If you want to accommodate 1/255 PWM that implies a PWM period of 255 * 6 us = 1.53 ms, or 654 Hz.
In the code above, select on the /8 prescaler for the PWM timer.
Then try 1/255.
You might not like the flicker, but it illustrates the point.
TCCR0A=0b00100001; //phase-correct PWM
TCCR0B=0b00000010; //pre-scale 8, so PWM at 1.1 kHz
or
TCCR0B=0b00000011; //pre-scale 64, so PWM at 140 Hz (should give terrible flicker)
Hmm, I just went to try this, and I am not having success. You just connected the LED+ to DMM+ and neg to gnd? My DMM has a Hz/% button, I assume that’s frequency,