• Scam Alert. Members are reminded to NOT send money to buy anything. Don't buy things remote and have it shipped - go get it yourself, pay in person, and take your equipment with you. Scammers have burned people on this forum. Urgency, secrecy, excuses, selling for friend, newish members, FUD, are RED FLAGS. A video conference call is not adequate assurance. Face to face interactions are required. Please report suspicions to the forum admins. Stay Safe - anyone can get scammed.

Someone check my math please.... Arduino Shaper Ram FPM Sensor

Don't over complicate it. Count the number of full cycles in one minute (simple terms same point), the stroke in one direction is X (in inches), the time is 1 (minute)

Here is the math.

X/12 = ft x 1 (one minute) = FPM.

I know its fun to do all sorts of neat complicated things, but KISS.
 
Last edited:

YYCHM

(Craig)
Premium Member
Don't over complicate it. Count the number of full cycles in one minute (simple terms same point), the stroke in one direction is X (in inches), the time is 1 (minute)

Here is the math.

X/12 = ft x 1 (one minute) = FPM.

I know its fun to all sorts of neat complicated things, but KISS.

I like the KISS principal too LOL...
 

whydontu

I Tried, It Broke
Premium Member
The shaper stroke is variable from 0 to 8", two fixed points is not a practical approach in this case.

I have an analog IR distance sensor and a sonic distance sensor inbound by snail mail thanks...... Should be here next week with luck. My wire has cleared customs in Calgary so Amazon should deliver that anytime now.
I build electronic music equipment. I use a couple of the HRC04 ultrasonic sensors to detect hand positions on a theremin. One for pitch, one for volume


I can get repeatable 1mm resolution, which as a theremin translates to moving my hand <2mm changes pitch from C to C#

I haven't tried using the optical sensors, they had too long a minimum range for my application.
 

Dusty

(Bill)
Premium Member
I wanted to find out what FPM my shaper is running at....

So, I setup the shaper for a 6.25" stroke and then counted 52 forward strokes per minute using a stop watch.

From that I derived 54 FPM. That sound right to you? This the slowest the machine will run at.

Craig

Hey Craig, I'm a real dumb ass when it comes to shapers, for what reason should one need to know FPM.
 

YYCHM

(Craig)
Premium Member
Hey Craig, I'm a real dumb ass when it comes to shapers, for what reason should one need to know FPM.

Speeds and Feeds. It's your tool cutting speed, just like you adjust a lathe or mill by changing RPM. This shaper has a variable diameter pulley system where by you can change the ram velocity by changing the diameter of the motor pulley on the fly. It's quit ingenious actually. The pulley diameter changes dynamically as you increase or decrease the belt tension.

 
Last edited:

Dusty

(Bill)
Premium Member
Speeds and Feeds. It's your tool cutting speed, just like you adjust a lathe or mill by changing RPM. This shaper has a variable diameter pulley system where by you can change the ram velocity by changing the diameter of the motor pulley on the fly. It's quit ingenious actually.

Hey Craig, didn't know that where in heck have I been all this time. Tempting I know please don't answer that. LOL
 

YYCHM

(Craig)
Premium Member
Finally got all the stuff together to attempt a FPM meter.......

Parts.JPG

The IR sensor was a bust. Tinkered with it for a day and gave up. Not accurate enough and all kinds of false readings. That silly thing cost 5 times more than the Ultrasonic senor I got at the same time.

The Ultrasonic sensor behaves much better, but has it's quirks as well. It not exactly repeatable. By applying all sorts of filtering and averaging I managed to get it to settle down on shorter distances but still not great for longer distances. Will keep plugging away on this one. Still need an enclosure, 9V battery holder and on/off sw in order to move it into the shop and try it on the shaper.

Crimper.JPG

This JST connector crimping stuff I got doesn't seem to work well at all. Mangles the wire so bad you can't seat the pin into holder. Don't know what I'm doing wrong, but it's very frustrating..

Craig
 
Sometimes the simple ways are best, causes less grey hair or hair loss.

Consider using a simple mechanical counter (god help us no electronics ;)) like


Math is simple number of counts x distance in 1 stroke direction gives you fpm.

KISS

Cheers,
 
BTW I sell dies for crimpers (unfortunately not this applications), most of the time it is a less quality die and not the crimper body, unless you use them a lot. Look for a die it might be cheaper.
 

deleted_user

Super User
Finally got all the stuff together to attempt a FPM meter.......

View attachment 19543

The IR sensor was a bust. Tinkered with it for a day and gave up. Not accurate enough and all kinds of false readings. That silly thing cost 5 times more than the Ultrasonic senor I got at the same time.

The Ultrasonic sensor behaves much better, but has it's quirks as well. It not exactly repeatable. By applying all sorts of filtering and averaging I managed to get it to settle down on shorter distances but still not great for longer distances. Will keep plugging away on this one. Still need an enclosure, 9V battery holder and on/off sw in order to move it into the shop and try it on the shaper.

View attachment 19544

