Devices & Components
Arduino Uno Rev3
Graphic OLED, 128 x 64
3144 Hall Sensor
Project description
Code
Easy Peasy Tachometer
arduino
It is a home made reliable tachometer, that can be used with an Arduino UNO or NANO that you can use to measure the speed of rotating objects on tools, bicycles, and robotics. For a complete tutorial follow this link https://youtu.be/2-J4f8-RX90
1// Easy Peasy Tachometer 2//James Rovere 2020 3#include <Wire.h> 4#include <Adafruit_SSD1306.h>// You may have to edit library for 128x64, 5// default is 128 x 32. 6 7#define OLED_WIDTH 128 8#define OLED_HEIGHT 64 9 10#define OLED_ADDR 0x3C // A very common address for these displays. 11 12Adafruit_SSD1306 display(OLED_WIDTH, OLED_HEIGHT); 13 14 15float value=0; 16float rev=0; 17int rpm; 18int oldtime=0; 19int time; 20 21void isr() //interrupt service routine 22{ 23rev++; 24} 25 26void setup() 27{ 28 display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR); 29 display.clearDisplay(); 30 31digitalWrite(2 ,HIGH);// Instead of using a pull up resistor 32attachInterrupt(0,isr,RISING); //attaching the interrupt 33 34} 35 36void loop() 37{ 38delay(2000);// 2 second delay 39detachInterrupt(0); //detaches the interrupt while calculating 40time=millis()-oldtime; //finds the time 41rpm=(rev/time)*60000; //calculates rpm 42oldtime=millis(); //saves the current time 43rev=0; 44 45 display.clearDisplay(); 46 display.setTextSize(2); 47 display.setTextColor(WHITE); 48 display.setCursor(0, 0);// Vertical, Horizontal. 49 display.println("RPM:"); 50 display.setTextSize(5); 51 display.setTextColor(WHITE); 52 display.setCursor(0,25); 53 display.println(rpm); 54 display.display(); 55 56 57 attachInterrupt(0,isr,RISING); 58 59 60}
Easy Peasy Tachometer
arduino
It is a home made reliable tachometer, that can be used with an Arduino Uno or Nano that you can make to measure the speed of rotating objects on tools, bicycles, and robotics.
1// Easy Peasy Tachometer 2//James Rovere 2020 3#include <Wire.h> 4#include <Adafruit_SSD1306.h>// You may have to edit library for 128x64, //default is 128 x 32. 5 6#define OLED_WIDTH 128 7#define OLED_HEIGHT 64 8 9#define OLED_ADDR 0x3C // A very common address for these displays. 10 11Adafruit_SSD1306 display(OLED_WIDTH, OLED_HEIGHT); 12 13 14float value=0; 15float rev=0; 16int rpm; 17int oldtime=0; 18int time; 19 20void isr() //interrupt service routine 21{ 22rev++; 23} 24 25void setup() 26{ 27 display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR); 28 display.clearDisplay(); 29 30digitalWrite(2 ,HIGH);// Instead of using a pull up resistor 31attachInterrupt(0,isr,RISING); //attaching the interrupt 32 33} 34 35void loop() 36{ 37delay(2000);// 2 second delay 38detachInterrupt(0); //detaches the interrupt while calculating 39time=millis()-oldtime; //finds the time 40rpm=(rev/time)*60000; //calculates rpm 41oldtime=millis(); //saves the current time 42rev=0; 43 44 display.clearDisplay(); 45 display.setTextSize(2); 46 display.setTextColor(WHITE); 47 display.setCursor(0, 0);// Vertical, Horizontal. 48 display.println("RPM:"); 49 display.setTextSize(5); 50 display.setTextColor(WHITE); 51 display.setCursor(0,25); 52 display.println(rpm); 53 display.display(); 54 55 56 attachInterrupt(0,isr,RISING); 57 58 59}
Easy Peasy Tachometer
arduino
It is a home made reliable tachometer, that can be used with an Arduino UNO or NANO that you can use to measure the speed of rotating objects on tools, bicycles, and robotics. For a complete tutorial follow this link https://youtu.be/2-J4f8-RX90
1// Easy Peasy Tachometer 2//James Rovere 2020 3#include <Wire.h> 4#include 5 <Adafruit_SSD1306.h>// You may have to edit library for 128x64, 6// default is 7 128 x 32. 8 9#define OLED_WIDTH 128 10#define OLED_HEIGHT 64 11 12#define 13 OLED_ADDR 0x3C // A very common address for these displays. 14 15Adafruit_SSD1306 16 display(OLED_WIDTH, OLED_HEIGHT); 17 18 19float value=0; 20float rev=0; 21int 22 rpm; 23int oldtime=0; 24int time; 25 26void isr() //interrupt 27 service routine 28{ 29rev++; 30} 31 32void setup() 33{ 34 display.begin(SSD1306_SWITCHCAPVCC, 35 OLED_ADDR); 36 display.clearDisplay(); 37 38digitalWrite(2 ,HIGH);// Instead 39 of using a pull up resistor 40attachInterrupt(0,isr,RISING); //attaching the interrupt 41 42} 43 44void 45 loop() 46{ 47delay(2000);// 2 second delay 48detachInterrupt(0); //detaches 49 the interrupt while calculating 50time=millis()-oldtime; //finds the time 51 52rpm=(rev/time)*60000; //calculates rpm 53oldtime=millis(); //saves 54 the current time 55rev=0; 56 57 display.clearDisplay(); 58 display.setTextSize(2); 59 60 display.setTextColor(WHITE); 61 display.setCursor(0, 0);// Vertical, Horizontal. 62 63 display.println("RPM:"); 64 display.setTextSize(5); 65 display.setTextColor(WHITE); 66 67 display.setCursor(0,25); 68 display.println(rpm); 69 display.display(); 70 71 72 73 attachInterrupt(0,isr,RISING); 74 75 76}
Documentation
Hall Sensor wiring diagram
Hall Sensor wiring diagram
Hall Sensor wiring diagram
Hall Sensor wiring diagram
Comments
Only logged in users can leave comments