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

Looks like it's Windows only, that's a no-go for me. Besides, if I'm going to use a demo version, I might as well use the one from Microchip. But maybe someone will give this compiler a try, once I get around to cleaning up and releasing the PIC-port.

This is so much fun! I got my first prototype together. I reduced your code Tido just to make a real simple 3 mode light with no strobes and no programming. To access the modes, just tap the momentary switch (this is a Maglite btw) the same number of times as the mode you want to access. Tap once before fully clicking the switch in and you'll go to mode one. Tap three times before turning it on and you go to mode three. The nice thing is that the light delays turning on for 250ms. So if you just woke up in the middle of the night and don't want to have to cycle through modes, ruining your night vision, just tap once before turning on and you go to low (mode one in my case). If you almost always use the light on max, just set to max and it will always turn on at max. The nice thing is that you don't have the 2 second delay before it programs the mode like the driver comes stock. Once the light is on you know the memory is stored, so you can turn it on for a split second and then off without having it go to the next mode upon the next startup.

I just want to thank you guys again, this is a really fun little hobby.

EDIT: I thought this would really only work will with forward-clicky switches, but it could work well for reverse-clickys as well, you would have to tap 2 times once the light is on to access mode 1, 4 times for mode 3 (although you could think of 1 tap as going to the saved mode, 2 taps for the 2nd slot, etc.)

I've just received the two "AMC7135*8+MCU 1100mAh 5-Mode Circuit Board SKU: S009742" from KD they are both 105C's with the Atmel chip.

The order was placed on the 21st so only took a week to arrive, which is rather good.

That was really fast!

I hope for you that they are 2800 mA

Hey guys,

Now that I have things working great, I'm thinking about adding a secondary switch on my Maglite. The main switch will still act as the main power switch, but a momentary switch would also be installed in order to facilitate mode switching. I'm thinking this switch could be setup with a pull-up resistor to one of the PCINT pins.

Looking at the reference sheet, it seems as though I could have the ISR trigger when the pin switches low to high or high to low. Is that correct? If so, would I be able to recognize how long the secondary button was pushed? This would make it really easy to enter programming mode and be able to select a new mode.

Thanks,

- Jon

ordered: 25 Jan 2011

Recieved today.

1x 106 ATtiny13A

2x 105A PIC

how come I got mixed ones?

Good grief.

So it's not over yet (if ever) with the PIC's. It looks like they have a lottery mill they draw them from.

I have 3 pc on order, packing right now. I pray they are ATtiny13.

but considering I don't do "reprograming", they should be fine for me since the functions are similiar...

I wonder if we can post them a note to request for "specific" models instead of waiting for lottery for 105A, 106 and 105C[I have not seen this,but I heard the stars have no functions]

FYI, I ordered 3 x SKU 6190 from DX. Took almost a month to arrive from the shipping date, but they are all Atmel ATtiny13A's :)

I'm very much interested in this topic, being a Computer Science major and a flashaholic. I'm curious to know if anyone has used this programmer: http://www.solarbotics.com/products/50844/. The price is good. Of course, I would have to get an 8 pin cable for it. It's based on the USBtinyISP, so I would think it would work with the ATINYs. Great work, guys. It's impressive what can be done with a little curiosity and some ingenuity.

Welcome to BLF bmmeadors

Have a good time here.

Thanks, Don. I have viewed many threads on this site. Finally became a member now.

By the way, I found another source for AMTMEL driver boards (supposedly, since they're the same ones as ShiningBeam's). There's a 3 mode 1.4A and a 2.8A version. Craig at IlluminationSupply has them, along with XM-L emitters and various other DIY pars. Already received an XM-L along with an empty P60 module and some teflon coated wire. Great stuff.

http://illuminationsupply.com/mod-parts-c-12.html

I've got two of the 1.4A drivers and an XM-L on the way. Maybe I can order that USB programmer now that I have an excuse.

Thanks for the link bmmeadors. It's good to have another US supplier.

