Home  |  Contents 
Microcontroller and PC projects
  Forum Index : Microcontroller and PC projects         Section
Subject Topic: APA 102 LED Strip Post ReplyPost New Topic
Page of 2 Next >>
Author
Message << Prev Topic | Next Topic >>
Bill.b
Senior Member
Senior Member
Avatar

Joined: 25 June 2011
Location: Australia
Online Status: Offline
Posts: 167
Posted: 01 February 2016 at 4:08am | IP Logged Quote Bill.b

Hi all

I have been playing with a 1m length of 60 APA 102 RGB leds for my Christmas
light displays.

Here is the program I have been using to test the LEDS. also a youtube
video of the results. The code is not pretty as it has been built up as I added different patterns and tried different ways to use the LEDs.

The beauty of the APA 102 LEDs are that they do not require any Cfunction code.

The APA 102 require a 5v supply but the clock and data inputs work quite well on 3.3v
from the PICMX170.

https://www.youtube.com/watch?v=IRmtGD0kJVo


 'Test Program for APA102 60 RGB LED Strip
  Option autorun on
  Option DEFAULT NONE
  cpu 48
 ' Option EXPLICIT
  randomize timer
  Dim integer count, count1, rndnum, loopcnt, indexcount
  Dim INTEGER NUMLEDS=60
  Dim integer buffer(183)
  Dim integer red1, red
  Dim integer green1, green
  Dim integer blue1, blue
  SPI open 5000000, 3,8
  For count = 0 To 180  'Reset all LED to OFF
    buffer(count) = 0
  Next count
  sendLED
  Pause 100
  
  main
  
Sub app102Head    ' Send the start of data header
  SPI write 4, &H00,&H00,&H00,&H00
End Sub
  
Sub app102tail   'Send the end of data tail
  SPI write 4, &HFF,&HFF,&HFF,&HFF
End Sub
  
Sub main
  Do
  for count1 = 1 to 6
  getcolour         'set colour randomly
        'Flash all leds 
    For count = 0 To 178 Step 3
      buffer(count) = Red   'RED
      buffer(count+1) = green  'Green
      buffer(count+2) = blue    'Blue
    Next count
    sendLED
     Pause 1000
next count1
    Pause 1000
    
    For count = 0 To 180 'turn all leds OFF
      buffer(count) = 0
    Next count
    sendLED
    getcolour       'set colour randomly
    for loopcnt = 1 to 4
    For count1 = 0 To 178 Step 3
      buffer(count1) = red
      buffer(count1+1) = green
      buffer(count1+2) = blue
      sendLED
      Pause 20
    Next count1
     getcolour
    
    For count1 = 183 To 2 Step -3
      buffer(count1-2) = red
      buffer(count1-1) = green
      buffer(count1) = blue
      sendLED
      Pause 10
    Next count1
    next loopcnt
    pause 1000
    For count = 0 To 180  'Reset all LED to OFF
      buffer(count) = 0
    Next count
    sendLED
    '   Random display
    Pause 100
    for count1 = 1 to 150         'repeat random lights 150 times
      for count = 0 to 5
        rndnum = Int(RND()*180)+1           'Set array size and set data - Number of LEDs * 3
        Buffer(rndnum) = count * 10 and 10  'Set Brightness of LED
      next count
      sendLED
      pause 100
    next count1
    sendLED
    pause 900
    'Kit scanner
    For count = 0 To 183    'turn all leds OFF
      buffer(count) = 0
    Next count
    sendLED
    for loopcnt = 1 to 2
      for count1 = 5 to 180 step 3     'Run the Red LED from end to end and return
            Buffer(count1) = 30
        sendLED 
               Buffer(count1-3) = 0
        sendLED 
      next count1
      for count1 = 179 to 0 step -3    
        Buffer(count1) = 30
        sendLED 
        Buffer(count1+3) = 0
        sendLED 
      next count1
    next loopcnt
    pause 10
    for count1 = 1 to 12
    for loopcnt = 0 to 179
    read buffer(loopcnt)
    next loopcnt
    sendLED 
    pause 50
    next count1
    pause 2000
    restore
    
    
     For count = 0 To 183    'turn all leds OFF
      buffer(count) = 0
    Next count
    sendLED
      For count = 0 To 183  step 3  'turn all leds OFF
      buffer(count) = 1
    Next count
    sendLED
     indexcount = 180
     for loopcnt = 1 to 60
        for count1 = 5 to indexcount step 3     'Run the Red LED from end to end and return
          Buffer(count1) = 30
          sendLED 
          Buffer(count1-3) = 0
          sendLED 
        next count1
        indexcount = indexcount -3
      next loopcnt
      
          For count = 0 To 180    'turn all leds OFF
      buffer(count) = 0
    Next count
    sendLED
      For count = 0 To 180  step 3  'turn all leds OFF
      buffer(count+2) = 1
    Next count
    sendLED
     indexcount = 180
     for loopcnt = 1 to 60
        for count1 = 4 to indexcount step 3     'Run the Red LED from end to end and return
          Buffer(count1) = 30
          sendLED 
          Buffer(count1-3) = 0
          sendLED 
        next count1
        indexcount = indexcount -3
      next loopcnt
      
  Loop
  
