Rupin Chheda
Published

ESP8266 Cycle Computer

Hack open a off the shelf cycle computer and make it wireless.

IntermediateShowcase (no instructions)4 hours3,737
ESP8266 Cycle Computer

Things used in this project

Hardware components

Cycle Computer
×1
General Purpose Transistor NPN
General Purpose Transistor NPN
BC547 Small Signal Transistor
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Resistor 100k ohm
Resistor 100k ohm
Any value from 500K to 800k should be fine.
×6
Female Header 8 Position 1 Row (0.1")
Female Header 8 Position 1 Row (0.1")
For Connection to ESP8266
×1
Wemos D1 Mini
Espressif Wemos D1 Mini
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Wire Cutter

Story

Read more

Schematics

Schematics/Connection

I created this connection diagram with the BC547 NPN Transistor, but any generic NPN transistor should do.

Code

Tachometer

C/C++
This code is for the ESP8266, but can be used with an Arduino as well
#define TACHOINPUT 5
#define FACTOR 1.6*1000*3600
unsigned long int lastMicros=0;

unsigned int speedKMPH=0;

void setup() {
  // put your setup code here, to run once:
  pinMode(TACHOINPUT, INPUT);
  attachInterrupt(TACHOINPUT, tachoInterrupted, RISING);
  Serial.begin(115200);
  lastMicros=micros();
}

void loop() {
  // put your main code here, to run repeatedly:
//Serial.println(digitalRead(TACHOINPUT));
}

void tachoInterrupted()
{
  unsigned long int duration=micros()-lastMicros;
  lastMicros=micros();
  if(duration>1000)
  {
    speedKMPH=FACTOR/duration;
  }
  Serial.println(speedKMPH);
}

Credits

Rupin Chheda

Rupin Chheda

35 projects • 83 followers
Resident Maker at CuriosityGym! Electronics Engineer, CAD Modeller, Educator

Comments