User talk:Daveb: Difference between revisions

From London Hackspace Wiki
m (→‎firmware design: new section)
 
(44 intermediate revisions by the same user not shown)
Line 1: Line 1:
Dave Brown - hacker in spirit.
Dave Brown playing for a while:)
 
==Project intended to progress sometime in the future==
==Project Ideas==
{|border="1" cellpadding="5" cellspacing="0"  
{|border="1" cellpadding="5" cellspacing="0"  
|'''Project''' || '''Status''' || '''Notes'''  
|'''Project''' || '''Status''' || '''Notes'''  
|-
|-
|'''Reconfigurable sailing proa'''|| plan || Rob Denny at http://www.harryproa.com has some interesting things to say about Proas and how they could be the basis for a cheap, high performance, spacious sailing cruising boat. Perhaps the ideal cruising boat :). I want to explore the sailing characteristics in a model.
|'''Reconfigurable sailing proa'''|| mostly inactive, built small bits || Rob Denny at http://www.harryproa.com has some interesting things to say about Proas and how they could be the basis for a cheap, high performance, spacious sailing cruising boat. Perhaps the ideal cruising boat :). I want to explore the sailing characteristics in a model.
|-
|-
|'''LED lights and lenses for my bike''' || plan  || http://pilom.com/BicycleElectronics/DynamoCircuits.htm explains the matching of LEDs to bike generators. 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 curent bike speed.  
|'''LED lights and lenses for my bike''' || active || http://pilom.com/BicycleElectronics/DynamoCircuits.htm explains the matching of LEDs to bike generators. 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.  
Success criteria:
Success criteria:
* generate some light at low speed
* generate some light at low speed
* generate more light at high speed
* generate more light at high speed
* get it too work
* get it too work
* dont break the bank  
* don't break the bank  
 
|-
|'''Visible surge arrestor''' || project || I want to know when power surges happen, and if possible stop them cheaply and quickly. [http://wiki.london.hackspace.org.uk/view/Project:SurgeArrestor Project:Surge Arrestor]
|-
|'''Low viscosity blood'''|| thoughts || I have some more reading to do; but am intrigued by http://customers.hbci.com/~wenonah/new/mcdaniel.htm and http://en.wikipedia.org/wiki/Integrated_Pulmonary_Index
|-
|-
|'''Quiet boxed PCs''' || project || I want to run more than one PC, and the droning gets to me :(  [http://wiki.london.hackspace.org.uk/view/Project:QuietBoxedPCs Project: Quiet Boxed PCs]
|}
|}


==Project Status==
==Project Ideas==
==Bike Headlight==
{|border="1" cellpadding="5" cellspacing="0"
Have ordered LEDs, reflectors and lenses. Have an attiny85 from the space components. Still need a dynamo, some diodes, mosfets, npns, a circuit and some firmware - oh and maybe a heatsink for the LEDs:). The project is moving along.
|'''Project''' || '''Status''' || '''Notes'''
|-
|'''Power efficient raid'''|| idea || Data needs to be written to multiple drives; so a single head-crash does not wipe it out. However, it could be staged to disks sequentially, remaining in memory until it has been written on the 2nd (or n'th) drive. The drives could be spun up more rarely, to simply update the file-store.
Perhaps it can be done using two or more file systems and unionfs; with the data eventually residing on a spinning disk, but initially being saved on ssd. The spinning disk using btrfs to make a sequence of stable snapshots from changes preserved on the ssd.
Maybe btrfs offers this sort of thing directly?
|-
|'''Make solar cell?'''|| idea || Link http://www.freewebs.com/acselectronics/TiO2solar.html
|-
|'''Safe by design nuclear'''|| meme || [http://www.youtube.com/watch?v=P9M__yYbsZ4 2 hour promo]
|-


Have received the [http://www.ledsupply.com/docs/Luxeon-StarIII.pdf LEDs (white Lambertian] (but not the reflectors etc).
|-
Have a bottle dynamo, but dont know much about it yet.
|'''bike trailer'''|| sketches on envelopes || to carry standard building 2.44 x 1.22 M sheets, 2up kayak, etc. Considering
* extending the bike rack so the trailer can be carried inverted over the rack;
* wheel mounts that can be pivoted to vary the trailers wheelbase
** narrow for storage on bike
** wider for normal use
** extra wide to control the windage of a building sheet
|-
|'''tricycle'''|| just a thought || Means of getting around...
|-
|'''hack caliphers'''|| seen in sparkfun comments || Member #333257


Still thinking about what the maximum voltage for the LED strings will be ..
If you measure current, you will see that the power off state draws 90% of the current of the power on state. For some reason, all electronic calipers seem to be this way- power off is actually display (only) off. THIS is why the batteries go bad quickly.


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.
I just open the caliper case, cut the battery trace (which one doesn’t matter), drill two holes to allow the fine (wire wrap) wire to come out the top to a micro-miniature slide switch glued to the top. I always turn the switch off, rather than press some caliper “off” button, and find that a button cell lasts for many years. I would attach a picture if Sparkfun allowed, but it doesn’t. Caliper thickness is unchanged, and the outline is very nearly unchanged.
|-
|'''temperature controller'''|| plan || to control cooker for soldering SMD.
# ssr to control power to heating plate
# type k thermocouple to measure temperature
# attiny 84a dip
# usb/serial converter to talk to netbook
* solder-less breadboard with banana-sockets to link 2 through 4
|-
|}


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 :(.
==Crazy Ideas==
{|border="1" cellpadding="5" cellspacing="0"
|'''Project''' || '''Status''' || '''Notes'''
|-
|'''Infer unit-testcases from a functions code'''|| thought || Summary: Use the parse tree for a function as input to heuristically apply symbolic logic that aims to build information about the values of parameters required to invoke particular functionality with-in the function.
So for example given a function "uint32_t f(uint32_t i, std::string s)", it starts with a range of possible inputs of (i in [0,2^32-1] x (s.size() in [0,2^32]) x [set-of-possible-values-of-actual-length]) , which is nearly infinite.
Then from the parse tree, derive the possible effects of the code, and the sub-ranges of the inputs that are required to have these effects.


|-
|'''prime number generator'''|| thought || Invert the sieve of Aristophanes, so the data structure holds primes and the next multiple of each prime. Keep the data-structure sorted by the next multiple. When a gap occurs between the current nearest multiple and the next nearest the gap contains prime number(s).
The algorithm requires sorting subsequent multiples into place.
If N is the number of discovered primes N, and the size of the primes is S; then the memory used is O(N*S) and the
CPU time used is O(S*N*N).


Assume 4.0V per LED - gives 16V for 4 LEDs, and 24V for 6 LEDs.
Other thoughts:
* use wheel factorisation of the first M primes to compactly and efficiently represent the impact of these first M primes, where M is chosen so the product of these primes fit in a machine word, and so that the primes less than the product fit in affordable memory.
* use interval arithmetic to keep track of the intermediate numbers.
* can it be fitted to hardware?
|-
|'''factorisation'''|| thought || By trial division using list of known primes; is exceedingly slow for large numbers; the number of potential factors is O(sqrt(N)) - if N is more than 100 bits that is a big number.  However, can knowledge of the factors be used to restrict the search space usefully? What are the constraints on the factors imposed by PGP for example
|-
|}


Am expecting 4x30deg, 3x15deg and 3x5deg reflecters.
==Dead Ideas==
 
{|border="1" cellpadding="5" cellspacing="0"
Originally thinking of four LED strings
|'''Project''' || '''Status''' || '''Notes'''
1 - very low speed - just a 120 deg med power LED (with voltage doubler to get the reqd V)
|-
2 - low speed - one 30deg
|'''mirrored coils'''|| reinventing the wheel; already exists as a [http://en.wikipedia.org/wiki/Choke_%28electronics%29#Common-mode_choke ''Common mode choke''] || wind two coils on the same core, one left hand the other right hand and link them together. I think they should act as a filter of some sort, because the emf generated by the first travels faster than the electrons and reinforces the current in the other coil, smoothing out the edges of each pulse. The filter frequency being related to the speed of light and electrons in copper and the coil winding length. Maybe there would be less energy lost in the filter?
3 - med speed - one 30deg, one 15deg
I need to learn some maths so I can understand the wiki explanation.  
4 - high speed - one 15deg, two 5deg
|-
 
|}
Of course, the length of the strings depend on the V generated by my bike speed.. not really predictable/
==Completed projects==
 
{|border="1" cellpadding="5" cellspacing="0"
Simplify (only last 3 strings) and no V doubler.
|'''Project''' || '''Status''' || '''Notes'''
 
|-
==Switches for LED current==
|'''Lowered Desk'''|| complete || Comfort requires a good desk:). [http://wiki.london.hackspace.org.uk/view/Project:Lowered_Desk Project:Lowered Desk]
* 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 :(.
|}
 
==Project Status==
* 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.
See [http://wiki.london.hackspace.org.uk/view/Project:SpeedAdjustableBikeLight Speed Adjustable Bike Light]
 
* 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://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
 
I need to establish the maximmum operating voltage!
 
==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:).
 
==Diode to isolate MCU==
This diode should allow the MCU to be reprogrammed in circuit, without blowing up the vreg or anything else with badly applied voltages.
* [http://uk.farnell.com/nxp/bat754c/diode-schottky-dual/dp/1081205RL 200mA, 260mV fwd voltage drop, 600mA surge current] 5 for £0.40
It is a dual common cathode part.
 
* [http://uk.farnell.com/vishay-general-semiconductor/mss1p3u-m3-89a/diode/dp/1863334 1a, 160mV fwd voltage drop, 30v max reverse voltage] £0.154 - however this wonder component is US stock, so £16 extra charge! (there are a few similar low voltage drop diodes and they are all US stock).  
** The Datasheet says the VF Max is 0.4V - crap !
 
== 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 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 crossed 5% 19V zener diodes to clip(+/- 5% -> 18 to 20V output) to safe range of rest of system
* 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
* MCU_[ADC]->light sensor
* 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 ==
 
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
}
 
 
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 ;
  }
}
 
 
policy ideas.
1) if it is dark provide light ASAP.
2) if it be comes light, wait for a bit to confim it stays light, and thn start flashing the lights to provide visiblity
3) as the speed increases, spend more time with tight focussed lights illuminated
4) as the speed decreases, spend more time with flood lights illuminated.
5) match the power available to the power cunsumed by the LED strings
 
policy mechanism
four intervals of variable length, for variable strings
off, string-a on, off, string-b on
 
defined as char counter[4], value[4];


will allow the fading from spots to floods gradually:).
==Parts Shopping==
[http://search.digikey.com/us/en/products/GTCA28-421M-R05-2/GTCA28-421M-R05CT-ND/2931568 GDT 420v] surge arrestor for 240v (if my calculations are right)


will allow the spots to be flashed at 10% duty cycle at a low speed during the day, intermingled with a 20% flash from the lower power medium floods...
[http://search.digikey.com/us/en/products/ED110%2F2DS/ED1605-ND/33880 wire to board screw connectors] 300V 20A


policy config.
[http://search.digikey.com/us/en/products/ELXZ500ELL222MM35S/565-2018-ND/756534 Electrolytic Cap] 50v, 2200uF, 8k hours lifetime, 3A ripple current, 23mOhm inductance, ?ESR.
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[4]

Latest revision as of 07:46, 24 October 2014

Dave Brown playing for a while:)

Project intended to progress sometime in the future

Project Status Notes
Reconfigurable sailing proa mostly inactive, built small bits Rob Denny at http://www.harryproa.com has some interesting things to say about Proas and how they could be the basis for a cheap, high performance, spacious sailing cruising boat. Perhaps the ideal cruising boat :). I want to explore the sailing characteristics in a model.
LED lights and lenses for my bike active http://pilom.com/BicycleElectronics/DynamoCircuits.htm explains the matching of LEDs to bike generators. 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.

Success criteria:

  • generate some light at low speed
  • generate more light at high speed
  • get it too work
  • don't break the bank
Visible surge arrestor project I want to know when power surges happen, and if possible stop them cheaply and quickly. Project:Surge Arrestor
Low viscosity blood thoughts I have some more reading to do; but am intrigued by http://customers.hbci.com/~wenonah/new/mcdaniel.htm and http://en.wikipedia.org/wiki/Integrated_Pulmonary_Index
Quiet boxed PCs project I want to run more than one PC, and the droning gets to me :( Project: Quiet Boxed PCs

Project Ideas

Project Status Notes
Power efficient raid idea Data needs to be written to multiple drives; so a single head-crash does not wipe it out. However, it could be staged to disks sequentially, remaining in memory until it has been written on the 2nd (or n'th) drive. The drives could be spun up more rarely, to simply update the file-store.

Perhaps it can be done using two or more file systems and unionfs; with the data eventually residing on a spinning disk, but initially being saved on ssd. The spinning disk using btrfs to make a sequence of stable snapshots from changes preserved on the ssd. Maybe btrfs offers this sort of thing directly?

Make solar cell? idea Link http://www.freewebs.com/acselectronics/TiO2solar.html
Safe by design nuclear meme 2 hour promo
bike trailer sketches on envelopes to carry standard building 2.44 x 1.22 M sheets, 2up kayak, etc. Considering
  • extending the bike rack so the trailer can be carried inverted over the rack;
  • wheel mounts that can be pivoted to vary the trailers wheelbase
    • narrow for storage on bike
    • wider for normal use
    • extra wide to control the windage of a building sheet
tricycle just a thought Means of getting around...
hack caliphers seen in sparkfun comments Member #333257

If you measure current, you will see that the power off state draws 90% of the current of the power on state. For some reason, all electronic calipers seem to be this way- power off is actually display (only) off. THIS is why the batteries go bad quickly.

I just open the caliper case, cut the battery trace (which one doesn’t matter), drill two holes to allow the fine (wire wrap) wire to come out the top to a micro-miniature slide switch glued to the top. I always turn the switch off, rather than press some caliper “off” button, and find that a button cell lasts for many years. I would attach a picture if Sparkfun allowed, but it doesn’t. Caliper thickness is unchanged, and the outline is very nearly unchanged.

temperature controller plan to control cooker for soldering SMD.
  1. ssr to control power to heating plate
  2. type k thermocouple to measure temperature
  3. attiny 84a dip
  4. usb/serial converter to talk to netbook
  • solder-less breadboard with banana-sockets to link 2 through 4

Crazy Ideas

Project Status Notes
Infer unit-testcases from a functions code thought Summary: Use the parse tree for a function as input to heuristically apply symbolic logic that aims to build information about the values of parameters required to invoke particular functionality with-in the function.

So for example given a function "uint32_t f(uint32_t i, std::string s)", it starts with a range of possible inputs of (i in [0,2^32-1] x (s.size() in [0,2^32]) x [set-of-possible-values-of-actual-length]) , which is nearly infinite. Then from the parse tree, derive the possible effects of the code, and the sub-ranges of the inputs that are required to have these effects.

prime number generator thought Invert the sieve of Aristophanes, so the data structure holds primes and the next multiple of each prime. Keep the data-structure sorted by the next multiple. When a gap occurs between the current nearest multiple and the next nearest the gap contains prime number(s).

The algorithm requires sorting subsequent multiples into place. If N is the number of discovered primes N, and the size of the primes is S; then the memory used is O(N*S) and the CPU time used is O(S*N*N).

Other thoughts:

  • use wheel factorisation of the first M primes to compactly and efficiently represent the impact of these first M primes, where M is chosen so the product of these primes fit in a machine word, and so that the primes less than the product fit in affordable memory.
  • use interval arithmetic to keep track of the intermediate numbers.
  • can it be fitted to hardware?
factorisation thought By trial division using list of known primes; is exceedingly slow for large numbers; the number of potential factors is O(sqrt(N)) - if N is more than 100 bits that is a big number. However, can knowledge of the factors be used to restrict the search space usefully? What are the constraints on the factors imposed by PGP for example

Dead Ideas

Project Status Notes
mirrored coils reinventing the wheel; already exists as a Common mode choke wind two coils on the same core, one left hand the other right hand and link them together. I think they should act as a filter of some sort, because the emf generated by the first travels faster than the electrons and reinforces the current in the other coil, smoothing out the edges of each pulse. The filter frequency being related to the speed of light and electrons in copper and the coil winding length. Maybe there would be less energy lost in the filter?

I need to learn some maths so I can understand the wiki explanation.

Completed projects

Project Status Notes
Lowered Desk complete Comfort requires a good desk:). Project:Lowered Desk

Project Status

See Speed Adjustable Bike Light

Parts Shopping

GDT 420v surge arrestor for 240v (if my calculations are right)

wire to board screw connectors 300V 20A

Electrolytic Cap 50v, 2200uF, 8k hours lifetime, 3A ripple current, 23mOhm inductance, ?ESR.