Sub sendLED             ' Send a LED controlling command
  app102head
  For count = 0 To 178 Step 3
    red1 = buffer(count)
    green1 = buffer(count + 1)
    blue1 = buffer(count + 2)
    SPI write 4, &HFF, red1, green1, blue1
  Next count
  app102tail
End Sub

'get random colour
  sub getcolour
      red = Int(RND()*5)+1
     red = red * 10 and 10
      green = Int(RND()*5)+1
     green = green * 10 and 10
      blue = Int(RND()*5)+1
     blue = blue * 10 and 10
  end sub

        ' Data for LED strip   00 = OFF   255 = Max ON   30 is normal brightness                   LED Number
  
     '| B  G  R| B  G  R |B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R|    
  data 30,00,00,00,30,00,00,00,30,30,00,00,00,30,00,00,00,30,00,00,00,00,00,00,00,00,00,00,00,00  ' 1 to 10
  data 30,00,00,00,30,00,00,00,30,30,00,00,00,30,00,00,00,30,00,00,00,00,00,00,00,00,00,00,00,00  ' 11 to 20
  data 30,00,00,00,30,00,00,00,30,30,00,00,00,30,00,00,00,30,00,00,00,00,00,00,00,00,00,00,00,00  ' 21 to 30 
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30  ' 31 to 40
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30  ' 41 to 50
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30  ' 51 to 60
  
    '| B  G  R| B  G  R |B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R|    
  data 00,00,30,30,00,00,00,30,00,00,00,30,30,00,00,00,30,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 1 to 10
  data 00,00,30,30,00,00,00,30,00,00,00,30,30,00,00,00,30,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 11 to 20
  data 00,00,30,30,00,00,00,30,00,00,00,30,30,00,00,00,30,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 21 to 30 
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,00,00,00  ' 31 to 40
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,00,00,00  ' 41 to 50
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,00,00,00  ' 51 to 60
  
     '| B  G  R| B  G  R |B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R|    
  data 00,30,00,00,00,30,30,00,00,00,30,00,00,00,30,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 1 to 10
  data 00,30,00,00,00,30,30,00,00,00,30,00,00,00,30,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 11 to 20
  data 00,30,00,00,00,30,30,00,00,00,30,00,00,00,30,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 21 to 30 
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,00,00,00,00,00,00  ' 31 to 40
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,00,00,00,00,00,00  ' 41 to 50
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,00,00,00,00,00,00  ' 51 to 60
  
     '| B  G  R| B  G  R |B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R|    
  data 00,30,00,00,00,30,30,00,00,00,30,00,00,00,30,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 1 to 10
  data 00,30,00,00,00,30,30,00,00,00,30,00,00,00,30,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 11 to 20
  data 00,30,00,00,00,30,30,00,00,00,30,00,00,00,30,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 21 to 30 
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,00,00,00,00,00,00,00,00,00  ' 31 to 40
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,00,00,00,00,00,00,00,00,00  ' 41 to 50
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,00,00,00,00,00,00,00,00,00  ' 51 to 60
  
     '| B  G  R| B  G  R |B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R|    
  data 00,00,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 1 to 10
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 11 to 20
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30  ' 21 to 30 
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 31 to 40
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 41 to 50
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30  ' 51 to 60
  
    '| B  G  R| B  G  R |B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R|    
  data 00,00,30,00,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 1 to 10
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 11 to 20
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,00,00,30  ' 21 to 30 
  data 00,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 31 to 40
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 41 to 50
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,00,00,30  ' 51 to 60
  
     '| B  G  R| B  G  R |B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R|    
  data 00,00,30,00,30,00,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 1 to 10
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 11 to 20
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,00,00,30,00,00,00,30  ' 21 to 30 
  data 00,30,00,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 31 to 40
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 41 to 50
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,00,00,30,00,00,00,30  ' 51 to 60
  
     '| B  G  R| B  G  R |B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R|    
  data 00,00,30,00,30,00,30,00,00,00,30,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 1 to 10
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 11 to 20
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,30,30,00,00,00,30,00,00,00,30  ' 21 to 30 
  data 00,30,00,30,00,00,00,03,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 31 to 40
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 41 to 50
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,30,30,00,00,00,30,00,00,00,30  ' 51 to 60
  
     '| B  G  R| B  G  R |B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R|    
  data 00,00,30,00,30,00,30,00,00,00,30,30,30,00,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 1 to 10
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 11 to 20
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,30,00,00,00,30,00,00,00,30  ' 21 to 30 
  data 00,30,00,30,00,00,00,03,30,30,00,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 31 to 40
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 41 to 50
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,30,00,00,00,30,00,00,00,30  ' 51 to 60
  
     '| B  G  R| B  G  R |B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R|    
  data 00,00,30,00,30,00,30,00,00,00,30,30,30,00,30,30,30,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 1 to 10
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 11 to 20
  data 00,00,00,00,00,00,00,00,00,00,00,00,30,30,00,30,00,30,00,30,30,30,00,00,00,30,00,00,00,30  ' 21 to 30 
  data 00,30,00,30,00,00,00,03,30,30,00,30,30,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 31 to 40
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 41 to 50
  data 00,00,00,00,00,00,00,00,00,00,00,00,30,30,00,30,00,30,00,30,30,30,00,00,00,30,00,00,00,30  ' 51 to 60
  
    '| B  G  R| B  G  R |B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R|    
  data 00,00,30,00,30,00,30,00,00,00,30,30,30,00,30,30,30,00,30,30,30,00,00,00,00,00,00,00,00,00  ' 1 to 10
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 11 to 20
  data 00,00,00,00,00,00,00,00,00,30,30,30,30,30,00,30,00,30,00,30,30,30,00,00,00,30,00,00,00,30  ' 21 to 30 
  data 00,30,00,30,00,00,00,03,30,30,00,30,30,30,00,30,30,30,00,00,00,00,00,00,00,00,00,00,00,00  ' 31 to 40
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 41 to 50
  data 00,00,00,00,00,00,00,00,00,30,30,30,30,30,00,30,00,30,00,30,30,30,00,00,00,30,00,00,00,30  ' 51 to 60
  
     '| B  G  R| B  G  R |B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R| B  G  R|    
  data 00,00,30,00,30,00,30,00,00,00,30,30,30,00,30,30,30,00,30,30,30,10,10,20,30,00,10,00,00,00  ' 1 to 10
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 11 to 20
  data 00,00,00,30,00,10,10,10,20,30,30,30,30,30,00,30,00,30,00,30,30,30,00,00,00,30,00,00,00,30  ' 21 to 30 
  data 00,30,00,30,00,00,00,30,30,30,00,30,30,30,00,30,30,30,10,10,20,30,00,10,00,00,00,00,00,00  ' 31 to 40
  data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00  ' 41 to 50
  data 00,00,00,30,00,10,10,10,20,30,30,30,30,30,00,30,00,30,00,30,30,30,00,00,00,30,00,00,00,30  ' 51 to 60









