my new light - finally......- Mtbr.com
Results 1 to 19 of 19
  1. #1
    mtbr member
    Reputation:
    Join Date
    Nov 2008
    Posts
    177

    my new light - finally......

    About january time I decided I should make a new bar light as my square tube version wasn't very pretty. (the previous version is here )

    Only problem was that after collecting the bits I got sidetracked, then it became summer and I didn't need lights so nothing happened
    Now the nights are drawing in I thought I should finish it asap!

    MCE M bin (because I had one)
    EVA-D (because troutie suggested it as a comparison to the rocket SS in the 1st one)
    A simple ally housing with electron mount.......


    No electronics in the head to keep it simple. They are a Kennan (AX2002) buck driver driven from a pic12F683 to give control (low/high/steady/flash) and battery monitoring and cutoff, all built onto some veroboard......


    and housed with some NiMH cells (because I had some spare) in a water bottle. the switch is difficult to see but is on top of the bottle....


    and just to round things up, a beam shot
    (100ft to the shrubs)


    Nothing special by today's standards but I still think a single MCE like this makes a nice and simple bar light, lots of flood that is complemented nicely with a spot helmet light.
    (this one in my case.)

    Toby

  2. #2
    I spelled Knievel wrong
    Reputation: StevelKnivel's Avatar
    Join Date
    Jun 2007
    Posts
    217
    That is a cool setup!

  3. #3
    mtbr member
    Reputation:
    Join Date
    Nov 2008
    Posts
    177
    thanks

  4. #4
    mtbr member
    Reputation:
    Join Date
    Sep 2007
    Posts
    25
    I second that. That light isn't too shabby dude! Very cool!

  5. #5
    mtbr member
    Reputation: bumphumper's Avatar
    Join Date
    Jan 2009
    Posts
    136
    Great looking light! Brilliant driver circuit, I think that there will be a few requests for the circuit diagram and pre-programmed pics....Hope you are ready for the rush

  6. #6
    mtbr member
    Reputation: troutie-mtb's Avatar
    Join Date
    Sep 2007
    Posts
    3,062
    Nice one Toby and a different way to use the mount bracket brilliant

    (goes out to garage to have a look at an electron bracket )

  7. #7
    mtbr member
    Reputation:
    Join Date
    Nov 2008
    Posts
    177
    Great looking light! Brilliant driver circuit, I think that there will be a few requests for the circuit diagram and pre-programmed pics....Hope you are ready for the rush
    thanks but I wouldn't want anyone to think the pic program is anything special - apart from reading the battery voltage and setting the LEDs accordingly it just monitors a single momentary switch for control.
    A press of 5 seconds or more turns it on or off. When on, a brief press toggles the brightness and a longer (about 2 sec) press toggles between flashing and continuous.
    Apart from a bug where it sometimes takes 10seconds to turn on it is pretty easy to use.
    My next task is to make a remote switch on the handlebar but I haven't worked out the best way to do that yet.
    I also need to check the driver enable. I needed to add a series resistor to get it to turn off correctly. I am not 100% sure why this is but I think it might be something to do with the PIC read/modify/write way of setting IO pins.
    but if anyone is really interested I could post the circuit diagram, it is pretty simple.

    Nice one Toby and a different way to use the mount bracket brilliant
    Again, I'd like to take the credit for a great idea. But in fact I just built the light with a screw hole in the back and then got the mount and scratched my head trying to work out how to join the two. that was just the quickest way of doing it
    But yes, it does appear to work ok.

  8. #8
    Go faster!
    Reputation: sergio_pt's Avatar
    Join Date
    Jan 2007
    Posts
    1,082
    Nice light.
    That's something similar to what I need. Where did you get the rounded aluminium housing? Or did you machine it yourself? I also have a spare MCE and some spare parts and I could build an helmet light with a similar housing.

  9. #9
    mtbr member
    Reputation:
    Join Date
    Nov 2008
    Posts
    177
    I made it on my "new" toy.......



  10. #10
    aka RossC
    Reputation: ocean breathes salty's Avatar
    Join Date
    Oct 2006
    Posts
    936
    Quote Originally Posted by tobymack
    but if anyone is really interested I could post the circuit diagram, it is pretty simple.
    Please do! That sort of stuff baffles me so I would like to spend some time looking at an "easy" one to try and get my head around it.

  11. #11
    mtbr member
    Reputation:
    Join Date
    Nov 2008
    Posts
    177
    Ok, I'll post the circuit but it might take me a few days - it just stopped working properly so I've got to work out what I did wrong.....

  12. #12
    www.hahntronix.com
    Reputation: mhahn@hvc.rr.com's Avatar
    Join Date
    Mar 2007
    Posts
    252
    Looks like you're driving the enable pin. The new "Keenan" has a RC circuit on that pin, which is designed to do a soft start on the AX2002. The R charges the C up, and the LED gradually turns on.

    Your picture looks like you drive the enable pin thru a different resistor, using the existing C (capacitor) on the printed circuit.

    What happens if you pull off the existing capacitor, and just drive the enable pin directly (no resistor in the circuit)? That's the way most LED driver chips work, and the AX2002 manual kind of hints at this.

    If the circuit is toast, what's the harm in trying (unless you are short on PICs)?

    Mark

  13. #13
    mtbr member
    Reputation:
    Join Date
    Nov 2008
    Posts
    177
    Hi Mark,

    Yes, you are correct - I drive the enable pin via a 47k to turn it on/off and the feedback pin via a 150k for dimming. (9.1k from Rsense to FB pin)
    However, I have removed the enable series resistor and it made no difference.

    I spent some time last night trying to work out what was going on but i am still puzzled.
    Initially the light started to flicker and vary in in brightness. I came to the conclusion I had a dodgy socket on the PIC so replaced it. Now it turns on/off fine but the dimming makes very little difference (stays dim) and I am measuring 100mV across the sense resistor. This is all with 3.3V (PIC voltage) on the enable pin. However, if I disconnect the pic from the enable and short the enable pin to Vbat it goes on full brightness and I get 280mV across the sense resistor.
    I've resoldered all the connections to the Kennan board and checked it for dodgy joints but can't find anything so I have come to the conclusion I have somehow damaged it. I do have some spare so I'll try a replacement.

    btw. the 47k in the enable line was a bit of a bodge. I found that without it the light turned on but not off. Despite the PIC writing the enable pin low it actually stayed high. Disconnecting the driver and the PIC pin toggled correctly. Connect it and it didn't.
    I came to the conclusion that this was because I was immediately following the enable pin write with a write to another pin on that port. IIRC the PIC does read/modify/write on bit set operations so the enable pin must have been held up for a short while (by the cap on the driver board?) causing it to be re-written to the high state.

    Toby

  14. #14
    www.hahntronix.com
    Reputation: mhahn@hvc.rr.com's Avatar
    Join Date
    Mar 2007
    Posts
    252
    TM

    Your diagnosis sounds correct. Read/Modify/Write instructions on the PIC don't always work as expected. Check out: http://www.piclist.com/techref/readmodwrite.htm for way more detail than you want.

    The PIC reads the actual state of the pin, not the value you think it is set to. This can be a problem driving RC loads.

    Try keeping a copy in RAM of what you want the pins on the port driving the AX2002 to be. Do your modification to the RAM location, then copy the whole byte of the RAM to the port.

    In C, with assembly language comments:

    Char temp;

    main( )
    {
    char temp;
    loop:

    temp = 0x01;
    // bsf temp,0

    PORTA = temp;
    // mov w,temp
    // mov porta,w

    delay_msec(1);

    temp = 0x00;
    // bcf temp,0

    PORTA = temp;
    // mov w,temp
    // mov porta,w

    delay_msec(9);

    goto loop;

    }

    I would expect the above loop (assuming you used bit 0 or port a to drive the enable pin) to turn the led at about 1/10th brightness.

    If you are new to PICs, don't feel bad, everybody gets burned by this. If you've been doing PIC programming for a while, don't feel bad, everybody forgets this one once in a while

    Mark

  15. #15
    mtbr member
    Reputation:
    Join Date
    Nov 2008
    Posts
    177
    The PIC reads the actual state of the pin, not the value you think it is set to. This can be a problem driving RC loads.
    that was my conclusion but I haven't got round to putting a 'scope on it to check I am correct.

    You are right, I should really have used a shadow register as you suggest. I was aware of the read/modify/write issue but that is the trouble with using C. If I had done it in assembler I would probably have realised what I was doing but writing
    LCD_EN=0;
    LCD_DIM=0;
    looked fine to me.......

    In my defense it is the 1st time I have used C on the PIC and apart from this little problem it appears to have worked 1st time
    I'll rewrite it when I am bored but at the moment I think I have more important non-SW issues to deal with

    Br
    Toby

  16. #16
    mtbr member
    Reputation: mojojojoaf's Avatar
    Join Date
    Sep 2008
    Posts
    757
    With the use of NiMHs whats your run (if you have tested) and how many are you using?

  17. #17
    mtbr member
    Reputation:
    Join Date
    Nov 2008
    Posts
    177
    I've not tested run time yet but I am using 8 2450mA AA cells so run time should be around 3 hours on full or 10 hours on low.

    Toby

  18. #18
    mtbr member
    Reputation:
    Join Date
    Nov 2008
    Posts
    177


    Right, well I tested another kennan driver and it appears the data sheet is wrong!

    According to the datasheet it will turn on when the enable pin is greater than 2V. Well, if I put 3V on it it only partially turns on (about 100 to 150mV across the sense resistor). If I put the 100K pullup back (i.e. tie it to Vbat) it turns on fully (250mV across the sense resistor).

    Not sure where that leaves me, I am going to have to work out another method of turning the damn thing on!

    Toby

  19. #19
    mtbr member
    Reputation:
    Join Date
    Nov 2008
    Posts
    177
    ok. back working again, I hope permanently this time!

    It looks like the kennan driver needs more than 3V to turn it on. So I modded the driver to use the original pull-up and used a transistor to pull it low to turn the driver off.
    So, some minor tidying of the code needed but it all appears to work now.

    For those that have asked, the circuit diagram is like this......


    This doesn't show the mods to the LED driver board but that is just adding a 10k resistor between the sense resistor and the feedback pin (cutting the existing track) and then connecting the enable and dim lines shown above.

    Toby

Members who have read this thread: 0

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

THE SITE

ABOUT MTBR

VISIT US AT

© Copyright 2020 VerticalScope Inc. All rights reserved.