|
|
(13 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| __NOTOC__ | | __NOTOC__ |
| =LED lights and lenses for my bike= | | =LED lights and lenses for my bike= |
| | I plan to have several strings of LEDs with different beam angles and aiming points - and the appropriate string of LEDs turned on for the current bike speed. |
| | |
| | ==Plan== |
| | Project journal is now in dropbox/bikelight/project-bikelight.nb |
| | |
| | Project overview and status is here. |
|
| |
|
| ==Overview== | | ==Overview== |
Line 10: |
Line 16: |
|
| |
|
| Initial target: | | Initial target: |
| * generate some difuse light at low speed | | * generate some diffuse light at low speed |
| * generate more focussed light at high speed | | * generate more focused light at high speed |
| * make it work | | * make it work |
| * dont break the bank | | * dont break the bank |
Line 17: |
Line 23: |
| Advanced target: | | Advanced target: |
| * during the day, flash the LEDs to attract attention. | | * during the day, flash the LEDs to attract attention. |
| | |
| | ==Next Steps== |
| | Pausing for a bit.. reminders for when I get back:) |
| | |
| | * Laser cut solder stencil |
| | ** Test plastic film for chlorine; need propane |
| | ** scale drawing dxf_scale.ulp in dropbox |
| | ** cut stencil (should be easy) |
| | |
| | * Heat source for soldering |
| | ** Marg's box has an electric kettle base and motor controller from vacuum cleaner - that should allow smooth manual heating control in combination with a non-contact thermometer.. |
| | |
| | * Test solder some resistors, which I have spare of; test solder joints and try again until I get it right on these!! |
| | |
| | * Build a board ... |
| | ** test as many board solder joints as feasible |
| | ** program MCU on board with test code |
| | ** test board functionality with test code |
| | |
| | * Using head-light code.. |
| | ** exercise functionality; observe result; consider |
| | ** improve; rinse repeat |
| | |
| | * Heat sink for LEDs |
| | ** have a test heat-pipe over box |
| | *** need to test its conductivity |
| | *** should test vacuum in pipe? |
| | *** maybe infer vacuum quality from conductivity? |
| | ** have some larger pipe in tools at home - need cap and taps to match |
| | ** need pipe-to-led adapters.. make? |
|
| |
|
| ==In progress lessons== | | ==In progress lessons== |
| * how to use Farnell component search
| |
| * how to use Digi-key component search
| |
| * how to use Eagle CAD: | | * how to use Eagle CAD: |
| ** to make components | | ** to make components |
Line 27: |
Line 61: |
|
| |
|
| ==Physical progress== | | ==Physical progress== |
| * purchased LEDs, reflectors and lenses from ebay.
| | Have components, circuit boards, solder paste. |
| * scrounged an attiny85 from the space components.
| |
| * scrounged a bottle dynamo from Walthamstow bike recycling centre.
| |
| * drilled and milled the LED lense mounts.
| |
|
| |
|
| ==Thiking progress==
| | Todo |
| * examined MOSFETs, Voltage regs and Diodes from Farnell - built a partslist for Max 20V parts. | | * Software |
| * rough circuit plan | | * Solder stencil |
| * rough firmware plan | | * Surface mount soldering |
| * found a better regulator in digikey and am re-examining the parts list. | | * Through hole soldering |
| | * Testing |
|
| |
|
| ==Open questions== | | ==Open questions== |
| * How to mount and cool the LEDs? | | * How to mount and cool the LEDs? |
| | ** on a horizontal copper heat pipe |
| * How to mount the circuit board? | | * How to mount the circuit board? |
| * What is the maximum voltage to plan for?
| |
|
| |
| ==LED behaviour==
| |
| The LEDs are [http://www.ledsupply.com/docs/Luxeon-StarIII.pdf Luxeon StarIII (white Lambertian] .
| |
|
| |
| At 0.7A and 25deg junction temp, voltage per LED varies between 3.03(min), 3.7(typ), 4.47(max). And 3.9V(typ) at 1A current.
| |
|
| |
| Some uncertaintity - current might just get to 0.5 A but I am sure the junction will be hotter than 25C, and see but no indication of change in V drop with temp in the datasheet :(.
| |
|
| |
| I tested one LED, and it turned on at 3.2V and was easy to overdrive using the Maplin adjustable current bench supply. I wont do that again:(. It still works, but I guess 3 seconds of 2A current in a 1A LED is bad for it.
| |
|
| |
| ==Lense behaviour==
| |
|
| |
| I bought 4x30deg, 3x15deg and 3x5deg reflecters.
| |
|
| |
| I tried the 5 degree lense over the LED, but the wires on the LED pushed the mount away from the led - leaving a ring of light on the wall surrounding a central dark spot.
| |
|
| |
|
| The second attempt involved melting the bottom of the mount to allow space for the wires.. the ring is smaller but still has a dark spot in the centre :(.
| | ==Electronics== |
| | | Plan is now for |
| Holding the lense over the LED I got a bright spot on the wall:).
| | * four LED strings (*) |
| | | # - very low speed - just a 120 deg med power LED |
| I will need to carfully cut slots in the mounting for the wires.
| |
| | |
| ===thinking space===
| |
| Original plan is for four LED strings
| |
| # - very low speed - just a 120 deg med power LED (with voltage doubler to get the reqd V) | |
| # - low speed - one 30deg | | # - low speed - one 30deg |
| # - med speed - one 30deg, one 15deg | | # - med speed - one 30deg, one 15deg |
| # - high speed - one 15deg, two 5deg | | # - high speed - one 15deg, two 5deg |
| | * LED voltage sense for fine control |
| | * light sensor - to allow different night and day policies |
| | * JTAG debugging |
| | * possible communications via SPI, TWI, ... |
|
| |
|
| Of course, the length of the strings depend on the V generated by my bike speed.. so not really predictable
| |
|
| |
| Simplify (only last 3 strings) and no V doubler.
| |
|
| |
| This fits in the attiny85 pinout.
| |
|
| |
| New link [http://www.mikrocontroller.net/attachment/14850/BikeLight.pdf on impedance matching and MCU control] of bike lights :). I am not sure what this means for my circuit and plans.
| |
|
| |
| ==Indicator LED==
| |
| (distraction)
| |
| I picked a 2mA red LED (should preserve night vision and show up well during the day) from Farnells catalog.
| |
| * [http://uk.farnell.com/vishay/vlms30k1l2-gs08/led-plcc2-red/dp/1328349 18mcd, 60degree, SMD LED] looks fancy in the jpg and is cheap - £0.51 for 5.
| |
|
| |
|
| |
| ==Switches for LED current==
| |
| * This [http://uk.farnell.com/diodes-inc/zxms6005dt8ta/mosfet-nn-ch-w-esd-60v-1-8a-sm8/dp/1902497 SMD Dual Logic Level MOSFET] will control two sets of LEDs directly from the MCU - given enough heat-sink capability on the board and enough voltage from the MCU (3.3 or 5v compatibke , Has ESD, over temp and over current protection... is really tiny! If the logic level REALLY needs to be 3.3v then that is an issue :( 3.3v logic turns into about +3.45v regulator (3.3v + a 200mV diode drop to allow the MCU tp be reprogramed in circuit) with 415mV regulation margin - nearly 4v reqd for the MCU.. when the LEDs start to light up near 3v :(.
| |
|
| |
| * This [http://uk.farnell.com/stmicroelectronics/stp16nf06l/mosfet-n-ch-60v-16a-to220/dp/9803068 TO220 MOSFET] should carry the 0.5a curent - perhaps without any heatsinking at all. and combined with a small transister should operate well at a supply voltage of 3v.
| |
|
| |
| * This [http://uk.farnell.com/nxp/pmn34un-135/mosfet-n-ch-30v-4-9a-sot457/dp/1758106 PNM34UN] is 2A mosfet, with Rds of 0.08 at 1.8V throu to about 0.05 at 4.5V; max Vds of 30V; £0.16 each. there are several similar parts at Vds 30V for a bit more money. [http://www.digikey.co.uk/product-detail/en/PMN34UN,135/568-7420-1-ND/2698079 digikey ] is more expensive for this part.
| |
|
| |
| * [http://uk.farnell.com/nxp/pmn27un-135/mosfet-n-ch-20v-5-7a-sot457/dp/1758104 PMN27UN] is similiar to the above; but 20V max Vds with a bit smaller Rds(on) - also marginally cheaper.
| |
|
| |
| There are a few impacts of this choice..
| |
| * SMD or through hole!!!
| |
| * Many fewer devices from the SMD integrated logic level MOSFETS
| |
| * Higher operating voltages might be required by the SMD MOSFETs
| |
|
| |
| ==Voltage regulator for the MCU==
| |
| Needs to operate of a widely varied supply voltage. The dynamo generates a voltage proportional to the bike speed. Potentially reaching hundreds of volts. And the higher the voltage climbs, the more power I can use in the LEDs! Many components to deal with 0.5A are specced at about 40 to 60V - so that is a very high limit for the working voltage. A chain of 6 LEDs would need 24v. My plans are for 3 LEDs in a chain - so 20V is a good target.
| |
| MCU Vcc of 3V (supporting 10MHz clock) these are some possible regulators.
| |
| * [http://uk.farnell.com/national-semiconductor/lm2936mp-3-0-nopb/ic-ldo-volt-reg-3v-50ma-sot-223/dp/1496125 3.0v, 200mV drop out, 50 mA, max 40v supply] from a 3.2V diode bridge supply :). It is a 4 pin SMD device for £1.60.
| |
| * [http://uk.farnell.com/national-semiconductor/lp2980im5-3-0-nopb/ic-ldo-volt-reg-3v-50ma-5-sot-23/dp/1559574 3.0v, 120mV drop out, 50mA, 16V max supply] will do above from a 3.12V supply, but restricts me to chains of fewer than four LEDs. £0.46
| |
| * [http://uk.farnell.com/on-semiconductor/lp2950cz-3-0g/ic-ldo-volt-reg-3v-0-1a-to-92-3/dp/1354344 3v, 350mV drop out, 100mA, 30V max supply] is a small 3 pin through hole package for £0.46. Required voltage is now 3.35V :(.
| |
|
| |
| MCU Vcc of 2.5V (max clock of 8Mhz)
| |
| * [http://uk.farnell.com/linear-technology/lt1761es5-2-5-pbf/ic-ldo-volt-reg-2-5v-0-1a-5-tsot/dp/1531492 a 2.5V, 300mV drop out, 100mA, 20V max power supply] will allow operation at 2.8V:).
| |
|
| |
| ==Adjustable voltage regulators==
| |
| These seem like they offer the voltage reqd (order of 2.5 to 2.7V) at acceptable dropout voltages - order of 0.3V.
| |
|
| |
| But the fine print is hard to follow, so far I have investigated several families to find either I can not understand them or they have secondary voltage requirments above 4V;
| |
|
| |
| * [http://uk.farnell.com/linear-technology/lt3080est-pbf/ic-adj-ldo-reg-0v-to-36v-1-1a-sot/dp/1556601 LT3080EST three pin regulator] requires a source voltage > 1.25V higher than output although Farnel calls it a 350mV dropout :(. 2.7+1.25 is nearly 4V, way after the LEDs have lit up. This is Farnell missing the note in the datasheet, and quoting the voltage dropout for a different part in the family.
| |
|
| |
| * [http://uk.farnell.com/on-semiconductor/lm2931ctg/v-reg-ldo-adj-3-24v-2931-to2205/dp/1211139 LM2931CTG automotive volt regulator] This guy is just plain confusing. There are about 10 extra components in the application circuit. The guidance for selection of the output capacitor sent me of to work out the resonant freqency of tantalum caps. For which I apparently need the equivalent series inductance (ESL) - which no devices I looked at on Farnell mentioned in the datasheet, and this is the easy components. Meanwhile, I recall that I am advised to increase the size of the capacitor because the operating voltage is low.. by an unspecified amount. Next.
| |
|
| |
|
| |
| * [http://uk.farnell.com/micrel-semiconductor/mic2941awu/ic-reg-ldo-1-25a-adj/dp/1556739 MIC2941AWU automotive voltage regulator] is restricted to 4.3V inputs at temp != 25degrees. Confused? Yes, definitely. The datasheet has headline operating parameters specified for 25 degrees - that appear in the first page product blurb, and much more constrained parameters for the for the full tempreture range of -40 to +125degrees. Naturally the blurb claims the regulator operates from -40 to +125degrees. To cap it off there is no derating guidance. I am not used to datasheets being written by sales droids. Next.
| |
|
| |
| * [http://uk.farnell.com/on-semiconductor/ncv4276adsadjg/ic-voltage-regulator/dp/1703366 NCV4276] minimum input is 4.5V - just Farnell's search tool not dealing with input voltage ranges.
| |
|
| |
| * [http://uk.farnell.com/micrel-semiconductor/mic29152wu/ic-v-reg-ldo-1-5a-adj-smd-29152/dp/1100648 MIC29152WU 1.5A Adj] might be an ok regulator. It is 26V input continuous, 50V 10mSec spikes. 5mA minimum load. Unfortunately, the datasheet is ambiguous. The headline voltage dropout figure is 340mV, but all the electrical characteristics are quoted for 1V margin over the regulated voltage... so not sure how well it will do the job...
| |
|
| |
| And there appears to be a better choice..
| |
| * [http://uk.farnell.com/linear-technology/lt3008edc-pbf/ic-adj-ldo-reg-0-6v-to-44-5v-20ma/dp/1692192 LT3008 20mA 0.6 to 44V] 200mV dropout, or 500mV at higher tempreture. Since high temp is associated with daylight or lots of wasted power this should be fine. Needs a resister network, and two caps.
| |
|
| |
| ==digikey options..==
| |
|
| |
| * [http://www.digikey.co.uk/product-detail/en/LT3008ETS8-2.5%23TRMPBF/LT3008ETS8-2.5%23TRMPBFTR-ND/2074413 LT3008 2.5V fixed] from Digi-Key. Is easier to check for alignment on board. Doesn't need the resister network. And is cheaper.
| |
|
| |
| ==Diodes for rectifying AC ==
| |
| This diode should allow be low voltage drop - to get the LEDs working at lower speeds.
| |
| Need to be >10V barrier. Higher barrier gives higher drops. So chosen 15V barrier diode.
| |
|
| |
| * [http://uk.farnell.com/vishay-formerly-i-r/10bq015trpbf/schottky-rectifier-1a/dp/1651136 1A, 360mV fwd voltage drop]
| |
|
| |
| * [http://www.digikey.co.uk/product-detail/en/DFLS130L-7/DFLS130LDICT-ND/673203 digikey 1A 30V 0.31 voltage drop] £0.38/1 £3/10
| |
|
| |
| == light sensor ==
| |
|
| |
| All the Farnell photo-resistors are through hole; makes sense I guess as that way they can be poked through a hole in the casing.
| |
|
| |
| * [http://uk.farnell.com/excelitas-tech/vt90n2/ldr-series-vt900/dp/1652637 photo-resistor or LDR ] is cheapest at £0.27 - now to find out how to use it, and if there is a reason to spend more.
| |
|
| |
| == 20V, 30V or 60V diode bridge. ==
| |
|
| |
| From what I read yesterday, the voltage drop of a schottky diode is a function of the junction temp, the current passed, the reverse voltage barrier, and the size of the diode junction (which I guess becomes cost).
| |
| There is this [http://uk.farnell.com/vishay-formerly-i-r/vs-95sq015/diode-schottky-9a-15v/dp/506795 £3.19 diode 9A/15V] that has a Vf for 1A at 25C less than 250mV. If you could heat the junction to 100C it would be about .1V!! AT 100mA it is less than 200mV Vf.
| |
|
| |
| Since the voltage out of the dynamo is essentially a function of the road speed, it could be quite high. leading to my difficulties in finding low Vf diodes..
| |
|
| |
| If I put a pair of zener diodes across the output of the dynamo - before the rectifier, then the rest of the circuit is limited to only that voltage, and the diodes in the bridge recifier are limited to half of that.
| |
|
| |
| I am not sure if 20V or 30V is the right target voltage for the rectifier. Higher voltages get more complex, as larger logic level MOSFETs seem to need 5.5 to 4.5V gate voltages rather than 3V, 2.5V or even 1.8V. Also, low-drop-out v-reg that will take > 30V as input are rare.
| |
|
| |
| I am leaning towards 20V (or 18V to split the diff between LEDs and specs).
| |
|
| |
|
| |
| If 20V then [http://uk.farnell.com/on-semiconductor/mbrs410lt3g/schottky-rectifier/dp/1702812 10V/1A] seems a useful diode to rectify 0.5A with low losses.
| |
|
| |
| * [http://uk.farnell.com/nxp/pmeg1020ev/diode-schottky-sot-666/dp/8737835 10V 2A, 250mV drop at 0.5A] 10 for a £ :)
| |
|
| |
| == MCU programming ==
| |
|
| |
| All AVR MCUs come with debugWire disabled :( - see [http://www.atmel.com/Images/doc2562.pdf Connecting to a board with JTAG MK2].
| |
|
| |
| To enable debugWire I need to use ISP/ which needs MISO,MOSI,SCK and RESET, VCC, and GND! Can do with the DIP by programming before putting in the board; using a socket.
| |
|
| |
| I wonder how the users of SMD packages manage it?
| |
|
| |
| == rough design ==
| |
|
| |
| * dynamo->AC
| |
| * AC->2 back-to-back 5% 18V zener diodes->clipped AC. (Clip the input voltage to less than 20V (allowing for error and forward diode voltage) which should be a safe range of rest of components.)
| |
| * clipped AC->diode bridge->DC (using 10-15V diodes, loose .5V so 17.5 to 19.5 max V)
| |
| * (three of)DC->LED strings->logic level 20V mosfets->GND
| |
| * DC->2.5V reg->Vcc->MCU->GND (requires DC >= 2.8V)
| |
| * AC->diode-> 100k resister->(MCU int0 pin)->2.5V zener diode->GND
| |
| * MCU_reset->Reset_debugWire->100k resistor->Vcc
| |
| * MCU_[3*gpios]->MOSFET Gates
| |
| * DC->1M resister->MOSFET_on->2.7V zener diode->GND (hardware default this MOSFET to on)
| |
| * MOSFET_off(two off)->1M resistor->GND (hardware default these MOSFETs to off)
| |
| * Vcc->LightDependentResistor->MCU_[ADC]->10k resistor->GND
| |
| (Micro-controller programming)
| |
| * DC->prog supply pin
| |
| * Vcc->Vref_debugWire
| |
| * Gnd->Gnd_debugWire
| |
|
| |
| NOTES
| |
| If the LEDs light up below 2.8V, then I need to think about lower voltage supply for MCU.
| |
|
| |
| One LED string should default to ON - so that while the MCU is booting there is a power consumer to stop capacitors charging to unsafe voltages.
| |
|
| |
| Not sure what the failure modes are and what protection should be added.
| |
|
| |
| Plans for cooling of LEDs are still vaugue.
| |
|
| |
| == firmware design ==
| |
| ===pseudo code===
| |
| <nowiki>
| |
|
| |
| isr(int0)
| |
| {
| |
| freq++ ;
| |
| }
| |
|
| |
| isr(counter_2_overflow)
| |
| {
| |
| // copy current freq to main line, reset freq.
| |
| }
| |
|
| |
| isr(adc_complete)
| |
| {
| |
| copy adc value to mainline;
| |
| }
| |
|
| |
| isr(counter1_...)
| |
| {
| |
| // implement the lighting policy
| |
| ?flip the current MOSFETs bit..
| |
| ?change the current MOSFET
| |
| ?change the counter target
| |
| }
| |
|
| |
| void
| |
| main()
| |
| {
| |
| setup() ; // set the ports, direction etc.
| |
| for(;;)
| |
| {
| |
| if (newFreq)
| |
| {
| |
| {
| |
| DISABLE_ISR ;
| |
| copy new freq ;
| |
| }
| |
| if new freq != old freq
| |
| adjust policy;
| |
| }
| |
| if (newLumons)
| |
| {
| |
| {
| |
| DISABLE_ISR;
| |
| copy new lumons;
| |
| }
| |
| if new lumons != old lumons
| |
| adjust policy ;
| |
| }
| |
| }
| |
| }
| |
| </nowiki>
| |
|
| |
| ===inputs and conditioning===
| |
| ===policy ideas===
| |
| # if it is dark provide constant light immediately.
| |
| # if it becomes light, wait for a few seconds to confim it stays light, and then start flashing the lights to make it easier for others to see the bike.
| |
| # as the speed increases, spend more time with tightly focussed lights lit
| |
| # as the speed decreases, spend more time with flood lights lit.
| |
| * Flashing LEDs use less power, maybe can lit up high speed strings at lower speeds?
| |
| * Flashing LEDs have higher power limits, so should be able to flash low speed floods even at high speed - to get attention from road users at large angles to the bikes direction of travel.
| |
| * Aim to match the power available to the power consumed by the LED strings
| |
|
| |
| ===policy mechanism===
| |
| Four intervals of variable length, applied to selected string of LEDs: off, string-a on, off, string-b on.
| |
|
| |
| The intervals are defined as an array of counter[4]. The LED strings by the MOSFET number in an array of mosfet[4];
| |
|
| |
| This will allow:
| |
| * the fading from spots to floods gradually:).
| |
|
| |
|
| * day lashing patterns to be set using any two strings of LEDs. | | (*) the length of the strings depend on the Voltage generated, and will be changed to match. |
|
| |
|
| ===policy config===
| | This easily fits in the attiny84 - with space for JTAG also. |
| * night vs day lumonosity value.
| |
| * samples of day light required for flashing to start.
| |
| * freq exponential smoothing factor (power of 2)
| |
| * night freq bounds[4] between {floods | mix | medium | mix | spots}
| |
| * day freq bounds[N] between flash patterns
| |
| * day flash patterns[N]
| |
|
| |
|
| ===user config===
| | New link [http://www.mikrocontroller.net/attachment/14850/BikeLight.pdf on impedance matching and MCU control] of bike lights :). I am not sure what this means for my circuit. My plan is to continue on:). |
| policy values in miles per hour?
| |
| or are they automated from load/power info?
| |