The 100r resistors are to protect the inputs of the 170 if a fault develops in the LEDS.

Bill




Edited by Bill.b on 01 February 2016 at 4:30am


__________________
"It always seems imposible until it's done" Nelson Mandela



Back to Top View Bill.b's Profile Search for other posts by Bill.b
 
Frank N. Furter
Guru
Guru


Joined: 28 May 2012
Location: Germany
Online Status: Offline
Posts: 316
Posted: 01 February 2016 at 6:55am | IP Logged Quote Frank N. Furter

VERY NICE!

It's very impressive!

Frank
Back to Top View Frank N. Furter's Profile Search for other posts by Frank N. Furter
 
cicciocb
Newbie
Newbie


Joined: 29 April 2014
Location: France
Online Status: Offline
Posts: 32
Posted: 01 February 2016 at 10:53am | IP Logged Quote cicciocb

Hello,
theoretically even the WS2812B can be driven with the SPI; it's more tricky but is how I did in another project.
However I don't know if this will be possible with the micromite.

Cicciocb
Back to Top View cicciocb's Profile Search for other posts by cicciocb
 
Bill.b
Senior Member
Senior Member
Avatar

Joined: 25 June 2011
Location: Australia
Online Status: Offline
Posts: 167
Posted: 01 February 2016 at 11:20am | IP Logged Quote Bill.b