This JST connector crimping stuff I got doesn't seem to work well at all. Mangles the wire so bad you can't seat the pin into holder. Don't know what I'm doing wrong, but it's very frustrating..

Craig
I have similar crimper. https://www.amazon.ca/gp/product/B07R1H3Z8X/ref=ppx_yo_dt_b_asin_title_o01_s01?ie=UTF8&psc=1

It's all about placement and technique. I had to watch a youtube video how to use it.

I hope you figure out a good sensing method to count your strokes and the shaper. Can you mount a magnet and a hall sensor anywhere on the shaper?
 

YYCHM

(Craig)
Premium Member
I hope you figure out a good sensing method to count your strokes and the shaper. Can you mount a magnet and a hall sensor anywhere on the shaper?

Strokes I can count no problem. Trying to compute FPM with any configuration of stroke length on the fly.
 

deleted_user

Super User
Strokes I can count no problem. Trying to compute FPM with any configuration of stroke length on the fly.
can you share your arduino code you've tried?

I'm about to modify a tachometer program to add surface feet per minute based on input workpiece diameters. The programming should be very similar. I may be able to work out yours too.

caveat, I have not written any code for arduino in years so I am rusty.
 

YYCHM

(Craig)
Premium Member
can you share your arduino code you've tried?

I'm about to modify a tachometer program to add surface feet per minute based on input workpiece diameters. The programming should be very similar. I may be able to work out yours too.

caveat, I have not written any code for arduino in years so I am rusty.

---------------------------------------------------------------------------------------------------------------
const int pingPin = 7; // Trigger Pin of Ultrasonic Sensor
const int echoPin = 6; // Echo Pin of Ultrasonic Sensor

// Include the library:
#include <LiquidCrystal_I2C.h>
#include <NewPing.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
//LiquidCrystal_I2C lcd(0x3F, 16, 2);

#define MAX_DISTANCE 400

NewPing sonar(pingPin, echoPin, MAX_DISTANCE);

// Create variable to store curent value _c, pervious value _p, delta value d_, centemeter cm, millisec ms, seconds sec
float c_cm = 0;
float p_cm = 0;
float d_cm = 0;
unsigned long c_ms = 0;
unsigned long p_ms = 0;
unsigned long d_ms = 0;
unsigned long d_sec = 0;

// Create variable to store cm per sec cps, ft per min fpm
float cps = 0;
float fpm = 0;

float duration, c_dur, p_dur, a_dur, inches, cm = 0.0;

unsigned long lcdrefresh = 0; // To store time for lcd to refresh

void setup() {
Serial.begin(9600); // Starting Serial Terminal

lcd.init();
lcd.backlight();
lcd.clear();
lcd.setCursor(0,0);
lcd.print("FWD FPM ");
lcd.setCursor(0,1);
lcd.print("REV FPM ");
lcd.setCursor(0,1);
}

void loop() {

/*******
pinMode(pingPin, OUTPUT);
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(10);
digitalWrite(pingPin, LOW);
pinMode(echoPin, INPUT);
c_dur = pulseIn(echoPin, HIGH);
****/
c_dur = sonar.ping_median(5);

if (abs(c_dur - p_dur) <= /*4.35*/ 4.4) c_dur = p_dur;

a_dur = (c_dur + p_dur) / 2.0;

inches = microsecondsToInches(a_dur);
cm = microsecondsToCentimeters(a_dur);
Serial.print(inches);
Serial.print("in, ");
Serial.print(cm);
Serial.print("cm, ");

// Serial.print(sonar.ping_in());
// Serial.print("in, ");

Serial.print("c_dur ");
Serial.print(c_dur);
Serial.print(" p_dur ");
Serial.print(p_dur);
Serial.print(" a_dur ");
Serial.println(a_dur);
Serial.println();

c_cm = cm;
c_ms = millis();

bool fwdfpm = false;
bool revfpm = false;
bool frfpm = false;

if (c_cm > p_cm) fwdfpm = true;
if (c_cm < p_cm) revfpm = true;
if (c_cm == p_cm) frfpm = true;

d_cm = c_cm - p_cm;
d_ms = c_ms - p_ms;
d_sec = d_ms / 1000;
cps = d_cm / d_sec;
fpm = (cps / 30.48) * 60.0;

// LCD Display
// if( ( millis()-lcdrefresh ) >= 1000 )
{
if (fwdfpm)
{
lcd.setCursor(8,0);
lcd.print(" ");
lcd.setCursor(8,0);
lcd.print(fpm);
}

if (revfpm)
{

lcd.setCursor(8,1);
lcd.print(" ");
lcd.setCursor(8,1);
lcd.print(fpm);
}

if (frfpm)
{
lcd.setCursor(8,0);
lcd.print(" ");
lcd.setCursor(8,0);
lcd.print(fpm);
lcd.setCursor(8,1);
lcd.print(" ");
lcd.setCursor(8,1);
lcd.print(fpm);
}

Serial.print("fpm ");
Serial.print(fpm);
Serial.print(" dcm ");
Serial.println(d_cm);
Serial.println();


lcdrefresh = millis();
}

p_cm = c_cm;
p_ms = c_ms;
// p_dur = a_dur;
p_dur = c_dur;


// delay(100);
delay(900);
}

