user334153146
Published © LGPL

DIY Speedometer Using Arduino and Processing Android App

Make a cool speedometer for bikes or any automotive by using Arduino, Bluetooth, and an Android Application.

Full instructions provided29,689
DIY Speedometer Using Arduino and Processing Android App

Things used in this project

Hardware components

Arduino Pro Mini 328 - 5V/16MHz
SparkFun Arduino Pro Mini 328 - 5V/16MHz
×1
Hall Effect Sensor
Hall Effect Sensor
×1
SparkFun FTDI Basic Breakout - 5V
SparkFun FTDI Basic Breakout - 5V
×1
3V to 5V DC-DC Boost Converter with USB output
×1
TP4056 Lithium battery module
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
or HC-06
×1
18650 Lithium cell
×1
SparkFun Snappable Protoboard
SparkFun Snappable Protoboard
×1
Headers (male and female)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Schematic 1

Code

Code snippet #1

Arduino
/*Arduino Code for measuring speed of the Vechile using Hall Sensor
  * Coded by Circuitdigest.com
  * On 14-04-2017
  */
 /*CONNECTION DETIALS
   * Arduino D11 -> RX of BT Module
   * Arduino D12 -> Tx of BT
   * Arduino D2  -> Hall sensor 3rd pin
   */
#include <SoftwareSerial.h>// import the serial library
SoftwareSerial Cycle_BT(11, 12);  // RX, TX
 int ledpin=13; // led on D13 will show blink on / off
 int BluetoothData; // the data given from Computer
float radius_of_wheel = 0.33;  //Measure the radius of your wheel and enter it here
 volatile byte rotation; // variale for interrupt fun must be volatile
 float timetaken,rpm,dtime;
 int v;
 unsigned long pevtime;
void setup()
  {
    Cycle_BT.begin(9600); //start the Bluetooth communication at 9600 baudrate
    //pinMode(ledpin,OUTPUT); //LED pin aoutput for debugging
    attachInterrupt(0, magnet_detect, RISING); //secound pin of arduino used as interrupt and magnet_detect will be called for each interrupt
    rotation = rpm = pevtime = 0; //Initialize all variable to zero
  }
 
 void loop()
 {
   /*To drop to zero if vehicle stopped*/
  if(millis()-dtime>1500) //no magnet found for 1500ms
  {
   rpm= v = 0; // make rpm and velocity as zero
   Cycle_BT.write(v);
   dtime=millis();
  }
  v = radius_of_wheel * rpm * 0.37699; //0.33 is the radius of the wheel in meter
 }
 
 void magnet_detect() //Called whenever a magnet is detected
 {
   rotation++;
   dtime=millis();
   if(rotation>=2)
   {
     timetaken = millis()-pevtime; //time in millisec for two rotations
     rpm=(1000/timetaken)*60;    //formulae to calculate rpm
     pevtime = millis();
     rotation=0;
     Cycle_BT.write(v);
     //Cycle_BT.println("Magnet detected...."); //enable while testing the hardware
   }
 }

Credits

user334153146

user334153146

1 project • 6 followers

Comments