# Another Triple MC-E Light



## CloggyAbroad (Nov 8, 2008)

Hello All,

Finally have my Triple MC-E working to a point where I can share it with you. Before you ask, I do not have beam shots yet but if the weather is half decent tonight I'll give it a go.

So, let me introduce the *Cloggy Light*:




























This triple MC-E is based on a single Printed Circuit Board (PCB) which houses the LEDs, the drivers and a PIC micro controller which controls the functions of the light. Control of the various functions is done with the pressure pad which can be seen on the bar in the picture above. This allows me to control all aspects of the light without taking my hands off the bars.

The pressure pad came from a 'tactical flashlight' I got of eBay for another purpose. BTW, it was useless as an ON/OFF switch because its resistance is way to high for high current applications.










I still need to find a rubber grommit for the cable exit and I need to finalise the mounting. At the moment I use an Electron mounting bracket and a few cable ties. This will be sorted out soon.

This is what is inside the housing:










What you can see is the LEDs, the LED drivers (four of them) at the bottom, the inductors at the top and the PIC controller in the middle.

If anybody is interested in the electronics, you can find a PDF of the schematic diagram here.

I use four LED drivers, each driving a string of 3 LEDs. Power comes from the 'cheapo' 14.6 V, 4000mAH LiPo battery which is currently being discussed in another thread. The reason I don't drive any LEDs in parallel is because that gives me insufficient control over the individual die currents. If I put 2800 mA through four parallel dies there is no way of guaranteeing that they each get 700mA, due to differences in Vf. Additionally this would require a much larger singe inductor and I am not sure if I would have been able to mount this under the optics.

The maximum current each driver is set to is 1000 mA. I then use the microcontroller to limit this to a maximum of 700 mA when the light is in steady mode, but in the high power flashing mode I pump the full 1000 mA through the MC-Es. Because the duty cycle is low (less than 25%) this is no problem for the MC-Es.










To facilitate the cooling of the LEDs I devised a novel way of mounting them. If they are fixed to the top of the PCB you need to leave an opening in the PCB and have a machined heatsink to extend through these openings and contact the LEDs. Very labour intensive to make and therefore costly. So, I had the PCBs made with a larger opening and mounted them from the bottom, bending the legs upward slightly to stop them from short-circuiting on the heatsink This way the whole assembly can be fixed to a flat surface and the LEDs get optimum heat transfer to the heatsink. It seems to work very nicely










The white stuff is some heat conducting paste. Also visible is the temperature sensor in the middle of the PCB. More on this later.

The PCB was originally designed to go in a custom made housing, machined from 50mm aluminium. This proved very costly, and while searching for another option I found the 4W Tesco torch which has been used by others on this forum. This was a lucky find, since the inside of the torch head turned out to be exactly the same size as the PCB. Bingo.

I machined a slug to go inside the torch head, reduced the end cap of the torch a bit to plug the end of the light and cut some grooves in the outside of the torch head to aid in cooling.

The optics I use come from L2. They sit neatly on the PCB and are always perfectly aligned with the LEDs.




























The PCB is only 0.8 mm thick. Standard thickness for PCBs is 1.6 mm, but the optics would then bottom out on the PCB and not be positioned on the LED properly, as can be seen in the picture above.










This PCB neatly fits inside the torch head as can be seen here.










The PIC monitors the battery voltage and temperature of the light and controls the brightness. I can re-program it in situ and am still fine tuning the software.

When the heatsink temperature reaches 65 degrees C the output of the light is reduced to a maximum of 500 lm (or I should say a current that gives 500 lm output). The temperature needs to drop below 60C before higher outputs are allowed again.

If the Voltage drops to 13V it starts to reduce the current in an attempt to maintain 13V and optimise runtime. Between 13 and 12V the controller will only allow an output of 500 lm or less. Once the battery voltage drops to 12V the light switches off completely to protect the battery.

As I said, control is done with the single switch. This is how it works.










Takes a bit of getting used to, but it became quite intuitive after only a few minutes.

The light switches on in low mode, which is around 500lm. By using the output adjusting feature of the controller I can reduce this to about 250 lm. This is the setting I have been using on the road. Any higher and I seem to upset too many other road users.

There is no 'hard' ON/OFF switch. When the light is switched OFF it still draws about 2mA, which does not have a significant influence on battery life.

At the moment I am using 370 lm K bin LEDs, producing a total of some 1900 lm at 700 mA. Next one I'll build with M bin LEDs, increasing the total output to some 2250 lm. In high power flash mode (at 1000 mA) this will give me an estimated 2600 lm flash.

I ran the light at 500lm at room temperature without additional cooling for an hour, and the temperature protection did not activate. It got fairly warm though. When riding with it, even at max power, it only gets lukewarm.

Weather permitting I'll do some beam shots tonight and post them later.

Cheers for now and happy DIYing.

Cloggy


----------



## PaMtnBkr (Feb 28, 2005)

All I can say is "Wow!" Great job on that one! You guys are a true inspiration to us poor schmucks who are still trying to sort out what battery to use or understand how a buck or boost circuit works! Great job!


----------



## TOMMO (Dec 12, 2008)

That is some nice work!
That setup would put a Lupine system to shame! very neat mate.
Where did you find the PCB? or are you able to get them custom made at your work?
Can't wait for beam shots.
Tommo.


----------



## StevelKnivel (Jun 23, 2007)

Very nice! Looking forward to the beamshots!


----------



## troutie-mtb (Sep 20, 2007)

Good stuff there Cloggy , and your own driver too amazing


----------



## [email protected] (Mar 28, 2007)

Cloggy!

Very nice driver design. I especially like how you've split the 3 LEDs among 4 driver chips.

I looked at using the zxld1360 for an MCE driver, but was a bit put off by the price (> $6 from digikey , though Newark and Future have them for lots less). I also wasn't thrilled about the voltage "headroom" required, from graphs in the datasheet it looks like a bit more than 2 volts (they never come right out and say it).

Have you done any tests with your supply voltage just a volt or so above the 10.5 Vf of your 3 LED strings? Does the 1360 get warm when you do that? The driver's mosfet will be running near 100% so I would expect things might heat up. I ask because I was looking at using the 1360 with a 9.6V NiMh battery driving a MCE is 2S2P configuration. The NiMh would be down around 8V when drained, and I was worried there wouldn't be enough "headroom" to keep the LEDs lit.

If you want to reduce your "OFF" current draw, look at the LM2936 as a voltage regulator. They are pretty tough and draw less then 20 uA (0.02 mA). The ZXLD1360s also draw around 20 uA when shut down. You should be able to get your whole board draw down under around 270 uA. Not that 2 mA is bad, considering the massive size of your battery 

Congrats on an excellent design.

Mark


----------



## CloggyAbroad (Nov 8, 2008)

Thanks everybody,

Glad to see you liked it.

TOMMO,

I didn't 'find' the PCB, I designed the electronics and the PCB, then had some PCBs manufactured. If you fancy to try that yourself, I use a package called Eagle (google for eagle pcb). They do a free version for schematic capture and PCB layout with more than enough functionality for this kind of work.

Mark,

I buy the ZXLD1360 here in the UK for 2.10 GBP including sales tax (VAT). That would be 3.00$. The whole driver (all electronic components that is) comes to 20GBP, less than 30$.

