Teensy APA102 POV Poi / Pixel Poi Build. Tutorial

Thanks for your replies. I looked at the guys code Fr1day posted the youtube link of (here: http://www.thingiverse.com/thing:653340/#files).
The coding is very straight forward, since the Teensy doesn't know about the bluetooth connection, it only sees the serial port. The App sends commands to switch between predefined patterns that are hardcoded on the teensy. As I suspected he uses the delay times to poll the serial port and parse the commands, but sadly no real "over the air updating" is happening.
 
If the patterns aren't changing, you might want to put the keyword const in front of the OutImage, HeartImage, StarImage, and GoogleImage arrays. The Arm GCC compiler will put const file scope declarations into program memory. The AVR GCC compiler won't do this because in the AVR, the program memory is not part of the same address space as the data memory. Your 4 patterns right now are using up 36,984 bytes of the 64k bytes in read/write SDRAM memory (there is 256K of flash memory to hold programs and constants).

If you wanted the ability to do over the air updates, you could make a protocol to copy data over the air to SDRAM memory, reusing one of the arrays you currently define. Alternatively, I could imagine using either a micro SD card or the LC prop shield to hold the patterns, and download the pattern being used to SDRAM before using it.
 
@Michael, I somehow missed your reply, sorry. Thanks for the suggestions, I think I'll go the route of external flash memory and a single array in RAM to display. For over the air updates a small buffer in RAM will be enough so I can perform page writes in one go. SD card would be very cool, but I'm not sure about mechanical reliability as the whole contraption will spin at about 600rpm, would be bad if it flung out the card :)
For me this project won't happen until November or December, so I still have some time to think about the concept...
 
@Michael, I somehow missed your reply, sorry. Thanks for the suggestions, I think I'll go the route of external flash memory and a single array in RAM to display. For over the air updates a small buffer in RAM will be enough so I can perform page writes in one go. SD card would be very cool, but I'm not sure about mechanical reliability as the whole contraption will spin at about 600rpm, would be bad if it flung out the card :)
For me this project won't happen until November or December, so I still have some time to think about the concept...

I've done more then a few micro SD they did work and i never had a issue of them flinging out just SPI issues.
 
I am currently working with addressable LEDs for the first time. I have a friend who has a hoop that is malfunctioning and I thought this repair would be a good introduction to the technology so I have a bit of a foundation when I start my first poi project.

I identified and replaced a short that was inside the LED strip that was causing a section to be completely dark. However now the original problem that I was trying to fix has returned. Whenever the hoop is struck hard enough or spun fast enough (seemingly) random segments will very briefly flash very bright white. I want to assume there is another short somewhere. Before I go off on trying to locate it, do any of you with experience know what else might be causing it? I can post a video if that will help.
 
I am currently working with addressable LEDs for the first time. I have a friend who has a hoop that is malfunctioning and I thought this repair would be a good introduction to the technology so I have a bit of a foundation when I start my first poi project.

I identified and replaced a short that was inside the LED strip that was causing a section to be completely dark. However now the original problem that I was trying to fix has returned. Whenever the hoop is struck hard enough or spun fast enough (seemingly) random segments will very briefly flash very bright white. I want to assume there is another short somewhere. Before I go off on trying to locate it, do any of you with experience know what else might be causing it? I can post a video if that will help.

You would ask me a Hula hoop question. Through you probably don't know who I am so it's quite funny.

It could be from a number of reason's but can almost bet it's from the LED strip being damaged. From over flexing or bending/folding. If the LED's are all red it's a power issue, if the LED's are glitching it's a ground connection issue from the micro-controller to the LED strip or a possible damaged LED strip section. You can sometimes find the brake in the lights as the pattern will stop at X point most times that X point will be the area of issue. Or it was never connected very well and it just fell off over time/abuse which also is very common if the unit does not have anything protecting the LED's batteries and electronics.

