Menu

Christmas tree lights

2019-12-20
2019-12-24
  • David Stephenson

    As things are slow at the moment. Here is a project that I have built.
    The background is that I was given a number of strings of (tungsten filament) lights (as my neighbour thought that I was unfestive). Over the years the bulbs have burned out.
    (The strings were of the US type 100 bulbs consisting of two set of 50 bulbs in series and the two 50 strings in parallel).
    So what about replacing the bulbs with LEDs - even better bicolour LEDs.
    The circuit is essentially a high voltage H-bridge (integrated H-bridges do not seem to go above 40V). By switching polarity the LED changes from red to green, they can even be switch fast enough to make a passing orange.
    So attached is the circuit.
    Caution: If you are unconfortable working with high voltages do not attempt this (it uses 170 DC which will kill).

     

    Last edit: David Stephenson 2019-12-20
  • David Stephenson

    Here is some code. I'm sure somebody can come up with better sequences.
    Care should be taken not to have the wrong two halves of the h-bridge on at the same time.

    #chip 12F1840,16
    #config OSC=INTOSC, MCLRE=Off, WDT=off, boren=off
    'trisa=b'00001000'
    dir porta.0 out
    dir porta.1 out
    dir porta.2 out
    dir porta.4 out
    dir porta.5 out
    'lata=b'00000000'
    set porta.0 off
    set porta.1 off
    set porta.2 off
    set porta.4 off
    set porta.5 off
    dim ix as word
    dim iy as word
    dim ia as word
    wait 1 sec
    Randomize
    do
    repeat 100
    j=random/64
    if j=0 then
    lata=b'00010001' 'RED
    wait 1 sec
    end if
    if j=1 then
    lata=b'00100010' 'GREEN
    wait 1 sec
    end if
    if j=2 then
    repeat 200
    lata=b'00010001' 'RED
    wait 2000 us
    lata=b'00100010' 'GREEN
    wait 3400 us
    end repeat
    end if
    IF J=3 THEN
    lata=b'00000000' 'off
    wait 250 ms
    end if
    end repeat
    
    
    repeat 5
    lata=b'00000000'
    wait 1 sec
    for ia=0 to 1000
    ix=ia*10
    iy=10000-ix
    lata=b'00000000' 'off
    wait iy us
    lata=b'00100010' 'green
    wait ix us
    next i
    lata=b'00100010' 'green
    wait 2 sec
    
    for ia=0 to 1000
    ix=ia*10
    iy=10000-ix
    lata=b'00010001' 'fade green-red
    wait ix us
    lata=b'00100010'
    wait iy us
    next i
    
    
    lata=b'00010001' 'red
    wait 2 sec
    
    for ia=0 to 1000
    ix=ia*10
    iy=10000-ix
    lata=b'00010001' 'red
    wait iy us 'fade red-green
    lata=b'00100010' 'green
    wait ix us
    next i
    
    lata=b'00100010' 'green
    wait 2 sec
    
    for ia=0 to 1000
    ix=ia*10
    iy=10000-ix
    lata=b'00010001' 'fade green-red
    wait ix us
    lata=b'00100010'
    wait iy us
    next i
    
    lata=b'00010001' 'red
    wait 2 sec
    
    for ia=0 to 1000
    ix=ia*10
    iy=10000-ix
    lata=b'00010001' 'red
    wait iy us
    lata=b'00000000' 'off
    wait ix us
    next i
    
    repeat 20
    lata=b'00010001' 'red
    wait 10 sec
    lata=b'00000000' 'off
    wait 250 ms
    lata=b'00100010' 'green
    wait 10 sec
    lata=b'00000000' 'off
    wait 250 ms
    repeat 2000
    lata=b'00010001' 'RED
    wait 2000 us 'attempt at orange
    lata=b'00100010' 'GREEN
    wait 3400 us
    end repeat
    lata=b'00000000' 'off
    wait 250 ms
    
    end repeat
    
    end repeat
    
    loop
    
     
  • stan cartwright

    stan cartwright - 2019-12-24

    or go to poundland :)

     
  • stan cartwright

    stan cartwright - 2019-12-24

    I got a lantern and a few "bulbs" that have a flame effect but they are so cheap in lidl or ebay why bother?
    It's difficult to find something worth making that costs less on ebay.

     
  • David Stephenson

    It's the joy of creation and I can say that mine is unique. I would guess that it probably is the only one in the world.
    I spent a week in England recently and all I saw were flashy white led things I saw none with bicolour LEDs. Oh and I can program in any sequence I want.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.