Mod - GarryBunk's SecurityIng HD-016 (It's Finally Done!) - Pic Heavy

^ I agree. Given the power levels Garry has decided upon and with Turbo Timeout, heat should not be a issue in most situations.

How would we keep the stock MCU in an "On" mode?

It only runs lights the indicator LED's when it is powering one of the two headlight LED's (an "On" mode). It would need to be connected to a momentary switch or something in order to turn it "On" in case it goes into "Off" mode. I'm guessing it would go into "Off" mode every time it's disconnected from power.

Good point! There are probably a couple of options. How does the stock driver respond to holding down the button from off? If it simply switches to the first mode and stays there then that’s your answer.

^ Very clever wight. You're saying if it works that way, then just hard wire the stock MCU's momentary switch pin to ground, right?

Ledoman,

Can you please try holding down (and not releasing) the power switch from Off mode and tell us what the light does?

EDIT: Ledoman,

Your suspicion was correct, that component is some sort of thermistor. When I aim a hair blow drier at it, voltage output drops quickly. Turn off the blow drier and the voltage starts climbing back up slowly. I just don't know how to get a good read on what temp equals what voltage. I don't believe I have anything that can measure temp of such a small object.

EDIT2: The voltage dropped pretty rapidly and slowed down when it started to approach .3 volts. I would say it seems like .28 would be a good starting point. I could have to run the light assembled to see at what exterior temp the thermal control kicked in and then adjust the settings from there. I guess we need to hear what ledoman says about the power switch being pressed and held. Then it seems to be decision time.

Exactly. The status lights would always be on when batteries are attached. Really that’s OK, as we’ve already established that storing the light with batteries attached would not be the best thing to do.

Regarding calibrating the temperature measurement: you are thinking about the situation in reverse. Based on your comments I assume you have an IR thermometer. It needs a half inch diameter circle or similar to measure, much much larger than the thermister. If the thermister was a 0805 component which generated heat we would be unable to measure it’s temperature: it’s too small. But since we are talking about a 0805 component which responds to heat… which we are testing with a large hair drier… we can safely assume that the entire 0.5in circle around the thermister is also the same temp. So using any old temp gun should be able to get you an accurate reading. :slight_smile:

Yes, Garry said he disconnects power when not using the light. Just need to hear back from Ledoman or anyone else that has a HD-016. Reassembling the driver is a last resort to getting that info.

Good point on testing. I'll do that. Thank you. :)

Sorry I was away. Edit: Upon holding down the switch from Off the light does nothing. Also the status leds are not powered up. Only short press puts it into wide beam on and brings up status leds.

