Thomas Angielsky
Published © GPL3+

Tension Meter for Saw Blades on Band Saws with Arduino

Setting up a new blade for a band saw is sometimes a hard job. But there could be help with Arduino power.

IntermediateFull instructions provided8 hours3,614

Things used in this project

Story

Read more

Custom parts and enclosures

Housing of the tension meter

The device is made of three parts. You can print it with a 3d printer.
Download the current version on https://techpluscode.de/downloads/download-messgerat-fur-bandspannung/

Schematics

Circuit diagram

created with fritzing

Code

Arduino sketch of tension meter

Arduino
/*
Programm: bladetension.ino
Funktion: Tension meter of blades on band saws
          measured with Force sensing resistor FSR

Autor:    Thomas Angielsky
Internet: https://techpluscode.de

*/

/*
 *   lcdgfx:
 *   Copyright (c) 2017-2019, Alexey Dynda
 *   Attiny85 PINS (i2c)
 *             ____
 *   RESET   -|_|  |- 3V
 *   SCL (3) -|    |- (2)
 *   SDA (4) -|    |- (1)
 *   GND     -|____|- (0)
 *
 *   Attiny SPI PINS:     connect LCD to D4 (D/C), GND (CS), D3 (RES), D1(DIN), D2(CLK)
 *
 *   Nano/Atmega328 PINS: connect LCD to A4/A5 (i2c)
 *   ESP8266: GPIO4(SDA) / GPIO5( SCL )
 *   STM32: B7(SDA), B6(SCL)
 */

#include "lcdgfx.h"

DisplaySSD1306_128x64_I2C display(-1);
//DisplaySSD1306_128x64_SPI display(-1,{-1, 0, 1, 0, -1, -1); // Use this line for nano pi (RST not used, 0=CE, gpio1=D/C)
//DisplaySSD1306_128x64_SPI display(3,{-1, 4, 5, 0,-1,-1});   // Use this line for Atmega328p (3=RST, 4=CE, 5=D/C)
//DisplaySSD1306_128x64_SPI display(24,{-1, 0, 23, 0,-1,-1}); // Use this line for Raspberry  (gpio24=RST, 0=CE, gpio23=D/C)
//DisplaySSD1306_128x64_SPI display(22,{-1, 5, 21, 0,-1,-1}); // Use this line for ESP32 (VSPI)  (gpio22=RST, gpio5=CE for VSPI, gpio21=D/C)
// composite_video_128x64_mono_init(); // Use this line for ESP32 with Composite video support

String bladeName[4] = {"No.01-03mm","No.02-06mm","No.03-12mm","No.04-16mm"};
int bladeMin[4] =     { 430,         450,         470,          470};
int bladeMax[4] =     { 470,         470,         510,          510};
String s;

int fsrPin = A1; 
int buttonPin = A2;   

int blade = 0;
int fsrValue;
float fsrMax = 5.0; //Maximum (measured) value of FSR in Kilogramm 
float fsrKG;
float resolutionADW = 1024.0;
char str[16];
int i = 1;
int button;
int buttonlast;
long timestamp = 0;
long debounce = 100;



void setup()
{
    Serial.begin(9600);  
  
    pinMode(fsrPin, INPUT);  
    pinMode(buttonPin, INPUT); 
  
    display.setFixedFont(ssd1306xled_font8x16);
    display.begin();
    display.clear();   
}

void loop()
{
  button = digitalRead(buttonPin);

  if (button == HIGH && buttonlast == LOW && millis()-timestamp > debounce) {
    timestamp = millis();    
    blade=blade+1;
    if (blade>3) {blade=0;}   
  }

  buttonlast = button;

  i=i+1;
  if (i>10) {
    i=1;
  
    fsrValue = analogRead(fsrPin);  
    fsrKG = float(fsrValue)/resolutionADW*fsrMax;
  
    Serial.print("Measured value = ");
    Serial.print(fsrValue);
    Serial.print(" in Kilogramm: ");
    Serial.println(fsrKG);
   
   
    s="BLADE: "+bladeName[blade];
    s.toCharArray(str,16);
    display.negativeMode();
    display.printFixed(8,  0, str, STYLE_NORMAL);
    display.positiveMode();

    display.printFixed(8,  16, "Value", STYLE_NORMAL);
    sprintf(str,"%04d",fsrValue);
    display.printFixed(8,  32, str, STYLE_NORMAL);

    display.printFixed(72,  16, "Limit", STYLE_NORMAL);
    s=String(bladeMin[blade])+"-"+String(bladeMax[blade]);
    s.toCharArray(str,16);
    display.printFixed(72,  32, str, STYLE_NORMAL);

  //trick for float with sprintf
    sprintf(str, "%d.%1d kg ", (int)fsrKG, (int)(fsrKG*100)%100);
    display.printFixed(8,  48, str, STYLE_NORMAL);


    if ((fsrValue>bladeMin[blade]) && (fsrValue<bladeMax[blade])) {
      display.negativeMode();
      s="GOOD!";
      s.toCharArray(str,16);
      display.printFixed(72,  48, str, STYLE_NORMAL);
      display.positiveMode();  
      }
    else {
      s="-----";
      s.toCharArray(str,16);
      display.printFixed(72,  48, str, STYLE_NORMAL);
    }
  }
  lcd_delay(100);
}

Credits

Thomas Angielsky

Thomas Angielsky

18 projects • 36 followers
Mechanical engineer, maker, love woodwork, like Lazarus

Comments