Hi everybody,
After a few weeks of bad tries, I need help today.
(sorry for bad english, I'm french)
So, my company makes wiper motor/arm/blade for windshield of planes and helicopter. http://www.falgayras.com/
My job is to make benchtest at the end of line production.
Our motor is wiping the widows with a discontinuous movement. Not a full turn but move to reach a max angle return to low position (min angle) and do it again and again and again....same as a car
I have to measure the max and min angle over a period of 1mn (one minute)
I started using accelerometer, but the results was an acceleration (of course) not an angular position. As I have to measure cycle over the minute, i cannot give a speed reference since I have to measure it as well.
I used a mouse (optical) from a computer to measure the distance (pi ratio) on a mechanical part at the motor axis, but zero reference is moving and never the same value when motor axis is in the SAME angular position.
I can't use an optical sensor such as wheel with little hole on the circumference because our motor setup is vibrating to much.
Now I have a rotativ sensor such as potentiometer but more reliable and long lasting life for using in production department.
It's a magnetic sensor.
The problem is : "transfering the rotative movement in good condition and repetitive setup for workers"...I sure need a drive belt...(wich I want to avoid)
So I try with gyroscope (in fact I wish it was my first idea). ref=> tinkerkit T00000062 (RS : 758-9351)
I have seen many exampes code, but I'm still lost since I'm a begginer in arduino and not specialist in writing code
Still reading ? thank you
My problem is that the value from sensor (after treatment ) is still moving up or down.
I can memorize max end min angle, (thx to clever functions) but how to code in order to stabilize position ?
I used the code given in the datasheet, but seems more dedicated to quadricopter, anyway, I kept somes lines and checked them on my motor. Still the same, when motor is not turning, the angle value is running by itself from 0 to 360°...
I read that : [u]Arduino Playground - HomePage but not so helpfull for me.
I have a nokia LCD wich I get back from my old 3310
here's my last code (display is for debugging), not the final version
#include <PCD8544.h>
static const byte sensorPin = 5;
static PCD8544 lcd;
float gyrorate = 0;
float gyroadc = 0;
float gyrozero = 0;
float gyroangle = 0;
int t1 = 0;
int t2 = 0;
int dt = 0;
void setup() {
lcd.begin(84, 48);
gyrozero = analogRead(sensorPin); // memorize value in zero/parking position of motor
}
void loop() {
t1 = millis();
lcd.setCursor(0, 0);
lcd.print("gyrozero=");
lcd.print(gyrozero);
lcd.print(" ");
lcd.setCursor(0, 2);
lcd.print("gyroadc= ");
gyroadc = analogRead(sensorPin);
t2 = millis();
lcd.print(gyroadc);
gyrorate = (gyroadc-gyrozero) / 0.2077; // sensitivity : (0,00067/3,3)*1023 = 0,2077 3,3 is voltage
dt = t2 - t1; // delta time between parking position and reading time of sensor
lcd.setCursor(0,1);
lcd.print("dt=");
lcd.print(dt);
lcd.setCursor(0, 3);
lcd.print("gyrorate=");
lcd.print(gyrorate);
lcd.print(" ");
gyroangle += (gyrorate * dt)/1000; // use delta time to calculate angle reached at each time
lcd.setCursor(0, 4);
lcd.print("gyroangle=");
lcd.print(gyroangle); // display angle
lcd.print(" ");
}
In fact I would like an inclinometer
Anyone can give some advices please ?
Thanks a lot for reading till here, I hope you understood what I wrotte , i forgot my english.
According web and/or google I may have to use derivative functions, what do you think ?
BR
Arnaud