Regarding stock MCU you might look just posted circuit drawing about DX driver (http://club.dx.com/forums/forums.dx/threadid.1343534?page=21) - IC4. It might help you resolving it's functionality. It has pretty much different UI, but the pinout should be about the same.

Thank you Ledoman very much for trying that out. Wow, that driver's MCU has so many differences in nin out that they really are not comparable. Like you, I figured they would be similar too. Garry's pin out is as follows:

01 Vcc

02 Indicator LED

03 Momentary Switch

04 NC

05 Indicator LED

06 Indicator LED

07 PWM for one Headlight Driver

08 PWM for the other Headlight Driver

09 NC

10 NC

11 NC

12 Tempature Sensing Circuit

13 Voltage Dividing Circuit

14 Gnd

Ok, With the info we have collected, I propose the following approach regarding the MCU's. Please chime in with an concerns, thoughts, better ideas, etc.

  • Cut Pins 7 ,8, 13 (See Post 51) and reinstall the stock MCU. The stock MCU will only control the indicator LED's.
    • I think the mode cycle for the stock MCU is Wide Beam On, Wide Beam Strobe, Throw Beam On, Throw Beam Strobe, Both Beams On, Both1 Beams Strobe, Off. So most of the time the indicator lights will be on as 6 of the above modes are "On". Every time Garry hits switch 7 times, the stock MCU will turn off. He will need to cycle 4 clicks to return to a the same mode on the Attiny13a and also have the stock MCU on (that's if he even wants the indicator light on at that moment). If he changes modes often, there is really no concern because the next mode change will turn on the stock MCU.
  • Attiny will control drivers and have external temperature and voltage divider monitoring and safeguards.
  • Piggy back the Attiny connecting Vcc to stock Pin Pad 1, and Ground to Pin Pad 14. Pin Pads 7 and 8 (Head light PWM), 03 (Momentary Switch), 12 (Temp sensing), 13 (Voltage Divider) will connect to Attiny as determined by the FW.

The above is dependent on Toykeeper's and Garry's approval. They will need to nail down what they want to do regarding:

  • External temperature monitoring. Will the FW have it?
    • If yes, is Turbo Timeout still needed?

In the mean time, I will get some temp/voltage readings and finish the work on the thermal path (AR coated lenses have arrived). Do I nee to change resistor in the thermal circuit to increase voltage? Right now it looks like the .2x volts will be the target voltage at which the FW would step down a mode? I'm guessing not because it is a fraction of 1.1 (e.g. .28 volts would be about a value of 65 in the FW).

EDIT: Plan outlined above is not viable due to how stock MCU is turned Off (Long press).

Well stock modes were: wide led on, narrow led on, both LEDs on, both LEDs strobe, then off (I think). Nope, back to wide led on. It's a press-n-hold from any mode to turn it off. So is that close enough to the Attiny's FW to stay "aligned"?

-Garry

Stock modes are as follows: wide beam on, throw beam on, both beams on, strobe with both leds on, ... repating ... Long press in any mode turns light off. There is no off mode in the cycle.

Wait- if the Attiny were put into it's strobe mode that would throw off the "alignment", right?

-Garry

OK, good info Garry and ledoman. I think my idea needs to be scrapped. I got nothing at the moment. Anyone have any good ideas?

EDIT: What if we toss the stock MCU and just use one pin on the Attiny for the indicator LED's? It could blink one or all of them when voltage gets down to a certain level. Maybe faster as voltage gets lower.

For anyone interested in some of the circuits outside of the drivers, here is a very high tech diagram.

The dots are thru-holes. They are just from memory so there may be some I forgot. Pin 3 connects to the Momentary Switch.

I think that we can control the stock MCU with a different, relatively simple, circuit. Whether you’ll want to build one is up to you. I’ll hammer something out and post it in a minute.

I think that a “monostable multivibrator” is the tool for the job if we want to turn on the stock MCU when power is applied. - Multivibrator - Wikipedia

You could certainly build one, and it wouldn’t take many components or much money… but you can also buy one in an IC for <$1. I specifically glanced over the datasheet of the SO-16 packaged 74AHCT123AD,118 ($0.40) and it seemed suitable. I think that at least 2-3 external components (at least one cap and one resistor) will be required. At a glance the SSOP-8 packaged TC7WH123FUTE12LF also looks suitable and is smaller.

  • What a circuit like this should allow us to do is trigger an output pulse on a ‘rising edge’ (power being applied).
  • I think that we can setup the pulse length using a resistor/capacitor/both.
  • If it fails to trigger due to the chip being powered on at the same time as the trigger input is produced (eg we are applying power)… I think that we can put a capacitor between the “positive edge triggered input pin” and GND, then put a resistor between that and Vcc. That should slow down how quickly it triggers, I think.

I'm totally fine with this. I don't need all three lit, just some indication that the battery pack is getting low. Would be nice if indication was in two steps: 1) 10% battery (or whatever is most appropriate) and 2) flashing indicator LEDs and either dropping output to low or shutting off. I would plan to change battery at the first indication so the light cutting off during a ride probably wouldn't happen.

-Garry

^ Thank you for the idea wight. I'll have to think on that.

I trust you on the theory (goes over my head), but I'm initially concerned about more components/complexity. It increases the risk for problems and future failures. Do you have any rough guess how much power this circuit would consume?

Fair enough. It’s not like I’ve built and tested one. There’s a lot of “I think” and “should” in my suggestion. :wink:

As far as how much power would be consumed… I think sub 1mA, maybe waaaay below 1mA, but I don’t know and I’m not super confident. (I think that the IC cannot supply more than 75mA, so it should be safe to say that it would consume less than 100mA or something no matter how wrong I was about the rest.) In any case it should not be enough to affect battery life and in the most likely case the big drain will be keeping a 10-20mA LED lit.

Would it be easier to convert the power bank to parallel, bypass the stock MCU entirely (don’t even power it up, or the other stock components), and use only two of the three power indicators? That way, there’s no need to buck the voltage, no need to sync anything with the original MCU, and most common firmwares should “just work”.

At that point your longest regulated runtime likely comes from switching to a linear driver as well (eg Nanjg-105c).

EDIT: switching the battery config doesn’t free up any MCU pins anyway.