It can be extremely hard to remove the LED strips from tubing so be-careful. It's easier to have someone help you hold the tube straight so the lights come out without being pulled across the inside curve of the hoop damaging more of the LED's and likely the power connections. Most LED hoops are made horrible and with little care or love.

I've taken apart, fixed, and upgraded just about every LED Hoop made till 2016 and found the reasons above to be the biggest reason for issues other than user error.

Best of luck and i'm glad not to be in your shoes. Don't let that hoop ruin your life. (inside joke.. kinda)

Larry
 
Hi
With arduino IDE 1.5 sketch working perfect
Arduino 1.6 have problem but with sugestion in post #120
Sketch is working but colours is invert
Red is Blue
Blue is Red
Green is Green

#include "FastLED.h"

#define NUM_LEDS 72 //number of leds in strip length on one side
#define DATA_PIN 7 //= second hardware spi data
#define CLOCK_PIN 14 //= second hardware spi clock
CRGB leds[NUM_LEDS];
//int numberOfSlices = 150;
void setup() {

delay(200);
FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN>(leds, NUM_LEDS);
}




//for post use this>
const unsigned int array1[] = { 0x000000, 0x010101, 0x010001, 0x000000.....
//red/black


void PoiSonic(unsigned long time, const unsigned int array[], int sliceNumber);

void loop() {
PoiSonic(5000,array1,100);//holly



}

void PoiSonic(unsigned long time, const unsigned int array[], int sliceNumber){
unsigned long currentTime = millis();
while (millis()< currentTime + (time)) {

int f= sliceNumber;// previously used numberOfSlices;
int z; //a counter
int j=NUM_LEDS;

for (int x=0;x<f;x++){
for(z=NUM_LEDS;z>0;z--){
leds[z-1]=array[x+((j-z)*f)];}
FastLED.show();
delayMicroseconds(500); //may need to increase / decrease depending on spin rate
}
delayMicroseconds(1000); //may need to increase / decrease depending on spin rate
}
}



Thanks
 
Last edited:
Hi all,

Signed up to this site because of this project. Thanks mortonkopf! Don't have much experience in this area but the the detailed steps have me confidence. I bought some 40 pixel graphic poi off aliexpress for $250 AUD. They claimed to be programmable but I never have managed to get images to upload so I thought I would make my own. I'm running 72 LEDs on each side but think I am having voltage issues. The last 9 or so LEDs on both sides don't light up, with one or two on the boundary between the no working and working LEDs lighting up a pale red. I'm running the teensy and the strip off a 18650 battery.any help will be much appreciated!

Happy spinning guys.
 
Ah so it is a power issue. Thanks for the reply. Unfortunately I don't have enough room for another battery. Looks like I will need to cut down my strip.
 
Red pixels is usually a power drop issue. I have apa102 running from 3.3v data without any issues, so don't think its that.
 
hi everyone , im a electronic studenf from portugal and i have been folow this tread for weeks. at the moment im trying to do a globe pov as project.

teensy 3.2
low cost prop shield
43 leds only apa102c
5v pc power supply

i wonder if i can get any help . at the moment im stuck in the code (@Mortonkopf code) using arduino ide 1.6.12 and teensyduino beta.




#include "FastLED.h"

#define NUM_LEDS 43//number of leds in strip length on one side


CRGB leds[NUM_LEDS];
int numberOfSlices = 50 ;

void setup() {

delay(200);
FastLED.addLeds<APA102, BGR>(leds, NUM_LEDS);
pinMode(7, OUTPUT);
digitalWrite(7, HIGH); // enable access to LED

}


const unsigned int array1[] = { 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0................, }; //end of array*



void loop() {
PoiSonic(2000,array1); //call method, with duration to show (2sec) and array name.

}


void PoiSonic(unsigned long time, const unsigned int array[]){
unsigned long currentTime = millis();
while (millis()< currentTime + (time)) {

int f= numberOfSlices;
int z; //a counter
int j=NUM_LEDS;

for (int x=0;x<f;x++){
for(z=NUM_LEDS;z>0;z--){
leds[z-1]=array[x+((j-z)*f)];}
FastLED.show();
delayMicroseconds(40); //may need to increase / decrease depending on spin rate
}
delayMicroseconds(1000); //may need to increase / decrease depending on spin rate
}
}



but give this error at digitalWrite(7,HIGH);

Arduino: 1.6.12 (Windows 10), TD: 1.31-beta1, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz optimize speed (overclock), US English"


stray '\302' in program
 
Last edited:
so my code aint working!
the proper low cost shield has a 8mb memory, how to use it?
do i need a hall sensor to detect the spining of the pov globe?

any help will be apreciated
 
Code:
, 0xfefefe, 0................, }; //end of array*
Perhaps this is the problem. The compiler can't guess...
 