I decided to run 4 strings to be able to control the exact LED current. CREE never mention running dies in parallel, and for a good reason I'd assume.

The 2mA is mainly due to the fact I don't shut the PIC down properly when the light is 'OFF'. The A/D converter is still running etc. The software as I said is still a work in progress, although there is not that much to be gained really.

I have had a quick look at the efficiency at max power output, which came in close to 90%. I did not check the ZXLD temp separately, or did any tests at such low voltages.

The weather is looking good, so should have beam shots later (provided I can get this new camera to work in the dark).

Cheers

Cloggy


----------



## tobymack (Nov 12, 2008)

Hi Cloggy,

that is excellent! 

a few more questions....
1) where did you get the zxld from? Best I can find in the uk is farnell at 2.57+vat.
2) I've used eagle but never found a reasonably priced PCB proto place in the uk - who did you use? I am assuming you didn't make them with a light box and a dremel  

BR,
Toby


----------



## CloggyAbroad (Nov 8, 2008)

Toby,

1) Farnell it is. Price break for 10 or more is 1.83 + VAT. I have 10 of those PCBs, so I ordered a few extra drivers to get the price break.

2) I use www.pcbtrain.com for these kind of jobs.

Cloggy


----------



## tobymack (Nov 12, 2008)

Thanks,

Toby


----------



## CloggyAbroad (Nov 8, 2008)

As promised, a few beamshots.

All pictures taken as ISO-100, F/3.3 and 8 seconds exposure time. On my camera I cannot control the shutter time manually I'm afraid, and this is what it came up with.

First a control picture










As you can see, it is dark around where I live.

For reference, as shot with a 3W Testo torch. As far as I know, the is a q5 bin LED. I don't know what current they use.










I placed a can of GT85 on the track, around 30m from the camera.

On its lowest setting, around 220 lm.










On its default setting, currently around 450 lm (will be 500 once I get the M-bin LEDs)










And finally on its maximum setting of around 1900 lm










Finally, a little video you can download here. It shows the flash mode at the high and default settings and also the steady output at default and high. This file is 15MB.

I think I aimed the beam a bit too far to the left and possibly a bit too low as well. Not sure if this track shows the light at its best, maybe a slight up slope gives a better perspective of what it does.

So I was thinking, two of these on the bars and one on the helmet. Would that be enough light you think? 

Cheers

Cloggy


----------



## texas (Nov 26, 2004)

very impressive. That board looks awesome. If you wanted to sell some of those boards I'm guessing some people on this board would be interested.

I could be wrong but my guess is that your case will have a hard time dissipating 30 watts, causing you to drop down to power savings mode more often then you like.


----------



## yetibetty (Dec 24, 2007)

WOW:thumbsup: 

What would Tesco think about that.


----------



## CloggyAbroad (Nov 8, 2008)

Every little helps?


----------



## sdnative (Aug 10, 2008)

Man, that's a nice PCB! Was looking seriously at using the same chip for my own MCE board; but pricing was cost inhibitive, and the chip didn't do exactly what I needed  Was breakeven (and less headache) to go with a usual character (FYI, in my opinion taskLED.com makes some very nice ones).

The heat man!?! How much surface area do you have? I run over 14inSQ'd, have good thermal design & pathways, and over-amping the MCE at 900ma gets it pretty hot. At the normal the 700 it runs luke warm. And YOU HAVE 3 MCEs!! Does it get smoking? (my heat sink is configured the same as yours)

Sweet to see some projects that exceed the caliber of my own! Keep it up, keep sharing, I'm impressed! ~Chris

Just to show you what I'm talking about .... not to derail


----------



## ifor (Apr 15, 2008)

Very nice work. I like the driver very smart looking layout and the reverse side mounting of the leds is genius. I had never thought about putting the inductor in the middle of the led string like that either.

I would be interested to know about the tempreture of the ZXLD1360 chips they are new to me and that control scheme looks very interesting as I am looking to do my own driver. The nominal 0.5 ohm at 25C for the switch means somthiong up to 0.5W at 1A and it looks to go up to to 0.6 ohm at 100C.

Mark. If I am reading the datasheat correctly the headroom needed should not be up at the 2V level it should be less than 1V eg 0.1v sense resistor, 0.5-0.6v switch plus say 0.1v-0.2v for the inductor.

Ifor


----------



## [email protected] (Mar 28, 2007)

Ifor,

Your your numbers add up, but if you look at the graphs on page 12 you will notice they stop drawing the lines as the input voltage goes down. For example the duty cycle graph starts at a duty cycle of 80% at 10V. What happens at 9V? Or at 8V?

The ZXLD1360 is a hysteretic controller. My experience with other hysteretic controllers (like the LM3401) is they stop oscillating as input voltage decreases. If they go to direct drive too soon, like at 9V when your LED string has a Vf of 7V, you'll poof your LED. Also as the input voltage gets closer to the Vf of the LED string, the frequency they oscillate at gets pretty low. It gets dodgy driving your controller with a 1 KHz PWM signal if it's oscillating at 3 kHz.

So when a driver manufacturer stops showing what will happen at lower input voltages, and they don't specify what's going on, I always figure it might not be wise to operate the device in that region.

Mark


----------



## yetibetty (Dec 24, 2007)

cloggy, are these the otics that you have used http://www.l2optics.com/optxtriple.aspx ?

I had a look at L2 and it looks like they are for the XR-E, not that it matters as you apear to have a great beam for a bar mounted light.

Are you pleased with the beam?


----------



## troutie-mtb (Sep 20, 2007)

CloggyAbroad said:


> As promised, a few beamshots.
> 
> So I was thinking, two of these on the bars and one on the helmet. Would that be enough light you think?
> 
> ...


Ace beamshots there Cloggy 
Wheres home with a name like cloggy you should be from west yorkshire.

9 MCE you wont be able to ride against the back pressure from all the photons .


----------



## Calina (Apr 8, 2008)

One of these and a couple of XR-e with 3 degree optics as a helmet light should be more than enough and would be easier in terms of battery requirement.


----------



## TOMMO (Dec 12, 2008)

Cloggy,ever thought about using a small pc fan in the housing somewhere?
If there was enough room in the housing you could work it so instead of reducing the power when it gets hot,it switches on the fan and sucks away the internal heat?
Some of these fans are very small and would not use much power.
Silly idea but i think it would be a really cool!(pardon the pun!) 
Tommo.


----------



## troutie-mtb (Sep 20, 2007)

I dont think Cloggy has a heat issue it is the same size as my mag lite triple and it ran cool while riding .
and he has the heat sensing on his board 


And Cloggy if you want to try a different optic I have a MR16 rocket triple from my now dead mag housing yours for the postage .
it was a pretty good beam .


----------



## CloggyAbroad (Nov 8, 2008)

> Wheres home with a name like cloggy you should be from west yorkshire.


Almost. If fact, not close at all.

I am Dutch (a proper cloggy) but live in the UK (hence the CloggyAbroad). North Essex to be precise. Not known for its mountains, but miles and miles of green lanes and bridleways right on my doorstep.



> If you wanted to sell some of those boards I'm guessing some people on this board would be interested


Well, I have a couple of spare boards and optics. Send me a PM if you're interested.



> The heat man!?! How much surface area do you have?


