Arduino Bandsaw Speedometer

6,202

58

22

Introduction: Arduino Bandsaw Speedometer

About: Tinkerer, dumpster-diver, occasional artist. I like to work in wood, metal, and electronics

A couple of years ago, I converted my bandsaw to run off a DC motor from a treadmill instead of the AC-induction motor that it came with. The addition of the the DC motor, plus the motor controller that came out of the treadmill, allows my bandsaw to operate at a big range of speeds without requiring me to change the position of the belts in the back of the saw.

My main motivation in doing this was to give myself the ability to cut metals like steel on the bandsaw, while also keeping the capability of cutting wood. The conversion has overall been a success, but after ruining blades while cutting steel, I found I really needed some way of knowing how fast my blade was moving. Enter the Arduino speedometer.

Supplies:

For this project you will need the following:

- Arduino (Uno, Nano, knockoff or genuine) Buy a Nano Every here: https://amzn.to/2nrEY2S

- Rare-earth magnets: https://amzn.to/33iI4pn

- Hall-effect sensor: https://amzn.to/2nz0VNa

- Perfboard: https://amzn.to/2Vsky6F

- LCD screen of the Hitachi-driver type. You can get these on Adafruit and elsewhere. My project uses a 4x20 screen, but that's just what I had. You can use any size you want as long as it has a minimum of two lines to write text to.

- 10K potentiometer

- 3D printer (optional, but makes fabrication easier)

- Wire and assorted bits of hardware like screws, nuts, bolts

- Two-part epoxy (for attaching the magnets)

- Power supply for your Arduino

Step 1: Wiring

Wiring this project is relatively straightforward, if a bit time consuming because of how many wires need to be soldered. There's nothing tricky to it, and the components that need soldering are minimal.

Step 2: The Code!

For this project to work, your Arduino needs to know what it's doing. This is my code. It's written to work on a bandsaw with 14-inch wheels and six magnets glued around the rim. Consult the code comments if you want to tweak those specifications for your own project.

Arduino Speedometer

