Arduino Atelie Hacker

_MG_0427

Bike riding is good, but with LEDs is even better. Bike POV is a luminous device that drawings on bicycle wheel as it rotates. It is made with an Arduino, 11 LEDs that can be of any color and a control button to switch the drawn patterns.

Materias:

1 Arduino
11 LEDs
11 Resistors 12R
1 Resistor 10K
1 Pushbutton
1 Switch
28 Pin Male Header
1 9V battery
1 9V battery socket

Tools:

Soldering iron
Cutting pliers

Circuit:

Bike POV Button_bb

Arduino Code:

// defining the picts

int off[] = {
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0};

int heart[] = {
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,1,1,1,1,0,0,0,0,0,
  0,1,1,1,1,1,1,0,0,0,0,
  0,1,1,1,1,1,1,1,0,0,0,
  0,0,1,1,1,1,1,1,1,0,0,
  0,0,0,1,1,1,1,1,1,1,0,
  0,0,1,1,1,1,1,1,1,0,0,
  0,1,1,1,1,1,1,1,0,0,0,
  0,1,1,1,1,1,1,0,0,0,0,
  0,0,1,1,1,1,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0};

int greek[] = {
  1,1,0,0,0,0,0,0,0,0,0,
  1,1,0,0,0,0,0,0,0,0,0,
  1,1,0,0,1,1,1,1,1,1,0,
  1,1,0,0,1,1,1,1,1,1,0,
  1,1,0,0,1,1,0,0,1,1,0,
  1,1,1,1,1,1,0,0,1,1,0,
  1,1,1,1,1,1,0,0,1,1,0,
  0,0,0,0,0,0,0,0,1,1,0,
  0,0,0,0,0,0,0,0,1,1,0,
  1,1,1,1,1,1,1,1,1,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,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0};

int dotTime;

// this constant won't change:
const int  buttonPin = 2;    // the pin that the pushbutton is attached to

// Variables will change:
int buttonPushCounter = 0;   // counter for the number of button presses
int buttonState = 0;         // current state of the button
int lastButtonState = 0;     // previous state of the button

#include

void setup()
{
  // POV setting the ports of the leds to OUTPUT
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);

  // defining the time dots appear (ms)
  dotTime = 5;

  // initialize the button pin as a input:
  pinMode(buttonPin, INPUT);

  // initialize serial communication:
  Serial.begin(9600);

}

//POV
void printPict(int row[]){

  int y;

  // printing the y1 row of the pict
  for (y=0; y<11; y++)
  {
    digitalWrite(y+3, row[y]);
  }
  delay(dotTime);

  // printing the y2 row of the pict
  for (y=0; y<11; y++)
  {
    digitalWrite(y+3, row[y+11]);
  }
  delay(dotTime);

  // printing the y3 row of the pict
  for (y=0; y<11; y++)
  {
    digitalWrite(y+3, row[y+22]);
  }
  delay(dotTime);

  // printing the y4 row of the pict
  for (y=0; y<11; y++)
  {
    digitalWrite(y+3, row[y+33]);
  }
  delay(dotTime);

  // printing the y5 row of the pict
  for (y=0; y<11; y++)
  {
    digitalWrite(y+3, row[y+44]);
  }
  delay(dotTime);

  // printing the y6 row of the pict
  for (y=0; y<11; y++)
  {
    digitalWrite(y+3, row[y+55]);
  }
  delay(dotTime);

  // printing the y7 row of the pict
  for (y=0; y<11; y++)
  {
    digitalWrite(y+3, row[y+66]);
  }
  delay(dotTime);

  // printing the y8 row of the pict
  for (y=0; y<11; y++)
  {
    digitalWrite(y+3, row[y+77]);
  }
  delay(dotTime);

  // printing the y9 row of the pict
  for (y=0; y<11; y++)
  {
    digitalWrite(y+3, row[y+88]);
  }
  delay(dotTime);

  // printing the y10 row of the pict
  for (y=0; y<11; y++)
  {
    digitalWrite(y+3, row[y+99]);
  }
  delay(dotTime);

  // printing the y11 row of the pict
  for (y=0; y<11; y++)   {     digitalWrite(y+3, row[y+110]);   }   delay(dotTime); } void loop() {    checkSerial(); printPict(lastPict); } int checkSerial () {            //button loop   // read the pushbutton input pin:   buttonState = digitalRead(buttonPin);   // compare the buttonState to its previous state   if (buttonState != lastButtonState) {     // if the state has changed, increment the counter     if (buttonState == HIGH) {       // if the current state is HIGH then the button       // wend from off to on:       buttonPushCounter++;       Serial.println("on");       Serial.print("number of button pushes:  ");       Serial.println(buttonPushCounter, DEC);     }      else {       // if the current state is LOW then the button       // wend from on to off:       Serial.println("off");      }   }   // save the current state as the last state,    //for next time through the loop   lastButtonState = buttonState;         if(buttonPushCounter == 0) {      memcpy(lastPict, off, sizeof(lastPict));   }      if (buttonPushCounter == 1) {     memcpy(lastPict, triangle, sizeof(lastPict));   }   if (buttonPushCounter == 2) {     memcpy(lastPict, diagonal, sizeof(lastPict));   }    if (buttonPushCounter == 3) {     memcpy(lastPict, seta, sizeof(lastPict));   }    if (buttonPushCounter == 4) {     memcpy(lastPict, greek, sizeof(lastPict));   }    if (buttonPushCounter == 5) {     memcpy(lastPict, chakana, sizeof(lastPict));   }      if (buttonPushCounter > 5) {
    buttonPushCounter = 0;

  }
	

Perfboard Circuit

In this circuit the Arduino components were direct soldiers in the perforated plate, as well as the complementary circuit with LEDs, resistors, buttons and battery.

DSC00824 DSC00823

You can use plastic or wire seals to secure the LED board on bike radius

DSC00817 DSC00815  

DSC00821

Agora é só ligar e sair rodando!

_MG_0424

_MG_0414

_MG_0401

_MG_0408