sdnative:

Not quite enough to run full power indoors, but out on the track it seems fine even at full power. Admittedly, it is rather cold outside at the moment.

I think the trick is in the mechanical layout. Here's a quick drawing I made in google sketchup.










This does not yet show the grooves I machined in the housing. The LEDs sit on a solid lump of aluminium which has a rather tight fit inside the torch head. Helped by a small amount a heat conducting paste there seems to be a good transfer of heat to the outside. In addition, the cooling grooves are positioned on the area of the light where the heat is generated. Your light has a lot of surface area, but I think not necessarily where it matters (ie too far forwards of the actual heat source).



> I like the driver very smart looking layout and the reverse side mounting of the leds is genius.


Genius is a big word, but thanks. For me this configuration was the 'light bulb moment' (excuse the deviation from LEDs) that made the whole light possible.



> I had never thought about putting the inductor in the middle of the led string like that either.


It's a series connection, so it doesn't matter where the inductor sits. It will store energy just the same. It was the best way to fit everything in the small space I've got.

As far as the driver goes, I specifically selected the configuration I use to avoid going into direct drive. 3 LEDs plus the driver overhead should only ever be a maximum of around 12V. That just happens to be the minimum battery voltage the controller will accept and switch off. (I started with the battery I wanted to use, and worked the design parameters out backward from that)

yetibetty,

That's the one. Not specifically listed for MC-E, but for an LED with a similar dome size and similar light output angle. These are the two parameters that matter after all. I think a lot of the different optics being listed as 'specifically for this or that LED' are actually largely the same, it is just a bit of marketing and it makes ordering easier.



> Are you pleased with the beam?


Yes. The beam shots don't really do it justice. When I switch this thing to high it fills up the whole track ahead of me with light. The shots I posted earlier look overexposed nearby and a bit dark in the distance. I think this is probably a limitation of the camera I am using.

Cheers

Cloggy


----------



## CloggyAbroad (Nov 8, 2008)

TOMMO,

The thought has crossed my mind. Not looked into it in detail yet though.

Troutie,

Problem is that in my design the LEDs are fixed on a 25mm diameter circle to match the optics. If the rocket triple has the same dimensions I'd love to give that a go.

Cloggy


----------



## troutie-mtb (Sep 20, 2007)

CloggyAbroad said:


> TOMMO,
> 
> The thought has crossed my mind. Not looked into it in detail yet though.
> 
> ...


Silsden west yorkshire was once famous for clog making in england 
but not like the dutch clogs more industrial .

Here is the Data sheet for the rocket .
http://www.ledil.fi/datasheets/DataSheet_ROCKET-3.pdf

if it is any good to you PM me your address and I will pop it in the mail .

it was a medium but I have modified it a little for more throw 
worked well too.


----------



## CloggyAbroad (Nov 8, 2008)

The Dutch clogs I used to use for gardening were plain wood, and very comfortable too. Nothing like those yellow and red things they produce for tourists.

That data sheet looks good. 24.9 as opposed to 25 mm shouldn't make that much of a difference. I'll pm you my address.

Cheers

Cloggy


----------



## Calina (Apr 8, 2008)

If I read the datasheet correctly, they are 50 mm in diameter.


----------



## msxtr (Dec 10, 2006)

Incredible!!!!!!!!! have done you the PCB circuit?? wowwwwwwwwwww 

Greetings - Saludos

msxtr


----------



## HuffyPuffy (Jun 9, 2008)

Wow, that is a very cool driver! Do you think a PIC such as a PICAXE with 80 lines of memory would be capable of doing something similar? I ask because I am just starting to check into PIC's for a similar project and am (almost) settled on the PICAXE to learn with.


----------



## CloggyAbroad (Nov 8, 2008)

HuffyPuffy,

Since that gets a bit technical for this forum I'll answer this one by PM.

Cloggy


----------



## zemike (Sep 3, 2007)

It would be excellent, if this light would accept a Carclo triple holder - it would be possible to mix various 20mm Carclo optics.


----------



## CloggyAbroad (Nov 8, 2008)

I believe the Carclo triple holder has the LEDs positioned on a slightly different diameter than what I am using (24.2 vs. 25.0 mm), so the lenses wouldn't be aligned properly. Especially on narrow optics the resulting misalignment would be too much according to Carclo's technical information and you wouldn't get the required beam width.

Cloggy


----------



## tobymack (Nov 12, 2008)

Hi Cloggy,

I am a bit puzzled by the PIC you have used: 16F683. I can't find any info on it anywhere, not even on the microchip website!
I'd be interested in why you went for it as I am looking for a 6 or 8 pin PIC for basic control and voltage monitoring. The 16F88's I have used for other projects are a bit excessive for what I need.

Br,
Toby


----------



## CloggyAbroad (Nov 8, 2008)

Probably because I got it wrong. It's the 12F683, selected because it has PWM output and A/D inputs, and was the cheapest PIC to do so.

Cheers

Cloggy


----------



## zemike (Sep 3, 2007)

I guess you are using OPTX-3 ?

A very poor datasheet they have:
http://www.l2optics.com/optxtriple.aspx
I can't find the dimensions, to compare with Carclo
http://carclo-optics.co.uk/catalog/...7.pdf?osCsid=71c2867651a5612ddf19580e1ab3e74d


----------



## CloggyAbroad (Nov 8, 2008)

Their data sheets match their customer service to be honest.

That is indeed what I am using. I actually measured one to determine the LED positioning, because a CAD drawing (although requested) was never received.

Cheers

Cloggy


----------



## tobymack (Nov 12, 2008)

Hi Cloggy,

thanks again, I am reading the datasheet now 
I've also noticed that RS sell the PICkit 2 programmer for £20 so I might use this as an excuse to retire my 5 year old DIY programmer.....

Br,
Toby


----------



## zemike (Sep 3, 2007)

CloggyAbroad said:


> I actually measured one to determine the LED positioning.


L2 optics are not customer-friendly, as I see. Cloggy, what is the distance between the LEDs in your PCB? I wonder, if it would be possible to use triple or single optics from other manufacturers.


----------



## CloggyAbroad (Nov 8, 2008)

zemike,

They are on a 25 mm diameter circle. Troutie is sending me a Ledil optic to try, and I think some of the single Carclo optics might work as well. I still have the original plastic lens from the torch in place, and this would hold the optics on the LEDs if I wanted to try this.

Cheers

Cloggy


----------



## CloggyAbroad (Nov 8, 2008)

Toby,

That's the spirit.

Spend a few pounds more and get a PICKIT 2 starter kit. It included the low pin count demo board with some LEDs etc. It's worth the extra money.

Cloggy


----------



## troutie-mtb (Sep 20, 2007)

Cloggy I missed the post yesterday cos of the snow
posted it today first class so you should have it tomorrow.

save your money I tried a triple with the carclos and was very underwhelmed and so were some comments from folk on here . 
it is all somewhere deep in the mce thread .

here is a shot of the modded optic you are getting


----------



## CloggyAbroad (Nov 8, 2008)

Been away a few days and found the Lidel Triple optic waiting for me when I got back home. Thanks Troutie. I can see how you have modified it, presumably because you found the original too spotty.

Unfortunately it is snowing right now and doing beam shots while it's snowing just doesn't work. I did do a quick indoor test to check the different beam patterns.