/*
This sketch allows an Arduino to act as a speedometer. Data input can come from
magnets glued to the rim or spoke of a wheel along with a hall-effect sensor or
reed switch. You can also use an optical sensor using the spokes to break the
beam of light.
(If you use a reed switch instead of a hall-effect sensor, you will probably
need to modify the sketch to include some debouncing. If you use an optical
sensor, you might need Schmitt trigger circuitry.)
The sketch times how long it takes in milliseconds between pulses from the
sensor, and converts it into feet per minute. It is written for a bandsaw with
16-inch wheels, and six magnets evenly spaced on one of the wheels.
The data is written to an LCD with Hitachi HD44780 compatible chipsets using the
LiquidCrystal library.
For more information about LiquidCrystal, visit
https://www.arduino.cc/en/Reference/LiquidCrystal
The circuit:
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* LCD VSS pin to ground
* LCD VCC pin to 5V
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
Library originally added 18 Apr 2008
by David A. Mellis
library modified 5 Jul 2009
by Limor Fried (http://ladyada.net)
example added 9 Jul 2009
by Tom Igoe
modified 22 Nov 2010
by Tom Igoe
modified 7 Nov 2016
by Arturo Guadalupi
modified 21 Aug 2018 from LiquidCrystal Hello World sketch by Emily Velasco
This example code is in the public domain.
*/
// Include the library code:
#include
// Initialize the library by associating any needed LCD interface pin with the
// arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
// Unsigned long is necessary for these variables because they hold millisecond
// values, which add up quickly as the program runs, and would overflow as int
// variables
unsigned long TimerCount;
unsigned long previousTimerCount;
unsigned long LCDUpdateTime;
int sensorPin = 8;
int pinState = LOW;
int oldpinState = LOW;
int LCDprintValue = 0;
int sawPulse = 1;
void setup() {
pinMode(sensorPin, INPUT);
// Gives TimerCount a millisecond value to start with. millis() is the current
// time in milliseconds since the Arduino booted up
TimerCount = millis();
// Gives previousTimerCount a millisecond value to start with
previousTimerCount = millis();
// Set up the LCD's number of columns and rows. Change this to match your LCD
// dimensions
lcd.begin(20, 4);//
lcd.print("Feet per minute:");
}
void loop() {
pinState = digitalRead(sensorPin);
// Checks to see if the sensor is reading high and if that's
// different than the last time it checked. if both are true, it
//means a pulse from the sensor is being received
if (pinState == HIGH && pinState != oldpinState){
// Records the time in milliseconds so we know when the pulse was
// received
TimerCount = millis();
// Subtracts the time the last pulse was received from the time the newest
// pulse was receieved to determine the milliseconds between each pulse.
// Fewer milliseconds between pulses mean the wheel is turning faster. The
// constant, 41887.8, is derived from a series of calculations that turn
// milliseconds between pulses into revolutions per minute, and then
// revolutions per minute into feet per minute. This constant depends on how
// many pulses per rotation the wheel sensor generates, and the diameter of
// the wheel. In this case, I have six pulses per rotation, and 16-inch
// wheels.
// mpp = milliseconds per pulse = TimerCount - previousTimerCount
// circumference of band saw wheel = 16 inch diameter * Pi
// cif = circumference in feet = (16 * Pi)/12
//
// 1 pulse 60000 ms 1 rev cif 41887.8
// ------- X -------- X ------- X ----- = ------- = feet per minute
// mpp ms 1 min 6 pulse 1 rev mpb
LCDprintValue = (((unsigned long)41887.8)/(TimerCount - previousTimerCount));
// Sets a flag that we can use to tell if the speed has dropped
// to zero
sawPulse = 1;
// Sets previousTimerCount to whatever value was recorded for
// TimerCount before math was calculated
previousTimerCount = TimerCount;
}
// Checks to see if LCDUpdateTime is less than current time in
// milliseconds. this is so the LCD only updates once a second
if (LCDUpdateTime <= millis()){
// Places the cursor in the first column on the second row of the
// LCD
lcd.setCursor(0, 1);
// Checks to see if sawPulse was set to 1 by the first if
// statement. if it has been, it means a pulse was detected
// within the last second and the wheel is still turning
if (sawPulse == 1){
// Prints the speed value calculated above to the LCD
lcd.print(LCDprintValue);
// Prints spaces to clear the line now in preparation for the
// next speed value to be displayed
lcd.print(" ");
// Resets sawPulse to zero in preparation for the else statement
// below
sawPulse = 0;
}
// If sawPulse is anything besides 1, it means the program has
// not detected a new pulse within the last second, and it can
// be assumed speed has dropped to zero
else {
lcd.print("0"); //Prints zero for the speed
// Prints spaces to clear the line now in preparation for the
// next speed value to be displayed
lcd.print(" ");
}
// Checks the time, adds 1000 milliseconds (1 second) to it, and
// records it. this value is compared against the time in
// milliseconds above to see if a second has elapsed.
LCDUpdateTime = (millis()+1000);
}
// Sets oldpinState to the last measured state from the sensor so it can be
// used to see if that state has changed next time the loop runs
oldpinState = pinState;
}

