BLF 15 & 17dd_PIC : final version update 10/14

52 posts / 0 new
Last post

Pages

Cereal_killer
Cereal_killer's picture
Offline
Last seen: 9 months 4 weeks ago
Joined: 07/22/2013 - 13:10
Posts: 4005
Location: Ohio
BLF 15 & 17dd_PIC : final version update 10/14

Current info 10/14: Final update for the 12F617 boards, I will be switching to 10F322 MCU (Which are WAY cheaper) which also has the code written in C for all us idiots (all thanks again to tterev3

I've learned the proper way to use poly's in eagle and have made a final revision to the board, I've moved the CAP's and polarity diode to the bottom (note I'm not using C2 on the 17's, C1 on the 15's). Other changes include making the SW+ via large enough for 26AWG wire and a Z1 silkscreen mark (you stack it over C1). About the SwLED via's, these can be used to wire a switch LED to (which will flash as the indicator if switched from the main LED in the code and enabled with the config option). You can also solder the legs of a 2/5mm encapsulated LED straight to them. [This next part is ONLY for the 17] and they're spaced correctly to use a 0805 directly on the board if it can be lined up properly for that. It's masked incase you done need / want to use a switch / indicator LED so just gently scrape it off to use. [again not so with the 15].

 

 

BLF 17dd_PIC v2.1

 

(mouseover)

 

BLF 15dd_PIC v2.1

 

(mouseover)

 

I have built several of both of these all working fine (tho one is giving me issues, but its isolated and it still works even when it happens so it wont leave you in the dark). Up next is a 7135 board I have ordered but haven't yet received. I'm posting it here incase anyone wants to order but I'm not gona say its G2G till I have them together and running, especially since its an all new MCU and code. Also note, there is a clicky switch UI thats available now too, its a very basic UI that can be built from.

 

10x7135_PIC v0.4

 

(mouseover)

 

 

Note I do not plan to develop the 12Fxxxx boards or code any further, I also have new 17dd boards on order for the 322.

 

 

 

 

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

EVERYTHING BELOW THIS LINE IS SUPERSEDED BY ABOVE

See reply 32 for info on new 17mm 7135 driver with clicky FW!

 

I've been looking for a better momentary switch FW for a while and I've finally found it! I've started using "The Ultimate Flashlight Code" by tterev3, an open source (single channel) FW he wrote a few years back but as far as I know up till now he's the only one that used it (atleast around here). I've took and modified remade starting from scratch, the BLF 15 and 17dd drivers to use a Microchip PIC MCU, specifically the 12F617. The MCU can handles voltage monitoring internally so no voltage divider circuit is needed making all components for both drivers fit on the top!

 

 

 

OSHPark links:

BLF 15dd_PIC_v2.1 READY TO ORDER

BLF 17dd_PIC_v2.1 READY TO ORDER

10* 7135_PIC_v0.2 NOT READY TO ORDER, only shared in case you want to play with it

 

Universal parts:

U1 = 12F617 (10F322 on the 10*7135 board)

D1 = SOD-323 (standard 105c polarity diode)

C1 = 0805 10uf XR7 (standard 105c cap) required

C2 = 0805 10uF (this cap may not be needed at all, will take further testing to determine, this is the cap to do the same thing as the new location for the AVR drivers a la comfy style)

Driver specific parts:

17 FET = DPAK such as the 70N02 and AOD510

15 FET = SOT-23 such as the AO3400A and IRLM 2502

 

 

 

For a general tutorial to get setup for PIC you can read threw tterev3's thread, the picKIT3 can be purchased from between $25-40 (I paid $27 for mine on ebay and it came in about a week but I had to make an offer, it was regularly $33 and on sale for $31).

You will need 2 other files: One, the part-specific header file (P12F1822.h ) is included in the Microchip suite of software, the other is an instruction file (instructions.inc) you can get from my drop box. You can see when and where you need these two files in tterev3's tutorial.

 

 

All credit for the FW to tterev3, you are free you use and modify the code for private use but please do not rehost the code. tterev3 is happy to field any code related questions and I will try to answer hardware questions and some basis code stuff.

Ramping only code (video example)

Ramping / non ramping code (same code but with an additional configuration option to turn off the ramping and enable 4 arbitrary levels)

If you are using this code for a dual switch light and want the light to come on when power is applied (when the tail clicky is turned on) you can add a few lines of code to the initialization section at line 427, I'll post that change in the first post below.

 

So you can see it in action I've created these 3 short videos, I tried to keep them short but I'm notoriously long winded and its a lot to cover, each one turned out 3-4 minutes. I will be remaking these video's once my Y3 gets here and I have a dual switch light to put these in. If anyone is interested in one of these drivers before they can get setup with PIC I will be happy to program MCU's for you for no charge (just pay~$2  for the MCU and shipping) and tterev3 would probably be able to help you out as well but I didnt talk to him about that yet.

 

 

 

 RIP  SPC Joey Riley, KIA 11/24/14. Now I am become death, the destroyer of worlds.

Edited by: Cereal_killer on 10/14/2014 - 19:16
Cereal_killer
Cereal_killer's picture
Offline
Last seen: 9 months 4 weeks ago
Joined: 07/22/2013 - 13:10
Posts: 4005
Location: Ohio

These 2 videos are a demo of the 12F617 version of the code, ag stated I do not plan to develope this hardware / FW anymore not that its available in C and in a smaller package!

Video 1: UI


video one covers how to use all modes / shortcut’s and how to set “primary level”

Video 2: configurations


covers all config’s again including primary level

 RIP  SPC Joey Riley, KIA 11/24/14. Now I am become death, the destroyer of worlds.

Cereal_killer
Cereal_killer's picture
Offline
Last seen: 9 months 4 weeks ago
Joined: 07/22/2013 - 13:10
Posts: 4005
Location: Ohio

I recommend making some code changes, if you don't need the dual switch feature you can comment these lines back out then it'll be there when you do need it.

Dual switch setup (turns on when power is applied) changes starting at line 427 to 437:

Initialize

    clrf    flags
    clrf    flags2
    clrf    mode
    clrf    mode_previous
    movlw    .10
    movwf    slower
    call    read_NVM
    movfw    primary
    movwf    bright
    clrf mode            ;These 4 lines make light with with dual switch (come on when power is applied)
    movfw bright        ;comment these lines out to disable feature
    call set_output        ;light is only able to come on at the primary level (possible to change it to come on it max by changing next line)
    goto normal_mode    ;power cycling will reset all temporary settings (i.e. strobes and/or other volotile memory)

 

 

to change the the minimum level at which below the ramp will start out moving up change the value at line 578

 

To change the timing of the locator beacon (the flash when off) change the hex value at line 395, to change from 5sec to 8sec change b00011001 to b000111011. To change the brightness of that blip change the value on line 207 



 RIP  SPC Joey Riley, KIA 11/24/14. Now I am become death, the destroyer of worlds.

Cereal_killer
Cereal_killer's picture
Offline
Last seen: 9 months 4 weeks ago
Joined: 07/22/2013 - 13:10
Posts: 4005
Location: Ohio

One thing that can be a little confusing with MPLAB is knowing what toolsuite to use since in the PIC quick start guide the XC8 compiler is used for that code, this code is compiled in the MPASM Assembler, make sure you select that option in the project wizard.

 RIP  SPC Joey Riley, KIA 11/24/14. Now I am become death, the destroyer of worlds.

tterev3
Offline
Last seen: 2 weeks 2 days ago
Joined: 03/28/2014 - 11:22
Posts: 298
Location: NC, USA

Thanks for doing these videos!

I wanted to make one clarification: the tactical option locks the light in whatever mode is currently selected, not just maximum, and makes all use momentary-only. You could go to a strobe, for example, enter the menu, activate tactical, and you would then have the light in momentary-only strobe.

Turby3Pots
Turby3Pots's picture
Offline
Last seen: 57 min 47 sec ago
Joined: 03/31/2013 - 20:51
Posts: 582
Location: Richmond va USA

hahahahah video #2 strobe made your camera go BANANAS.

Thanks for videos/hard work!

FlashPilot
FlashPilot's picture
Offline
Last seen: 28 min 31 sec ago
Joined: 05/10/2010 - 16:07
Posts: 4662
Location: USA

Thanks for the great write-up CK. :bigsmile:

ImA4Wheelr
Offline
Last seen: 3 months 1 week ago
Joined: 02/03/2013 - 14:51
Posts: 7932
Location: SC

Exciting stuff going on here.  Thank you for sharing all that great info.

downlinx
downlinx's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 04/09/2014 - 09:38
Posts: 1292
Location: Indiana, USA

I don’t understand any of this but, from you have been telling me, you get a huge thumbs up from me.

BLF Community Battery Pull Thread http://budgetlightforum.com/node/32720

DB Custom
DB Custom's picture
Offline
Last seen: 4 hours 42 min ago
Joined: 01/13/2013 - 22:28
Posts: 20633
Location: Heart of Texas

I don’t really understand it, but I like the end result.

will be trying to wrap my mind around this in the near future…

Cereal_killer
Cereal_killer's picture
Offline
Last seen: 9 months 4 weeks ago
Joined: 07/22/2013 - 13:10
Posts: 4005
Location: Ohio

Thanks guys, gotta get caught up on customer orders but this week I will be doing an 8× 7135 driver as well as a 10mm dd version

 RIP  SPC Joey Riley, KIA 11/24/14. Now I am become death, the destroyer of worlds.

DB Custom
DB Custom's picture
Offline
Last seen: 4 hours 42 min ago
Joined: 01/13/2013 - 22:28
Posts: 20633
Location: Heart of Texas

Oooooooo! The 10mm version piques my interest for certain! The BLFTiny10 is working in my Texas Poker, but it’s a pita with components on the battery side of the board, it being a twisty. This would solve the issue and allow me to fine tune a brass post so the light contacted perfectly at the closed or tight position!

Will definitely be wanting to know about that one, might just want you to build me one as it’s the only light I have that would require that size and MCU combination.

WarHawk-AVG
WarHawk-AVG's picture
Offline
Last seen: 4 months 3 weeks ago
Joined: 01/04/2014 - 06:47
Posts: 5071
Location: H-Town

Nice!!!

tterev3
Offline
Last seen: 2 weeks 2 days ago
Joined: 03/28/2014 - 11:22
Posts: 298
Location: NC, USA

One more thing I noticed in the first video that I wanted to clarify:

The shortcut to max is a click-press from on, but it’s just a double-click from off. The reason for this is so that you can also use max from off in momentary mode: click-press and hold for as long as needed, then release and it will go back off and the previous level is still remembered. I think this is why you had some issues doing max from off in the first video. If you want to latch on, just double click, don’t try to hold down on the second press. Does that make sense? It’s tough to describe click commands in text

Cereal_killer
Cereal_killer's picture
Offline
Last seen: 9 months 4 weeks ago
Joined: 07/22/2013 - 13:10
Posts: 4005
Location: Ohio

Ok guys I’m feeling pretty down not one person has ordered any of these yet…

I put a lot of time/work into designing, building and testing these things. As you can probably guess these are not the original versions, there were several previous attempts (these are actually my 3rd set of boards). Someone please start using them! The FW is much much more advanced that any modded version of STAR (but still extremely simple to operate), I mean totally different level of stuff here, everything people complained about with STAR / Werner’s UI has been fixed in the UFLC (its called “Ultimate flashlight code” for a reason!)
Things like direct access to off from any level, shortcut’s to max and the user set primary level (shortcut’s direct from off and from any other mode). HIDDEN strobe (and not just 1 but three strobes including one with a completely adjustable strobe speed and duty cycle allowing you to freeze objects in place. Truly momentary operation. Not to mention the multiple different config options that are done in-light (no coding required) so you can customize each light to how you need it to operate!

Now I understand not many of you are setup for PIC, thats why I’ve made multiple offers to flash the MCU’s for you for no charge, all the rest of the parts are the exact same parts as the AVR drivers, the same AOD510 FET’s and the cap’s are the input / smoothing cap from a 105c.

Is there something I can do to get someone to order some of these? What if I build them for you (for free of course, open source after all). I’ll give you another option, for the exact cost of the parts plus $.50 for my to ship it (not a single cent markup for my time) I will ship the first 5 people to take me up on this one of these drivers, I have all parts on hand and can ship out first of the week. The price would be $5.25 each ($4.75 in parts plus a postage stamp)

I should mention-I’m not pushing for anyone to buy anything from me, this is a dedicated open source project. In fact the MCU and the boards are the only new parts you need to buy (about $6 total for 3 MCU’s and a set of 3 boards) everything else is standard 105c parts and the same FET’s used on the old AVR 15 and 17DD’s), just please someone install one in something and make me feel like this wasnt a total waste of my time

Not that I wouldnt have done these for myself, of course I would, thats why I started them in the first place but I certainly wouldnt have done them to the level of refinement I did had it only been for myself nor would I have made a whole write up and set of videos about it just for myself… Just saying, know what keeps us oshpark board designing guys happy and keeps us wanting to design more stuff? Its definitely not people totally ignoring the projects we put out. Its one thing if I made a driver for one specific light that isnt very popular but these are very wide application…

I also have a redesign (using a 10F322) that is power cycle controlled but I’m not sure its worth my time if it seems like no one is going to use it anyway and just stick with the same old AVR / STAR stuff…

/rant

 RIP  SPC Joey Riley, KIA 11/24/14. Now I am become death, the destroyer of worlds.

downlinx
downlinx's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 04/09/2014 - 09:38
Posts: 1292
Location: Indiana, USA

I will just start sending my lights to for the next month or until life settles down with the new baby, hehe

BLF Community Battery Pull Thread http://budgetlightforum.com/node/32720

priest77
priest77's picture
Offline
Last seen: 3 years 3 days ago
Joined: 02/05/2014 - 03:59
Posts: 78
Location: Serbia

@Cereal_killer
I am in!
You have a PM.
I want a driver for my Roche F6.

DB Custom
DB Custom's picture
Offline
Last seen: 4 hours 42 min ago
Joined: 01/13/2013 - 22:28
Posts: 20633
Location: Heart of Texas

Will this work with a twisty? I saw where you might try a 10mm version and my premier light is that size, but a twisty.

I’m thinking this would work very nicely in my new Fenix TK22 with dual switches. I had about decided to leave this one stock but had occasion to use it to guide a car in a parking lot Sunday night and it was rather anemic. So I’ll be looking at this driver as the light itself is actually a pretty dang nice light.

PM sent, hope I made sense! lol

DB Custom
DB Custom's picture
Offline
Last seen: 4 hours 42 min ago
Joined: 01/13/2013 - 22:28
Posts: 20633
Location: Heart of Texas

Just watched all 3 vids and see that this probably wouldn’t work well with the small twisty.

The Fenix TK22 would be an ideal choice, with tail clicky and side e-switch. I also have a Convoy L4 that is a likely candidate. Would a TK61 work well with this? Using the driver as a master and running an HX1175b1 as the slave? Wondering if the 2 e-switches might be utilized to work as power on and mode selection as it was from the factory. Right now I’m using both switches in parallel to do the same thing.

Wondering too if the UI is written down, my memory is horrible and I’d need to work on the options a lot to be able to remember how to use it. Smile

Cereal_killer
Cereal_killer's picture
Offline
Last seen: 9 months 4 weeks ago
Joined: 07/22/2013 - 13:10
Posts: 4005
Location: Ohio

What you just posted in actually something I’m working on now, I’m not sure when (if) it’s going to work out, it’s not exactly at the top of the list but it is something physically on my bench (that’s more than some of my other projects lol). I’m also not sure about the possibility if a second e-switch input, I can tell you that while it may be possible it would mean the MCU could no longer be flashed ICSP (if/when MCLR has a physical connection it doesn’t allow on board flashing since the pickit3 senses it as a short).

Also I’ve switched over to running a different PIC (a 12F617, a direct drop in replacement for the more expensive 1822). The UI is nearly identical (only the strobes are changed) but battery monitoring is added as well as the ability for the driver to reconfigure the locator beacon from the main emitter to a SMD emitter placed under the switch boot [requires code changes, not in the config menu].

I’ve also updated the board to allow a 22AWG sw+ wire to fit the via (stupid mistake originally).

 RIP  SPC Joey Riley, KIA 11/24/14. Now I am become death, the destroyer of worlds.

Cereal_killer
Cereal_killer's picture
Offline
Last seen: 9 months 4 weeks ago
Joined: 07/22/2013 - 13:10
Posts: 4005
Location: Ohio

V2 of the 17 released! (15 in progress, will be done in the next few days)

-The MCU has been switched over to the slightly cheaper 12F617
-The code has a few new features, this includes battery monitor and a flashing indicator LED that can be placed under the switch (and replaces the main LED locator beacon) there is also some changes to the way strobe operates (however its still entered via a triple tap).
-The secondary emitter (switch indicator) runs from pin 6 and uses those 2 tented via’s you see, they’re tinted to help prevent shorts in applications you dont run one, scrape the mask to solder to them. You should even be able to solder an 0603 LED direct to the via’s like a pad if your light has a switch at the top of the driver level.

I will make anice little flow chart of the UI (and a new video showing this final version) later today / tonight.

Note the code linked above DOES NOT run on a 1822, I will be hosting the new 617 code in soon as everett has a chance to check it over (tonight), it runs but I want him to make sure he’s cool with the credit I put and the comments and stuff I added. Everett had already added lots more comments to this new version and I took it ever farther, hopefully its easy for you to mod. You guys can download MPLAB and check the code out now even without having a picKIT to flash it yourself. If you want to do this I will flash code you modify and send me. Again please do not re-host code you modify but you may make any changes you wish and use it in any personal applications.

 RIP  SPC Joey Riley, KIA 11/24/14. Now I am become death, the destroyer of worlds.

ImA4Wheelr
Offline
Last seen: 3 months 1 week ago
Joined: 02/03/2013 - 14:51
Posts: 7932
Location: SC

I think this will be a very popular driver once folks start using it and giving feed back.  It probably taking off slow for 2 reasons:

  • Past new boards were purchased by many of us as soon as they released and then new revsions had to be made to fix issues.  I think that made many of us gun shy.
  • This is a new MCU for BLF'ers (Well, they may have drivers with this MCU, but they don't know how to program them yet.

I just ordered 3 17mm boards.  Once I get them working, I'm sure I will be ordering many more.  I'm off to find the PIC MCU's and will order some.  Do you have a recommended source?  The rest of the parts I already have. I'll report back on progress soon.

A side note.  I don't think you should feel you have to provide these drivers as cost.  I think most folks here feel your time is valuable and have no issue with you including something for you time in the price.  It might even make folks feel better about taking the plunge into this new driver.

Thank you very much for your efforts on this project.  It's an exciting new development for your hobby.  Hang in there bro Smile

ImA4Wheelr
Offline
Last seen: 3 months 1 week ago
Joined: 02/03/2013 - 14:51
Posts: 7932
Location: SC

There are several different SMD 12F617's listed on Mouser.  They have the following suffixes: E/SN, E/MS, I/SN.  Do you know which one is best for this driver? 

An AliExpress vendor is selling 50 pieces for $33.06.  They are I/SN's.  Will they work on this driver?

ImA4Wheelr
Offline
Last seen: 3 months 1 week ago
Joined: 02/03/2013 - 14:51
Posts: 7932
Location: SC

So compared to the Attiny13a, the 12F617 has twice the program memory and twice the data memory.  Program memory can be flashed 100.000 times (10,000 for Attiny) and will be retained for more than 40 years (20 years for the Attiny).  Standby power usage is super low (50nA vs 24uA for the Attiny). All that means its much bette long term for our hobby.

The 12F617  doesn't appear to have EEPROM memory.  Do we use the EEPROM memory in the Attiny's?

The 1822 has even better specs.  Was the only think you needed to change was the FW?  It appears that the pinout is the same for both the 617 and 1822.

EDIT: Made some changes to clarify wording.

Cereal_killer
Cereal_killer's picture
Offline
Last seen: 9 months 4 weeks ago
Joined: 07/22/2013 - 13:10
Posts: 4005
Location: Ohio
ImA4Wheelr wrote:

There are several different SMD 12F617’s listed on Mouser.  They have the following suffixes: E/SN, E/MS, I/SN.  Do you know which one is best for this driver? 

An AliExpress vendor is selling 50 pieces for $33.06.  They are I/SN’s.  Will they work on this driver?

Why the ones that are sold out of course (@ DK)!

12F617-I/SN is what I use, tho the letters dont mean much in our application, I believe any of the soic8 package ’617’s would work. They’re temp rating and stuff like that.

As for the ones @ AE, they list as SOP8 but when I google SOP8 vs SOIC8 they seem to be classified as the same thing (so maybe just slightly different size / width / something)I’m not sure.

Quote:
…The 1822 has even better specs.  Was the only think you needed to change was the FW?  It appears that the pinout is the same for both the 617 and 1822…

The FW for the 617 was further developed and the 1822’s are about $.30 more per piece. Also running these on the 617 all my drivers use the same MCU

 RIP  SPC Joey Riley, KIA 11/24/14. Now I am become death, the destroyer of worlds.

ImA4Wheelr
Offline
Last seen: 3 months 1 week ago
Joined: 02/03/2013 - 14:51
Posts: 7932
Location: SC

I ordered them from Ali.  I won't need 50 as I don't plan on selling drivers or chips.  They should be fine if they are really 12F617-I-SN's.  I'll keep you posted.

ImA4Wheelr
Offline
Last seen: 3 months 1 week ago
Joined: 02/03/2013 - 14:51
Posts: 7932
Location: SC

In addition to Cereal_killer, I wanted to thank tterev3 for making this driver possible.  Getting excited to start playing with them and with programming these PIC's

By the way folks, the PIC programming kit is now only $19.80 at Banggood.  Mine arrived very fast.  I haven't used mine yet, but it looks good.

hank
hank's picture
Offline
Last seen: 1 day 5 hours ago
Joined: 09/04/2011 - 21:52
Posts: 9360
Location: Berkeley, California

> I don’t think you should feel you have to provide these drivers as cost. …
> your time is valuable and have no issue with you including something for you time in the price.
> It might even make folks feel better about taking the plunge into this new driver.

+11

ImA4Wheelr
Offline
Last seen: 3 months 1 week ago
Joined: 02/03/2013 - 14:51
Posts: 7932
Location: SC

I received the 12F617 I SN's Saturday.  They look just like in the picture here.  Also have the 17mm boards from OSH Park.  Not sure when I will get much time to work on FW though.  Got a car project underway right now.  Hope to wrap it up fast though.

Cereal_killer
Cereal_killer's picture
Offline
Last seen: 9 months 4 weeks ago
Joined: 07/22/2013 - 13:10
Posts: 4005
Location: Ohio

Just finished up installing the first one of these I’ve Zener modded and it works great. Since voltage monitoring doesn’t work once the Zener is added I went ahead and used the original 1822 to have all the strobe options and adjustment (originally switched to the 617 cause that version has battery monitoring but not the extra strobes) the 1822 version doesn’t have the battery monitor but that doesn’t matter in this application. Again the pinout is exactly the same so its a direct swap.

Note the Zener gets REALLY hot while it’s connected to the PK3 since the current is actually higher than the 200ohm resistor allows while it’s running, careful, I wouldn’t leave it connected very long and don’t touch the Zener.

This is in a Yezl Y3. Pic’s later…

 RIP  SPC Joey Riley, KIA 11/24/14. Now I am become death, the destroyer of worlds.

ImA4Wheelr
Offline
Last seen: 3 months 1 week ago
Joined: 02/03/2013 - 14:51
Posts: 7932
Location: SC

Cool.  Which of Everett's 1822 FW's did you use?  I'm aware of at least 3 he has out for single color light.

Pages