Hi Cicciocb

The ws2812b are not true SPI as they only require a single data line.
The data has to be loaded at a frequency of 800kHz, difficult for MMbasic
to do with out using a cFunction to control the timers.

See the post

http://www.thebackshed.com/forum/forum_posts.asp?TID=7420&PN=1

Bill

__________________
"It always seems imposible until it's done" Nelson Mandela
Back to Top View Bill.b's Profile Search for other posts by Bill.b
 
cicciocb
Newbie
Newbie


Joined: 29 April 2014
Location: France
Online Status: Offline
Posts: 32
Posted: 01 February 2016 at 12:43pm | IP Logged Quote cicciocb

I know, it's the reason for why I said that is a little bit "tricky" to do.
if you put a SPI at 2.5MHz, you can cheat it.
Looking at the documentation of the WS2812B, the "0" and the "1" are simply pulses of 1.2us; the difference is that the "0" is a logic high for 0.4us and the "1" is a logic high for 0.8us.

So, taking this into account, you can consider that, with the SPI, one WS2812B bit can be composed of 3 SPI bits where the "0" is a sequence of "100" and the "1" is a sequence of "110".

As at 2.5Mhz of SPI, the each bit is 0.4us, you can do the job!

This means that a "WS2812B" byte can be "simulated" with 3 SPI bytes and, globally, you need 9 bytes per each led.

For sure, you don't require the CLK signal but only the DOUT.

I think it should work also for the micromite without requiring any cfunction.

Regards,
Cicciocb

Edited by cicciocb on 01 February 2016 at 12:46pm
Back to Top View cicciocb's Profile Search for other posts by cicciocb
 
viscomjim
Guru
Guru


Joined: 08 January 2014
Location: United States
Online Status: Offline
Posts: 817
Posted: 02 February 2016 at 7:52pm | IP Logged Quote viscomjim

Hi Billb, this is very nice. Thank you for posting. Just ordered some apa leds and will try when they arrive. Great Work!!!
Back to Top View viscomjim's Profile Search for other posts by viscomjim
 
lew247
Guru
Guru
Avatar

