STAR Firmware by JonnyC - Source Code and Explanation

The reason I started offering the STAR as well as the NLITE was because I was getting requests every day from customers wanting more customization than what NLITE gives them. I did not have the source code, nor did DrJones want to provide it, so there was no way I could do this with NLITE.

As for the similar code: why would you reinvent the wheel when others have OPENLY SHARED their code and you are planning on OPENLY SHARING your own code? After you've seen others code that works you would have to try exceptionally hard to write something functionally similar but coded substantially different, especially with the space limitations of this MCU. It is easy to see that there is original work here, along with better, more understandable comments than I've seen in any other project so far. The reason he wrote such descriptive comments was so that when he shared it, lay people (such as I) would be able to understand what he did and build on it.

JonnyC didn't build this firmware to make money, which is why he released the source code after many of the bugs had been worked out. He wants to help everyone with their projects, and hoped that others would take and continue to build their own code with any part of it (or the whole thing!) that they liked. I pay him a percentage out of gratitude for all of the time he spent with me getting this working, not because he asked for it. The reason I charge for it is because (1) it takes me time to configure, flash, and test every driver and (2) because it is my small way of saying "thank you" for the countless hours he has spent with me troubleshooting and making this work. He will never earn enough off of this to be worth even close the amount of time he spent with me alone.

As for me? I spend WAY more time than it's worth configuring, flashing, and testing these drivers. I offer it so that those who can't yet or don't want to do it on their own have a way to get the flashlight they want. With my limited amount of time I would rather sell parts and have people build their own stuff than build it myself, but I know that there are many who have big dreams and not enough time or skills yet to do it themselves.

As for all of the accusations, let's put them to rest right here and now. Answer this question: if I or JonnyC wanted to profit from this firmware, WHY IN THE WORLD would we release the source code??? This was a labor of love, not a profiteering exercise by JonnyC. Let me reiterate: JonnyC wrote this with the INTENTION of sharing it and helping others with their projects. He wanted to make sure that we had most of the bugs ironed out before releasing the code.

So I hope that this settles some of the bad mojo that's flying around here. The reason I love BLF is that spirit of sharing which benefits us all, and if sharing this source code isn't in accordance with that spirit I don't know what is. I know that it's easy to get caught up in a bunch of assumptions when you don't have the whole story, but let's just let this one go.

OK, now that said...deep breath and back to happy BLF! :)

Thanx All!! Not sure bout this software rights issue. Even though I'm a 35 year career software developer, I make my living on consulting, and I've found the best policy is to be 100% open with my clients, don't hide or disguise anything, and be committed to openness, and teaching to all those that want to learn. This of course is all within the client's organization, or partners we work with.

As far as a community like BLF is concerned, I feel strongly it should be an open community. All of us seem to publish everything we know, teach those that want to learn, put it all out on the table when asked, etc. So making software/firmware/drivers somehow an exception to that rule, just doesn't fit or feel right here.

There is absolutely no one now making any money off the custom driver software floating around. The small mark-ups that are charged don't even cover classic shipping and handling costs, and certainly don't cover the costs/time to even program the boards with normal labor rates. Basically it's a service of matching a hardware board to a customized configured program. Many of us don't have the time, patience, or knowledge to do this our selves.

Edit - Ooops, posted before reading your post RMM - I'm in total agreement here... Stating from my point of view.

http://www.ebay.com/itm/321057008586

They must be the smaller 'half pitch' pieces, the more common 2.54mm pitch (the spacing between leads) is too bulky to fit.

Bend the upper legs so they point straight down, bend the lower set all the way under. Scrape off the green solder mask covering the traces going to the stars where the legs will sit. The spring has to be temporarily removed for clearance.

Fold the switch down flat, then solder the lower legs to the ground ring on the driver.

They're a bit fragile if you leave them like that, so add a little dab of epoxy (JB Weld) on the left & right sides to hold the switch onto the driver. I had some of them break free during assembly before I started using epoxy.

Thanks Dr.Jones!

