Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Skyler HudsonHunter EshamDaniel Sanchez
Published © GPL3+

Dual Linear Potentiometer MTB Wheel Truing Indicator

Use two potentiometers to indicate via different colored leds whether the wheel is within two milimeters deviation.

IntermediateFull instructions provided10 hours258
Dual Linear Potentiometer MTB Wheel Truing Indicator

Things used in this project

Hardware components

Resistor 330 ohm
Resistor 330 ohm
×1
Through Hole Resistor, 680 ohm
Through Hole Resistor, 680 ohm
×1
Argon
Particle Argon
×3
Wood
×1
Screws
×16
Jumper wires (generic)
Jumper wires (generic)
×2
5 mm LED: Green
5 mm LED: Green
×1
5 mm LED: Red
5 mm LED: Red
×1
LED, Blue
LED, Blue
×1
Potentiometer, 5 kohm
Potentiometer, 5 kohm
×2
Breadboard (generic)
Breadboard (generic)
×3
12mm Threaded Rod
×1
12mm nuts
×4

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
ThingSpeak API
ThingSpeak API

Hand tools and fabrication machines

Drill / Driver, Cordless
Drill / Driver, Cordless
Hack Saw
Velcro Command Strip

Story

Read more

Schematics

Potentiometer Particle Boards

This is the breadboard schematic for the Particle Argon that posts the displacement data to thing speak and the Particle Argon that Publishes the data for the Led Particle.

Led Indicator Particle

This Particle subscribes to the potentiometer data and shines a red, green, or blue led according to the displacement of the wheel.

Code

Potentiometer Particle Code

C/C++
This code powers both potentiometers and reads the data output from each particle. It then publishes the color led that shoud be shining based on the displacement of the wheel.
int power = A5;
double Reading1 = A0;   //reading from potemtiometer 1
double Reading2 = A1;   //reading from potemtiometer 2
double Displacementdata;

    void setup() {
  pinMode(Reading1,INPUT);
  pinMode(Reading2,INPUT);
  pinMode(power,OUTPUT);
  digitalWrite(power,HIGH);

  

    }   

  
void loop()  
{if(digitalRead(power) ==HIGH){     //determines if circuit is on

   Displacementdata=0.5;

        if ((analogRead(Reading1)-analogRead(Reading2))/244.286>= Displacementdata){    //Is true if wheeel is aligned right
            Particle.publish("RedLight", "Red");        //sends event "RED"
        }
        
        else if ((analogRead(Reading1)-analogRead(Reading2))/244.286<= -Displacementdata){   //Is true if wheeel is aligned left
        Particle.publish("BlueLight", "Blue");          //Sends event BLUE
        }
        
        else{ Particle.publish("GreenLight", "Green");}      //Is true if wheeel is centered, Sends event Green
        
    
    delay(1000);
    

  }}

Thing Speak Particle Code

C/C++
This code takes the data output from the potentiometers and posts it to Thingspeak.
int power = A5;
double Reading1 = A0;
double Reading2 = A1;
int Displacementdata;

    void setup() {
  pinMode(Reading1,INPUT);
  pinMode(Reading2,INPUT);
  pinMode(power,OUTPUT);
  digitalWrite(power,HIGH);

  

    }   

  
void loop()  {



  String Displacement2=String(((analogRead(Reading1)-analogRead(Reading2))/244.286));    //Turns the Voltage drop recived into the change in distnance of the potenteometers
  Particle.publish("Disp2", Displacement2);     //Publishes the data for thinkspeak to access
  
  
  
  
    delay(1000);
    
  
  }

Led Particle Code

C/C++
This code subscribes to the potentiometer particles data and tells the particle which led to turn on.
//Identifies the pins powering each LED
int red = D4;   
int grn = D3;
int blu = D2;

void setup() {

//Identifies each of the previous pins as outputs
pinMode(red, OUTPUT);
pinMode(grn, OUTPUT);
pinMode(blu, OUTPUT);

//Subscribes to three events published by POS_Volume_2, each dictating which LED to illuminate.
Particle.subscribe("RedLight",Red);
Particle.subscribe("BlueLight",Blue);
Particle.subscribe("GreenLight",Green);

}




//Initiates events dependent on event "Red"
void Red(const char *R, const char *r){
//Turns off non-target LEDs
digitalWrite(blu, LOW);
digitalWrite(grn, LOW);
//Turns on target LED
digitalWrite(red, HIGH);
delay(500);
}

//Initiates events dependent on event "Blue"
void Blue(const char *B, const char *b){
//Typ.
digitalWrite(red, LOW);
digitalWrite(grn, LOW);
//Typ.
digitalWrite(blu, HIGH);
delay(500);

}

//Initiates events dependent on event "Green"
void Green(const char *G, const char *g){
//Typ.
digitalWrite(red, LOW);
digitalWrite(blu, LOW);
//Typ.
digitalWrite(grn, HIGH);
delay(500);

}

Credits

Skyler Hudson
1 project • 0 followers
Contact
Hunter Esham
2 projects • 0 followers
Contact
Daniel Sanchez
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.