Joined: 23 December 2015
Location: United Kingdom
Online Status: Offline
Posts: 790
Posted: 30 October 2017 at 9:31am | IP Logged Quote lew247

Bill.b wrote:

' Data for LED strip 00 = OFF 255 = Max ON 30 is normal brightness LED Number

'| B G R| B G R |B G R| B G R| B G R| B G R| B G R| B G R| B G R| B G R|
data 30,00,00,00,30,00,00,00,30,30,00,00,00,30,00,00,00,30,00,00,00,00,00,00,00,00,00,00,00,00 ' 1 to 10
data 30,00,00,00,30,00,00,00,30,30,00,00,00,30,00,00,00,30,00,00,00,00,00,00,00,00,00,00,00,00 ' 11 to 20
data 30,00,00,00,30,00,00,00,30,30,00,00,00,30,00,00,00,30,00,00,00,00,00,00,00,00,00,00,00,00 ' 21 to 30
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30 ' 31 to 40
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30 ' 41 to 50
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30 ' 51 to 60

'| B G R| B G R |B G R| B G R| B G R| B G R| B G R| B G R| B G R| B G R|
data 00,00,30,30,00,00,00,30,00,00,00,30,30,00,00,00,30,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 1 to 10
data 00,00,30,30,00,00,00,30,00,00,00,30,30,00,00,00,30,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 11 to 20
data 00,00,30,30,00,00,00,30,00,00,00,30,30,00,00,00,30,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 21 to 30
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,00,00,00 ' 31 to 40
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,00,00,00 ' 41 to 50
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,00,00,00 ' 51 to 60

'| B G R| B G R |B G R| B G R| B G R| B G R| B G R| B G R| B G R| B G R|
data 00,30,00,00,00,30,30,00,00,00,30,00,00,00,30,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 1 to 10
data 00,30,00,00,00,30,30,00,00,00,30,00,00,00,30,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 11 to 20
data 00,30,00,00,00,30,30,00,00,00,30,00,00,00,30,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 21 to 30
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,00,00,00,00,00,00 ' 31 to 40
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,00,00,00,00,00,00 ' 41 to 50
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,00,00,00,00,00,00 ' 51 to 60

'| B G R| B G R |B G R| B G R| B G R| B G R| B G R| B G R| B G R| B G R|
data 00,30,00,00,00,30,30,00,00,00,30,00,00,00,30,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 1 to 10
data 00,30,00,00,00,30,30,00,00,00,30,00,00,00,30,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 11 to 20
data 00,30,00,00,00,30,30,00,00,00,30,00,00,00,30,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 21 to 30
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,00,00,00,00,00,00,00,00,00 ' 31 to 40
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,00,00,00,00,00,00,00,00,00 ' 41 to 50
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,00,00,00,00,00,00,00,00,00 ' 51 to 60

'| B G R| B G R |B G R| B G R| B G R| B G R| B G R| B G R| B G R| B G R|
data 00,00,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 1 to 10
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 11 to 20
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30 ' 21 to 30
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 31 to 40
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 41 to 50
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30 ' 51 to 60

'| B G R| B G R |B G R| B G R| B G R| B G R| B G R| B G R| B G R| B G R|
data 00,00,30,00,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 1 to 10
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 11 to 20
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,00,00,30 ' 21 to 30
data 00,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 31 to 40
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 41 to 50
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,00,00,30 ' 51 to 60

'| B G R| B G R |B G R| B G R| B G R| B G R| B G R| B G R| B G R| B G R|
data 00,00,30,00,30,00,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 1 to 10
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 11 to 20
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,00,00,30,00,00,00,30 ' 21 to 30
data 00,30,00,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 31 to 40
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 41 to 50
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,00,00,30,00,00,00,30 ' 51 to 60

'| B G R| B G R |B G R| B G R| B G R| B G R| B G R| B G R| B G R| B G R|
data 00,00,30,00,30,00,30,00,00,00,30,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 1 to 10
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 11 to 20
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,30,30,00,00,00,30,00,00,00,30 ' 21 to 30
data 00,30,00,30,00,00,00,03,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 31 to 40
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 41 to 50
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,30,30,00,00,00,30,00,00,00,30 ' 51 to 60

