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

Oops, looks like a different firmware will be needed. I didn’t know this thing had battery indicator lights.

Then again, if it’s running on 2x18650 in series, I don’t think I can measure the voltage anyway. We’ll see.

Hi ToyKeeper. The driver appears to have 2 different voltage dividers (Still trying to sort out). One MCU pin pad reads close to 1.5 volts and another at about 1 volt with fully charged cells. I don't have exact numbers here at work. I also need to measure with different input voltage levels. I can adjust the values in the FW as needed. I don't know of anyone pulling this off yet though. I just know the theory the wight taught me.

Yeah, I set those a tad bit different than requested. They’re actually about 1.6, 12, 46, and 100. But after adjusting the values on a visually-linear cube root scale with a maximum of about 1600 lumens, the resulting “perceptual” percentages are 25, 50, 77, and 100.

The low end may be a bit off since I’m not totally sure where “zero” is on this hardware, but I’m guessing it’s at about PWM=6/255.

That sounds like it’ll probably take a lot of trial and error, manually checking lots of different values and reflashing. And that’s if it works at all. It might deliver a constant voltage due to the buck driver, and it could possibly be too low to measure accurately (the attiny13a’s reference voltage is 1.1V). In any case, it likely won’t be easy.

ImA4Wheelr, did you measure both of those voltages as changing with different Vbat? Just based on what you wrote I’d expect that one of those two voltages was probably a reference voltage to compare the other voltage against. (If so, the ATtiny13A will not need that.)

I think that the easiest course of action is simply to make up a new voltage divider and work with what we know.

^ Haven't had a chance to try different voltages yet. Just trying to understand some basics about this driver.

The traces don't make sense to me yet. I can't completely track the PWM traces going to the Buck Controllers. I expected 2 separate pads to control PWM for each driver because the stock light operates them independently. But only one pad seems too activate both of the drivers simultaneously. So far, this diagram is about all I think I know about the stock MCU pin pads. The voltage readings are from ground. Doesn't that the Vcc seem high?

The indicator LED's are always connected to positive power. It appears that the MCU must a path to ground to turn them on, but when I try to ground those pads, the emitters do not light. They light when tested with a DMM though.

Something seems to have gone wrong. Now when I connect power to the driver, one led turns on and one of the sense resistors starts to smoke within seconds. Wondering if a Buck Controller failed.

It's late and I got to crash for work tomorrow. I think I will replace the Buck Controller is connected to the burning sense resistor and begin testing circuits all over again. Probably should reflow the MCU and see if the driver still works properly too. I'll decide tomorrow.

Yeeee Haaaa! We're in business. Finally, got this driver sorted out. It turned out one of the Buck Controllers had failed (Probably when I was poking and prodding around trying to figure this damn thing out). I reluctantly pulled the switch so that I could see the traces under it. That helped answer more questions. I still can't follow the traces for PWM, but process of elimination gave a clear indication as to which pads were for that. I think the traces are hiding under the vertical board. I have much better trace pictures that I will soon replace some the pics in Post 16 with. Here are a couple views of the traces under the switch:

We also seem to have a viable on-board voltage divider. It measured 1.43v at 7.61v input and 1.55v at 8.2x input. More measurements will soon be taken. The other "voltage divider" seems to decrease voltage as input voltage increases. So it doesn't seem like anything we will be utilizing in this build.

So, I'm at a point where I can now start modding the driver. I should have something to report some time before the weekend it up.

EDIT: To all the folks that said nice things up above. Thank you very much. I'll reply to those posts sometime soon now that I'm starting to see some light at the end of the tunnel.

Bad news ImA4Wheelr: The 1.4-1.6v range does not make for a simple mod. If there is not a rock solid Vcc available then it’s not useful at all to the ATtiny13A, which uses an internal 1.1v reference with current firmwares. ATtiny13A units without a fully regulated voltage supply cannot measure above 1.1v in other words.

I think I said it earlier, but the easy way out here is definitely just to build a new voltage divider. If you have a rock solid Vcc then the firmware could be modified to measure the stock voltage divider against that, but it would require (minor) code changes and (unknown amounts of) testing.

Good luck with figuring out anything strange relating to controlling the two buck circuits independently, I’m looking forward to that. Maybe there is a transistor which switches the availability of the PWM signal on or off for one of the circuits (so it would be controlled by a binary output from the MCU).

Having an on-board circuit makes this so much easier. I just need to change out resistors to get the appropriate voltages. I think it's good news.

The drivers were independently driven stock. The will both be feed the same PWM signal from the Attiny. One may end up putting out more current overall to balance the beam pattern, but they will both get the same PWM feed.

Thanks for the input wight. Always appreciated and valued.

I agree, if you can swing that it would be much nicer than having extra resistors banging around all over the place.

Oh, I thought 1.1V was the bottom end of the attiny’s built-in voltage measurement range… When using the default 1.1V reference, can’t it measure anything between 1.1V and 5.5V?

If that’s the case, I think it should work… but the voltage values you use might be in the range of 10 to 30 instead of the default values of like 120 to 190.

This is incorrect. The ATtiny13A measures betweeen GND and Vref.

Vref may be taken from the internal Vref (1.1v) or Vcc (you’d want it to be tightly regulated of course, a Zener attached to a battery is not good). Some other AVRs allow for taking Vref from an external pin as well, but I don’t think the ATtiny13A does IIRC.

Wow, I had no idea this mod was going to get so complicated. Great job ImA! Keep up the good work! (And sorry it didn't turn out to be so simple.)

-Garry

The voltage divider of interest consists of the 3 components (C2,R2,R3) on the top right of the below picture:

Using this diagram (Linked to Voltage Divider Calculator that wight introduced us to), the component ratings are as follows:

R1 (Labled "R3" on PCB) is 43.2k ohms (E96 marking of 62C)

R2 (Labled "R2" on PCB) is 10K ohms (E24 marking of 103)

There is a capacitor parallel to R2

VCC is wired as follows:

  • B+ into a 150 ohm Resistor
  • After the resistor the trace connects parallel to the following:
    • A zener diode (Labeled "W8") connected reversed biased. The is what regulates to a solid 5.19-5.20 volts out.
    • Capacitor
    • The other "voltage divider" looking grouping to the left (R4,C3,R5). The component in "R4" looks like it might be a multilayer inductor. I don't think this circuit impacts anything much as R5 is a 31.6k ohm resistor.
      • The other side of the above are connected to B-.
  • The trace continues on to a inline diode (can't make out marking on diode). It is in bay "D1" on the main PCB. This appears to be for reverse polarity protection.
  • The diode connects to the VCC pin of the MCU.
    • There is a Capacitor between it and ground (See far right of the pic below).

garrybunk wrote:

Wow, I had no idea this mod was going to get so complicated. Great job ImA! Keep up the good work! (And sorry it didn't turn out to be so simple.)

No worries. Problems and complications are good learning opportunities. And, it's great having ToyKeeper and wight helping out.

ImA4Wheelr, is it possible that the other group of elements (R5,C3,R4) includes thermistor - R4 (no markings) for thermal protection? Similar like here - left side near W8 diode: http://m2.dealextreme.com/upload/reviewpicture/201311/e834b9ca-3352-46ee-a695-c74b8862fb5e.jpg

Also the stock 14 legs chip is quite similar like this: http://m2.dealextreme.com/upload/reviewpicture/201311/fddd88bc-763b-467d-8077-ca9075360617.jpg

Pictures are from my discussion thread at DX - http://club.dx.com/forums/forums.dx/threadid.1343534 It is looooong thread, but you might learn something along, specialy from things posted by LEDsShine.

Fixed the link to your DX driver discussion.

-Garry

ledoman,

Very interesting. That makes sense. That would explain the kind of random, but fairly tight readings (due to room temp environment) I have been getting. Garry's component looks a little different (Contacts on end curve inward on the body). Do you know how I can test it? I'm guessing connect a voltmeter and start heating it up to see what happens to output.

If it is, Garry wants thermal protection. Obstacles would be getting code written (that also fits in the Attiny13a) and he would have to give up one of the two pins that is for voltage indicator LED's.

EDIT: Yeah, that is probably the same MCU. Probably a PIC 14fxxxx or something. With the right clip I could probably copy the program that is on it (it's probably in hex).

Don't know about electronics so I can't help much except for some testing. I still have HD-016 and also new driver from DX. Will do some resistor and capacitor mods on DX one (see pages 17 onward in the disscussion) for next project.

This DX driver has one of the best UI I've ever seen in cheapo bicycle drivers. It would be nice to decode the program from it and flash it to the HD-016 or similar drivers. Some hard work would be needed. But let this alone for the future. You are already working hard...

Ah yeah, I see what you mean now. With 3 voltage indicator lights there is no room without using the Reset pin.

Pins:

  1. N/C - Reset
  2. GND
  3. PWM
  4. Voltage ADC
  5. Vcc