How To Build a Flashlight With Perfect Modes (picture heavy)

Thank you, I fixed that frequency error…… now all that remains is these include errors.
They all started after upgrading to studio 5

problem solved…. driver.c was not in the folder “one up” from the project files.

Hello all

Apologies if I’m in the wrong thread.

I am tryinng to retrofit my recumbent with my own lights . Recently I ordered 2 Nanjg drivers , unfortunately the flash patterns already programmed are the equivalent of an ashtray on a motorcycle.useless…S>O>S , 10hz photosentive epilepsy inducing strobe…0.3hz flashing.

I have recently purchased an usbisp programmer, an atmel attiny 13 dip , project board, leds etc to experiment with in either bascom or Hex.
Does anyone have a link to how I can input my first program , how I can chop and change flash patterns and dim to 50%.

My favorite flash pattern for the headlight is 2 cycles a second of F F F F o o o o……flash 4 times , off for the same duration.
Second is flashing 4hz.

The flash pattern I would like to achieve for the rear light is 30% brigthness with superimposed pulsing at 100% brightness at 2 cycles a second of ooFFoooFFo. I have made the latter with a 555 timer + a decade counter + 2 seperate left and right light housing flashing alternatively.

Can someone please help point me in the right direction.

regards
Dan

Most “custom” firmware for the NANJGs is written in C, so that might be a good idea. Then you can take a look at several custom firmware sources (like Tido’s here and luxdrv, but you can find others in google) as a starting point.

Hello all

Can you please help

I have made a big F up. I have both a 2.8a 105c and a 101 Ak.
With extreme burner AVR I wanted to copy the Hex from the 105c but unfortunately I erased it.
However I copied the files from the 101 AK and saved the file to documents.

I tried reflashing the .hex file to the 105c but message states ” MISMATCH AT LOCATION 0X00000000”
What does this mean?
I also tried flashing to an erased tiny 13a I had spare - same message.
Does this hex file have a copyright protection or a code that stops writing , lock bits etc.
I have winavr and avr dude which does not work in Win7.
I am using an USBASP programmer.
This is new to me so an explaination in basic(non technical) english would be most appreciated.

regards
Dan

Hello

winavr and avrdude work fine on win7, I use them both.

are you using the right syntax from an elevated command prompt? (run cmd as admin)

Test connection:
avrdude -p t13 -c usbtiny -n

Flash .eep and .hex files:
avrdude -p t13 -c usbtiny -u -U flash:w:BLF-VLD.hex:a -U eeprom:w:BLF-VLD.eep:a -U lfuse:w:0x79:m -U hfuse:w:0xed:m

I also place the .eep and .hex files in “C:WindowsSysWOW64” so avrdude finds them.

Craig

I am building a new torch its a small single 18650 with XM-L U2 and Nanjg 105C with two extra AMC7135’s added.

I would like to reprogram the 105C but have no experience at this programming language.

Here is what I would like to achieve.

Always starts on mode 1.

mode 1 just enough to read a map or find things in a tent.
mode 2 just enough to walk by
mode 3 about 120 lumens then reducing to keep a constant 3v
mode 4 strobe slow fade from 10 lumens to full brightness and back

Turbo mode accessed from any mode full power for 3 seconds drops back to the mode it came from then after 10 seconds does a battery check one blink good, two blinks getting low.

I have ordered the programer which will take a few weeks to arrive.

I need pointing in the right direction.

Any help would be much appreciated, is there some software I can test programs before burning them.

I think that you should start with something simpler, especially if you do not have any experience in C programing language. For start modifying available code to grasp some basics.

Also code needed for request above might be too vast for attiny13 memory capabilities and/or hardware resources.

Thanks for the reply. If space is a problem the strobe can be dropped. Reading through this loooooong thread every other feature has been implemented except the turbo button but in different configurations. At the moment I a 3/4 of the way through a python course. When that finishes just after Xmas I don’t mind learning C. Turbo feature is quite important to me as the host is tiny and would over heat very quickly.

Is there any way to simulate or test code so I can experiment before the programmer arrives.

Slightly off topic but I seem to recall somewhere (and I'm not sure if it was in this thread or a related thread) details regarding cell voltage detection/low voltage protection (LVP). The post in question was dealing with how to modify the ATtiny13 circuit to allow for this to take place. The reason I am after this is because the ATtiny chip can apparently perform voltage level detection via the VCC pin, but only if it's lower than 1V. This is easily achievable via a voltage divider circuit, however as far as I know the ATtiny13 is not capable of running below 1V...

Anyway, if I can find that post it might help me understand what's going on a bit more. I also notice that on DrJones LuxDrv thread he has implemented LVP using the standard setup which implies to me that the above statement regarding 1V is horse-poo.

Any ideas?

- Matt

Think the answer to the voltage divider is here post 5

The NANJG has a voltage divider on board (19k/4k7) to do that. That voltage then is compared to an internal 1.1V reference.

The voltage detection of the Vcc pin is for brown-out detection. The Attiny13A has 3 speed grade, 0-4MHz@1.8-5.5V, 0-10MHz@2.7-5.5V, 0-20MHz@4.5-5.5V.

I just got a few of the KD 7135 V2 drivers, is it possible to write firmware and flash it via AVR/usb programmer? Or maybe desolder the PIC (?) and add an atmel?

Short answer: Sorry, no to both.

Has anybody tested any of those cheap SOIC8 Clips?
http://www.ebay.com/sch/i.html?\_udlo=7.88&\_sacat=0&\_from=R40&\_mPrRngCbx=1&\_udhi=11&\_nkw=SOIC8+Clip&LH_PrefLoc=2
(black ones,
blue ones may be problematic, according to AVR Drivers - Flashlight Wiki )

I have a black one, it works just fine. Once in a while I do have to re-seat it on the chip, but it beats any alternative!

I have one of these on the way will let you know how it works.

The soic clip (5250) I received was a blue POMONA. Worked first time out no problems.
Using tido’s v.4 but cant figure out how to keep the mode I have selected in the extended modes. To go to the first three modes. I read tido’s read me file and can not seem to get it to work.

You mean "programming" the light, i.e. reconfiguring one of the main modes with a new setting?

Are the programmable and proghelper flags on?

If I remember correctly, the procedure is this: Tap until you reach your desired extended mode, use it for a few seconds. After tapping once, a timed sequence starts:

  • you have to tap again within <1s
  • you have to tap again within <1s
  • you have to tap again within >1s, but <2s
  • you have to tap again within <1s

An indicator blink (proghelper) helps: Tap right after the blink (it blinks at 0.25s for steps 1,2,4 and at 1.0s for step 3).

From the wanted extended mode it's like tap-tap-tap-pause-tap-tap.

I finally got it Drjones thanks. You have to wait for the flash each time you tap. As soon as you see the flash tap again and hold until the next flash. Going to try Luxdrv next.
I’am using the 105c 5-mode 2800ma driver from lightmalls.