float microsecondsToInches(long microseconds) {
return microseconds / 74.0 / 2.0;
}
float microsecondsToCentimeters(long microseconds) {
return microseconds / 29.0 / 2.0;
}

---------------------------------------------------------------------------------------------------------------

Still need to figure out how to capture peak FPM or average FPM for the fwd and rev strokes.
 
Last edited:

YYCHM

(Craig)
Premium Member
@TorontoBuilder check these out....


 

deleted_user

Super User
const int pingPin = 7; // Trigger Pin of Ultrasonic Sensor
const int echoPin = 6; // Echo Pin of Ultrasonic Sensor

// Include the library:
#include <LiquidCrystal_I2C.h>
#include <NewPing.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
//LiquidCrystal_I2C lcd(0x3F, 16, 2);

#define MAX_DISTANCE 400

NewPing sonar(pingPin, echoPin, MAX_DISTANCE);

// Create variable to store curent value _c, pervious value _p, delta value d_, centemeter cm, millisec ms, seconds sec
float c_cm = 0;
float p_cm = 0;
float d_cm = 0;
unsigned long c_ms = 0;
unsigned long p_ms = 0;
unsigned long d_ms = 0;
unsigned long d_sec = 0;

// Create variable to store cm per sec cps, ft per min fpm
float cps = 0;
float fpm = 0;

float duration, c_dur, p_dur, a_dur, inches, cm = 0.0;

unsigned long lcdrefresh = 0; // To store time for lcd to refresh

void setup() {
Serial.begin(9600); // Starting Serial Terminal

lcd.init();
lcd.backlight();
lcd.clear();
lcd.setCursor(0,0);
lcd.print("FWD FPM ");
lcd.setCursor(0,1);
lcd.print("REV FPM ");
lcd.setCursor(0,1);
}

void loop() {

/*******
pinMode(pingPin, OUTPUT);
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(10);
digitalWrite(pingPin, LOW);
pinMode(echoPin, INPUT);
c_dur = pulseIn(echoPin, HIGH);
****/
c_dur = sonar.ping_median(5);

if (abs(c_dur - p_dur) <= /*4.35*/ 4.4) c_dur = p_dur;

a_dur = (c_dur + p_dur) / 2.0;

inches = microsecondsToInches(a_dur);
cm = microsecondsToCentimeters(a_dur);
Serial.print(inches);
Serial.print("in, ");
Serial.print(cm);
Serial.print("cm, ");

// Serial.print(sonar.ping_in());
// Serial.print("in, ");

Serial.print("c_dur ");
Serial.print(c_dur);
Serial.print(" p_dur ");
Serial.print(p_dur);
Serial.print(" a_dur ");
Serial.println(a_dur);
Serial.println();

c_cm = cm;
c_ms = millis();

bool fwdfpm = false;
bool revfpm = false;
bool frfpm = false;

if (c_cm > p_cm) fwdfpm = true;
if (c_cm < p_cm) revfpm = true;
if (c_cm == p_cm) frfpm = true;

d_cm = c_cm - p_cm;
d_ms = c_ms - p_ms;
d_sec = d_ms / 1000;
cps = d_cm / d_sec;
fpm = (cps / 30.48) * 60.0;

// LCD Display
// if( ( millis()-lcdrefresh ) >= 1000 )
{
if (fwdfpm)
{
lcd.setCursor(8,0);
lcd.print(" ");
lcd.setCursor(8,0);
lcd.print(fpm);
}

if (revfpm)
{

lcd.setCursor(8,1);
lcd.print(" ");
lcd.setCursor(8,1);
lcd.print(fpm);
}

if (frfpm)
{
lcd.setCursor(8,0);
lcd.print(" ");
lcd.setCursor(8,0);
lcd.print(fpm);
lcd.setCursor(8,1);
lcd.print(" ");
lcd.setCursor(8,1);
lcd.print(fpm);
}

Serial.print("fpm ");
Serial.print(fpm);
Serial.print(" dcm ");
Serial.println(d_cm);
Serial.println();


lcdrefresh = millis();
}

p_cm = c_cm;
p_ms = c_ms;
// p_dur = a_dur;
p_dur = c_dur;


// delay(100);
delay(900);
}

float microsecondsToInches(long microseconds) {
return microseconds / 74.0 / 2.0;
}

float microsecondsToCentimeters(long microseconds) {
return microseconds / 29.0 / 2.0;
}

I think I understand what you're attempting. let me know if I am correct in my assumption. You're trying to have the sensor count both stroke value and stroke distance?

If I were designing a sensor and code for this I would use a different approach. I'd require some manual input in order to simplify the programming and sensing devices. I'm not sure how ultra sonic sensors handle the environmental aspects of being on a shaper.

I'd have a simple hall sensor to count the strokes. I'd input the stroke length using simple LCD shield with keypad. This way the device only needs to count individual strokes, take your user input and calculate simple math.
 
Top