











Estude fácil! Tem muito documento disponível na Docsity
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Esta página não é visível na pré-visualização
Não perca as partes importantes!












Coolest site ever -I-N-S-T-R-U-C-T-A-B-L-E-S-.-C-O-M Intro: ATtiny85 POV Display The first time I saw a POV (Persistence Of Vision) display was on a show called FAQ on TV. The POV display consisted of an oscillating shaft with 6 LED's mounted on the end of the shaft. Since then I have always wanted to make one myself, I tried making one about 2 months ago with an oscillating shaft myself but I was not successful as the speed of the shaft was too low for the POV display to work. Now I decided to make the POV display with just a DC Motor instead of an oscillating shaft as they are much cheaper and easily available compared to the shafts. In this instructable I will show you how to make the POV Display yourself! This is a very simple project both on hardware and software (coding) areas. It costed me only about 5$ to make it from start to finish! So lets get started! Here is a video of it in action! Note: The brightening and dimming of the LEDs in the video is due to my crappy camera, in reality its consistent and quite bright.
Image Notes
Step 4: Connecting the ATtiny Using the given pinout, wire the IC holder to the LED bar. Using a protoboard attach 2 wires to the 3V ( Pin 8 ) and Gnd ( Pin 4 ) on the IC holder which will be attached to the 3V battery holder later. Connect the common cathode to the Gnd (Pin 4) of the IC holder and the 5 anodes of the LEDs to pins 2,3,5,6,7 of the IC holder. Glue this to the LED bar made before. Once we program the ATtiny85 we will insert it into the IC holder. The holder also makes it easy to reprogram the ATtiny85 whenever we need to. Once all the connections are made, you can use some hot glue to secure everything in place as the LED bar is going to be rotated everything should be firmly held together.
Step 6: Casing and Enclosure Once you have attached the LED bar to the motor you can place the whole setup in some sort of box/can etc. I placed the motor in a LEGO wheel's outer rubber, and then hot glued it on top of a perfume can that I had lying around. The can has a top which can be placed back on. I made a small hole on the side of the can through which the USB wire could come out and then added a few stones in for weight. Once this was done I put the top back on and made sure everything was held firmly. Image Notes
Step 7: Installing support for the ATtiny series In order to program the ATtiny chips with the arduino, we need to install a few things first before we get programming. Go to https://github.com/damellis/attiny/archive/master.zip and download the " attiny-master " folder. In the folder you should see " attiny " folder. Open the Arduino sketchbook folder, you can find its location by checking in the preferences menu. In the arduino sketchbook folder, create a folder named hardware and copy the "attiny" folder into the hardware folder. Documents>Arduino>hardware>attiny The attiny folder should have a boards.txt and another folder "variants". Once you do this you can just open your Arduino IDE and in the boards menu you should see options such as ATtiny45/85/44/84 etc. For more information visit : http://highlowtech.org/?p=
Step 8: Programming the ATtiny You will have to connect 6 pins on the ATtiny85 to the arduino and a capacitor in order to program it. Pin connections: ATtiny Pin 2 to Arduino Pin 13 (SCK) ATtiny Pin 1 to Arduino Pin 12 (MISO) ATtiny Pin 0 to Arduino Pin 11 (MOSI) ATtiny Reset Pin to Arduino Pin 10 (RESET) You will also have to connect the +5V and Gnd from the ATtiny to the Arduino. Attach a 10 Micro Farad capacitor between Reset and Gnd of the Arduino. (Refer to the diagram given above) Once that is done, open up the Arduino IDE, and go to Tools, Board and select the appropriate board (Usually its going to be ATtiny85 (1 MHz internal clock) ). You should also select the right serial port in tools, serial port. Once that is done go to Tools, Programmer and change it to Arduino as ISP. When you have done all these things, copy and paste the code from below and hit Upload, then plug the ATtiny into the IC holder and watch your POV Display spring into action. Code: int delayTime = 1; int charBreak = 2.1; int LED1 = 0; int LED2 = 1; int LED3 = 2; int LED4 = 3; int LED5 = 4; void setup() { pinMode(LED1, OUTPUT); pinMode(LED2, OUTPUT); pinMode(LED3, OUTPUT); pinMode(LED4, OUTPUT); pinMode(LED5, OUTPUT); } int a[] = {1, 6, 26, 6, 1}; int b[] = {31, 21, 21, 10, 0}; int c2[] = {14, 17, 17, 10, 0}; int d[] = {31, 17, 17, 14, 0}; int e[] = {31, 21, 21, 17, 0}; int f[] = {31, 20, 20, 16, 0}; int g[] = {14, 17, 19, 10, 0}; int h[] = {31, 4, 4, 4, 31}; int i[] = {0, 17, 31, 17, 0}; int j[] = {0, 17, 30, 16, 0}; int k[] = {31, 4, 10, 17, 0}; int l[] = {31, 1, 1, 1, 0}; int m[] = {31, 12, 3, 12, 31}; int n[] = {31, 12, 3, 31, 0}; int o[] = {14, 17, 17, 14, 0}; int p[] = {31, 20, 20, 8, 0}; int q[] = {14, 17, 19, 14, 2}; int r[] = {31, 20, 22, 9, 0}; int s[] = {8, 21, 21, 2, 0}; int t[] = {16, 16, 31, 16, 16}; int u[] = {30, 1, 1, 30, 0}; int v[] = {24, 6, 1, 6, 24}; int w[] = {28, 3, 12, 3, 28}; int x[] = {17, 10, 4, 10, 17}; int y[] = {17, 10, 4, 8, 16}; int z[] = {19, 21, 21, 25, 0}; int eos[] = {0, 1, 0, 0, 0}; int excl[] = {0, 29, 0, 0, 0}; int ques[] = {8, 19, 20, 8, 0}; void displayLine(int line) { int myline; myline = line; if (myline>=16) {digitalWrite(LED1, HIGH); myline-=16;} else {digitalWrite(LED1, LOW);} if (myline>=8) {digitalWrite(LED2, HIGH); myline-=8;} else {digitalWrite(LED2, LOW);} if (myline>=4) {digitalWrite(LED3, HIGH); myline-=4;} else {digitalWrite(LED3, LOW);} if (myline>=2) {digitalWrite(LED4, HIGH); myline-=2;} else {digitalWrite(LED4, LOW);} if (myline>=1) {digitalWrite(LED5, HIGH); myline-=1;} else {digitalWrite(LED5, LOW);} } void displayChar(char c) { if (c == 'a'){for (int i = 0; i <5; i++){displayLine(a[i]);delay(delayTime);}displayLine(0);} if (c == 'b'){for (int i = 0; i <5; i++){displayLine(b[i]);delay(delayTime);}displayLine(0);} if (c == 'c2'){for (int i = 0; i <5; i++){displayLine(c2[i]);delay(delayTime);}displayLine(0);} if (c == 'd'){for (int i = 0; i <5; i++){displayLine(d[i]);delay(delayTime);}displayLine(0);} if (c == 'e'){for (int i = 0; i <5; i++){displayLine(e[i]);delay(delayTime);}displayLine(0);} if (c == 'f'){for (int i = 0; i <5; i++){displayLine(f[i]);delay(delayTime);}displayLine(0);} if (c == 'g'){for (int i = 0; i <5; i++){displayLine(g[i]);delay(delayTime);}displayLine(0);} if (c == 'h'){for (int i = 0; i <5; i++){displayLine(h[i]);delay(delayTime);}displayLine(0);} if (c == 'i'){for (int it = 0; it <5; it++){displayLine(i[it]);delay(delayTime);}displayLine(0);} if (c == 'j'){for (int i = 0; i <5; i++){displayLine(j[i]);delay(delayTime);}displayLine(0);} if (c == 'k'){for (int i = 0; i <5; i++){displayLine(k[i]);delay(delayTime);}displayLine(0);} if (c == 'l'){for (int i = 0; i <5; i++){displayLine(l[i]);delay(delayTime);}displayLine(0);} if (c == 'm'){for (int i = 0; i <5; i++){displayLine(m[i]);delay(delayTime);}displayLine(0);} if (c == 'n'){for (int i = 0; i <5; i++){displayLine(n[i]);delay(delayTime);}displayLine(0);} if (c == 'o'){for (int i = 0; i <5; i++){displayLine(o[i]);delay(delayTime);}displayLine(0);} if (c == 'p'){for (int i = 0; i <5; i++){displayLine(p[i]);delay(delayTime);}displayLine(0);} if (c == 'q'){for (int i = 0; i <5; i++){displayLine(q[i]);delay(delayTime);}displayLine(0);} if (c == 'r'){for (int i = 0; i <5; i++){displayLine(r[i]);delay(delayTime);}displayLine(0);} if (c == 's'){for (int i = 0; i <5; i++){displayLine(s[i]);delay(delayTime);}displayLine(0);} if (c == 't'){for (int i = 0; i <5; i++){displayLine(t[i]);delay(delayTime);}displayLine(0);} if (c == 'u'){for (int i = 0; i <5; i++){displayLine(u[i]);delay(delayTime);}displayLine(0);}
Step 9: Explanation of the code int delayTime = 1; //The delay time between sub characters int charBreak = 2.1; //The delay between different characters The above 2 delay times should be adjusted as required. Try changing them until you get the desired display you want, increasing the delayTime will increase the width of each part of the letter whereas increasing the charBreak will increase the space between 2 letters. int LED1 = 0; //Defining which pins the LEDs are attached to int LED2 = 1; int LED3 = 2; int LED4 = 3; int LED5 = 4; void setup() { pinMode(LED1, OUTPUT); //Setting LED1 as output pinMode(LED2, OUTPUT); //Setting LED2 as output pinMode(LED3, OUTPUT); //Setting LED3 as output pinMode(LED4, OUTPUT); //Setting LED4 as output pinMode(LED5, OUTPUT); //Setting LED5 as output } int a[] = {1, 6, 26, 6, 1}; // These are the integers that help us display the letter A int b[] = {31, 21, 21, 10, 0}; int c2[] = {14, 17, 17, 10, 0}; int d[] = {31, 17, 17, 14, 0}; int e[] = {31, 21, 21, 17, 0}; int f[] = {31, 20, 20, 16, 0}; int g[] = {14, 17, 19, 10, 0}; int h[] = {31, 4, 4, 4, 31}; int i[] = {0, 17, 31, 17, 0}; int j[] = {0, 17, 30, 16, 0}; int k[] = {31, 4, 10, 17, 0}; int l[] = {31, 1, 1, 1, 0}; int m[] = {31, 12, 3, 12, 31}; int n[] = {31, 12, 3, 31, 0}; int o[] = {14, 17, 17, 14, 0}; int p[] = {31, 20, 20, 8, 0}; int q[] = {14, 17, 19, 14, 2}; int r[] = {31, 20, 22, 9, 0}; int s[] = {8, 21, 21, 2, 0}; int t[] = {16, 16, 31, 16, 16}; int u[] = {30, 1, 1, 30, 0}; int v[] = {24, 6, 1, 6, 24}; int w[] = {28, 3, 12, 3, 28}; int x[] = {17, 10, 4, 10, 17}; int y[] = {17, 10, 4, 8, 16}; int z[] = {19, 21, 21, 25, 0}; The 5 different integers correspond to the 5 time frames that make up each letter. (In the 2nd step of this instructable I used 3 time frames to make up the letter E, here we use 5 time frames) int eos[] = {0, 1, 0, 0, 0}; int excl[] = {0, 29, 0, 0, 0}; int ques[] = {8, 19, 20, 8, 0}; void displayLine(int line) { int myline; myline = line; if (myline>=16) {digitalWrite(LED1, HIGH); myline-=16;} else {digitalWrite(LED1, LOW);} if (myline>=8) {digitalWrite(LED2, HIGH); myline-=8;} else {digitalWrite(LED2, LOW);} if (myline>=4) {digitalWrite(LED3, HIGH); myline-=4;} else {digitalWrite(LED3, LOW);} if (myline>=2) {digitalWrite(LED4, HIGH); myline-=2;} else {digitalWrite(LED4, LOW);} if (myline>=1) {digitalWrite(LED5, HIGH); myline-=1;} else {digitalWrite(LED5, LOW);} } This is the most important part of the code which explains what all the number we mentioned above mean, For example let x be an integer. If x is greater than or equal to 16, then LED1 turns on, and we subtract 16 from x, now if (x-16) is greater than or equal to 8, LED2 turns on as well along with LED1, and we subtract 8, now if (x-24) is greater than or equal to 4, LED3 turns on along with LED1 and LED2 and so on..... If at any instance it is less than the specified number, then that LED is off and we move on to the next step without subtracting any number. Ex : Lets take 18, now it is greater than 16, therefore LED1 is on, now on subtracting 16 we have 2, 2 is less than 8 so LED2 is off, now 2 is less than 4 so LED3 is off, now 2 is greater than or equal to 2 , therefore LED4 is on, and on subtracting 2 we have 0 which is less than 1, therefore LED5 is off. In such manner we can assign different integers to turn on and off different LEDs as we require. Lets take the letter H for example, the integers are 31,4,4,4,31; So first 31, it turns on all the LEDs 1 to 5, next 4 turns on only LED3, then 4 again turns on LED3 and 4 again turns on LED3 then 31 turns on all LEDs 1 to 5. In this manner when we put these next to each other as shown in step 2 of this instructable, we see the letter H. void displayChar(char c) { if (c == 'a'){for (int i = 0; i <5; i++){displayLine(a[i]);delay(delayTime);}displayLine(0);} if (c == 'b'){for (int i = 0; i <5; i++){displayLine(b[i]);delay(delayTime);}displayLine(0);} if (c == 'c2'){for (int i = 0; i <5; i++){displayLine(c2[i]);delay(delayTime);}displayLine(0);} if (c == 'd'){for (int i = 0; i <5; i++){displayLine(d[i]);delay(delayTime);}displayLine(0);} if (c == 'e'){for (int i = 0; i <5; i++){displayLine(e[i]);delay(delayTime);}displayLine(0);} if (c == 'f'){for (int i = 0; i <5; i++){displayLine(f[i]);delay(delayTime);}displayLine(0);}
if (c == 'g'){for (int i = 0; i <5; i++){displayLine(g[i]);delay(delayTime);}displayLine(0);} if (c == 'h'){for (int i = 0; i <5; i++){displayLine(h[i]);delay(delayTime);}displayLine(0);} if (c == 'i'){for (int it = 0; it <5; it++){displayLine(i[it]);delay(delayTime);}displayLine(0);} if (c == 'j'){for (int i = 0; i <5; i++){displayLine(j[i]);delay(delayTime);}displayLine(0);} if (c == 'k'){for (int i = 0; i <5; i++){displayLine(k[i]);delay(delayTime);}displayLine(0);} if (c == 'l'){for (int i = 0; i <5; i++){displayLine(l[i]);delay(delayTime);}displayLine(0);} if (c == 'm'){for (int i = 0; i <5; i++){displayLine(m[i]);delay(delayTime);}displayLine(0);} if (c == 'n'){for (int i = 0; i <5; i++){displayLine(n[i]);delay(delayTime);}displayLine(0);} if (c == 'o'){for (int i = 0; i <5; i++){displayLine(o[i]);delay(delayTime);}displayLine(0);} if (c == 'p'){for (int i = 0; i <5; i++){displayLine(p[i]);delay(delayTime);}displayLine(0);} if (c == 'q'){for (int i = 0; i <5; i++){displayLine(q[i]);delay(delayTime);}displayLine(0);} if (c == 'r'){for (int i = 0; i <5; i++){displayLine(r[i]);delay(delayTime);}displayLine(0);} if (c == 's'){for (int i = 0; i <5; i++){displayLine(s[i]);delay(delayTime);}displayLine(0);} if (c == 't'){for (int i = 0; i <5; i++){displayLine(t[i]);delay(delayTime);}displayLine(0);} if (c == 'u'){for (int i = 0; i <5; i++){displayLine(u[i]);delay(delayTime);}displayLine(0);} if (c == 'v'){for (int i = 0; i <5; i++){displayLine(v[i]);delay(delayTime);}displayLine(0);} if (c == 'w'){for (int i = 0; i <5; i++){displayLine(w[i]);delay(delayTime);}displayLine(0);} if (c == 'x'){for (int i = 0; i <5; i++){displayLine(x[i]);delay(delayTime);}displayLine(0);} if (c == 'y'){for (int i = 0; i <5; i++){displayLine(y[i]);delay(delayTime);}displayLine(0);} if (c == 'z'){for (int i = 0; i <5; i++){displayLine(z[i]);delay(delayTime);}displayLine(0);} if (c == '!'){for (int i = 0; i <5; i++){displayLine(excl[i]);delay(delayTime);}displayLine(0);} if (c == '?'){for (int i = 0; i <5; i++){displayLine(ques[i]);delay(delayTime);}displayLine(0);} if (c == '.'){for (int i = 0; i <5; i++){displayLine(eos[i]);delay(delayTime);}displayLine(0);} delay(charBreak); } This part of the code tells the arduino to move through one time frame after another with the delay of delayTime and it cycles from i=0 (Time frame 1) to i=4 (Time frame
Related Instructables $10 ATtiny85/ POV display!! (works really well) by xBacon ATtiny85 Mini RGB Mood Light! by xBacon Spell out affection for your Valentine with chocolates, LEDs, Attiny and Arduino IDE by elabz persistence of vision display (POV) by jakebader Persistence Of Vision Using Arduino UNO(New Prototype) (Photos) by abhirooprobotics Cheap 16F POV Message - AirText by ahmedebeed Advertisements Comments 3 comments Add Comment nodcah says: Jun 9, 2014. 11:42 AM^ REPLY Awesome Instructable! Also, aren't ATtinys just awesome?!? :-) andrea biffi says: Jun 9, 2014. 11:08 AM^ REPLY I merged your three frames in an animated gif :) craftclarity says: Jun 9, 2014. 10:12 AM^ REPLY SUPER COOL!!!! It'd be neat to put this on a pair of bicycle handlebars....so that you could see it from the front.