I also came up with the battery indicator and the short cycle memory that you found the good name for.

Theese functions are governed by the GNU license rules from my publification.

Honestly I don't know exactly what that implies.

The dip switch's kind of kill the e-switch ability. Best if in the UI, but it's never easy with having power ON/OFF being your only UI input.

Momentary FW link added to OP.

This FW has a UI similar to Werner's beta momentary firmware, with a few extra functions such as definable modes, turbo timer, etc.

please don’t take any of what I wrote as an accusation, it really wasn’t meant as such and I apologise if I offended you or JonnyC. I appreciate that no one’s going to get rich off of this and the list of people who’ve contributed to each feature in the code is long and somewhat complicated. I also think that it’s great that you’ve both provided the source code and that’s part of what makes BLF great. I just wanted to make the point that the list of people who’ve contributed to the firmware and the fact that some of them also have a business selling drivers with custom firmware makes it a bit of a minefield to make sure the contributors are all okay with their code being made commercially available (and that it won’t affect their providing free code in the future). As far as I can remember most of the code is out under a Open Commons/ GNU licence for personal or non-commercial use, but it wouldn’t hurt to get the okay from the authors first.

I’m hoping (have been hoping for the last 6mths!) to get a full featured e-switch firmware for Attiny13/25 put together from different bits’n’pieces people have published on here, but I won’t release it publicly until I’ve got the OK from everyone who’s code I’ve used.

Thanks to everyone involved for their time and generosity! Sticky’d.

Momentary is as usual, star 4 and ground?

Yes.

ah facepalm… Thanks :slight_smile:

Couldn’t find any dedicated procedure in the momentary version code to switch the light off.
Should we just click all the way up or down to “zero mode” to do this?

With 5 levels you're never more than 3 clicks away from the 0%/off mode. Add more levels and it gets annoying, but with 5 it's manageable. Being able to choose to turn on in either high or low, to me, more than makes up for not having an instant-off function.

I would like to think everyone involved with flashlight driver coding and thanks for sharing your hard work with the rest of us crazy flashlight modders. Being able to program a driver to my very own liking has made flashlight modding fun and for me, is the single best thing to happen to flashlight modding in all my years modding. Sure is nice not having to go through all those da flashy modes just to get to the mode you want. Thanks to all, and a special thanks goes out to jonnyC for your help. :wink:

Actually it gives the ability to select a star without permanently soldering it to ground, just unscrew the head, flip the switch to whatever star or turn em all off for stock and screw it back together instead of having to solder/unsolder a star if you want to make a mode “(semi)permanent” for whatever reason

Actually that is a tinkerers dream as you can flash whatever firmware you want to the ATtiny13A, and test it out very easily without all that soldering/unsoldering

Comfychair seems to make some of the most useful "utility" mods...

And I would like to thank ALL the coders that have contributed whatever to the designs...absolutely incredible!!!

And for what it's worth

In the GNU project, our aim is to give all users the freedom to redistribute and change GNU software. If middlemen could strip off the freedom, we might have many users, but those users would not have freedom. So instead of putting GNU software in the public domain, we “copyleft” it. Copyleft says that anyone who redistributes the software, with or without changes, must pass along the freedom to further copy and change it. Copyleft guarantees that every user has freedom.\

Copyleft also provides an incentive for other programmers to add to free software. Important free programs such as the GNU C++ compiler exist only because of this

Nice teamwork guys! Thank you for doing this for all of us. :beer: :beer:

You guys have no idea what it means to share this kind of stuff with us! This source code gave me enough ambition to finally figure out how to flash these things and I had complete success! The comments in the source really helped a lot for me to be able to modify the code a little.

How did I do it? I flashed some Qlite drivers to both NLITE and STAR using an Arduino Uno as an AVRISP using the ArduinoISP sketch. The source was compiled in Atmel Studio 6.1, and I used the newest version of avrdude (version 6.1).

