Thanks guys. I am new to this arena and discussion like this is helpful.
It was only 6 months ago when I ordered my first 18650 (Latticebright “XP-E”) flashlight. Initially, I merely wanted to play with the electronics to modify the driver. Eventually, I concluded it is easy to get an MCU based driver, write my own firmware to achieve what I want to do. I was very apprehensive when I first considered the ATTINY85v. So I share my experience here for the next guy. May be he/she can approach with a bit more confidence.
I already have my own firmware written for the ATTINY13A. It has all the functions I wanted but a very bad UI for selection. I was at around 1020 bytes. So, to do a better UI, I need more flash space.
While I was still deciding, I blew my ATTINY13A by mistake. So, no more deciding, Mouser was happy. With my ATTINY85V from Mouser at hand, I rush to install it. My first one did not went well. I must have a hidden solder bridge somewhere. Removing it and resolder again, the thing worked like a charm. For some reason during initial install, the ADC always read around 2.7V to 2.8V, yet measuring with DMM, the ADC pin is reading right at 4.7K to ground and 19.1K to diode. I double check the code for mistaken where I might have set the ADC pin to OUT and send a 1 there, but that was not the case. So believing it is a dry joint, I desoldered the TINY85 and resoldered it. It works.
Beside the on for the test/development board, I have another 4 for real flashlights. After the first one , the other 5 were no problem. No technical problem anyway. All went very smooth except the 4th one. The next paragraph is a distraction:
The SAGA of Chip#4
My “work flow” is: first put it on SOIC clip to check for chip operations - read the flash, eeprom, fuses, etc., then bend legs, then install. On ATTINY85V #4, it slipped the clip and shoot out of the spring-clip away from my electronic work area to somewhere around my PC desk. An hour later, a miracle that I found it in that rat-nest of wires on the ground between the PC desk and the wall. So, I finish my read-test, programmed it, and re-read it AOK. I bend the leg on this 4th one. About ready and on final check, it felt off my plier. So problem, this is not like behind the desk… An hour later, I found somehow it landed BEHIND my backup SLA battery. Ok, at least I got it. So on to soldering. After testing the TINY13A and the NANJG105c, I removed the TINY13A and reach for my ATTINY85V#4 - it is missing! The chip is gone! I looked at the floor a dozen times, I just couldn’t figure out where this chip went. It is not on the table, it is not on the floor, and it did not felt into or behind anything! I looked, and looked, on the floor, move the stuff on the table, move the stuff from boxes around around the table… Where the hell is chip#4!!!
Back to about the 85V. I took it as a challenge to find out what I needed to do for code change. I did the research by the datasheets alone as a challenge. I came back to this thread to see what changes are recommended and I did do all those from the datasheet research alone. So I passed my own challenge.
- FCPU change
- ADC reference voltage bit change
- PWM change
and, I did one more that I didn’t find mentioned here
- eeProm write address needs to change to H & L both since it has 512 bytes, L alone is not going to do 512.
The bending of the leg is not hard. it is best to re-flatten/re-align the end-part of the leg to ensure good contact with the pad on the PCB. Secure one outer leg (nearer to edge of PCB) first, check all leg for good positioning, then secure one more leg and recheck again. Then finish soldering, check the soldering and clean up any bridging.
Now, my 4 ATTINY85V flashlights has the features/functions I wanted exactly.
That was at times a frustrating project, but it works well now. I have four “new” flashlights with TINY85V, and still have a TINY85V on my work-bench “flash light” for more playing-around-with for future versions. Getting the TINY85V’s leg bend right and installed it right requires a lot of patience, but it fits very nice and the result is very rewarding.
The SAGA of Chip#4 Episode 2
By now, it was > 4 hours on this chip alone. I cleaned the floor slowly and gently an inch strip at a time - as far as 6 feet from the table clear wall-to-wall but found nothing. By now, I am totally puzzled. How can a chip this big just vanished! I gave up, sat on the floor, and a bit dumbfounded. Suddenly, something caught my eyes in mid-air. I grab a working flashlight - this time, not on the floor, not on the table, and about 2 feet off the floor. There it was, hung on a small spider-web between the table-leg and the wall in mid-air. Well, no spider in my house was going to eat silicon for dinner that night. That chip took me half a day to finally finish. Like I said, not really a technical problem. Just a hungry spider.