This is the L2 optic










And this is the Lidel Optic










Both pictures taken with ISO-100, but I cannot control exposure time. The L2 ended up with 1/200 sec, the Lidel turned out to be 1/140 sec. Both F/3.3.

If somebody can explain to me how I can change the brightness of the one to match the exposure time of the other I'd be very interested.

The (modified) Lidel optic has a more pronounced hot spot than the L2 optic. It's difficult to compare brightness due to the difference in exposure time.

The weather is forecast to be pretty poor here the next few days, and I'll be away again till next week. I'll try to get some outdoor beam shots done when I am back home in the middle of next week.

This is what it looked like last week when I was out riding after the first snow fell.










It started to snow again, and the next picture looked like this.










When I rode home while it was still snowing I had to turn the light right down. There was so much reflection coming of the falling snow I couldn't see a thing. The question has been asked on the forum if you can have too much light. Given the right (or wrong, depending on how you look at it) conditions, I'd say yes.

Cheers

Cloggy


----------



## HuffyPuffy (Jun 9, 2008)

Having too much light is a good problem to have, as long as you can dim it down 

Sent you a PM on your camera question.


----------



## troutie-mtb (Sep 20, 2007)

nice cloggy

no I modified the Ledil optic because it was too floody as most of the MCE optics seem to be 
before it was pretty much like your L2 pic

removing the bobbles and polishing the front made the hotspot


----------



## CloggyAbroad (Nov 8, 2008)

HuffyPuffy

Thanks. I'll try to look into that. Problem is then when you are out in the dark it ain't that easy to fiddle around with these type of camera settings to make things match.

I was more thinking along the lines of reducing the brightness of one picture afterwards in software so that I can compare them. One picture has 5ms exposure time, the other 7ms. Since 5/7 = 0.71, would reducing the brightness of the picture with the longer exposure time by 29% give a technically accurate result? If so, what software could I use to do this?

Troutie,

I was going by the marks that were left of the optic. Was the centre of the lens originally smooth or did that part of the lens polish better than the outside? It looks like you used your lathe to remove the bobbles. What did you use for the final polish? I might try the same on a L2 optic, which has some pronounced lines on its surface.

Cheers

Cloggy


----------



## Hack On Wheels (Apr 29, 2006)

Cloggy, did you get your start with all of this with the PICkit 2 Starter kit? I notice on the microchip site that they offer the PICkit 2 in both a Starter kit and the Debugger Express kit. I'm interested in learning more about programming this kind of thing, as well as picking up knowledge about the various components and how to use them.

How did you get your start? Are there any (other) kits that you would recommend, or any resource materials to learn from? Any info would be great, thanks!

Brilliant looking design, by the way.


----------



## troutie-mtb (Sep 20, 2007)

Yes Cloggy I lathed the bobbles off and then used 1400 wet n dry . used wet 
and afterthat flash polished it with a flame which is why it is a bit uneven 

but practice on one that doesnt matter


----------



## CloggyAbroad (Nov 8, 2008)

HOW,

I did indeed use the PICKit starter kit. The debug kit is actually the same hardware, the functionality just depends on which microcontroller you are connecting to. The starter kit comes with some tutorials to get you going as well.










This is the set up I used to develop the software. It is powered from USB and allowed me to do most of the programming on my laptop while I was away from home for work. I replaced one the the red LEDs with a white one, since it was difficult to see the dimming levels on the red LED.

In fairness I must say that I do have previous experience using PIC microcontrollers.

Cheers

Cloggy


----------



## CloggyAbroad (Nov 8, 2008)

Right, I have reduced the brightness of the Lidel picture by 29% and combined the two in one.

This is how they compare 'like for like':










Modified Lidel on left, L2 on right.

Looks like that modified Lidel optic is going to be the winner. I'll get some beam shots done as soon as the weather allows it.

Cloggy


----------



## tobymack (Nov 12, 2008)

on the subject of the PICKIT2 programmer. If you happen to be in the UK there is a magasine (Everyday Practical Electronics I think) that has a reader offer on at the moment.
PICKIT2 starter kit (ie. what Cloggy shows above) for £9.99 I think. I think the normal price is more like £30 so that is a bit of a bargain!
Shame I found this out two days after ordering one from RS :madman: 

Toby


----------



## troutie-mtb (Sep 20, 2007)

Great it is good to have a posative result from all my tinkering about and stuff

it would be good if you got hold of the same ledil optic in the 4 degree spot option to try 
that was going to be my next try , before I started playing with the Xpes

http://www.cutter.com.au/proddetail.php?prod=cut760


----------



## Hack On Wheels (Apr 29, 2006)

CloggyAbroad said:


> HOW,
> 
> I did indeed use the PICKit starter kit. The debug kit is actually the same hardware, the functionality just depends on which microcontroller you are connecting to. The starter kit comes with some tutorials to get you going as well.
> 
> ...


Thanks for the reply! So you would recommend that kit even for a complete beginner? Where/how did you learn enough about components beyond the microcontroller to assemble such a nice driver? I know I'm a nerd, but I find the idea of making my own regulating circuits to be pretty exciting and I'd love to learn how!


----------



## Hack On Wheels (Apr 29, 2006)

tobymack said:


> on the subject of the PICKIT2 programmer. If you happen to be in the UK there is a magasine (Everyday Practical Electronics I think) that has a reader offer on at the moment.
> PICKIT2 starter kit (ie. what Cloggy shows above) for £9.99 I think. I think the normal price is more like £30 so that is a bit of a bargain!
> Shame I found this out two days after ordering one from RS :madman:
> 
> Toby


Too bad I'm not in the UK! I doubt it would be much of a bargain with shipping over here to Canada.


----------



## tobymack (Nov 12, 2008)

Hack On Wheels said:


> Too bad I'm not in the UK! I doubt it would be much of a bargain with shipping over here to Canada.


True 



> Thanks for the reply! So you would recommend that kit even for a complete beginner? Where/how did you learn enough about components beyond the microcontroller to assemble such a nice driver? I know I'm a nerd, but I find the idea of making my own regulating circuits to be pretty exciting and I'd love to learn how!


I know this one is for Cloggy to answer but I'd say the PICKIT2 is ideal for learning on - there are loads of tutorials etc and a forum on the microchip site if you need help. However, it does depend on where you are starting from. Do you have any SW experience? used assembly language before? If not it might be a steep learning curve and might take you a while but it should still be do-able. My 9 year old daughters 1st programming experience was modifying some code I wrote on a pic. She did need a lot of help from me but she still found it fun. 
If you are not sure then go to the microchip website and have a look at some of the documentation - application notes and example code. That will give you an idea of what you are up against.

As to the electronic circuit bit, that also depends on your basic electronic knowledge. I'd start with the PIC, do something like a simple battery monitor circuit with warning LEDs or something like that. If you find that ok then try modifying one of the drivers available from Kaidomain or DealExtreme and control it from the PIC. If you are ok with that then maybe download the data sheet for the buck converter Cloggy used and have a good read. If it all makes sense (including the info on inductor selection, PWB layout etc) then go for it 

I'd love Cloggy to confirm this but I suspect from the results he has got that he has professional training in electronics and possibly a good few years experience. That is not to say a circuit like this is particularly difficult, just that some of the detail and design decisions imply he knows what he is doing :thumbsup:

