7 Commits
cutter ... V2.0

Author SHA1 Message Date
jonny_ji7
ef0ac39c9b Update diagram pdf files, cad files (guides)
- update / export pdf version from current drawio connection-plan and
  function-diagram
- update cad files
2022-10-13 14:01:19 +02:00
jonny_l480
ad2ce8c33b Adjust speed thresholds, increase custom length range
Update speed thresholds to slow down earlier
Increase custom length range from 30 to 50m
2022-10-11 11:48:54 +02:00
jonny_ji7
8f5b33c554 Add LENGTH_OFFSET and REACHED_TOLERANCE options
Add feature and config option #define TARGET_LENGTH_OFFSET
that makes it possible to set a distance that gets added to the target
length, thus preventing falling short on the actual length when spools
rotates back slightly after stop.

Also move reached tolerance to config.
2022-09-30 13:14:48 +02:00
jonny_ji7
592351c265 Add CAD-files, wire-labels, docs/datasheets
Add add cad files of all designed and 3d-printed parts.
Mostly Freecad and a few older SolidEdge files (_SE)

Add wire-labels.fods containing the printed labels for wires in
control-box and switching cabinet

Add docs folder with relevant images and datasheets of the used components
2022-09-29 19:39:56 +02:00
jonny_ji7
d473bf6b8c Add autoCut-cancel with any button; Fix display init
- Pending auto cut (countdown) can be canceled using any button on the
    panel
- Reset button does not reset the length when countdown cancledo

- Fix bug where display did not initialize correctly after start some
  times
  -> simply init again after welcome msg

- reduce countdown time by 500ms
2022-09-29 13:57:26 +02:00
jonny_ji7
4cb6b41a6b Add blinking at RESET; Adjust preset values
Blink 'IST' value on top display when reset (as with presets)
Adjust preset values to current labeling
2022-09-23 10:33:42 +02:00
jonny_ji7
bf87be2590 Merge branch 'cutter'
New cutter feature is tested and works reliably in automatic mode with
delay or manual mode via button
2022-09-23 10:29:47 +02:00
52 changed files with 3610 additions and 26 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
*.fcstd text

3
.gitignore vendored
View File

@@ -7,3 +7,6 @@ build
# drawio files
*.bkp
# freecad backup files
*.FCStd1

Binary file not shown.

BIN
cad/box/box_v1.0.FCStd Normal file

Binary file not shown.

2356
cad/box/panel.svg Normal file

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

4
cad/export/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
docs/3SK1111-1AB30_con1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
docs/3SK1111-1AB30_con2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
docs/LPD3806-dimensions.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@@ -0,0 +1,2 @@
currently the vfd 'T13-750W-12-h' is actually used.
Included documentation about T13-400W here too, modbus specification might be the same.

Binary file not shown.

Binary file not shown.

View File