Code:
, 0xfefefe, 0................, }; //end of array*
Perhaps this is the problem. The compiler can't guess...

hi , thanks 4 answer. i just short a bit the array cause was to big to post so aint that the problem. still have few days to finish it , hope i can.
 
@mortonkopf wondering if you could explain how your image converter works or at least the most effective way to use it.
Say if I have 60 LEDS is it best to have a 120 x 120 pixel image? 24 bit Bitmap?

Also it says in the OP that the code and image data are in the attachment but I couldn't find them. Is it still there?
 
how fragil is the teensy 3.2 cause mine is dead when i was loading the code to the board? i felt like was a waisting of money , got 1 board dead and a prop shield that i cant use now so i guess my pov globe gonna have to wait a bit more.
theres nothing like the arduinos , they a bit slow but i never kill 1 even if was a chinese clone!!!
 
Not fragile at all in my experience. The only ones I've killed have been by snapping the usb port off.
Not all usb cables are suitable for data transmission though - so check that.

Anyway how about my question?!?!
 
@gulga, I compiled your posted code, but removed the array content at end, this bit - "......................,", and it compiled without an issue. I am using Arduino 1.6.8 and teensyduino 1.2.8. Also, teensy is not fragile, but sensitive to sticking current in the wrong place.
 
@gavspav, the image converter uses html functions. It uses “.drawImage” with 'canvas' to grab the data in the file, and redraw it int he prescribed dimensions of output width and output height. My understanding is that the canvas element uses bi-linear interpolation. However, I am not a programmer, so could be wrong. Also, in using the suggested interim process of applying a reduction technique in a graphics package before using the converter to generate the code, you are getting round the issues of aliasing. Well, thats my theory anyway.

Not sure if that answered the question.

The page uses the code below which shows how the canvas element is used:
Code:
var zfim = document.querySelector('img');
  var f45vas = document.querySelector('canvas');
  f45vas.height = f45vas.width = 0;
  
    var context = f45vas.getContext('2d');
    var cimw = zxwe;
    var cimh = zxwh;
    f45vas.width = cimw;
    f45vas.height = cimh;
    context.drawImage(zfim, 0, 0, zxwe,zxwh);
    
   var imageData = context.getImageData(0,0,zxwe,zxwh);
    var zfrda = imageData.data;
  
   for(var i = 0, n = zfrda.length; i < n; i += 4) {
          var de = zfrda[i];
          var ne = zfrda[i + 1];
          var eu = zfrda[i + 2];
          var ah = zfrda[i + 3];
   
var hexi =
   ("0" + parseInt(de,10).toString(16)).slice(-2) +
  ("0" + parseInt(ne,10).toString(16)).slice(-2) +
  ("0" + parseInt(eu,10).toString(16)).slice(-2);

    document.getElementById("OutPutTextArea").innerHTML += "0x";
    document.getElementById("OutPutTextArea").innerHTML += hexi;
    document.getElementById("OutPutTextArea").innerHTML += ", ";
    }
    document.getElementById("OutPutTextArea").innerHTML += "}; //end of array ";
 
Last edited:
Back
Top