Toby


----------



## zemike (Sep 3, 2007)

I wish it would be possible to order this PCB ! (but not for L2 optics!)


----------



## CloggyAbroad (Nov 8, 2008)

> I'd love Cloggy to confirm this but I suspect from the results he has got that he has professional training in electronics and possibly a good few years experience. That is not to say a circuit like this is particularly difficult, just that some of the detail and design decisions imply he knows what he is doing


I studied electronic Engineering and earned my crust in that industry for nearly 15 years. Doing something else now, which rekindled my love for all things EE as a hobby. Been playing with PICs for a good few years now. Using embedded controllers like these PICs opens up so many possibilities that I don't know where to start tinkering.

Toby you're correct. As far as the electronics go this is all just applying the information in the data sheets and linking it together, then using the software to make it do what I want. My background allows me to interpret the data sheets and extract the information I need quickly, and translate that into a suitable circuit diagram. Non of it is rocket science though and with the information available on the internet anybody can build their own electronic circuitry. Just don't try to run before you can walk. You need to understand the basics (that recent post about the MC-E lumen output measurements being all wrong is a good example) before you cam cobble a circuit like this together.

If I find the time I intend to put together a little tutorial showing some of the basics, like voltage and current distribution in series and parallel circuits, battery configuration, run time calculations, why you need a constant current source to drive an LED. That kind of thing. If only there were 30 hours in each day.........

Another project I am working on is a battery monitor circuit which plugs in the USB port and records currents and voltages on a light under test and sends the data to a logging program on the PC. That would allow me to do proper runtime measurements and battery capacity measurements.

Troutie,

I am modifying one of the L2 optics to see if I can achieve the same result. Working on the polishing at the moment. I used to work for a company producing fibre optic lead assemblies and they have some nifty optical polishing equipment. Time to call in some favours.

zemike,

I have a few spare PCBs. Send me a PM, we can talk. And it does work with the Lidel optic as well, even though the legs don't line up so well with the mounting holes in the PCB.

HOW

Toby is correct about what he says regarding programming a pic controller. It does require being able to understand the data sheet. The PIC starter kit comes with some decent tutorials to get you going. The programming software is free and the complete investment to get started is in the 25$/£ range.

Cheers

Cloggy


----------



## Hack On Wheels (Apr 29, 2006)

tobymack said:


> True
> 
> I know this one is for Cloggy to answer but I'd say the PICKIT2 is ideal for learning on - there are loads of tutorials etc and a forum on the microchip site if you need help. However, it does depend on where you are starting from. Do you have any SW experience? used assembly language before? If not it might be a steep learning curve and might take you a while but it should still be do-able. My 9 year old daughters 1st programming experience was modifying some code I wrote on a pic. She did need a lot of help from me but she still found it fun.
> If you are not sure then go to the microchip website and have a look at some of the documentation - application notes and example code. That will give you an idea of what you are up against.
> ...


Sounds good!

Where I'm starting from? Well, I'm an engineering student... By SW, you probably don't mean SolidWorks, do you? I've done some C++ programming and such, but definitely higher level stuff than working with hex code. Hex code might take a bit of learning, but it should be fine.

Thanks for the pointers, looks like I could have a lot of fun even just learning how to use it.


----------



## Hack On Wheels (Apr 29, 2006)

CloggyAbroad said:


> I studied electronic Engineering and earned my crust in that industry for nearly 15 years. Doing something else now, which rekindled my love for all things EE as a hobby. Been playing with PICs for a good few years now. Using embedded controllers like these PICs opens up so many possibilities that I don't know where to start tinkering.
> 
> Toby you're correct. As far as the electronics go this is all just applying the information in the data sheets and linking it together, then using the software to make it do what I want. My background allows me to interpret the data sheets and extract the information I need quickly, and translate that into a suitable circuit diagram. Non of it is rocket science though and with the information available on the internet anybody can build their own electronic circuitry. Just don't try to run before you can walk. You need to understand the basics (that recent post about the MC-E lumen output measurements being all wrong is a good example) before you cam cobble a circuit like this together.
> 
> ...


Awesome, not surprising at all that you made such a sweet piece of kit! I'm in Mechanical Engineering, but I'm enrolled in the Mechatronics option, so I'm hoping that next year I'll get a good dose of the electrical and computer sides of things as well. We've had some basic electrical courses but nothing very interesting, so I'm guessing there is more readily applicable stuff yet to come beyond all this theory. With any luck that can help me along, however far I've gotten with this PIC stuff by that point. 

The only place I've found the PICKit 2 over here doesn't have it quite that cheap, but it still sounds like it should be more than worth the cost, thanks for the feedback!


----------



## k4rma (Nov 30, 2008)

Simply amazing work! I'd love to have a light that was half as nice. 

Im sure you have a specific goal with the selection of the optics, but I have a quick question. Wouldnt the optic on the right with the less pronounced hot spot be easier on the eyes in actual riding conditions? It might not look as bright in comparison, but could it be more useful. I was actually thinking about how my HIDs in my car look compared to an old standard headlight. A cars headlight next to me often appears brighter, but about 10 times less useful.


----------



## troutie-mtb (Sep 20, 2007)

k4rma said:


> Simply amazing work! I'd love to have a light that was half as nice.
> 
> Im sure you have a specific goal with the selection of the optics, but I have a quick question. Wouldnt the optic on the right with the less pronounced hot spot be easier on the eyes in actual riding conditions? It might not look as bright in comparison, but could it be more useful. I was actually thinking about how my HIDs in my car look compared to an old standard headlight. A cars headlight next to me often appears brighter, but about 10 times less useful.


The shots on the wall are probably taken about 2 metres away to give you an idea on beam shape and intensity.

There is a major problem with the MCE/P7 type of multi emmitter devices whereas they are very difficult to focus the beam with small optics/reflectors , as they require the light source to be as small as possible .

go and have a trawl through all the beamshots of the MCE and you will see they spreadout very fast and lose longer range penetrating power.

this is somewhat overcome by using 2 or more MCE and relying on sheer lumen power for the extra throw 
or as others myself included have done and add a XRE or 2 into the mix to aid throw.

back to your question that hotspot will have spread out and become a pretty floody beam in a few feet .

be interested to see Cloggys trail shots and conclusions


----------



## CloggyAbroad (Nov 8, 2008)

> Im sure you have a specific goal with the selection of the optics,


Not really. My goal was to get as much light as possible out of an integrated electro-mechanical package, which I have done. I have been out a few times with my light, and I am actually quite please with the way it is. Terrain around here is not very technical so a nice bright light to light up the way ahead of me is just fine.

Having said that, a bit more reach would probably be good. Hence the current experiments with different optics. I am in the process of polishing one of my L2 triple lenses. Curious to see how that will pan out.



> Wouldnt the optic on the right with the less pronounced hot spot be easier on the eyes in actual riding conditions?


Possibly. I have in the past attached a small LED torch to my handle bars (when my HID light packed up) and this was very spotty. I would not want to go off road with that, but it was fine on the road to get me home. I guess there is a happy medium somewhere, but it will depend on riding style, terrain and to a large extend personal preference. It's great that we can build lights that show minute details 100m away, but I am personally not sure you actually need that.