@@ -55,6 +55,9 @@ extern "C" {
//=============================
//======= configuration =======
//=============================
//--------------------------
//----- display config -----
//--------------------------
@@ -79,11 +82,20 @@ extern "C" {
//--------------------------
//------ calibration -------
//--------------------------
//use encoder test for calibration and calculate STEPS_PER_METER
//#define ENCODER_TEST //show encoder count instead of converted meters
//enable mode encoder test for calibration
//if defined, displays always show length and steps instead of the normal messages
//#define ENCODER_TEST
//steps per meter
#define STEPS_PER_METER 2127 //roll-v3-gummi-86.6mm - d=89.8mm
//#define MEASURING_ROLL_DIAMETER 86.6 //roll v3 large
//#define PI 3.14159265358979323846
//millimetres added to target length
//to ensure that length does not fall short when spool slightly rotates back after stop
#define TARGET_LENGTH_OFFSET 0
//millimetres lengthNow can be below lengthTarget to still stay in target_reached state
#define TARGET_REACHED_TOLERANCE 5

View File

@@ -43,7 +43,7 @@ QueueHandle_t encoder_queue = NULL; //encoder event queue
rotary_encoder_state_t encoderState;
int lengthNow = 0; //length measured in mm
int lengthTarget = 3000; //target length in mm
int lengthTarget = 5000; //default target length in mm
int lengthRemaining = 0; //(target - now) length needed for reaching the target
int potiRead = 0; //voltage read from adc
uint32_t timestamp_motorStarted = 0; //timestamp winding started
@@ -54,7 +54,7 @@ int lengthBeeped = 0; //only beep once per meter during encoder test
//automatic cut
int cut_msRemaining = 0;
uint32_t timestamp_cut_lastBeep = 0;
uint32_t autoCut_delayMs = 3000; //TODO add this to config
uint32_t autoCut_delayMs = 2500; //TODO add this to config
bool autoCutEnabled = false; //store state of toggle switch (no hotswitch)
@@ -110,11 +110,11 @@ bool handleStopCondition(handledDisplay * displayTop, handledDisplay * displayBo
void setDynSpeedLvl(uint8_t lvlMax = 3){
uint8_t lvl;
//define speed level according to difference
if (lengthRemaining < 20) {
if (lengthRemaining < 40) {
lvl = 0;
} else if (lengthRemaining < 200) {
} else if (lengthRemaining < 300) {
lvl = 1;
} else if (lengthRemaining < 600) {
} else if (lengthRemaining < 700) {
lvl = 2;
} else { //more than last step remaining
lvl = 3;
@@ -190,12 +190,16 @@ void task_control(void *pvParameter)
//---------------------------
//--- RESET switch ---
if (SW_RESET.risingEdge) {
//dont reset when press used for stopping pending auto-cut
if (controlState != systemState_t::AUTO_CUT_WAITING) {
rotary_encoder_reset(&encoder);
lengthNow = 0;
buzzer.beep(1, 700, 100);
displayTop.blink(2, 100, 100, "1ST ");
//TODO: stop cutter with reset switch?
//cutter_stop();
}
}
//--- CUT switch ---
//start cut cycle immediately
@@ -205,6 +209,9 @@ void task_control(void *pvParameter)
cutter_stop();
buzzer.beep(1, 600, 0);
}
else if (controlState == systemState_t::AUTO_CUT_WAITING) {
//do nothing when press used for stopping pending auto-cut
}
//start cutter when motor not active
else if (controlState != systemState_t::WINDING_START //TODO use vfd state here?
&& controlState != systemState_t::WINDING) {
@@ -250,7 +257,7 @@ void task_control(void *pvParameter)
//read adc
potiRead = gpio_readAdc(ADC_CHANNEL_POTI); //0-4095
//scale to target length range
int lengthTargetNew = (float)potiRead / 4095 * 30000;
int lengthTargetNew = (float)potiRead / 4095 * 50000;
//apply hysteresis and round to whole meters //TODO optimize this
if (lengthTargetNew % 1000 < 200) { //round down if less than .2 meter
ESP_LOGD(TAG, "Poti input = %d -> rounding down", lengthTargetNew);
@@ -283,20 +290,20 @@ void task_control(void *pvParameter)
//--- target length presets ---
if (controlState != systemState_t::MANUAL) { //dont apply preset length while controlling motor with preset buttons
if (SW_PRESET1.risingEdge) {
lengthTarget = 1000;
buzzer.beep(lengthTarget/1000, 25, 30);
displayBot.blink(3, 100, 100, "S0LL ");
}
else if (SW_PRESET2.risingEdge) {
lengthTarget = 5000;
buzzer.beep(lengthTarget/1000, 25, 30);
displayBot.blink(2, 100, 100, "S0LL ");
}
else if (SW_PRESET3.risingEdge) {
else if (SW_PRESET2.risingEdge) {
lengthTarget = 10000;
buzzer.beep(lengthTarget/1000, 25, 30);
displayBot.blink(2, 100, 100, "S0LL ");
}
else if (SW_PRESET3.risingEdge) {
lengthTarget = 15000;
buzzer.beep(lengthTarget/1000, 25, 30);
displayBot.blink(2, 100, 100, "S0LL ");
}
}
@@ -305,7 +312,7 @@ void task_control(void *pvParameter)
//--------- control ---------
//---------------------------
//calculate length difference
lengthRemaining = lengthTarget - lengthNow;
lengthRemaining = lengthTarget - lengthNow + TARGET_LENGTH_OFFSET;
//--- statemachine ---
switch (controlState) {
@@ -342,7 +349,7 @@ void task_control(void *pvParameter)
case systemState_t::TARGET_REACHED:
vfd_setState(false);
//switch to counting state when no longer at or above target length
if ( lengthRemaining > 10 ) { //FIXME: require reset switch to be able to restart? or evaluate a tolerance here?
if ( lengthNow < lengthTarget - TARGET_REACHED_TOLERANCE ) {
changeState(systemState_t::COUNTING);
}
//switch initiate countdown to auto-cut
@@ -362,8 +369,13 @@ void task_control(void *pvParameter)
//handle delayed start of cut
cut_msRemaining = autoCut_delayMs - (esp_log_timestamp() - timestamp_changedState);
//- countdown stop conditions -
if (!autoCutEnabled || !SW_AUTO_CUT.state || SW_RESET.state || SW_CUT.state) { //TODO: also stop when target not reached anymore?
//stop with any button
if (!autoCutEnabled
|| SW_RESET.state || SW_CUT.state
|| SW_SET.state || SW_PRESET1.state
|| SW_PRESET2.state || SW_PRESET3.state) {//TODO: also stop when target not reached anymore?
changeState(systemState_t::COUNTING);
buzzer.beep(5, 100, 50);
}
//- trigger cut if delay passed -
else if (cut_msRemaining <= 0) {

View File

@@ -34,7 +34,7 @@ max7219_t display_init(){
ESP_ERROR_CHECK(max7219_init_desc(&dev, HOST, MAX7219_MAX_CLOCK_SPEED_HZ, DISPLAY_PIN_NUM_CS));
ESP_ERROR_CHECK(max7219_init(&dev));
//0...15
ESP_ERROR_CHECK(max7219_set_brightness(&dev, 8));
ESP_ERROR_CHECK(max7219_set_brightness(&dev, 8)); //TODO add this to config
return dev;
//display = dev;
ESP_LOGI(TAG, "initializing display - done");
@@ -50,7 +50,7 @@ void display_ShowWelcomeMsg(max7219_t dev){
//show name and date
ESP_LOGI(TAG, "showing startup message...");
max7219_clear(&dev);
max7219_draw_text_7seg(&dev, 0, "CUTTER 20.08.2022");
max7219_draw_text_7seg(&dev, 0, "CUTTER 29.09.2022");
// 1234567812 34 5678
vTaskDelay(pdMS_TO_TICKS(700));
//scroll "hello" over 2 displays
@@ -60,6 +60,11 @@ void display_ShowWelcomeMsg(max7219_t dev){
max7219_draw_text_7seg(&dev, 0, hello + (22 - offset) );
vTaskDelay(pdMS_TO_TICKS(50));
}
//noticed rare bug that one display does not initialize / is not configured correctly after start
//initialize display again after the welcome message in case it did not work the first time
ESP_ERROR_CHECK(max7219_init(&dev));
ESP_ERROR_CHECK(max7219_set_brightness(&dev, 8)); //TODO add this to config
}

1189
wire-labels.fods Normal file

File diff suppressed because it is too large Load Diff