Shop OBEX P1 Docs P2 Docs Learn Events
A fist full of LEDs for Christmas — Parallax Forums

A fist full of LEDs for Christmas

ClemensClemens Posts: 236
edited 2008-06-15 07:14 in Propeller 1
Charlieplexing? Beauplexing? Desilvaplexing?

- Whatever you want to call it, it took me quite some time to figure out how it works... :-)
So here is a sample·8 column 7 row led display that only uses 8 pins.:

x-mas-plexing.gif

plexing_module1.jpgplexing_module2.jpg

It's my first soldering project! (Obviously ;-))
Just wanted to show it to thank you people for sharing so much knowledge on this forum.

And..... , one question, but it's really basic stuff I'm afraid.
If I want to take one number to the power of another, how do I do this in spin?
I wrote a function:
PUB pow (num, pownum)  | returnvalue
if pownum==0
 return 1
else
  returnvalue := num
  repeat pownum-1
     returnvalue*= num
  return returnvalue

Is that the correct way to do it, I have a feeling there is an easier way?
Thank you all and have a nice christmas if you're celebrating and just a good time if you don't.

Clemens
«13

Comments

  • deSilvadeSilva Posts: 2,967
    edited 2007-12-24 01:46
    Breathtaking! I stopped with a 5x5 Matrix. But there are still some 24 hours till Xmas...
    I think your soldering is quite o.k.

    I hope you do not mind when I post your images also to other places?

    The LEDs seem to be quite bright, but they can only be powered by 0.7 to 0.9 mA.
    What is the brightness rating? When you have taken some advertised with 5.000 mcd @20 mA then they should shine with 200 mcd., what is still 10 times more than an old fashioned LED..

    Your "power loop" is not the fastest, but the simplest way to do it.
    Note that the exponent cannot become VERY large. Lets say the basis is at least 2 it must be < 32, and the basis being around 16 it has be be <8

    In cases with LONG numbers (with hundreds of digits) however, it will pay to analyse the binary factors of the exponent E.
    E = 2**a + 2**b + 2**c + ....
    Then the power B**E will be
    B**(2**a) * B**(2**b) * ....

    To compute each of the factors you will need a, b, or c multiplications, as: x1 := B*B; X2 := X1*X1; X3 := x2*X2;..)

    So e.g. B**255 will take some time:
    0+1+2+3+4+5+6+7 multiplications + 8 for all factors = 36 multiplications... but much less than the straight forward 254...

    And B**256 it will only take 8 multiplications!!

    This algorithm is best implemented in assembly language, where the binary decomposition is rather simple..

    Post Edited (deSilva) : 12/24/2007 2:20:14 AM GMT
  • kevin101kevin101 Posts: 55
    edited 2007-12-24 02:18
    Now try to do the display with RGB led's and 24 bit color! lol.gif

    Couldn't keep the relatives out this year,
    Kevin
  • RaymanRayman Posts: 14,233
    edited 2007-12-24 02:20
    Nice job!
  • ClemensClemens Posts: 236
    edited 2007-12-24 02:24
    Thanks DeSilva,
    sure you can distribute the images elsewhere.
    I probably wouldn't even have needed the power-function as I only need powers of 2. I think I could have done it with shift.
    It's actually just for defining the one pin that has to be skipped in each row of the display (the one that switches the columns). Well I was glad I got it running in spin, was hard enough for me, but I guess it could be a nice project to get started with assembler... I read potatoheads beginner tutorial and halfway understand it.
    Much to explore in 2008. smile.gif
  • bambinobambino Posts: 789
    edited 2007-12-24 03:46
    Maybe 2008 will see you with that thing mounted on a pendulem arm, showing the full message through persistance-of-vision!
    Great job.
  • ForrestForrest Posts: 1,341
    edited 2007-12-24 05:30
    I don't see any current limiting resistors in the picture - are they there?
  • ClemensClemens Posts: 236
    edited 2007-12-24 09:54
    @ kevin: Let's see, it took me half an hour to solder these 56 LEDs together, so that's 1024*768*3(for RGB) /56 /2 makes about 21000 hours - that's only about seven years if I work on it 8 hours per day. And by then prop4 will maybe have enough pins to control it... :-D

    @ bambino: hm, multiplexing and pov together... Won't be much brightness left, at least not with those cheap leds. wink.gif

    @ forest: I had resistors in there while testing. But the LEDs now are only pulsed 1/8 of the time (duty cycle) to do the plexing, so no harm should be done to the prop or the leds.
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-24 11:01
    (a) You have forgotten the slightly quadratic influence noticed with large projects and dull work smile.gif
    (b) Yes that's the bottleneck. LEDs do no magic. 100mW in - 100mW out (if
  • ClemensClemens Posts: 236
    edited 2007-12-24 14:07
    Well I just bought the cheapest ones in a little bag of 25 LEDs for·1 Euro something.
    I think it must be these ones: http://www.conrad.de/goto.php?artikel=184918
    But it doesn't say anything about the brightness level there...
    The brightness is fine with this duty cycle, but it rapidly get's lower at duty cycles·below 1/10.
    I started with a smaller grid of 5x4 LEDs and checked what duty cycle would be still acceptable before I soldered the "BIG" one.
    Would that one be a better candidate? ·http://www.conrad.de/goto.php?artikel=154295
    A little beyond the budget perhaps... :-)
  • Nick MuellerNick Mueller Posts: 815
    edited 2007-12-24 14:24
    > Would that one be a better candidate? http://www.conrad.de/goto.php?artikel=154295

    <G> Because of the "risk of eye-injury" smile.gif

    > A little beyond the budget perhaps... smile.gif

    Did you try a filter? If you don't intend to have multiple colors, it's much more effective to have a yellow (color of LED) filter in front of.


    Nick

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never use force, just go for a bigger hammer!

    The DIY Digital-Readout for mills, lathes etc.:
    YADRO
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-24 15:09
    Clemens,
    you buy at the wrong places smile.gif

    LEDs is a very transparent market.. Lots are sold through ebay. Look at CAR ADD-ONs ("Autozubeh
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-24 15:11
    Nick Mueller said...
    <G> Because of the "risk of eye-injury" smile.gif
    Nick, this is nonsense! You know the effects of multiplexing , dont you?

    Post Edited (deSilva) : 12/24/2007 3:17:33 PM GMT
  • TransistorToasterTransistorToaster Posts: 149
    edited 2007-12-24 18:37
    Clemens,
    For the raise to the power question, you could use logarithms and exp. There's a set of ROM table's on the Propeller for that.

    A^B
    =EXP( B* LN(A))
    =EXP( EXP(LN B + LN(LN(A))
    Frank
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-24 18:38
    Can you further elaborate on EXP and LN, please?
  • ClemensClemens Posts: 236
    edited 2007-12-25 00:10
    Thank you TransistorToaster, looks like an elegant solution. I'll have to do some research on those ROM tables though...
    It's amazing that a chip of the size less than 1 square Centimeter can keep my brains occupied for months and months. Does this speak for the chip or against my brains?
    - And please, this last question was merely rethoric please don't answer! smile.gif
  • BEEPBEEP Posts: 58
    edited 2007-12-25 03:07
    Thumbs up (P8X32A is ready to take-off) smile.gif
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-25 11:19
    Clemens said...
    It's amazing that a chip of the size less than 1 square Centimeter can keep my brains occupied for months and months.
    Christmas time generally rises the question how things without any silicon at all can keep you occupied for 2000 years now smile.gif
  • ClemensClemens Posts: 236
    edited 2007-12-25 16:32
    Well that's another story. Searching for the roots of our existance may be as sucess-promising as trying to explain to the prop, why the guy with the soldering iron out there wants him to output current on various pins. - But that doesn't mean it's not a fine sport worth putting some attention to. smile.gif
  • OakGraphicsOakGraphics Posts: 202
    edited 2007-12-25 22:27
    Clemens said...
    Charlieplexing? Beauplexing? Desilvaplexing?

    - Whatever you want to call it, it took me quite some time to figure out how it works... :-)
    So here is a sample·8 column 7 row led display that only uses 8 pins.:


    That looks great!·· Do you have a wiring diagram·for how you wired it up?· I see you attached it on pins 16~23 of the propeller, but now how the grid was assembled. :-)
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-25 23:22
    Have a look at this principle diagram. As the secondary diagonal is omitted,
    all diodes right of it have to be shifted ("bent") one place to the left to make it "good looking"
    ----
    Edit: I added a sketch which better shows the needed connections and leads
    It is very sytematic but needs a lot of concentration smile.gif

    Post Edited (deSilva) : 12/25/2007 11:34:33 PM GMT
    720 x 510 - 55K
    270 x 287 - 15K
  • OakGraphicsOakGraphics Posts: 202
    edited 2007-12-25 23:32
    deSilva said...
    See this principle diagram. As the secondary diagonal is omitted,
    all diodes right of it have to be shifted one place to the left to make it "good looking"
    Gotcha.· I was looking at the maxim's web site while you posted, and found this:
    DI217Fig02.gif

    So I then put that into a matrix in eagle like so: (see attachment)·· Does that make sense? smile.gif·· I have included the eagle schematic and board layout for fun.· I am not an expert in eagle - as you can see. tongue.gif

    Post Edited (OakGraphics) : 12/25/2007 11:39:42 PM GMT
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-25 23:51
    Great! Such projects need good preparation..
    I have a veroboard here for some time with horizontal stripes at the front side and vertical stripes at the back side.
    This will simplify the task considerably; I think I need just 7 cuttings and 7 short patchwires... And 56 LEDs...
    I have the LEDs.. I mean: SOLDERING 56 LEDs
  • OzStampOzStamp Posts: 377
    edited 2007-12-25 23:52
    Hi Clemens

    You did well.. looks great . Merry Xmas to you and fellow Proppers..

    There are a couple of really neat led games around..
    One that I saw a guy here in OZ had· see link below

    Based on a AVR 168..

    http://www.youtube.com/watch?v=Q0VH-7gdFB4

    A Propeller should eat this for breakfast...
    Would be a great learning tool as well... a MINI HYDRA..???

    cheers·· Ron·· Melbourne Australia
  • OakGraphicsOakGraphics Posts: 202
    edited 2007-12-25 23:57
    Cool! Where do you get the veroboard with the horizontand stripes at the front, and vertical stripes at the back? I don't think I have ever seen that. smile.gif
    wouldent you need to 'isolate' each pin from either top-bottom when you don't want the two connected? Or will the act of not soldering the top seperate from the bottom layer? (i.e. wont the lead of the LED potentially make a contact between the two layers?)

    Anywho - I kow veroboard is not popular in the US for some reason. I noted I could get some from http://www.futurlec.com/ProtoBoards.shtml for pretty cheap - but they don't seem to carry the one you were refering to. smile.gif
  • ClemensClemens Posts: 236
    edited 2007-12-26 00:36
    Here is how I set it up. It may be less scientific but assures that one doesn't break his fingers soldering.
    The LEDs are on the opposite side off course. The blue wires are flat on the board, the red ones a little above.

    plexing_module3.jpg
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-26 00:48
    @Oz: Ouch -They have 256 LEDs. Square is nice, but there are hardly any superbrights with this option.
    With luck you buy for 4 to 8 Cents * 256 = $10 to $20 - and its monochrome.

    It should not be Charlieplexed but refreshed line after line so you get any brightness at all.

    - 16x anode current from the Prop @10mA each
    - 16 (=2x ULN2803) cathode sinks @160 mA each
    - 4:16 decoder
    (=20 Pins)

    I should prefer one of 4Ds OLEDs smile.gif
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-26 00:52
    @Clemens: Ah, nicely colored! It shows very clear how that "shifting the LEDs right of the secondary diagonal" is accomplished

    I just found my double sided Veroboard, but it's midnight now and shall not start soldering LEDs on it now smile.gif
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-26 01:43
    @OakGraphics: we have a different situation here in Europe....
    Well, both sides have each second stripe only.. This is handy for any kind of matrix.. But it is rarely requested I am sure...
    However I can no longer find them in one of the online stores I must have ordered it some months ago....Weird..
  • ToleyToley Posts: 16
    edited 2007-12-26 23:27
    @OakGraphics : simple solution, just use 2 veroboards one over the other and flip one a quarter turn!!! And use the led leads to link the 2 boards. This is what I'm gonna try if I can find 56 similar leds...

    This is very cool project two thumbs up Clemens.

    But the real question is : Who is Charlie???
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-27 00:05
    Toley said...
    @OakGraphics : simple solution, just use 2 veroboards one over the other and flip one a quarter turn!!! And use the led leads to link the 2 boards.
    Right! But use 5.08 mm bords where only each second row has a (broad) copper stripe. They exist; I still encountered them yesterday when I - successless tried to find the sorce of my board....
    said...
    This is what I'm gonna try if I can find 56 similar leds...
    This is not a lucky number. Just buy 100. I gave enough recommendations in two threads yesterday.
    said...
    But the real question is : Who is Charlie???
    This esplained by MAXIM in the datasheet where the 6 7-segment example comes from; and also in one of the Charlieplexing threads quite popular here 3 months ago..
Sign In or Register to comment.