So, I'm done programming. The 8 pin clip is giving out. After connecting it to a MCU probably 20-30 times, it's falling apart. I tried fixing it, but there's nothing that can be done now. Is there any place to get a higher quality clip? The only other way I can see doing this is soldering 6 tiny wires to the pins on the MCU just for programming, then removing once I have the program I want. That would be really tedious though. For now I'm just going to stick with the program that came on the boards to build lights :(

Aloha and welcome to BLF bmmeadors!

Is this with the chip in the circuit or loose? I suppose the clip is the only way once the chip is soldered down - my first thoughts ran to a ZIF socket. When I have fiddly things like that to repair, I consult my dentist - dental casting resins are amazingly useful. They are not cheap but you don't need a lot.

The people who make false teeth might be worth consulting too - dental technicians they are called here - they are used to fabricating small items with very high precision. And work a lot cheaper than dentists.

Hi bmmeadors, welcome to the BLF.

I'm currently using the Bus Pirate for programming ATMELs. It's a really handy tool that can do much more than just flash-program MCUs. As for the debugging clip, I use one like this. It may cost twice as much as the cheaper ones, but mine has been in use for a few months now and is still in good shape.

Tido, that Bus Pirate looks pretty cool. Looks like I'd have to break out an Ubuntu live CD(or other distro) to use it. I used to dual boot with Ubuntu, but I eventually gave up that partition, as I found that I didn't use it very much.

Have been thinking a long time of how to make the best mode arragement (for me). The last one I made was 4 lm - 16 lm - 64 lm - 250 lm with memory (XP-G in WF-502B) where modes repeated in ring: verylow -> low -> mid -> high -> verylow etc.

The memory was handy but the number of tabs to reach a certain mode from turn-on of course depended on the memorized mode. The goal is to reach the most used modes with the fewest tabs.

A light with no memory would fullfill that and always have the same number of tabs to reach a certain mode and disco modes could even be added at the end:

low -> mid -> high -> verylow -> strobe -> SOS -> Beacon -> low etc.

For a XM-L light this could be:

32 lm -> 125 lm -> 500 lm -> 4 lm -> strobe -> SOS -> Beacon -> low etc.

I think that 32 lm would be a fine standard level for close use and the light would always start in that level. But for other uses it would be better to start in another level. That gave me the idea to combine the no-memory list with a memory giving this mode array:

last_mode -> low -> mid -> high -> verylow -> strobe -> SOS -> Beacon -> last_mode etc.

When the light is turned on it will start in the memorized mode. One tap wil bring it to low, two taps to mid and so forth. If the last_mode was low, one tap of couse should go to mid but that is easy done in programming.

The memory could kick in after staying a few secs in a mode or 1 sec after switch-off.

If memory is made after switch-off it opens up for an alternative arrangement with normal modes in one chain and disco modes in another:

Turn-on, wait 1 sec -starts in normal modes chain:

last_mode -> low -> mid -> high -> verylow -> last_mode etc.

Turn-on + fast tab -goes to Disco modes chain.

strobe -> SOS -> Beacon -> strobe etc.

Now I "only" have to modify Tido's program to test all this.

EDIT: For implementation: Look at post #254

Just to update you guys, I took your advice and ordered the 3M clip from here...

http://search.digikey.com/scripts/DkSearch/dksus.dll?KeyWords=923655-08-ND

They are only a state away, so it arrived really fast and shipping was cheap. The clip really locks on to the chip tight, but the contacts just barely didn't reach. So I had to trim the plastic down a bit, and then it wouldn't stay on :( After trimming it down multiple times, I think I have it working. However, I don't have a working chip anymore to test my latest program. Hopefully the shipment from Kaidomain will arrive shortly and they will have the Atmel chips.

...just really busy.

I started at a new job last week and I'm still looking for a flat. So it might take a few weeks before I find time to hack the driver code again.

We apologise for the inconvenience.