I used a scratch built pin contact setup made of wood, CA glue, bare solid tinned wire, and some breadboard jumpers. The bare drivers were held in place by flipping an empty P60 pill upside down, and the contact pins were lowered onto the driver and held under spring pressure while executing the avrdude commands. Ugly, yes… but works every time with no fiddling, and cost nothing except a little time and a Arduino Uno clone that I had laying here.

Here is a link to the solid wire that I use for the contacts. It’s nothing special, except it’s stiff and solid, and not stranded wire:
http://www.radioshack.com/product/index.jsp?productId=2102500

First upload the ArduinoISP sketch to your Uno. Now your Arduino can function as an AVRISP programmer.
Here is a chart showing the connections that the arduino needs to program the Attiny13A. I also placed a 10uf capacitor between RESET and GND on the Uno. I don’t know if this is really necessary, but the ArduinoISP page says that it is necessary with the Uno. I have also tried it without the capacitor and it still works fine without it, so it is probably unnecessary.

Now, you have to set up avrdude. Download it at the avrdude website here: http://download.savannah.gnu.org/releases/avrdude/avrdude-6.1-svn-20131205-mingw32.zip

Place the avrdude program file and config file in a new folder on your main hard drive, like C:\avrdude or D:\avrdude or replace the drive letter with whatever drive letter your hard drive is.

Now you need a file called libusb0.dll in order for avrdude to work. You can get the file here: http://dlldb.com/libusb0-dll/

Place that file in your C:\avrdude folder.

Now find the shortcut to your windows command prompt. This is located at, Start:All Programs:Accessories:Command Prompt (on Windows Vista)

Right click the Command Prompt icon, and select: Send To: Desktop (Create Shortcut)

Now, there is a command prompt shortcut on your desktop. Right click it and select “Properties”. In the box that says “Start in”, type this in: C:\avrdude

Now, when you need to use avrdude, just click your command prompt shortcut, and simply copy and paste your avrdude commands in. WARNING: When using the command prompt, CTRL+V does not work to “Paste”. You have to right click and select “Paste”.

Here’s the avrdude command I used to flash the star or NLITE firmware using the Arduino. Just replace the COM3 with whatever com port your arduino is connected to, which you can see in your windows device manager.

STAR FIRMWARE
avrdude -p t13 -P COM3 -c avrisp -b 19200 -u -Uflash:w:star.hex:a -Ulfuse:w:0x75:m -Uhfuse:w:0xFF:m

NLITE FIRMWARE
avrdude -p t13 -P COM3 -c avrisp -b 19200 -u -Uflash:w:nlite.hex:a -Ulfuse:w:0x75:m -Uhfuse:w:0xFF:m

Just a breakdown of the added avrdude commands to use the ArduinoISP programmer:
-P COM3 tells avrdude what port the ArduinoISP programmer is connected to.
-c avrisp is what an arduino ISP programmer is called.
-b 19200 specifies the serial baudrate that the arduino ISP programmer communicates at.

And all the other avrdude commands are standard for avr programming.

Just plug in your Arduino Uno usb cable, let the Arduino boot up, place the pins onto the Attiny13A, and hold it under spring pressure. Press the “reset” button on your arduino, and let the arduino reset. Now just execute the avrdude command. This is what a successful flash will look like in the command prompt:

I had a 3M SOIC8 test clip, and it was a severe pain to get working at first. The shape of the grippers wasn't right to hold onto the chip, I had to disassemble the whole thing and reshape the ends and file the metal contact pins to match. The spring was also way too stiff. It finally wore out for good last week.

I decided to try the cheaper Pomona clip, and whaddya know, it works as-is right out of the box. Already has a fairly light spring, but still able to stay latched on just fine. It's cheaper, too. $11.85 at Digikey, that's about $6 less than the cheapest U.S. sellers on ebay.

Nice Drdanke. I will definitely try making a rig like that soon.

Great tip Comfy. I've been using that same clip since I started flashing chips. It's still holding up well, but I do have to be very precise positioning it every time.

@drdanke
easy and simple, I like it.
If you add 2 more contact wires, for + and - and one emitter you will be able to flash and test the driver in matter of seconds :smiley: