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

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

Come to think of it, there’s already no room! You need a pin for button input as well as the 3 outputs for status LEDs.

Is there anyway to leave the stock MCU in place to drive the indicator LED's (& thermal protection if it's in there too) and just use the Attiny to control the light output to the XM-L2's?

-Garry

I think some of that should work:

  • leave the stock MCU in place to drive the indicator LED’s - YES, good idea
  • (& thermal protection if it’s in there too) - NO, the ATtiny will handle all actions which involve control of the buck circuits.
  • use the Attiny to control the light output to the XM-L2’s - yes

Low voltage warnings through the ATtiny could be disabled, so that only Low Voltage Protection / shutdown would be present. You’d have different microprocessors running the LED status indicators and the actual shutdown. The LED status indicators would remain the same and continue to behave as they did on the stock light, potentially including or not including heat warnings.

In order for the light to shutdown or throttle based on either temperature or battery voltage the ATtiny would also have to be hooked up to those dividers. That should give you just enough inputs to hookup 2 dividers (the temp thermister is likely part of a divider, I think that’s the normal setup) plus the momentary button.

The LVP shutdown may not be as effective with so many devices idling - 2 buck controllers and 2 MCUs. At least the ATtiny13A will go to sleep, but the rest of it may not do as well. I still think that it’s a good idea, I just want to point that out.

I doubt heat will be an issue during a ride, but low battery definitely can be. If you have to choose features to not enable, I’d suggest leaving out thermal monitoring.

Using the stock MCU for the indicator lights is an interesting idea, and eliminates the pin overload. :slight_smile:

It definitely sounds like it would be a bad idea to leave the light connected to a low battery though… since several components will always be powered up and we don’t have control over most of them.

This project is kind of fascinating in a bizarre way. I know almost nothing about circuit design, so I keep seeing surprising things here.

^ 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. :)