I am an electronics and flashlight guru:) and I would like to design my own diving flashlight.
I already thought about the body, heatsink, led (xm-l2) and driver (nanjg 8x7135).
But the only thing I could not find is how to attach a hall effect to the NANJG?
I want the light to be “stageless dimming” from 1% to 100% controlled with a a magnet sliding.
Now i am sure it can be programmed on the attiny with the nanjg, but how do I do that?
Thanks for you help:)
That depends on the specific sensor you want to use.
I haven’t yet tried hall sensors etc, and I don’t know any suitable sensor with analog output.
I guess the easiest way would be a sensor with a voltage output proportional to the magnetic field, in the range of a few volts or at least a few hundred millivolts.
I think that you meant a ratiometric hall effect.
I dont need to program the attiny? If the driver will get less Vin it will put out less current?
Yes, ratiometric would be fine.
But it will need a suitable firmware.
Ill try to find some code in arduino forums.
I have another question maybe you could answer that, how does this attiny works?
I mean, Actually, it cannot handle high current loads like 3A.
How does this small thing controls the 7135 regulators to be on “high mode” or “low mode”?
And last thing,I believe that this hall effect will have to get power supply… Will the attiny be able to supply it?
Thanks for your time!
I don't think it works like that, in fact, I Am perry sure that it doesn't, otherwise you would have very cheap chinese lights with magnetic ring and ramping function.
Easiest thing to do would be a magnetic ring with 3 positions (- / NEUTRAL / +), when you turn to - it would ramp down, + is for ramping up and NEUTRAL is for holding current light level setting.It's just like you have two (electronic) buttons (microswitches), press & hold one and it goes up, press & hold other one and it goes down...
How to do instant OFF, I don't know :D didn't think that ahead :P
Arduino code might not be very helpful, since the ATtiny13 is too small to support the Arduino system. It needs to be programmed in ‘bare’ C without the arduino libraries.
The ATtiny just gives an on/off signal to the AMC7135s, that is only a ver small current (about 0.2mA each), and the AMCs then switch the LED current of 350mA each.
If the Hall sensor supports a supply voltage range of 2.7-4V (or more of course), then it can be used in this setup.
Agreed. I put together a few Arduino sketches for the Attiny’s, and the most basic version takes up roughly 870 bytes. It does nothing more than switch modes, with no mode memory.
You might want to look at the tiny25, 45, or even the 85 if you plan to go the Arduino route.
Thanks for your answer.
Attiny85 could be a nice solution.
But i thought about something else.
Lets say the nanjg is configured to only 1 mode: high.
And I connect a ratiometric hall effect between the attiny(13) pwm and the vdd of the 7135 - shouldnt it get dimmed when the magnet is far from the hall effect and get brighter when I pit the magnet close to it?
Btw for example this hall effect: http://www.allegromicro.com/en/Products/Magnetic-Linear-And-Angular-Position-Sensor-ICs/Linear-Position-Sensor-ICs/A1324-5-6.aspx
Maybe I’m misunderstanding, I don’t see how placing the hall effect sensor between the PWM pin and the 7135 would change the duty cycle.
I think you just want to have the tiny’s ADC read the output of the sensor and then adjust the duty cycle depending on the voltage.
Maybe i misunderstood the how pwm works…
As I understood, it just pulsing between the 4.2v and 0v fast enough to change the avarage voltage output…, no?
I thought that maybe that way, when tiny’s output is on 100%, and you “interrupt” it with a hall effect which is changing the voltage ratiometrically to a magnet, it will dim the led. But maybe I understood it wrong
I will try to find any project with hall effect to see what code they use to read the output of the hall effect.
More or less, this is how I believe the circuit would be laid out. The pins of the microcontroller probably aren’t accurate for this specific application. I didn’t study the Nanjg driver before drawing it up.
There are several Arduino examples online for dimming an LED via PWM by using a pot as a voltage divider. The circuit above would work the same way and is fairly easy to adapt. Let me know if you need a link to one.
I did a little reading and see that there are a lot of different hall effect sensors available. If there isn’t one that is able to output a signal strong enough to be accurately read by the ADC, then you’ll have to amplify it.
Thanks for your help.
I have 2 types of hall effect, and should get the driver this week.
So ill try to play with thas thing.
Another thing, Can I wire the Vin to the hall effect from the Attiny itself?
From what I can tell by looking at the photos on google, there is a forward bias diode on Vcc of the microcontroller. As long as the voltage drop doesn’t effect the performance of the sensor, there shouldn’t be a problem.
Yes, that’s why I suggested a voltage range of 2.7 to 4V or better.