EFX-TEK

TEK Talk => Prop-1 => Topic started by: GregO on September 15, 2007, 02:46:38 PM

Title: Computer Matrix Board
Post by: GregO on September 15, 2007, 02:46:38 PM
Jon,
When this forum was at Parallax, you refered to a LED light project that resembled an computer readout board from 1960's Sci-Fi movies and TV.  A Matrix that the lights blinked randomly.  I have need of som info on this nif it is still available.
Thanks!
GregO
Title: Re: Computer Matrix Board
Post by: JonnyMac on September 15, 2007, 02:58:01 PM
The IT guy at Parallax trashed the Parallax EFX boards without giving us a copy -- darned irritating, but dealing with the guy always was.... 

Have a look at the Charlie-plexing thread I posted here:

http://www.efx-tek.com/php/smf/index.php?topic=201.0

By calling the patterns randomly and quickly you can have a much bigger display (of LEDs).  You can also use the SOUND cmd to add a bit of interest to it.  How big do you want your matrix?  With six pins you could have 30 LEDs giving a 6 x 5 array of LEDs.  And as only one is on at a given time, you can run a bit of current through them for brightness.
Title: Re: Computer Matrix Board
Post by: GregO on September 15, 2007, 03:00:34 PM
A 6x5 would be good to start, When wiring this it would be the same as for the faux candles, just with out the capacitor, correct?
Thanks!
GregO
Title: Re: Computer Matrix Board
Post by: GregO on September 15, 2007, 03:03:31 PM
I would not need the trigger at this time, just want it to run continuosly.
Thanks!
GregO
Title: Re: Computer Matrix Board
Post by: JonnyMac on September 15, 2007, 03:06:59 PM
There is a schematic (http://www.efx-tek.com/files/charlieplex_leds.pdf) attached to the Charlie-plexing post -- wiring is actually a bit tricky due to the nature of the process.  I'm on my way out but will stop and get a bunch of LEDs to wire a 6x5 array to show everyone what that's like.
Title: Re: Computer Matrix Board
Post by: GregO on September 15, 2007, 03:11:37 PM
Jon,
You are the greatest!
GregO
Title: Re: Computer Matrix Board
Post by: randyaz on September 15, 2007, 04:58:05 PM
Hey Mr. Peabody, I wonder if the wayback machine can take us back to 10/24/2005?  There was a post on the Parallax Forum I'd like to check out.

Well Sherman...we'll just have to try and see...

http://web.archive.org/web/20060217204643/forums.parallax.com/forums/default.aspx?f=22&m=92995

(http://www.spooksterville.com/gallery/main.php?g2_view=core.DownloadItem&g2_itemId=502&g2_serialNumber=1)
Title: Re: Computer Matrix Board
Post by: GregO on September 15, 2007, 05:20:59 PM
Mr. Peabody is way cool!  Sherman too!
Thanks!

GregO
Title: Re: Computer Matrix Board
Post by: GregO on September 16, 2007, 06:27:20 AM
Yawn!
Up til past midnight wiring and soldering the LED's according to the schematic (lots and lots of connections).  Got up early this morning attached the pot and trigger, change the ULN to the 2003, uploaded your program, flipped the swich and NOTHING!  What have I missed?  I am using 12 volts but none of that seems to be getting to the LED's.  I guess there must be a way to wire the power to the LED's that is not covered in the schematic?  Do I need more juice?  (Not ready to try that out without some confirmation, I don't have time to redo what I have done).

HELP!

GregO
Title: Re: Computer Matrix Board
Post by: JonnyMac on September 16, 2007, 10:10:45 AM
Did you connect the outputs to the Px.W terminals?  If you connected them to the OUTx terminals it will never work, as that circuit requires +5 volts and ground to be organized such that different LEDs can be selected.
Title: Re: Computer Matrix Board
Post by: GregO on September 16, 2007, 05:34:55 PM
Jon!
Thanks for the call and straightening me out.  I'll put it together as soon as I get it back and let you know how it works.

Thanks again!
GregO
Title: Re: Computer Matrix Board
Post by: GregO on September 17, 2007, 07:03:16 PM
Jon,
Here is the latest as I understand it.  The guy loved the demo.  Hurray!  I'll pick that up in the morning and fix it after work tomorrow.  But as I understand it now he wants 4 boards total ---2 with the 30 LED's and 2 half the size.  This is what I gleaned from the phone conversation I had with them earlier.  He has some issues with the color of the LED's on the demo board, so I'll have to build 4 new boards.  The long and the short of it is---I'll get the details in the morning.  Just thought you'd like an update.

Thanks!
GregO
Title: Re: Computer Matrix Board
Post by: JonnyMac on September 17, 2007, 07:16:38 PM
Congrats, Greg!  Remember to wire the new boards to the Px terminals so that you have proper control of the LEDs.  Since two pins are open you can add a trigger and also a speed control using the POT instruction.  Here's the schematic for the Prop-Pot:

(http://www.efx-tek.com/files/pot_circuit.png)
Title: Re: Computer Matrix Board
Post by: GregO on September 18, 2007, 07:35:43 AM
Morning Jon,
Picked the demo unit up this morning and had a few minutes to make the connection adjustments.  The speed control works and most of the LED's light up, some more that one at a time, a few not at all.  My assumption is the the ULN2003 is damaged (no smoke, but got very hot) because of the demo hook up that I finagled out of it.  I will replace the ULN this evening at home and hope that takes care of it--I'll let you know.  Then it's off to the races to create 2 control panels.  Thanks again for the help!

GregO
Title: Re: Computer Matrix Board
Post by: JonnyMac on September 18, 2007, 07:48:39 AM
If you put another ULN into the same circuit it will break too....

Patient: It hurts when I do this.
Doctor: Don't do that.
Title: Re: Computer Matrix Board
Post by: GregO on September 18, 2007, 01:20:13 PM
Jon,
I corrected the connections from the outputs to the "W" line on the TTL pins as instructed and the unit seems to work.  I tested the output side of the ULN and have 1 dead and lots of varying voltages on the others. 

When I demoed it I had the wires to the outputs and back fed from the Vss terminal to 1 of the outputs just to get some blinking action, doing this I believe damaged the ULN.

My first step in debugging it will be to replace the ULN. Second step will be to check the LED's to make sure that they are not burned out, then check the solder connections and make sure they are not shorted. 

All this of course won't happen until I get home tonight!

Thanks!

GregO
Title: Re: Computer Matrix Board
Post by: GregO on September 18, 2007, 01:23:58 PM
Oops!

Vss means V+ !!!!

GregO
Title: Re: Computer Matrix Board
Post by: JonnyMac on September 18, 2007, 01:54:30 PM
Let me try this again... in the Charlie-plexing scheme the ULN is not used.  At all.  Period.  The LED that's on is driven by setting two I/O pins (the Px.W pins) to output mode with one high (anode side of LED) and one low (cathode side of LED) -- all other I/O pins are made inputs.

You will never see a voltage out of the ULN; it either floats or connects to ground.  The proper way to test the ULN output is to put a volt meter between V+ and an OUTx terminal that is on; you should read your system voltage.  When the OUTx terminal is off, the meter will read nothing -- as if you disconnected the negative side of the circuit (which is what the ULN does).
Title: Re: Computer Matrix Board
Post by: GregO on September 18, 2007, 02:34:13 PM
Jon,
Thanks for the clarification, sorry to be so..... I'll check my wiring and LED's to see why they are lighting odd and forget the ULN.  I'm using 12 volts, could it be that I need more juice?

GregO
Title: Re: Computer Matrix Board
Post by: JonnyMac on September 18, 2007, 04:26:05 PM
No.  The Charlie-plexing arrangement only lights one LED at a time; the Prop-1 can handle that.  If you need multiple LEDs working at once, then you're going to need additional external hardware to create a matrix.
Title: Re: Computer Matrix Board
Post by: GregO on September 18, 2007, 04:59:27 PM
Jon,
I understand that the charlieplexing will only light 1 led at a time.  Are the TTL pins supposed to be active when the Prop-1 switch is in the "1" position?  I am in the process of examining my soldering on the led's, obviously something is not correct there because I'm getting multiple led's lit at the same time at varying degrees of brightness.  They swith to fast to keep track of them, but I notice that the block of D29 and D30 do not seem to light at all.  I have switched to another Prop-1 that I have and it does the same.

GregO
Title: Re: Computer Matrix Board
Post by: JonnyMac on September 18, 2007, 05:15:12 PM
Yes, the TTL outputs (5v) are available in positions 1 and 2 of the power switch; the Px connects to the output pins of the processor (through a 220-ohm reistor).

Please post you code -- you may just need a PAUSE in the loop somewhere.
Title: Re: Computer Matrix Board
Post by: GregO on September 18, 2007, 05:20:57 PM
I am using the your program for the charlieplexing.  I have not altered it just copied it into the unit with the editor of course.

GregO
Title: Re: Computer Matrix Board
Post by: GregO on September 18, 2007, 05:35:20 PM
I'm pretty sure that my solder job is a contributing factor, its pretty much a birdsnest.  see photo.

GregO
Title: Re: Computer Matrix Board
Post by: JonnyMac on September 18, 2007, 05:37:54 PM
Check your wiring carefully, then write test code that lights one LED at a time -- one should always test the constituent parts of a program before going for broke.
Title: Re: Computer Matrix Board
Post by: GregO on September 19, 2007, 05:36:11 AM
Jon,
I went over the wiring and found that I had 6 bad LED's and missed 2 connections.  I replaced and corrected and then looked at the program and realized that your Cylon 10 program only operated 10 of the LED's. 

I changed your numbers (see below) to include the rest of the LED's and now all the LED's light one at a time and "race" back and forth. 

The speed control works so I can adjust that easily.  I also removed the If Then trigger references too.

I beleive that due to nature of charlieplexing and how I soldered the LED's into the circuit, (The LED's are where I made ALL of the connections) is why some of the LED's light at less than full brightness in a random pattern.  This is not a displeasing side effect!  It gives the panel the appearance of "thinking". 

Is there a way to randomize the "race" (1 to 30 and 30 to 1)?  That combined with the "thinking" should really look cool.

Now to start building the new panels!

Thanks!

GregO


=========================================================================
'
'   File...... Cylon30.BS1 (star wars panelnew)
'   Purpose... 30 LED Cyclon-type display via Charlieplexing
'   Author.... Jon Williams, EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Modified.. Greg Owens
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Speed           = 7                     ' no ULN, remove SETUP
SYMBOL  Trigger         = PIN6                  ' SETUP = DN

SYMBOL  Leds            = PINS
SYMBOL  LedCtrl         = DIRS


' -----[ Constants ]-------------------------------------------------------

SYMBOL  Pressed         = 1
SYMBOL  NotPressed      = 0


' -----[ Variables ]-------------------------------------------------------

SYMBOL  theLed          = B2                    ' which LED is on
SYMBOL  pntr            = B3                    ' EEPROM pointer
SYMBOL  delay           = W5                    ' on-time for LED


' -----[ Initialization ]--------------------------------------------------

Reset:
  Leds = %00000000                              ' clear LEDs
  LedCtrl = %00000000                           ' disable outputs


' -----[ Program Code ]----------------------------------------------------

Main:


  FOR theLed = 1 TO 30
    GOSUB Set_Led
    GOSUB Speed_Delay
  NEXT

  FOR theLed = 30 TO 2 STEP -1
    GOSUB Set_Led
    GOSUB Speed_Delay
  NEXT

  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------

' Pass LED to light (1 to 30) in "theLed"

Set_Led:
  IF theLed > 30 THEN Set_Led_Exit              ' bad LED #
    LedCtrl = %00000000                         ' disable LEDs
    pntr = theLed - 1 * 2                       ' point into table
    READ pntr, Leds                             ' get LED pins
    pntr = pntr + 1
    READ pntr, LedCtrl                          ' get control pins

Set_Led_Exit:
  RETURN

' -------------------------------------------------------------------------

' Use Prop-Pot to control speed

Speed_Delay:
  POT Speed, 110, delay
  delay = delay * 4                             ' scale to ~1 sec max
  PAUSE delay
  RETURN


' -----[ EEPROM Data ]-----------------------------------------------------

Charlieplexed_Leds:

'            PINS       DIRS
'
  EEPROM (%00000001, %00000011)                 ' LED 1
  EEPROM (%00000010, %00000011)                 ' LED 2
  EEPROM (%00000001, %00000101)                 ' LED 3
  EEPROM (%00000100, %00000101)                 ' LED 4
  EEPROM (%00000001, %00001001)                 ' LED 5
  EEPROM (%00001000, %00001001)                 ' LED 6
  EEPROM (%00000001, %00010001)                 ' LED 7
  EEPROM (%00010000, %00010001)                 ' LED 8
  EEPROM (%00000001, %00100001)                 ' LED 9
  EEPROM (%00100000, %00100001)                 ' LED 10
  EEPROM (%00000010, %00000110)                 ' LED 11
  EEPROM (%00000100, %00000110)                 ' LED 12
  EEPROM (%00000010, %00001010)                 ' LED 13
  EEPROM (%00001000, %00001010)                 ' LED 14
  EEPROM (%00000010, %00010010)                 ' LED 15
  EEPROM (%00010000, %00010010)                 ' LED 16
  EEPROM (%00000010, %00100010)                 ' LED 17
  EEPROM (%00100000, %00100010)                 ' LED 18
  EEPROM (%00000100, %00001100)                 ' LED 19
  EEPROM (%00001000, %00001100)                 ' LED 20
  EEPROM (%00000100, %00010100)                 ' LED 21
  EEPROM (%00010000, %00010100)                 ' LED 22
  EEPROM (%00000100, %00100100)                 ' LED 23
  EEPROM (%00100000, %00100100)                 ' LED 24
  EEPROM (%00001000, %00011000)                 ' LED 25
  EEPROM (%00010000, %00011000)                 ' LED 26
  EEPROM (%00001000, %00101000)                 ' LED 27
  EEPROM (%00100000, %00101000)                 ' LED 28
  EEPROM (%00010000, %00110000)                 ' LED 29
  EEPROM (%00100000, %00110000)                 ' LED 30
Title: Re: Computer Matrix Board
Post by: JonnyMac on September 19, 2007, 09:07:24 AM
Sure, selecting a random LED is easy using my standard random value (lottery) and modulus operator (//) trick:

' =========================================================================
'
'   File...... Random_Charlie.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Speed           = 7                     ' no ULN, remove SETUP
SYMBOL  Trigger         = PIN6                  ' SETUP = DN

SYMBOL  Leds            = PINS
SYMBOL  LedCtrl         = DIRS


' -----[ Constants ]-------------------------------------------------------

SYMBOL  Pressed         = 1
SYMBOL  NotPressed      = 0


' -----[ Variables ]-------------------------------------------------------

SYMBOL  theLed          = B2                    ' which LED is on
SYMBOL  pntr            = B3                    ' EEPROM pointer
SYMBOL  delay           = W4                    ' on-time for LED
SYMBOL  lottery         = W5                    ' random value


' -----[ Initialization ]--------------------------------------------------

Reset:
  Leds = %00000000                              ' clear LEDs
  LedCtrl = %00000000                           ' disable outputs


  ' -----[ Program Code ]----------------------------------------------------

Main:
  RANDOM lottery
  IF Trigger = NotPressed THEN Main             ' wait for trigger

  theLed = lottery // 30 + 1                    ' make 1 to 30
  GOSUB Set_Led
  GOSUB Speed_Delay

  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------

' Pass LED to light (1 to 30) in "theLed"

Set_Led:
  IF theLed < 1 OR theLed > 30 THEN Led_Exit    ' test for bad LED #
    LedCtrl = %00000000                         ' disable LEDs
    pntr = theLed - 1 * 2                       ' point into table
    READ pntr, Leds                             ' get LED pins
    pntr = pntr + 1
    READ pntr, LedCtrl                          ' get control pins

Led_Exit:
  RETURN

' -------------------------------------------------------------------------

' Use Prop-Pot to control speed

Speed_Delay:
  POT Speed, 110, delay                         ' read speed pot
  delay = delay * 4                             ' scale to ~1 sec max
  PAUSE delay
  RETURN


' -----[ EEPROM Data ]-----------------------------------------------------

Charlieplexed_Leds:

'            PINS       DIRS
'
  EEPROM (%00000001, %00000011)                 ' LED 1
  EEPROM (%00000010, %00000011)                 ' LED 2
  EEPROM (%00000001, %00000101)                 ' LED 3
  EEPROM (%00000100, %00000101)                 ' LED 4
  EEPROM (%00000001, %00001001)                 ' LED 5
  EEPROM (%00001000, %00001001)                 ' LED 6
  EEPROM (%00000001, %00010001)                 ' LED 7
  EEPROM (%00010000, %00010001)                 ' LED 8
  EEPROM (%00000001, %00100001)                 ' LED 9
  EEPROM (%00100000, %00100001)                 ' LED 10
  EEPROM (%00000010, %00000110)                 ' LED 11
  EEPROM (%00000100, %00000110)                 ' LED 12
  EEPROM (%00000010, %00001010)                 ' LED 13
  EEPROM (%00001000, %00001010)                 ' LED 14
  EEPROM (%00000010, %00010010)                 ' LED 15
  EEPROM (%00010000, %00010010)                 ' LED 16
  EEPROM (%00000010, %00100010)                 ' LED 17
  EEPROM (%00100000, %00100010)                 ' LED 18
  EEPROM (%00000100, %00001100)                 ' LED 19
  EEPROM (%00001000, %00001100)                 ' LED 20
  EEPROM (%00000100, %00010100)                 ' LED 21
  EEPROM (%00010000, %00010100)                 ' LED 22
  EEPROM (%00000100, %00100100)                 ' LED 23
  EEPROM (%00100000, %00100100)                 ' LED 24
  EEPROM (%00001000, %00011000)                 ' LED 25
  EEPROM (%00010000, %00011000)                 ' LED 26
  EEPROM (%00001000, %00101000)                 ' LED 27
  EEPROM (%00100000, %00101000)                 ' LED 28
  EEPROM (%00010000, %00110000)                 ' LED 29
  EEPROM (%00100000, %00110000)                 ' LED 30


Note: If you leave the ULN installed you can get more than one LED on -- when not expected.  The reason for this is that the input to the ULN is about an 8K path to ground (this design keeps the ULN off unless specifically driven on) -- this resistance may allow an LED to light dimly (I saw this when I plugged a small Charlie-plex circuit into a Prop-1 that still had the ULN installed).
Title: Re: Computer Matrix Board
Post by: GregO on September 19, 2007, 03:13:55 PM
Jon!!!!
Thank you!!!! this is the effect I am looking for!!!
A couple of other questions....
With the switch in the 2 position there is voltage at the V+ and ground, would it be detrimental to the unit to power some non-controled LED's from there?  Just some that are steady on?
and
would the program be flexible enough to do a period of time in random mode then switch to the cylon race mode and then back again, say 30 seconds each?

Thanks!

GregO
Title: Re: Computer Matrix Board
Post by: GregO on September 21, 2007, 05:43:33 PM
Jon,
Thanks for your help and timely response to all of my questions.

GregO
Title: Re: Computer Matrix Board
Post by: JonnyMac on September 21, 2007, 05:53:54 PM
Greg,

Sorry I missed the questions from above. Yes, you can use V+/GND to power external devices -- no harm to the Charlie-plexing process.  Here's another version of your program that alternates between a random output and cyclon-style display.

' =========================================================================
'
'   File...... Random_Charlie_Cylon.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Speed           = 7                     ' no ULN, remove SETUP
SYMBOL  Trigger         = PIN6                  ' SETUP = DN

SYMBOL  Leds            = PINS
SYMBOL  LedCtrl         = DIRS


' -----[ Constants ]-------------------------------------------------------

SYMBOL  Pressed         = 1
SYMBOL  NotPressed      = 0


' -----[ Variables ]-------------------------------------------------------

SYMBOL  theLed          = B2                    ' which LED is on
SYMBOL  last            = B3                    ' last LED lit
SYMBOL  pntr            = B4                    ' EEPROM pointer
SYMBOL  cycles          = B5                    ' # of random cycles
SYMBOL  delay           = W4                    ' on-time for LED
SYMBOL  lottery         = W5                    ' random value


' -----[ Initialization ]--------------------------------------------------

Reset:
  Leds = %00000000                              ' clear LEDs
  LedCtrl = %00000000                           ' disable outputs


  ' -----[ Program Code ]----------------------------------------------------

Main:
  RANDOM lottery
  IF Trigger = NotPressed THEN Main             ' wait for trigger

  cycles = 0

Random_Leds:
  theLed = lottery // 30 + 1                    ' make 1 to 30
  IF theLed = last THEN Main
    last = theLed
  GOSUB Set_Led
  GOSUB Speed_Delay
  cycles = cycles + 1
  IF cycles < 30 THEN Random_Leds

  cycles = 0

Cylon_Leds:
  FOR theLed = 1 TO 30
    GOSUB Set_Led
    GOSUB Speed_Delay
  NEXT
  FOR theLed = 30 TO 1 STEP -1
    GOSUB Set_Led
    GOSUB Speed_Delay
  NEXT
  cycles = cycles + 1
  IF cycles < 2 THEN Cylon_Leds

  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------

' Pass LED to light (1 to 30) in "theLed"

Set_Led:
  IF theLed < 1 OR theLed > 30 THEN Led_Exit    ' test for bad LED #
    LedCtrl = %00000000                         ' disable LEDs
    pntr = theLed - 1 * 2                       ' point into table
    READ pntr, Leds                             ' get LED pins
    pntr = pntr + 1
    READ pntr, LedCtrl                          ' get control pins

Led_Exit:
  RETURN

' -------------------------------------------------------------------------

' Use Prop-Pot to control speed

Speed_Delay:
  POT Speed, 110, delay                         ' read speed pot
  delay = delay * 4                             ' scale to ~1 sec max
  PAUSE delay
  RETURN


' -----[ EEPROM Data ]-----------------------------------------------------

Charlieplexed_Leds:

'            PINS       DIRS
'
  EEPROM (%00000001, %00000011)                 ' LED 1
  EEPROM (%00000010, %00000011)                 ' LED 2
  EEPROM (%00000001, %00000101)                 ' LED 3
  EEPROM (%00000100, %00000101)                 ' LED 4
  EEPROM (%00000001, %00001001)                 ' LED 5
  EEPROM (%00001000, %00001001)                 ' LED 6
  EEPROM (%00000001, %00010001)                 ' LED 7
  EEPROM (%00010000, %00010001)                 ' LED 8
  EEPROM (%00000001, %00100001)                 ' LED 9
  EEPROM (%00100000, %00100001)                 ' LED 10
  EEPROM (%00000010, %00000110)                 ' LED 11
  EEPROM (%00000100, %00000110)                 ' LED 12
  EEPROM (%00000010, %00001010)                 ' LED 13
  EEPROM (%00001000, %00001010)                 ' LED 14
  EEPROM (%00000010, %00010010)                 ' LED 15
  EEPROM (%00010000, %00010010)                 ' LED 16
  EEPROM (%00000010, %00100010)                 ' LED 17
  EEPROM (%00100000, %00100010)                 ' LED 18
  EEPROM (%00000100, %00001100)                 ' LED 19
  EEPROM (%00001000, %00001100)                 ' LED 20
  EEPROM (%00000100, %00010100)                 ' LED 21
  EEPROM (%00010000, %00010100)                 ' LED 22
  EEPROM (%00000100, %00100100)                 ' LED 23
  EEPROM (%00100000, %00100100)                 ' LED 24
  EEPROM (%00001000, %00011000)                 ' LED 25
  EEPROM (%00010000, %00011000)                 ' LED 26
  EEPROM (%00001000, %00101000)                 ' LED 27
  EEPROM (%00100000, %00101000)                 ' LED 28
  EEPROM (%00010000, %00110000)                 ' LED 29
  EEPROM (%00100000, %00110000)                 ' LED 30



Title: Re: Computer Matrix Board
Post by: GregO on September 22, 2007, 06:31:54 AM
Jon,
Once again you have come through for me, Thank you! The changing back and forth looks really cool on my test board.  Now to finish the 2 control boards for the Mouse.

Thank you again, I'll post pictures and stuff when completed.

I do have another question about the physical adjustment if necessary. 

If I needed to Charlieplex less than 30 leds (you mentioned that your test board was 15 leds) do I just eliminate from the longest string in this order D9, D10 then D17, D18 then ...?  What is the process to keep them balanced?

Thanks!
GregO
Title: Re: Computer Matrix Board
Post by: JonnyMac on September 22, 2007, 08:18:13 AM
Glad it all worked.

You don't need to keep things "balanced" -- they're just outputs (and you're not going to wear them out).  In order to keep the software the same, start by eliminating D30, then D29, etc.
Title: Re: Computer Matrix Board
Post by: GregO on September 24, 2007, 05:10:54 AM
Jon!
Panels are completed and delivered!  Thank you for your help!  The attached photo shows both left and right.  The left one is just "on"  12 leds attached to a power supply.  The right panel is more detailed with 30 "charlieplexed" leds running the combo program.  They look pretty darn good.  I delivered them last night to the stage company and they will age and install them. 

Duh Duh da da da duh duh!  Use the farce Luke!

Thanks again!

GregO
Title: Re: Computer Matrix Board
Post by: JonnyMac on September 24, 2007, 07:39:27 AM
Cool!  Congrats, Greg.
Title: Re: Computer Matrix Board
Post by: GregO on October 13, 2007, 04:10:05 PM
Hey Jon!
I have a new question for programming the demo board I made for this.  I am using the program that has the random sequence and the cylon sequence in it, what would I have to add to the program to get a perpendicular cylon sequence.  The LED's are laid out in a 6 across by 5 down grid, from the back looking at them they are:

D1   D2  D3   D4   D5   D6
D7   D8  D9   D10 D11 D12
D13 D14 D15 D16 D17 D18
D19 D20 D21 D22 D23 D24
D25 D26 D27 D28 D29 D30

Perpendicular sequence would be in order D1,D7,D13,D19,D25, D26,D20,D14,D8,D2 and so on backwards and forwards.

Is there enough room to add?

Thanks!

GregO
Title: Re: Computer Matrix Board
Post by: JonnyMac on October 13, 2007, 04:59:31 PM
Give this a try:

' =========================================================================
'
'   File...... Cylon30_v2.BS1 (star wars panelnew)
'   Purpose... 30 LED Cyclon-type display via Charlieplexing
'   Author.... Jon Williams, EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Modified.. Greg Owens
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Speed           = 7                     ' no ULN, remove SETUP
SYMBOL  Trigger         = PIN6                  ' SETUP = DN

SYMBOL  Leds            = PINS
SYMBOL  LedCtrl         = DIRS


' -----[ Constants ]-------------------------------------------------------

SYMBOL  Pressed         = 1
SYMBOL  NotPressed      = 0


' -----[ Variables ]-------------------------------------------------------

SYMBOL  theLed          = B2                    ' which LED is on
SYMBOL  pntr            = B3                    ' EEPROM pointer
SYMBOL  idx             = B4                    ' loop index
SYMBOL  addr            = B5                    ' eeprom address
SYMBOL  delay           = W5                    ' on-time for LED


' -----[ Initialization ]--------------------------------------------------

Reset:
  Leds = %00000000                              ' clear LEDs
  LedCtrl = %00000000                           ' disable outputs


' -----[ Program Code ]----------------------------------------------------

Main:
  FOR theLed = 1 TO 30
    GOSUB Set_Led
    GOSUB Speed_Delay
  NEXT

Hori_Backward:
  FOR theLed = 30 TO 1 STEP -1
    GOSUB Set_Led
    GOSUB Speed_Delay
  NEXT

Vert_Forward:
  FOR idx = 0 TO 29
    addr = $3C + idx
    READ addr, theLed
    GOSUB Set_Led
    GOSUB Speed_Delay
  NEXT

Vert_Backward:
  FOR idx = 29 TO 0 STEP -1
    addr = $3C + idx
    READ addr, theLed
    GOSUB Set_Led
    GOSUB Speed_Delay
  NEXT

  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------

' Pass LED to light (1 to 30) in "theLed"

Set_Led:
  IF theLed > 30 THEN Set_Led_Exit              ' bad LED #
    LedCtrl = %00000000                         ' disable LEDs
    pntr = theLed - 1 * 2                       ' point into table
    READ pntr, Leds                             ' get LED pins
    pntr = pntr + 1
    READ pntr, LedCtrl                          ' get control pins

Set_Led_Exit:
  RETURN

' -------------------------------------------------------------------------

' Use Prop-Pot to control speed

Speed_Delay:
  POT Speed, 110, delay
  delay = delay * 4                             ' scale to ~1 sec max
  PAUSE delay
  RETURN

' -----[ EEPROM Data ]-----------------------------------------------------

Charlieplexed_Leds:

'            PINS       DIRS
'
  EEPROM (%00000001, %00000011)                 ' LED 1
  EEPROM (%00000010, %00000011)                 ' LED 2
  EEPROM (%00000001, %00000101)                 ' LED 3
  EEPROM (%00000100, %00000101)                 ' LED 4
  EEPROM (%00000001, %00001001)                 ' LED 5
  EEPROM (%00001000, %00001001)                 ' LED 6
  EEPROM (%00000001, %00010001)                 ' LED 7
  EEPROM (%00010000, %00010001)                 ' LED 8
  EEPROM (%00000001, %00100001)                 ' LED 9
  EEPROM (%00100000, %00100001)                 ' LED 10
  EEPROM (%00000010, %00000110)                 ' LED 11
  EEPROM (%00000100, %00000110)                 ' LED 12
  EEPROM (%00000010, %00001010)                 ' LED 13
  EEPROM (%00001000, %00001010)                 ' LED 14
  EEPROM (%00000010, %00010010)                 ' LED 15
  EEPROM (%00010000, %00010010)                 ' LED 16
  EEPROM (%00000010, %00100010)                 ' LED 17
  EEPROM (%00100000, %00100010)                 ' LED 18
  EEPROM (%00000100, %00001100)                 ' LED 19
  EEPROM (%00001000, %00001100)                 ' LED 20
  EEPROM (%00000100, %00010100)                 ' LED 21
  EEPROM (%00010000, %00010100)                 ' LED 22
  EEPROM (%00000100, %00100100)                 ' LED 23
  EEPROM (%00100000, %00100100)                 ' LED 24
  EEPROM (%00001000, %00011000)                 ' LED 25
  EEPROM (%00010000, %00011000)                 ' LED 26
  EEPROM (%00001000, %00101000)                 ' LED 27
  EEPROM (%00100000, %00101000)                 ' LED 28
  EEPROM (%00010000, %00110000)                 ' LED 29
  EEPROM (%00100000, %00110000)                 ' LED 30


Vert_Sequnce:
  EEPROM (1,  7, 13, 19, 25)                    ' start is at $3C
  EEPROM (2,  8, 14, 20, 26)
  EEPROM (3,  9, 15, 21, 27)
  EEPROM (4, 10, 16, 22, 28)
  EEPROM (5, 11, 17, 23, 29)
  EEPROM (6, 12, 18, 24, 30)