'| B G R| B G R |B G R| B G R| B G R| B G R| B G R| B G R| B G R| B G R|
data 00,00,30,00,30,00,30,00,00,00,30,30,30,00,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 1 to 10
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 11 to 20
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,30,00,00,00,30,00,00,00,30 ' 21 to 30
data 00,30,00,30,00,00,00,03,30,30,00,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 31 to 40
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 41 to 50
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,30,00,30,00,30,30,30,00,00,00,30,00,00,00,30 ' 51 to 60

'| B G R| B G R |B G R| B G R| B G R| B G R| B G R| B G R| B G R| B G R|
data 00,00,30,00,30,00,30,00,00,00,30,30,30,00,30,30,30,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 1 to 10
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 11 to 20
data 00,00,00,00,00,00,00,00,00,00,00,00,30,30,00,30,00,30,00,30,30,30,00,00,00,30,00,00,00,30 ' 21 to 30
data 00,30,00,30,00,00,00,03,30,30,00,30,30,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 31 to 40
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 41 to 50
data 00,00,00,00,00,00,00,00,00,00,00,00,30,30,00,30,00,30,00,30,30,30,00,00,00,30,00,00,00,30 ' 51 to 60

'| B G R| B G R |B G R| B G R| B G R| B G R| B G R| B G R| B G R| B G R|
data 00,00,30,00,30,00,30,00,00,00,30,30,30,00,30,30,30,00,30,30,30,00,00,00,00,00,00,00,00,00 ' 1 to 10
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 11 to 20
data 00,00,00,00,00,00,00,00,00,30,30,30,30,30,00,30,00,30,00,30,30,30,00,00,00,30,00,00,00,30 ' 21 to 30
data 00,30,00,30,00,00,00,03,30,30,00,30,30,30,00,30,30,30,00,00,00,00,00,00,00,00,00,00,00,00 ' 31 to 40
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 41 to 50
data 00,00,00,00,00,00,00,00,00,30,30,30,30,30,00,30,00,30,00,30,30,30,00,00,00,30,00,00,00,30 ' 51 to 60

'| B G R| B G R |B G R| B G R| B G R| B G R| B G R| B G R| B G R| B G R|
data 00,00,30,00,30,00,30,00,00,00,30,30,30,00,30,30,30,00,30,30,30,10,10,20,30,00,10,00,00,00 ' 1 to 10
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 11 to 20
data 00,00,00,30,00,10,10,10,20,30,30,30,30,30,00,30,00,30,00,30,30,30,00,00,00,30,00,00,00,30 ' 21 to 30
data 00,30,00,30,00,00,00,30,30,30,00,30,30,30,00,30,30,30,10,10,20,30,00,10,00,00,00,00,00,00 ' 31 to 40
data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ' 41 to 50
data 00,00,00,30,00,10,10,10,20,30,30,30,30,30,00,30,00,30,00,30,30,30,00,00,00,30,00,00,00,30 ' 51 to 60
[/code]


I don't get what the above actually does?
You said 255 = max but where would you put the 255 and what do each of those lines above actually do?
*trying to understand it*
Back to Top View lew247's Profile Search for other posts by lew247
 
WhiteWizzard
Guru
Guru


Joined: 05 April 2013
Location: United Kingdom
Online Status: Offline
Posts: 2436
Posted: 30 October 2017 at 7:17pm | IP Logged Quote WhiteWizzard

Great stuff Bill - can't wait to see your 'show' for this Christmas!!

One thing I found with the APAs, the recommended is to power these LED strings at 5v. The logic high out of the MM is 3v3 (typically) which falls just short of the recommended 0.7*Vdd of the APA to guarantee a 'high' data level.

