BADGE Time!

267

3

About: Love technology and sharing knowledge. while(1){ learn(); make(); share(); }

Wanted to make some Badges for the friends of Tecnoateneu de Vilablareix (www.tecnoateneu.cat).Tecnoateneu is more tan a Hackerspace, is a place where you can share your knowledge, help other people with their own projects, and ask for suppor for your ones.

The first step to design an original colorful Badge is create the schematic circuit: wanted to use the cheap ATtiny85 IC to turn On/Off some colored LEDs using the Charlieplex technique (https://en.wikipedia.org/wiki/Charlieplexing).

Here you have the link to the repository with Gerber files and code: https://github.com/Giroair/Badge-TAV

12 LEDs from different colors are managed by the ATtiny85. You have the schematic attached, and can be used for different Badges because is the same circuit. Just go to PCB Design, place the LEDs on the board, and draw the outline shape of the PCB.

Step 1: Designing.

3D rendering helps to have a glimpse of the PCB as you design. Finally send the Gerber Files to a PCB manufacturer.

When received the PCBs, placed and solder the components.

  • Hints: always double-check the connections before start soldering any component.
  • Solder one PCB first, and chek if everything is working properly. If so, proceed with the others.

Be colorful!: use any type of single-color LED device. Imagination is the limit!

Use 3mm or 5mm, rounded, square or triangular shaped. As long as you solder properly (long leg is "+", short leg is "-") almost any LED Will work. Think of Surface Mounted Devices too!

Choose the color scheme that you like the most, you have 12 LEDs to play with!.

And not to mention that you can choose the color of the PCB mask (Green, black, red, White, transparent, …).

One final recommendation: draw lines and areas in White color in the PCB layout, but leave zones without solder mask: shiny copper or silver is eligible

Step 2: Program the Attiny.

Followed this tutorial to program ATtiny using Arduino IDE and one Arduino UNO or Duemilanove. Love the Atmel for fast prototyping. A perfboard and some soldering will do to make the programmer.

The code is atached.. Modifying or adding new effects is up to you.

Find the schematic and procedure here:

You can also use a STlink programmer.

Badge TAV-EN

/*Code for a Badge for Tecnoateneu de Vilablareix.
ATTiny85 based.
It uses pins PB0 to PB3 to controll 12 LEDs using Charlieplexing technique.
Link to the schematic: http://www.technoblogy.com/show?1ONY
Link to implement a ATtiny85 programmer with Arduino: https://www.youtube.com/watch?v=BexXvxmOGN8
ledx(1,time)- turns On LED x and remains On for time indicated.
ledx(0,time)- turns Off LED x and remains Off for time indicated.
Copyleft Lluís Llimargas. Feel free to use or distribute, only mention to @Tecnoateneu and @LluísLlimargas is required.
*/
#define PB0 0
#define PB1 1
#define PB2 2
#define PB3 3
int i,j,time; // various variables for loops and time management.
void setup() {
}
void loop() {
alloff();
// ------------effect 1
// Di i D2 alterning.
time=500;
for (i=0;i<5;i++){
led1(1,time);
led1(0,0);
led2(1,time);
led2(0,0);
}
alloff();
// ------------effect 2
//Randomly turing On/Off LEDs.
for(i=0;i< 50;i++){
j=random(1,12);
switch (j){
case 1:
led1(1,100);
break;
case 2:
led2(1,100);
break;
case 3:
led3(1,100);
break;
case 4:
led4(1,100);
break;
case 5:
led5(1,100);
break;
case 6:
led6(1,100);
break;
case 7:
led7(1,100);
break;
case 8:
led8(1,100);
break;
case 9:
led9(1,100);
break;
case 10:
led10(1,100);
break;
case 11:
led11(1,100);
break;
case 12:
led12(1,100);
break;
}
alloff();
}
// ------------effect 3
//Circular On/Off the LEDs.
j=100; // waiting time in every LED (in milliseconds)
for(i=0;i<5;i++){
led11(1,j);
led12(1,j);
led8(1,j);
led4(1,j);
led6(1,j);
led5(1,j);
led3(1,j);
led7(1,j);
}
for(i=0;i<5;i++){
led1(1,j);
led9(1,j);
led10(1,j);
led2(1,j);
}
// ------------efecte 4
//Four LED Flash effect.
time=30; // waiting time in every LED (in milliseconds)
for(i=0;i<4;i++){
for(j=0;j<6;j++){
led1(1,time);
led1(0,time);
}
for(j=0;j<6;j++){
led2(1,time);
led2(0,time);
}
for(j=0;j<6;j++){
led9(1,time);
led9(0,time);
}
for(j=0;j<6;j++){
led10(1,time);
led10(0,time);
}
}
// ---------- Efecte 5
// Left to Right and back.
time=50; // // waiting time in every LED (in milliseconds)
//lateral movement
for(i=0;i<5;i++){
led3(1,time);
led7(1,time);
led5(1,time);
led9(1,time);
led11(1,time);
led1(1,time);
led2(1,time);
led12(1,time);
led10(1,time);
led8(1,time);
led6(1,time);
led4(1,time);
led6(1,time);
led8(1,time);
led10(1,time);
led12(1,time);
led2(1,time);
led1(1,time);
led11(1,time);
led9(1,time);
led5(1,time);
led7(1,time);
}
//vertical movement.
for(i=0;i<5;i++){
led11(1,time);
led12(1,time);
led8(1,time);
led2(1,time);
led1(1,time);
led7(1,time);
led3(1,time);
led9(1,time);
led10(1,time);
led11(1,time);
led6(1,time);
led5(1,time);
led6(1,time);
led4(1,time);
led10(1,time);
led9(1,time);
led3(1,time);
led7(1,time);
led1(1,time);
led2(1,time);
led8(1,time);
led12(1,time);
}
} // End of main Loop.
// ===================================================================
void led1(int i,int time){
pinMode(PB0,OUTPUT);
pinMode(PB1,OUTPUT);
pinMode(PB2,INPUT);
pinMode(PB3,INPUT);
if (i)
digitalWrite(PB0,HIGH);
else
digitalWrite(PB0,LOW);
digitalWrite(PB1,LOW);
delay(time);
}
void led2(int i,int time){
pinMode(PB0,INPUT);
pinMode(PB1,OUTPUT);
pinMode(PB2,OUTPUT);
pinMode(PB3,INPUT);
if (i)
digitalWrite(PB2,HIGH);
else
digitalWrite(PB2,LOW);
digitalWrite(PB1,LOW);
delay(time);
}
void led3(int i,int time){
pinMode(PB0,INPUT);
pinMode(PB1,OUTPUT);
pinMode(PB2,INPUT);
pinMode(PB3,OUTPUT);
if (i)
digitalWrite(PB3,HIGH);
else
digitalWrite(PB3,LOW);
digitalWrite(PB1,LOW);
delay(time);
}
void led4(int i,int time){
pinMode(PB0,OUTPUT);
pinMode(PB1,OUTPUT);
pinMode(PB2,INPUT);
pinMode(PB3,INPUT);
if (i)
digitalWrite(PB1,HIGH);
else
digitalWrite(PB1,LOW);
digitalWrite(PB0,LOW);
delay(time);
}
void led5(int i,int time){
pinMode(PB0,OUTPUT);
pinMode(PB1,INPUT);
pinMode(PB2,OUTPUT);
pinMode(PB3,INPUT);
if (i)
digitalWrite(PB2,HIGH);
else
digitalWrite(PB2,LOW);
digitalWrite(PB0,LOW);
delay(time);
}
void led6(int i,int time){
pinMode(PB0,OUTPUT);
pinMode(PB1,INPUT);
pinMode(PB2,INPUT);
pinMode(PB3,OUTPUT);
if (i)
digitalWrite(PB3,HIGH);
else
digitalWrite(PB3,LOW);
digitalWrite(PB0,LOW);
delay(time);
}
void led7(int i, int time){
pinMode(PB0,OUTPUT);
pinMode(PB1,INPUT);
pinMode(PB2,INPUT);
pinMode(PB3,OUTPUT);
if (i)
digitalWrite(PB0,HIGH);
else
digitalWrite(PB0,LOW);
digitalWrite(PB3,LOW);
delay(time);
}
void led8(int i,int time){
pinMode(PB0,INPUT);
pinMode(PB1,OUTPUT);
pinMode(PB2,INPUT);
pinMode(PB3,OUTPUT);
if (i)
digitalWrite(PB1,HIGH);
else
digitalWrite(PB1,LOW);
digitalWrite(PB3,LOW);
delay(time);
}
void led9(int i,int time){
pinMode(PB0,INPUT);
pinMode(PB1,INPUT);
pinMode(PB2,OUTPUT);
pinMode(PB3,OUTPUT);
if (i)
digitalWrite(PB2,HIGH);
else
digitalWrite(PB2,LOW);
digitalWrite(PB3,LOW);
delay(time);
}
void led10(int i,int time){
pinMode(PB0,OUTPUT);
pinMode(PB1,INPUT);
pinMode(PB2,OUTPUT);
pinMode(PB3,INPUT);
if (i)
digitalWrite(PB0,HIGH);
else
digitalWrite(PB0,LOW);
digitalWrite(PB2,LOW);
delay(time);
}
void led11(int i,int time){
pinMode(PB0,INPUT);
pinMode(PB1,OUTPUT);
pinMode(PB2,OUTPUT);
pinMode(PB3,INPUT);
if (i)
digitalWrite(PB1,HIGH);
else
digitalWrite(PB1,LOW);
digitalWrite(PB2,LOW);
delay(time);
}
void led12(int i,int time){
pinMode(PB0,INPUT);
pinMode(PB1,INPUT);
pinMode(PB2,OUTPUT);
pinMode(PB3,OUTPUT);
if (i)
digitalWrite(PB3,HIGH);
else
digitalWrite(PB3,LOW);
digitalWrite(PB2,LOW);
delay(time);
}
void alloff(void){
pinMode(PB0,OUTPUT);
pinMode(PB1,OUTPUT);
pinMode(PB2,OUTPUT);
pinMode(PB3,OUTPUT);
digitalWrite(PB0,LOW);
digitalWrite(PB1,LOW);
digitalWrite(PB2,LOW);
digitalWrite(PB3,LOW);
}
view rawBadge TAV-EN hosted with ❤ by GitHub

Step 3: Enjoy It!

Wear the badge using a necklace or a needle.

For future Badges, consider:

Less is More: large badges are not always the best. Smaller ones allows you to be worn in different places.

The use of SMT components: they are Little more expensive, and require some soldering skills, but your Badge Will look cool!

ISP programmer: include contacts to reprogram the microcontroller directly on the Badge.

Let me know about your Badges. I'll be happy to know you found this useful.

Colors of the Rainbow Contest

This is an entry in the
Colors of the Rainbow Contest

Share

    Recommendations

    • Classroom Science Contest

      Classroom Science Contest
    • Frozen Treats Challenge

      Frozen Treats Challenge
    • Fandom Contest

      Fandom Contest

    Discussions