Be the First to Share

    Recommendations

    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • Anything Goes Contest

      Anything Goes Contest

    22 Discussions

    0
    NeilRG
    NeilRG

    1 year ago

    Useful and thorough. Well done.

    1
    starguywisc
    starguywisc

    Question 1 year ago on Step 2

    Nice job! You should do an Instructable on the conversion of your bandsaw to a DC Treadmill motor. :)

    0
    CPUDOCTHE1.
    CPUDOCTHE1.

    Answer 1 year ago

    Actually a 3 phase motor with VFD is probably cheaper and much more robust. You can get VFDs from less than $100 US to several thousands of dollars US depending upon current capacity.

    0
    starguywisc
    starguywisc

    Reply 1 year ago

    Nice idea but I only have 2 phase.

    0
    CPUDOCTHE1.
    CPUDOCTHE1.

    Reply 1 year ago

    You can get VFDs that run off of 110V or 220V single phase for the smaller motors, 2 hp or so. We only have single phase in our area. We have a rotary 3 phase convert that runs the mills, and a 3 phase 220 volt VFD for the 2 hp lathe speed control that runs off of the rotary phase converter and a 110V 3 phase converter for the 1 hp lathe. The 220V input VFD will run off of 220V single phase and will run up to a 4 hp motor.

    0
    MLEonline
    MLEonline

    Reply 1 year ago

    More robust, perhaps. Cheaper, not at all. I got three treadmills for free. Free motor. Free motor control board. All I needed to make it work on my saw was an enclosure for the controller, a toggle switch, a pushbutton, and a potentiometer. It was probably $20 worth of parts.

    0
    MLEonline
    MLEonline

    Answer 1 year ago

    That's not a bad idea. I have spare treadmill motors, and one spare treadmill motor controller sitting in my garage. Maybe I could do a conversion of another one of my tools and document it

    0
    starguywisc
    starguywisc

    Reply 1 year ago

    I've got an old Craftsman band saw from probably the 1950's with a massive 3/4 HP motor on it. It would be great to make it variable speed. :)

    0
    MLEonline
    MLEonline

    Reply 1 year ago

    Start looking on craigslist in your area for free treadmills. They're not too hard to find because people buy them on a whim or for a resolution, and then stop using them, and they take up lots of room. Even when they're broken, the motor is usually still good.

    I got three treadmills for free, and between the three of them, I got a really good motor, and a really good control board. Once you have those, the wiring is not too hard.

    0
    prampec
    prampec

    1 year ago

    Nice Job! You might want to try using PWM for dimming the backlight of the LCD, but it might not worth it.

    0
    MLEonline
    MLEonline

    Reply 1 year ago

    That's not a bad idea. I have spare IO pins on the arduino, so I could probably use one of them for PWM with a mosfet or something like that

    1
    Gofish
    Gofish

    1 year ago

    Knowing what your blade speed is is vital. I sometimes work with Nickel and Iron based alloys that need around 45 - 50 FPM with lubricant/coolant with a bi-metal blade. Occasionally I end up on a Sunday evening with nought but a Carbon steel blade and need to drop to around 15 - 20 FPM. Most Woodworkers have no idea just how slow blade speed needs to be for SOME materials, hole saws are the classic example. Good article.

    0
    MLEonline
    MLEonline

    Reply 1 year ago

    15-20 is slooooow. I doubt my saw can go that slow without stalling, but I suppose I could get there with the right pulleys

    0
    tytower
    tytower

    1 year ago

    Pretty tricky. Lot of work though . I use the rev counters on ebay at about $10 a piece . Arduinos are great but you have to make a board and solder it or the contacts degrade and muck up the readings. That gets costly so using an ATTiny85 sometimes helps.

    I use this . It picks up the magnet passing -just one though. about $10 AUD
    https://www.ebay.com.au/itm/Digital-Engine-Tach-Tachometer-Hour-Meter-Inductive-for-Motorcycle-Motor-ATAU/392008527540?_trkparms=aid%3D555018%26algo%3DPL.SIM%26ao%3D1%26asc%3D60048%26meid%3Dc1eb12f64f3f4c948f70885f8f931b83%26pid%3D100005%26rk%3D3%26rkt%3D12%26sd%3D382596542583%26itm%3D392008527540%26pmt%3D1%26noa%3D0%26pg%3D2047675&_trksid=p2047675.c100005.m1851

    0
    MLEonline
    MLEonline

    Reply 1 year ago

    The cost was not much. The arduino nano every is less than $10. Perfboard is very cheap. The hall-effect sensors were about a buck apiece. The LCD was salvaged.
    Everything is soldered (no headers), so there are no contacts to degrade.
    And yeah, it was a bit of work, but that's the fun part.

    1
    Alex in NZ
    Alex in NZ

    1 year ago

    Neat solution! Well done, and thank you for sharing your work :-)

    0
    MLEonline
    MLEonline

    Reply 1 year ago

    You're welcome!

    0
    MLEonline
    MLEonline

    Reply 1 year ago

    You're welcome! Thanks for the nice comment.

    0
    liquidhandwash
    liquidhandwash

    1 year ago

    Thanks so much for documenting the Arduino code the way you have, makes it easy to understand.
    Nice job on the treadmill motor band saw too.

    1
    MLEonline
    MLEonline

    Reply 1 year ago

    A friend of mine was a software engineer in his past career, so I asked him to do code review. I didn't realize what I was asking for. He went through my code with a fine toothed comb, and made sure I commented everything clearly. Credit goes to him as well!