> The shots on the wall are probably taken about 2 metres away to give you an idea on beam shape and intensity.


Bit less actually. But if you move the light and the camera together it should not make a difference. It's angles we're interested in. If you double the distance you double the light area, but also the picture area, so nothing changes.

One problem I ran into is that my driver uses PWM (pulse width modulation) to vary the brightness. The frequency I use is around 200 Hz, which means that if I reduce the brightness to 20% the light is only actually on during 1 out of every 5 ms. When you get down to exposure times in the 7-8 ms range, this means I can get anywhere between one and two 'flashes' from the light during a single exposure, making it impossible to compare different shots for brightness. I realised this when I compared multiple shots from the same set-up, and noticed a large variation in brightness and shutter time (I cannot manually control shutter time on my camera).

Once you go outdoors and look at shutter times in the 6 second range this is of course not a problem any more, since it all averages out.

I have now modified one of my PCBs especially for indoor wall shots. I have reduced the current to 100mA and disabled the PWM, so it is always on in a steady state. This should make comparison between different shots a lot easier for me.

As soon as the weather clears up (it's absolutely foul here at the moment) and work allows I'll be out on the trail to get those beam shots.

Cheers

Cloggy


----------



## CloggyAbroad (Nov 8, 2008)

I have modified one of my L2 optics and this is what it looks like. The modification involves machining off the ridges on the front of the lens and polishing it with optical lapping paper (I used 30, 3 and 1 micron lapping paper).










The L2 appears to have slightly more even light distribution in the hot spot, but I wonder if that would show up in use.

Now I need the weather to go out.

Cloggy


----------



## tobymack (Nov 12, 2008)

Hi Cloggy,

Were those 4 beams taken with the same camera settings?
i ask because Gimp shows (using the colour picker HSV-value) that the max intensity is the same in all the pictures (within a few percent). Looking at your previous comparison between the L2 and ledil also shows the L2 being brighter in the middle but having a less defined hot spot. However, on this earlier picture it is interesting that the L2 hotspot is almost as big as the Ledil if you count the area with an intensity value of the same or better than the Ledil. It doesn't look like that to my eyes but that is what Gimp is telling me.

This is a very dodgy comparison as I don't know your camera settings but the implication is that on the trail a standard L2 will be as bright in the centre but give a better spread with a less abrupt transition from hotspot to flood. All of which are good things imho.
I'd be very interested to know if my theory is the case when you try them outside - I am trying to do a similar comparison with my own lights to find the best optics.

In my case I have found any attempt at modifying the optics has give a better beam pattern but always less intensity overall so the end result isn't as good. (an example of this is here.). But then I am using toothpaste to polish them, not optical lapping paper 
Toby


----------



## CloggyAbroad (Nov 8, 2008)

Yep, they all ended up with exactly the same camera setting. Also, these were done with a steady drive current, as opposed to a driver with PWM. The previous set of pictures are with a PWM driver and they cannot be reliably compared.

As I said earlier, I am not yet 100% convinced I need a small hot spot and 100m throw, but the modified lens definitely has a better defined centre section.

Playing with the light right now, I have found I can move the lens slightly and get an asymmetrical beam pattern. I have got it set now so that the hotspot is in the top centre, with more spill below than above. Might stop me blinding oncoming traffic and still have the throw. I'll will have to go and try this outdoors.










Cloggy


----------



## tobymack (Nov 12, 2008)

ok, I'll be interested in your impression outdoor. That offset beam looks interesting!

BR,
Toby


----------



## Skooks (Dec 24, 2008)

Cloggy:

Do you write all of your code in assembler? Are pics available with enough memory to develop in a high-level language such as C?

Thanks,

Don


----------



## CloggyAbroad (Nov 8, 2008)

Don,

I use assembler. I like the directness of it, and I have in the past made time critical applications were I needed complete control over what was done when. I just feel C doesn't offer that level of control to me. An application like this should be no problem however to do in C.

This project used up 15% of the available space (300 lines of code after compilation, 2048 available), so even a fairly inefficient C compiler should generate code that can do the same and still fit. MPLAB (the development IDE from Microchip) comes with a free C compiler, which I believe is limited to 2k memory devices. MPLAB also offers the option to combine parts in C and parts in assembler.

HTH

Cloggy


----------



## [email protected] (Mar 28, 2007)

Hi Cloggy,

I don't want to start a flamewar :madmax: about which is better, C or assembler. I use both in my work and they each have their uses. I probably lean toward C for quick and dirty projects.

I want to point out that there is a decent FREE  compiler available from Hi-Tech.

I wrote a review of an older version of their compiler. That older version can be found here. You need to register to get the compiler. Hi-Tech has never blasted me with spam, I get an email from them 2 or 3 times a year.

Here's my review. The review also includes source code and schematics for a simple beeper. The source would be a place to start for understanding how to get C working on a PIC.

Starting a project like a LED driver controlled by a PIC is probably a bit tough for somebody with no programming background. It's not impossible, but it will take you a while to learn what you need to know. If you already know C, you might want to look at my sample source code. I haven't tried porting it to the newest versions of Hi-Tech's compilers.

Mark


----------



## tobymack (Nov 12, 2008)

Mark, the C compiler that Cloggy refers to (comes with MPLAB) *is* the Hi Tech one 

Like cloggy I use assembler just because I know what it is doing and to be honest I have never tried C on a pic. This got me curious so as an example I just did the very simple counting on the port program in C (for a 10F220.
Here it is in the hope it helps PIC novices understand the pros and cons........

The C program is copied from the hitech quickstart guide:

#include htc.h
void init(void)
{
// port directions: 1=input, 0=output
TRIS = 0b00000000;
}

char counter;
void main(void)
{
counter = 0;
init();
while (1){
GPIO = counter;
_delay(10000);
counter++;
}
}

This use 43 words of program space and 7 bytes of data space.

Then I did the equivalent in assembler.....

Delay1s macro 
movlw D'4' 
movwf counter
clrf counter+1
clrf counter+2
clrwdt 
decfsz counter+2,f
goto $-2
decfsz counter+1,f
goto $-4
decfsz counter,f
goto $-6
endm

org 0x0 
Main 
clrf GPIO 
movlw DEFOPT 
option
movlw DEFADC
movwf ADCON0 
movlw LED12 
tris GPIO

Looping
incf GPIO,f
Delay1s
goto Looping

end

which used 19 words of code space and 3 bytes of data. btw. don't try assembling that code as I have not included all the headers, #defs etc.

I think that is a pretty good comparison, the C was MUCH easier to write but then the assembler took up a fraction of the space. On the basic PICs like the 10F220 then I don't think C is viable, that simple example took a third of the data space!!
However, I am sure the assembler looks a nightmare to novices and I am sure larger pics would have no problem with the bloat from the C and it would make life a lot easier.

Toby


----------



## [email protected] (Mar 28, 2007)

Hey tobymack,

I don't think MPLAB comes with a compiler. There are some links to the ones Microchip makes on the MPLAB download page. Microchip's compilers work with PIC18F and above families. They are made by Microchip, and based on the GNU GCC compiler. They will not work with the smaller 8 bit parts. You need a third party compiler to use C on a PIC12F683, like the Hi-Tech one.

There is a link to the the newer Hi-Tech compiler on this page on Microchip's web site. You want the compiler labeled "HI-TECH C PRO for the PIC10/12/16 MCU Family".

It's been a while since I downloaded MPLAB, so I could be totally wrong about it not including a compiler. I'll try downloading a copy this week and install the newer Hi-Tech compiler. I'm curious how it compares to the older version. I probably need to update my web page to the more current version anyway.

Mark


----------



## tobymack (Nov 12, 2008)

yes, a bit of confusion. You are right I think, the MPLAB download does not include the compiler but there are links from the microchip site as you have pointed out and it does integrate into MPLAB pretty well.
Also the disk that comes with the microchip PICKIT2 programmer includes both MPLAB and the HITECH compiler which saves a download 
It is the one you quoted above and I should point out that for my example above I have used it in free "lite" mode. I believe the full (paid for) version does a lot more optimisation.

Toby


----------



## [email protected] (Mar 28, 2007)

Tobymack!

No worries  . I assumed there was a web page (or demo CD) that included the Hi-Tech compiler that I hadn't found (or seen) yet. Microchip often does special offers that include demo versions of other vendors products.

I just wanted to point out to newbies that the PIC families numbering can be pretty confusing when you start out. Like: what's the difference between a PIC18F and a PIC12F?

I'll answer that by saying you probably want the PIC12F parts for now. If you're using a free compiler you almost certainly want to use the PIC12F683 if you can. It's not that much more expensive than versions that have less RAM or ROM (data memory or program memory for the unwashed masses  ).

I've been thinking I should re-do my beeper project to be a simple LED driver controller. The speaker output runs fast enough to drive the PWM input of a commercial LED driver. That would give folks thinking of programming a PIC to control an off the shelf driver a place to start from.

Mark


----------



## Hack On Wheels (Apr 29, 2006)

tobymack, thanks for showing the comparison between C and assembler! Looks like learning assembler is the way to go in the long run. 

Also, does anyone know whether the recently released PICkit 3 is worth the extra cost over the PICkit 2? http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2519&param=en534451 NB: It would appear that the PICkit 3 is only available in the Debug kit, and not in a Starter kit like the PICkit 2 is.

I find myself easily lost with these things still, but I'm guessing a Starter kit with the LED equipped test board would be simpler and more useful for me to learn on. Any advice?


----------



## tobymack (Nov 12, 2008)

I don't know anything about the Pickit3 but from that link it looks like about the only real advantage is a larger code space which I can't see being much of an issue with lower end PICs. Personally I am quite happy withe the _2.

BTW. on the subject of C, I installed MPLAB on my laptop over the weekend and I was wrong, it does come with the hitech C. No additional download is required.
It is all Marks fault  but I have started playing with C and I have got to say I am starting to like the idea of using it. Yes it is very code hungry compared to assembler (I have had to move up from a 10F220 to a 12F683 to cope) but it is very easy to use. You still need to fully understand the workings of the PIC but the basic programming is much quicker and the PIC specific aspects of C are pretty easy and quick to pick up. I think some specific PIC things might still need in-line assembler (eg I couldn't find a C sleep command) but that is very easy to do.

I just have the programmer but I'd recommend the starter kit for a beginner as I think it would be much easier if you don't have to debug your hardware as well as your software 1st time round 
As an example, I've used PICs a few times but it still took me half a hour to get my flashing LED test working when I changed to the F683. A combination of stupidity (forgetting that the 220 and 683 have their power/ground on different pins.....) and not reading the datasheet properly about port setup :blush: 

BR,
Toby


----------



## CloggyAbroad (Nov 8, 2008)

I never said one programming language is better than the other, I merely expressed a preference for assembler in certain situations. But maybe I am just too lazy to learn C for the PIC (I do use C++ for windows programming).

Anyway, I did some comparison shots with different lenses as promised. I went out riding earlier and had a few pints (one of the main reasons I ride at night), so I couldn't jump in the car and go back to the same track I used before. Instead, I did some shots in the back garden.









I can't say I can see any relevant difference between these shots. They were al done at ISO-100 and ended up with a 1.7 seconds exposure time.

I did a comparison between my car head lights (standard halogen fit on standard European car) and a single Cloggy light running at 2200 lm.









All these pictures ended up with 8 seconds exposure time.

I now understand why car drivers flash me when I am coming down the road. The beam pattern of car headlights is highly controlled, especially in dipped beam. Maybe we should be working towards the same with our bike lights.

Cheers

Cloggy


----------



## tobymack (Nov 12, 2008)

back on topic - thank god for that :blush:

that is a pretty impressive comparison with the car headlights :thumbsup:


----------



## cytoe (Jan 20, 2004)

I haven't done any pic stuff, but couldn't you write it in C, compile and output to assembly source? something like http://www.micro-examples.com/public/microex-navig/doc/095-asm-translator


----------



## zemike (Sep 3, 2007)

I have heard of an expensive German manufacturer (B& something) of HID bicycle lights which has a special accessory to comply with German road traffic rules.
It looked like a cap you put on the light.


----------



## tobymack (Nov 12, 2008)

zemike: was it Bush & Muller? here...
I think all the B&M lights have a cut off beam to cope with the german law. the trouble is that needs special optics designs (and rear facing LEDs in a lot of the designs). There are a few discussions here on how to achieve this but my conclusion is that it is easier to just have different lights pointing in different directions for high and low beams.

cytoe: you can get an assembly listing from MPLAB with the Hitech C. But to be honest, by the time you have modified the assembler you might as well just write it in assembler in the 1st place. On the other hand, i have found that looking at the assembly listing very useful in understanding just what the C is doing.e.g. It helped me understand why adding 3 lines of C suddenly increased the program size by 50%!

Toby


----------



## znomit (Dec 27, 2007)

zemike said:


> I have heard of an expensive German manufacturer (B& something) of HID bicycle lights which has a special accessory to comply with German road traffic rules.
> It looked like a cap you put on the light.


Yeah, the big bang.
http://www.peterwhitecycles.com/bigbang.asp

Theres a thread over at CPF where we are discussing a road light beam.
I'm doing a high/low roadie build right now using an MCE lighting all dice 250mA or just lower 500mA, just waiting for optics.
http://www.candlepowerforums.com/vb/showthread.php?t=214561


----------



## zemike (Sep 3, 2007)

Right, Bush & Muller Big Bang.
One of the possible solutions for MTB would be to use so-called "barn-doors", like this one:


----------



## HuffyPuffy (Jun 9, 2008)

Maybe an oval beam would be best? I just turn mine down when I am on the road, though if there are no cars around, who cares  One thing I am thinking of adding to my light project is a phototransistor which would dim the LED's in response it sensing a light from a vehicle. I have no idea how well that would work, and am pretty sure it would be flakey, but it may be one way to go.


----------



## HuffyPuffy (Jun 9, 2008)

tobymack said:


> zemike: was it Bush & Muller? here...
> I think all the B&M lights have a cut off beam to cope with the german law. the trouble is that needs special optics designs (and rear facing LEDs in a lot of the designs). There are a few discussions here on how to achieve this but my conclusion is that it is easier to just have different lights pointing in different directions for high and low beams.
> 
> Toby


That looks like something that could be done with some black electrical tape, just make some "eyelids" for the lights. It would look a bit sleepy, but would keep the drivers happy.


----------



## tobymack (Nov 12, 2008)

the trouble I had was trying to get a decent "dip" beam without losing light. My attempts at modifying the lens or adding a shade worked but gave less light, not what I wanted. the advantage of the B&M designs is that the optics are putting the light just where you want it so nothing is lost in modifying afterwards.
My ideal is an oval optic, something around 15x30 with a sharply defined hotspot, that could be aimed to cut off below the horizontal and give a decent "dip beam", add a nice spot for "main beam" but this would need to be separate to allow it to be aimed much higher.

I like the idea of something light sensitive, it could also reduce the glare back from undergrowth etc on tight singletrack. :thumbsup:


----------



## HuffyPuffy (Jun 9, 2008)

Perhaps a light with several optics, where some LEDs would be on high when riding on the road (such as a couple oval optics ) with low on the spots or medium optics, and then high for all of em when off road?


----------



## boorman_p (Feb 27, 2008)

Hi,
Do the inductors get hot? They look small, what make / type are they?
Cheers
Paul


----------



## sdnative (Aug 10, 2008)

Took me a second re-read to truly appreciate the awesome-ness of your project. Great work!

Wading into a software solution for my control needs; such great control, flexibility, etc.... you know them  Lots of options out there, is pretty overwhelming.


----------



## cdcdcd (Jun 30, 2009)

Wow! So many interesting ideas in this triple MC-E light. It's all good, but I'm curious on a couple of points.

I like the way you split the leds into 4 series strings.That let you use 4 off-the-shelf led-driver ICs, where each driver operates at reasonable efficiency because the total current requirement is split over 4 drivers. Also, this approach avoids any possible problems with equal current sharing of the led dies with an MC-E. However, I am not sure if this is really a problem anyway. The 4 leds within an MC-E would be extremely well matched, I would have thought, and this view is supported by the fact that the P7 internally hard-wires the 4 leds in parallel.

I'll also quizz you re the merits of using low frequency PWM for intensity control. Basically, with this scheme the led always operates at full current and intensity, except it is PWMed on and off to give a lower average current, giving the appearance to the human eye of a lower light intensity. It is well known that the efficiency of leds is poorest when operating at maximum rated current, so it could be argued that "dimming" in this way has the disadvantage of providing the poor efficiency of full current operation at all times, even when the light is "dimmed" to a lower average current. At sufficiently low PWM frequencies this criticism must be valid. Of course, "traditional" switchmode controllers such as mine which PWM at the native oscillation frequency, provide a smooth led current waveform at all output current levels, and therefore do not suffer from this problem, if in fact it is a problem at all.

There seem to be a few electronics savvy people on this thread, so what do you think? Is low frequency PWM intensity control the "real thing"?

Colin


----------



## zen bicycle (Mar 23, 2007)

Anyone know of an online emulator or virtual programmer for pics we could use to get our feet wet with minimal investment?


----------



## [email protected] (Mar 28, 2007)

PWM control is expedient if you are using a microcontroller to manage heat as well as the intensity of the LED. I've seen a number of different circuits that use a PWM signal from a micro to add a small voltage to the current sense voltage. These can be as simple as a RC low pass filter, to implementations that involve adding lots of parts to an already crowded PCB. So the simple PWM approach often wins out.

Is PWM control less efficient in terms of lumens per watt. Yep. Is it bad enough I'm going to try to cram another handful of tiny 0603 resistors and caps onto a board that already strains my eyesight to build? Nope.

The biggest problem with PWM dimming is using a frequency that is high enuff you don't get strobe effects when you whip the handlebars around a tight turn at high speed. It can make you queasy to see several separate bright spots where you expected to see one continuous slash of light. This is a problem when using lower frequency micros. I've seen this in a few of the cheaper flashlights from DX and KD.

The other issue with PWM control is your circuits switching frequency (how often you dump current into the inductor) should be much higher than your PWM frequency. For a hysteretic buck converter, this can sometimes be an issue as your input voltage approaches the Vf of the diode. Hysteretic converters get lower in frequency the closer Vin gets to Vf. You can get weird flickering out of your light when this happens.

Mark



cdcdcd said:


> Wow! So many interesting ideas in this triple MC-E light. It's all good, but I'm curious on a couple of points.
> 
> I like the way you split the leds into 4 series strings.That let you use 4 off-the-shelf led-driver ICs, where each driver operates at reasonable efficiency because the total current requirement is split over 4 drivers. Also, this approach avoids any possible problems with equal current sharing of the led dies with an MC-E. However, I am not sure if this is really a problem anyway. The 4 leds within an MC-E would be extremely well matched, I would have thought, and this view is supported by the fact that the P7 internally hard-wires the 4 leds in parallel.
> 
> ...


----------



## [email protected] (Mar 28, 2007)

MPLAB from microchip comes with a PIC simulator. I've only ever used it with assembly language, but it might support C these days (it's been a while). If you want a C compiler, Microchip doesn't offer one for the small PICs. There is a nice free C compiler from HiTech: http://www.htsoft.com/products/compilers/piccpro-modes.php, which I think Microchip was including with MPLAB downloads for a while. Be prepared to spend a few hours figuring out how to get everything installed and playing well (my experience a few years ago, YMMV)

Atmel has a simulator for the AVR as well. It seems to work well with C. It comes as part of AVR Studio (free from Atmel). There is also a free C compiler, WinAVR that is pretty easy to install along with AVR Studio. You can find tons of example projects and code at AVRFreaks.net. Since I've been fooling around with the ATtiny AVR parts, I've pretty much dropped using any of the 8 pin PICs

But regardless of which micro you play with, be prepared for a pretty steep learning curve.

If this stuff was easy to do, I wouldn't get to charge more an hour than my plumber does to do it 

Mark



zen bicycle said:


> Anyone know of an online emulator or virtual programmer for pics we could use to get our feet wet with minimal investment?


----------



## HuffyPuffy (Jun 9, 2008)

[email protected] said:


> But regardless of which micro you play with, be prepared for a pretty steep learning curve.


Hi Zen, if you want to skip the learning curve and get down to business , check out the PICAXE and Arduino. I have a PICAXE based pwm driver for a buckpuck which seems to have none of the flickering issues that were mentioned in regards to PWM, and just picked up an Arduino Duemilanove board from Adafruit.com for 30 bucks. Both PICAXE and Arduino are very well documented, with the PICAXE having the edge for simplicity (uses BASIC) and cheapness since you don't need a dedicated programmer, just a serial port and some resistors. Both PICAXE and Arduino offer free programming tools, Arduino is open, while PICAXE is not, but with PICAXE the basic programming tools are free, they only require that you buy pre-programmed PIC's which are pretty cheap. The Arduino also will require more work since they sell the proto board which is too big for a light driver, while the PICAXE is basically just the chip. The arduino seems to be a better overall prototying platform so far however. For something simple like a light driver where you do not need many in/out's, I would (and have) use the PICAXE.

Arduino:
http://www.adafruit.com/index.php?main_page=product_info&cPath=17&products_id=50
http://arduino.cc/en/

PICAXE:
http://www.rev-ed.co.uk/picaxe/
http://www.phanderson.com/picaxe/picaxe.html
http://www.solarbotics.com/advanced/picaxe/picaxe_chips_ics/


----------