Even though 3v3 'highs' do indeed appear to drive the APA correctly, IF you feed the data fast from the MM into the APA then the quality of signal drops. This is clearly seen if you try do a smooth (and fast) brightness fade (up or down). It becomes not very smooth.

Two solutions I found without any 'level shifting'. Power the APAs at 3v3, OR increase MM voltage from 3v3 to 3v6.

For anyone wanting to play with these brilliant RGB LEDs, I have some shorter strips becoming available for use with Peter's HAT Stand (PCBs arriving this week).

__________________
For everything MicroMite visit MicroMite.org

Direct Email: WhiteWizzard@MicroMite.org
Back to Top View WhiteWizzard's Profile Search for other posts by WhiteWizzard Visit WhiteWizzard's Homepage
 
Bill.b
Senior Member
Senior Member
Avatar

Joined: 25 June 2011
Location: Australia
Online Status: Offline
Posts: 167
Posted: 31 October 2017 at 10:16am | IP Logged Quote Bill.b

@lew247
Quote:
don't get what the above actually does?
You said 255 = max but where would you put the 255 and what do each of those lines above actually do?
*trying to understand it*


Though the spec for the apa102 states that the value for full range is 0 - 255
I found that a value of 30 achieves near max brightness and minimizes the total current drawn by the strip.

Bill

Edited by Bill.b on 31 October 2017 at 10:18am


__________________
"It always seems imposible until it's done" Nelson Mandela
Back to Top View Bill.b's Profile Search for other posts by Bill.b
 
lew247
Guru
Guru
Avatar

Joined: 23 December 2015
Location: United Kingdom
Online Status: Offline
Posts: 790
Posted: 31 October 2017 at 11:36am | IP Logged Quote lew247

Thanks Bill,
but what do all the lines actually do? are they needed? where do they go and how does the program access them?
Back to Top View lew247's Profile Search for other posts by lew247
 
WhiteWizzard
Guru
Guru


Joined: 05 April 2013
Location: United Kingdom
Online Status: Offline
Posts: 2436
Posted: 31 October 2017 at 3:34pm | IP Logged Quote WhiteWizzard

@lew247,

In Bill's code, there is a section as follows:


for count1 = 1 to 12 
   for loopcnt = 0 to 179 
     read buffer(loopcnt) 
   next loopcnt 
   sendLED  
   pause 50 
next count1


There are two loops here; the inner one performs 180 READs and reads a 'chunk' of the DATA i.e. the numbers 00 or 30. 00 means LED OFF, 30 means ON. Each LED has three bits of data (for Blue, Green and Red). So the first three data elements in the first of 12 chunks is 30, 00, 00 which equates to BLUE (i.e. B=ON, G=OFF, R=OFF).
The sendLED sub called simply sends the data to the LEDs so they become 'visible'

The 'outer' loop repeats this process 12 times to read all the 12 chunks of data.

Hope this helps . . . .

WW

__________________
For everything MicroMite visit MicroMite.org

Direct Email: WhiteWizzard@MicroMite.org
Back to Top View WhiteWizzard's Profile Search for other posts by WhiteWizzard Visit WhiteWizzard's Homepage
 
Bill.b
Senior Member
Senior Member
Avatar

Joined: 25 June 2011
Location: Australia
Online Status: Offline
Posts: 167
Posted: 07 December 2017 at 9:31pm | IP Logged Quote Bill.b

Quote:
Great stuff Bill - can't wait to see your 'show' for this Christmas!!


2017 lights

https://www.youtube.com/watch?v=E7vkjcxWzWE


Bill


__________________
"It always seems imposible until it's done" Nelson Mandela
Back to Top View Bill.b's Profile Search for other posts by Bill.b
 


Page of 2 Next >>
In the news...
 
Post ReplyPost New Topic
Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

Powered by Web Wiz Forums version 7.8
Copyright ©2001-2004 Web Wiz Guide

This page was generated in 0.1250 seconds.
Privacy Policy     Process times : 0, 0, 0, 0.12