Initial commit

This commit is contained in:
Pierrick C 2019-04-06 00:35:07 +02:00
parent 676b05a6de
commit 004596b5aa
14 changed files with 2060 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.directory
*.fcstd1

Binary file not shown.

BIN
3D/3d_print/big_gear.stl Normal file

Binary file not shown.

BIN
3D/3d_print/small_gear.stl Normal file

Binary file not shown.

1118
3D/cnc_router/frame.dxf Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,53 @@
[Statistics]
MainCounterTime=0
ActiveMainCounter=Yes
CounterName1=
ActiveCounter1=No
CounterTime1=0
CounterName2=
ActiveCounter2=No
CounterTime2=0
CounterName3=
ActiveCounter3=No
CounterTime3=0
CounterName4=
ActiveCounter4=No
CounterTime4=0
CounterName5=
ActiveCounter5=No
CounterTime5=0
[Plasma Nozzles]
PlasmaNozzleIgnit1=0
PlasmaNozzleTime1=0
PlasmaNozzleIgnit2=0
PlasmaNozzleTime2=0
PlasmaNozzleIgnit3=0
PlasmaNozzleTime3=0
PlasmaNozzleIgnit4=0
PlasmaNozzleTime4=0
PlasmaNozzleIgnit5=0
PlasmaNozzleTime5=0
[Set #1]
SetNumber=1
[Tool #1]
Number=1
ActiveTime=0
MaxTime=0
ActiveTrip=0
MaxTrip=0
ActiveDrills=0
MaxDrills=0
[Tool #2]
Number=2
ActiveTime=0
MaxTime=0
ActiveTrip=0
MaxTrip=0
ActiveDrills=0
MaxDrills=0
[EOF]

View File

@ -0,0 +1,73 @@
[Rack #1]
RackNumber=1
RackName=Pierrick
[Tool #1]
Number=1
Name=PEHD
Color=0x000000
Diameter=6
Profile=Cylindrical
NumberOfTeeth=1
ConicalAngle=None
ConicalMinDiam=None
RotationSpeed=13000
Zmax=20
FirstPlot=Undefined
FeedSpeed=1020
AbsPlotSpeed=60
AbsDrillSpeed=None
RelDrillSpeed=50
UnTamping=None
ChipBreakDown=None
ChipBreakUp=None
OverDrill=0.2
PlungeAngle=None
XOffset=0
YOffset=0
ZOffset=0
AutoChange=No
AutoSensor=Yes
AutoLeaveLast=No
PeckPause=No
SpindleOnOutputs=0x00000000
SpindleOnDelay=0
SpindleOffOutputs=0x00000000
SpindleOffDelay=0
Substitute=None
[Tool #2]
Number=2
Name=PEHD
Color=0x000000
Diameter=3
Profile=Cylindrical
NumberOfTeeth=1
ConicalAngle=None
ConicalMinDiam=None
RotationSpeed=24000
Zmax=10
FirstPlot=Undefined
FeedSpeed=600
AbsPlotSpeed=60
AbsDrillSpeed=None
RelDrillSpeed=50
UnTamping=None
ChipBreakDown=None
ChipBreakUp=None
OverDrill=0.2
PlungeAngle=None
XOffset=0
YOffset=0
ZOffset=0
AutoChange=No
AutoSensor=Yes
AutoLeaveLast=No
PeckPause=No
SpindleOnOutputs=0x00000000
SpindleOnDelay=0
SpindleOffOutputs=0x00000000
SpindleOffDelay=0
Substitute=None
[EOF]

View File

@ -0,0 +1,53 @@
[Statistics]
MainCounterTime=0
ActiveMainCounter=Yes
CounterName1=
ActiveCounter1=No
CounterTime1=0
CounterName2=
ActiveCounter2=No
CounterTime2=0
CounterName3=
ActiveCounter3=No
CounterTime3=0
CounterName4=
ActiveCounter4=No
CounterTime4=0
CounterName5=
ActiveCounter5=No
CounterTime5=0
[Plasma Nozzles]
PlasmaNozzleIgnit1=0
PlasmaNozzleTime1=0
PlasmaNozzleIgnit2=0
PlasmaNozzleTime2=0
PlasmaNozzleIgnit3=0
PlasmaNozzleTime3=0
PlasmaNozzleIgnit4=0
PlasmaNozzleTime4=0
PlasmaNozzleIgnit5=0
PlasmaNozzleTime5=0
[Set #1]
SetNumber=1
[Tool #1]
Number=1
ActiveTime=0
MaxTime=0
ActiveTrip=0
MaxTrip=0
ActiveDrills=0
MaxDrills=0
[Tool #2]
Number=2
ActiveTime=0
MaxTime=0
ActiveTrip=0
MaxTrip=0
ActiveDrills=0
MaxDrills=0
[EOF]

View File

@ -0,0 +1,73 @@
[Rack #1]
RackNumber=1
RackName=Pierrick
[Tool #1]
Number=1
Name=PEHD
Color=0x000000
Diameter=6
Profile=Cylindrical
NumberOfTeeth=1
ConicalAngle=None
ConicalMinDiam=None
RotationSpeed=13000
Zmax=20
FirstPlot=Undefined
FeedSpeed=1020
AbsPlotSpeed=60
AbsDrillSpeed=None
RelDrillSpeed=50
UnTamping=None
ChipBreakDown=None
ChipBreakUp=None
OverDrill=0.2
PlungeAngle=None
XOffset=0
YOffset=0
ZOffset=0
AutoChange=No
AutoSensor=Yes
AutoLeaveLast=No
PeckPause=No
SpindleOnOutputs=0x00000000
SpindleOnDelay=0
SpindleOffOutputs=0x00000000
SpindleOffDelay=0
Substitute=None
[Tool #2]
Number=2
Name=PEHD
Color=0x000000
Diameter=3
Profile=Cylindrical
NumberOfTeeth=1
ConicalAngle=None
ConicalMinDiam=None
RotationSpeed=24000
Zmax=10
FirstPlot=Undefined
FeedSpeed=600
AbsPlotSpeed=60
AbsDrillSpeed=None
RelDrillSpeed=50
UnTamping=None
ChipBreakDown=None
ChipBreakUp=None
OverDrill=0.2
PlungeAngle=None
XOffset=0
YOffset=0
ZOffset=0
AutoChange=No
AutoSensor=Yes
AutoLeaveLast=No
PeckPause=No
SpindleOnOutputs=0x00000000
SpindleOnDelay=0
SpindleOffOutputs=0x00000000
SpindleOffDelay=0
Substitute=None
[EOF]

Binary file not shown.

Binary file not shown.

458
3D/cnc_router/spacer.dxf Normal file
View File

@ -0,0 +1,458 @@
0
SECTION
2
HEADER
9
$ACADVER
1
AC1009
9
$INSBASE
10
0.0
20
0.0
30
0.0
9
$EXTMIN
10
0.0
20
0.0
30
0.0
9
$EXTMAX
10
0.0
20
0.0
30
0.0
0
ENDSEC
0
SECTION
2
TABLES
0
TABLE
2
VPORT
70
0
0
ENDTAB
0
TABLE
2
LTYPE
70
1
0
LTYPE
2
CONTINUOUS
70
0
3
Solid line
72
65
73
0
40
0.0
0
ENDTAB
0
TABLE
2
LAYER
70
1
0
LAYER
2
0
70
64
62
7
6
continuous
0
ENDTAB
0
TABLE
2
STYLE
70
1
0
STYLE
2
STANDARD
70
0
40
0
41
1.0
50
0.0
71
0
42
1
3
ARIAL.TTF
4
0
ENDTAB
0
TABLE
2
VIEW
70
0
0
ENDTAB
0
ENDSEC
0
SECTION
2
BLOCKS
0
BLOCK
8
0
2
CLONE024
70
0
10
0.0
20
0.0
30
0.0
3
CLONE024
0
ARC
8
0
62
0
10
-356.0
20
13.05
30
0.0
40
3.05
50
-90.0
51
90.0
0
LINE
8
0
62
0
10
-356.0
20
9.99999999999
30
0.0
11
-371.0
21
9.99999999999
31
0.0
0
LINE
8
0
62
0
10
-371.0
20
9.99999999999
30
0.0
11
-371.0
21
-10.0
31
0.0
0
LINE
8
0
62
0
10
-371.0
20
-10.0
30
0.0
11
-356.0
21
-10.0
31
0.0
0
ARC
8
0
62
0
10
-356.0
20
-13.05
30
0.0
40
3.05
50
-90.0
51
90.0
0
LINE
8
0
62
0
10
-356.0
20
-20.0
30
0.0
11
-356.0
21
-16.1
31
0.0
0
LINE
8
0
62
0
10
-356.0
20
-20.0
30
0.0
11
-146.0
21
-20.0
31
0.0
0
LINE
8
0
62
0
10
-146.0
20
-20.0
30
0.0
11
-146.0
21
-16.1
31
0.0
0
ARC
8
0
62
0
10
-146.0
20
-13.05
30
0.0
40
3.05
50
90.0
51
-90.0
0
LINE
8
0
62
0
10
-146.0
20
-9.99999999999
30
0.0
11
-131.0
21
-9.99999999999
31
0.0
0
LINE
8
0
62
0
10
-131.0
20
-9.99999999999
30
0.0
11
-131.0
21
10.0
31
0.0
0
LINE
8
0
62
0
10
-131.0
20
10.0
30
0.0
11
-146.0
21
10.0
31
0.0
0
ARC
8
0
62
0
10
-146.0
20
13.05
30
0.0
40
3.05
50
90.0
51
-90.0
0
LINE
8
0
62
0
10
-146.0
20
16.1
30
0.0
11
-146.0
21
20.0
31
0.0
0
LINE
8
0
62
0
10
-146.0
20
20.0
30
0.0
11
-356.0
21
20.0
31
0.0
0
LINE
8
0
62
0
10
-356.0
20
16.1
30
0.0
11
-356.0
21
20.0
31
0.0
0
ENDBLK
0
ENDSEC
0
SECTION
2
ENTITIES
0
INSERT
2
CLONE024
8
0
62
0
10
0.0
20
0.0
30
0.0
0
ENDSEC
0
EOF

BIN
3D/polisseur.fcstd Normal file

Binary file not shown.

View File

@ -0,0 +1,230 @@
/*
*/
#include <RotaryEncoder.h>
#include "SevSeg.h"
#include <EveryTimer.h>
#include <AccelStepper.h>
// PIN USAGE
#define SEVSEG_DIGIT_1 16
#define SEVSEG_DIGIT_2 17
#define SEVSEG_DIGIT_3 3
#define SEVSEG_DIGIT_4 4
#define SEVSEG_COLON 2
#define SEVSEG_SEGMENT_A 8
#define SEVSEG_SEGMENT_B 14
#define SEVSEG_SEGMENT_C 6
#define SEVSEG_SEGMENT_D A1
#define SEVSEG_SEGMENT_E 23
#define SEVSEG_SEGMENT_F 7
#define SEVSEG_SEGMENT_G 5
#define SEVSEG_SEGMENT_H 22
#define ROT_BUTT 11
#define ROT_ENC_1 12
#define ROT_ENC_2 13
#define STEPPER_STEP 10
#define STEPPER_DIRECTION 0
#define STEPPER_ENABLE A5
//SETTINGS
#define SEVSEG_REFRESH 250 // Refresh rate in ms
#define SEVSEG_BRIGHTNESS 100 // 100%, full brightness
#define STEPPER_MAX_SPEED 5000
#define STEPPER_MIN_SPEED 0
#define STEPPER_ACCELERATION 30.0
#define STEP_MOTOR_STEPS_PER_TURN 200
#define STEPPER_MICROSTEP 8
SevSeg sevseg; //Instantiate a seven segment controller object
// Setup a RoraryEncoder for pins 12 and 13:
RotaryEncoder encoder(ROT_ENC_1, ROT_ENC_2);
AccelStepper stepper(1, STEPPER_STEP, STEPPER_DIRECTION);
EveryTimer timer;
//Global variables
byte numDigits = 4;
byte digitPins[] = {SEVSEG_DIGIT_1, SEVSEG_DIGIT_2,
SEVSEG_DIGIT_3, SEVSEG_DIGIT_4};
byte segmentPins[] = {SEVSEG_SEGMENT_A, SEVSEG_SEGMENT_B,
SEVSEG_SEGMENT_C, SEVSEG_SEGMENT_D,
SEVSEG_SEGMENT_E, SEVSEG_SEGMENT_F,
SEVSEG_SEGMENT_G, SEVSEG_SEGMENT_H};
bool resistorsOnSegments = false; // 'false' means resistors are on digit pins
byte hardwareConfig = COMMON_ANODE; // See README.md for options
bool updateWithDelays = false; // Default. Recommended
bool leadingZeros = false; // Use 'true' if you'd like to keep the leading zeros
long refresh_timer = 0;
long countdown = 0;
byte hours = 0;
byte minutes = 0;
byte seconds = 0;
int current_rpm = 0;
int new_rpm = 0;
static bool currBut = true;
byte mode = 0;
void countdown_callback() {
if (current_rpm != 0) {
countdown--;
if (countdown < 0) {
countdown = 0;
}
hours = countdown / 3600;
minutes = (countdown / 60) % 60;
seconds = countdown % 60;
// Update data to be displayed
if (mode == 0) { // mode 0 = display speed
digitalWrite(SEVSEG_COLON, false);
sevseg.setNumber(current_rpm);
}
else if (mode == 1) { // mode 1 = display countdown
//Blink colon each seconds
if (seconds % 2) {
digitalWrite(SEVSEG_COLON, true);
}
else {
digitalWrite(SEVSEG_COLON, false);
}
//Display HH:MM or MM:SS if there is less than 1h left
if (hours) {
sevseg.setNumber(100*hours+minutes);
} else {
sevseg.setNumber(100*minutes+seconds);
}
}
Serial.println(countdown);
}
else {
Serial.println("Pause");
}
}
void update_encoder() {
static long currVal = 0;
int multiplier = 10;
encoder.tick();
long newVal = encoder.getPosition();
if (currVal != newVal) {
currVal = newVal;
if (mode == 0) {
if (current_rpm >= 500) {
multiplier = 100;
}
new_rpm += multiplier * encoder.getDirection();
if (new_rpm < STEPPER_MIN_SPEED) {
new_rpm = STEPPER_MIN_SPEED;
}
if (new_rpm > STEPPER_MAX_SPEED) {
new_rpm = STEPPER_MAX_SPEED;
}
}
if (mode == 1) {
multiplier = 60;
if (countdown >= 3600) {
multiplier = 600;
}
countdown += multiplier * encoder.getDirection();
if (countdown < 0) {
countdown = 0;
}
if (countdown >= 86400) {
countdown = 86399;
}
}
Serial.print("RPM: ");
Serial.print(current_rpm);
Serial.print(" | Countdown: ");
Serial.println(countdown);
}
//Check button for mode change
bool newBut = digitalRead(ROT_BUTT);
if (newBut != currBut) {
currBut = newBut;
if (currBut) {
mode++;
}
if (mode == 2) {
mode = 0;
}
else if (mode == 0) {
encoder.setPosition(current_rpm);
}
else if (mode == 1) {
encoder.setPosition(countdown);
}
Serial.print("Mode :");
Serial.println(mode);
}
}
void update_stepper() {
if (new_rpm != current_rpm) {
new_rpm = current_rpm;
stepper.setSpeed(current_rpm);
// Enable/Disable motor
if (current_rpm == 0) {
stepper.disableOutputs();
Serial.println("Stepper : Off");
}
else {
stepper.enableOutputs();
Serial.println("Stepper : On");
}
//if Countdown = 0 => pause (no move but keep speed setting)
if (countdown != 0 and current_rpm != 0) {
stepper.runSpeed();
}
}
}
void setup()
{
Serial.begin(115200);
pinMode(ROT_BUTT, INPUT_PULLUP);
pinMode(SEVSEG_COLON, OUTPUT);
sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments, updateWithDelays, leadingZeros);
sevseg.setBrightness(SEVSEG_BRIGHTNESS);
stepper.setEnablePin(STEPPER_ENABLE);
stepper.disableOutputs();
stepper.setMaxSpeed(STEPPER_MAX_SPEED);
stepper.setAcceleration(STEPPER_ACCELERATION);
stepper.setSpeed(0);
timer.Every(1000, countdown_callback);
}
void loop()
{
update_encoder();
//Update countdown
timer.Update();
//Make the motor move
update_stepper();
//refresh the 7-segment display
sevseg.refreshDisplay();
}