Commit 015de3ad authored by Jake Read's avatar Jake Read
Browse files

new controller, compare and test

parent 6f4d5ccc
......@@ -2,10 +2,14 @@
The DEX is an open source piece of materials testing equipment. The machine can be manufactured by anyone with access to a laser cutter with at least a 24x12" bed, or a milling machine of similar or larger size, and nearly any FDM 3D Printer. A bill of materials of purchased parts required to complete the machine is below, totaling some ~ $500 USD.
The machine uses a NEMA 23 stepper motor and a small ball screw to exert force on samples, and any off the shelf load-cell to measure stress. At the lab, we use [squidworks](https://gitlab.cba.mit.edu/squidworks/squidworks) controllers to operate the machine, but rolling a controller with an off-the-shelf Arduino should not be an exceptionally cumbersome task.
The machine uses a NEMA 23 stepper motor and a small ball screw to exert force on samples, and any off the shelf load-cell to measure stress. At the lab, we use [squidworks](https://gitlab.cba.mit.edu/squidworks/squidworks) controllers to operate the machine, but a standalone controller written for Arduino and with a JS frontend is [here](controller).
![dex](images/2020-02-11_dex-render.png)
![dex-alive](images/2020-07-12_dex-on-desk-01.jpg)
![control](images/2020-07-11_dex-tools.png)
## Operating Principle
A [stress - strain plot](https://en.wikipedia.org/wiki/Stress%E2%80%93strain_curve) is a very useful piece of information when characterizing materials.
......@@ -14,6 +18,13 @@ A [stress - strain plot](https://en.wikipedia.org/wiki/Stress%E2%80%93strain_cur
To generate these curves, the DEX slowly pulls samples (normally some 'dogbone' shape [below](#testing-notes)) apart, while measuring the amount that it stretches (~ the strain), and the amount of force it exerts as it is stretched (~ the stress). These types of machine are common in industry, often referred to by their leading brand name 'Instron', or as 'Universal Testing Machines' (UTM).
## Comparison to the Instron 4411
I compared results from the most recent DEX build to the Instron 4411 we have in the lab. Some errors still exist: it could be the case that the load cell needs better calibration: my largest calibration weights are near 2kg, but these loads approach 8kgf. I'm not sure how much nonlinearity exists in COTS (and cheap) loadcells like this, but I have *heard* they are *fairly* linear, so certainly we can do better than heresay. There is certainly some flex in the machine itself, but much less than earlier versions. To improve this, the DEX can be fabricated in Phenolic or some other composite, rather than Acrylic as used here. Finally, fixturing could be greatly improved, I believe some creep exists in the jaws as well. I have ordered some parts to test better (off the shelf) steel clamps.
![dt1](data/2020-07-12_compare-dex-4411/2020-07-12_compare-dex-4411-01.png)
![dt2](data/2020-07-12_compare-dex-4411/2020-07-12_compare-dex-4411-02.png)
## Hardware
### CAD
......@@ -55,7 +66,13 @@ Part numbers are from [McMaster Carr](http://mcmaster.com) unless otherwise link
Here, I list Acrylic Sheet as the main chassis material. With acrylic, the machine can be manufactured easily on a laser cutter. However, it should also be possible to build the DEX with different sheet material. Lately, I have been using Phenolic as a chassis material: it can be milled on a ShopBot or similar router, and performs much better than Acrylic, with around 11GPA flexural strength (vs. Acrylic's ~ 3GPA). Acrylic is best bonded with Acrylic Cement, a solvent that welds the plastic to itself. Phenolic is best bonded with a two-part epoxy: I use a 20 minute working life epoxy, and nearly any type will do.
## Control and Interface
## Control and Interface: Standalone
I recently built a [standalone controller](controller) for this thing, it's written in Arduino and vanilla JS for Node (to serve the app and connect to the machine) and the Browser.
![dex-alive](images/2020-07-12_dex-on-desk-02.jpg)
## Control and Interface: Squidworks
DEX is designed to run a [squidworks](https://gitlab.cba.mit.edu/squidworks/squidworks) controller. The `dex` branches of [cuttlefish](https://gitlab.cba.mit.edu/squidworks/cuttlefish) and [ponyo](https://gitlab.cba.mit.edu/squidworks/ponyo) contain code that is known to work with the machine. For more info on the controllers, please consult those repositories. In all, controlling the machine can be achieved in any number of ways, on needs only to control one stepper motor and read one load cell.
......
......@@ -69,6 +69,7 @@ uint16_t rl = 0;
uint16_t one = 1;
int32_t stepsToTake = 0;
int32_t position = 0;
uint8_t retries = 0;
void loop() {
stepper.run();
......@@ -78,12 +79,18 @@ void loop() {
cobsSerial->getPacket(&pck, &pl);
switch(pck[0]){
case DEXKEY_LOADCELLREADING:
while(!loadcell.is_ready()){
delay(100);
retries ++;
if(retries > 10) break;
}
if(loadcell.is_ready()){
int32_t reading = loadcell.get_value(10);
retries = 0;
int32_t reading = loadcell.get_value(5);
rl = 0;
res[rl ++] = DEXKEY_LOADCELLREADING;
ts_writeInt32(reading, res, &rl);
debugmsg("reads: " + String(reading));
//debugmsg("reads: " + String(reading));
} else {
debugmsg("loadcell not ready");
}
......@@ -97,7 +104,7 @@ void loop() {
stepsToTake = 0;
one = 1;
ts_readInt32(&stepsToTake, pck, &one);
debugmsg("to take steps: " + String(stepsToTake));
//debugmsg("to take steps: " + String(stepsToTake));
stepper.runToNewPosition(position + stepsToTake);
position += stepsToTake;
rl = 0;
......
......@@ -84,12 +84,16 @@ let DEXKEY_MOTORENABLE = 16
let dex = {}
let lsq = new LeastSquares()
let oldReadings = [[25, 14854, 29649, 44453, 74061, 103695],
[0, -0.100, -0.200, -0.300, -0.500, -0.700]]
let calibReadings = [[1,2,3], [1,2,3]]
let newReadings = [
[42, 255872, 209341, 171922, 141727, 108767, 79558, 48830, 30461],
[0, -16.8854, -13.7983, -11.3386, -9.3394, -7.1638, -5.243, -3.2144, -2.009]]
//[0, 1723g, 1408g, 1157, 953, 731, 535, 328, 205]] // (gf)
// donate some x, y readings to calibrate the least squares
// here this was observed integer outputs from the amp, and load applied during those readings
lsq.setObservations(
[[25, 14854, 29649, 44453, 74061, 103695],
[0, -0.100, -0.200, -0.300, -0.500, -0.700]])
lsq.setObservations(newReadings)
// loadcells need to be calibrated,
dex.readLoadcell = () => {
return new Promise((resolve, reject) => {
......@@ -185,7 +189,7 @@ dex.step = (mm) => {
}
// calculate for spmm,
let steps = Math.floor(- dex.spmm * mm)
console.log('STEPS', steps)
// console.log('STEPS', steps)
let req = new Uint8Array(5)
req[0] = DEXKEY_STEPS
TS.write('int32', steps, req, 1, true)
......@@ -201,7 +205,7 @@ dex.step = (mm) => {
}
} // end recv
let moveTime = (Math.abs(mm / dex.maxspeed) + 5) * 1000
console.log('TIME', moveTime)
//console.log('TIME', moveTime)
setTimeout(() => {
rejected = true
reject('timeout')
......
......@@ -173,7 +173,7 @@ export default function DEXUI(){
// testing
// test-by
let testStep = $('<input type="text" value="0.01">').addClass('inputwrap').get(0)
let testStep = $('<input type="text" value="0.005">').addClass('inputwrap').get(0)
setPosition(testStep, 50, ypos += yinc + 10)
// start / stop testing
let testButton = $('<div>').addClass('button').get(0)
......
......@@ -27,7 +27,7 @@ import { PerformanceObserver, performance } from 'perf_hooks'
import { TS } from '../core/ts.js'
let LOGPHY = true
let LOGPHY = false
// -------------------------------------------------------- WSS VPort
......
Time,Extension,Load
(sec),(mm),(N)
0.000,0.0000,1.2511
0.418,0.0050,1.5271
0.836,0.0101,2.1187
1.259,0.0151,2.7007
1.675,0.0202,3.2816
2.096,0.0252,3.8831
2.518,0.0302,4.5083
2.936,0.0353,5.1989
3.350,0.0403,5.8597
3.780,0.0454,6.5057
4.195,0.0504,7.1648
4.617,0.0554,7.8320
5.038,0.0605,8.5130
5.453,0.0655,9.2060
5.879,0.0706,9.8566
6.297,0.0756,10.5324
6.719,0.0806,11.2405
7.139,0.0857,11.9027
7.555,0.0907,12.5665
7.978,0.0958,13.2021
8.399,0.1008,13.8498
8.815,0.1058,14.5025
9.239,0.1109,15.1478
9.655,0.1159,15.8629
10.078,0.1210,16.5035
10.500,0.1260,17.1565
10.921,0.1310,17.8377
11.339,0.1361,18.5086
11.760,0.1411,19.1763
12.183,0.1462,19.8613
12.602,0.1512,20.5647
13.017,0.1562,21.2999
13.448,0.1613,22.0604
13.859,0.1663,22.7736
14.283,0.1714,23.4640
14.704,0.1764,24.1656
15.122,0.1815,24.8742
15.544,0.1865,25.5656
15.965,0.1915,26.2609
16.384,0.1966,27.0064
16.805,0.2016,27.6974
17.224,0.2067,28.3781
17.642,0.2117,29.0474
18.060,0.2167,29.7317
18.485,0.2218,30.4071
18.907,0.2268,31.0920
19.325,0.2319,31.7604
19.747,0.2369,32.4303
20.168,0.2419,33.1514
20.582,0.2470,33.8425
21.006,0.2520,34.5097
21.426,0.2571,35.1711
21.848,0.2621,35.8335
22.263,0.2671,36.5159
22.684,0.2722,37.1945
23.107,0.2772,37.9124
23.524,0.2823,38.5650
23.948,0.2873,39.2032
24.368,0.2923,39.8793
24.788,0.2974,40.5503
25.211,0.3024,41.1970
25.624,0.3075,41.8689
26.045,0.3125,42.5124
26.470,0.3175,43.1664
26.895,0.3226,43.8767
27.306,0.3276,44.5258
27.728,0.3327,45.1824
28.147,0.3377,45.8529
28.572,0.3427,46.5198
28.995,0.3478,47.1700
29.407,0.3528,47.8136
29.832,0.3579,48.5268
30.251,0.3629,49.1947
30.673,0.3679,49.8262
31.088,0.3730,50.4769
31.514,0.3780,51.0972
31.929,0.3831,51.7332
32.348,0.3881,52.3756
32.773,0.3931,52.9906
33.195,0.3982,53.6011
33.611,0.4032,54.2683
34.035,0.4083,54.8818
34.451,0.4133,55.5086
34.873,0.4183,56.1198
35.292,0.4234,56.7555
35.715,0.4284,57.3818
36.135,0.4335,58.0129
36.555,0.4385,58.6728
36.978,0.4435,59.2604
37.395,0.4486,59.8515
37.812,0.4536,60.4314
38.233,0.4587,60.9773
38.653,0.4637,61.5011
39.075,0.4688,62.0492
39.499,0.4738,62.6174
39.918,0.4788,63.2063
40.336,0.4839,63.8198
40.754,0.4889,64.3619
41.175,0.4940,64.9013
41.593,0.4990,65.4419
42.015,0.5040,65.9735
42.438,0.5091,66.4849
42.860,0.5141,67.0177
43.274,0.5192,67.6144
43.700,0.5242,68.1343
44.120,0.5292,68.6532
44.542,0.5343,69.1456
44.961,0.5393,69.6444
45.383,0.5444,70.1399
45.798,0.5494,70.6394
46.222,0.5544,71.0947
46.644,0.5595,71.5457
47.060,0.5645,72.0551
47.479,0.5696,72.4955
47.905,0.5746,72.9316
48.326,0.5796,73.3626
48.742,0.5847,73.7927
49.165,0.5897,74.2101
49.584,0.5948,74.6199
50.001,0.5998,75.0524
50.427,0.6048,75.3973
50.845,0.6099,75.7285
51.268,0.6149,76.0582
51.683,0.6200,76.3655
52.101,0.6250,76.6191
52.528,0.6300,76.8505
52.947,0.6351,77.0335
53.368,0.6401,77.2048
53.787,0.6452,77.3800
54.209,0.6502,77.4423
54.628,0.6552,77.4761
55.048,0.6603,77.4677
55.469,0.6653,77.4148
55.887,0.6704,77.3257
56.310,0.6754,77.1960
56.730,0.6804,77.0716
57.149,0.6855,76.8403
57.568,0.6905,76.5501
57.988,0.6956,76.2056
58.406,0.7006,75.8461
58.827,0.7056,75.4695
59.252,0.7107,75.0857
59.669,0.7157,74.6954
60.091,0.7208,74.3228
60.513,0.7258,74.0008
60.930,0.7308,73.6188
61.354,0.7359,73.2494
61.774,0.7409,72.8883
62.189,0.7460,72.5532
62.610,0.7510,72.2263
63.033,0.7560,71.9302
63.456,0.7611,71.6859
63.869,0.7661,71.3848
64.290,0.7712,71.1015
64.713,0.7762,70.8339
65.135,0.7812,70.5729
65.556,0.7863,70.3256
65.977,0.7913,70.0991
66.392,0.7964,69.9000
66.816,0.8014,69.7088
67.231,0.8065,69.5692
67.652,0.8115,69.3487
68.072,0.8165,69.1335
68.493,0.8216,68.9318
68.914,0.8266,68.7401
69.335,0.8317,68.5380
69.757,0.8367,68.3544
70.174,0.8417,68.2306
70.602,0.8468,68.0473
71.014,0.8518,67.8808
71.438,0.8569,67.6974
71.854,0.8619,67.5544
72.275,0.8669,67.4040
72.695,0.8720,67.2603
73.121,0.8770,67.0965
73.535,0.8821,66.9652
73.958,0.8871,66.8694
74.382,0.8921,66.7292
74.795,0.8972,66.5882
75.217,0.9022,66.4378
75.639,0.9073,66.2882
76.061,0.9123,66.1539
76.477,0.9173,66.0274
76.901,0.9224,65.9401
77.317,0.9274,65.8027
77.737,0.9325,65.6672
78.160,0.9375,65.5401
78.582,0.9425,65.4209
79.003,0.9476,65.2804
79.423,0.9526,65.1577
79.844,0.9577,65.0274
80.263,0.9627,64.9289
80.685,0.9677,64.8519
81.101,0.9728,64.7127
81.523,0.9778,64.5786
81.939,0.9829,64.4499
82.364,0.9879,64.3087
82.780,0.9929,64.1425
83.201,0.9980,63.9728
83.622,1.0030,63.8882
84.042,1.0081,63.7636
84.466,1.0131,63.6325
84.887,1.0181,63.4872
85.306,1.0232,63.3178
85.725,1.0282,63.1488
86.147,1.0333,62.9745
86.566,1.0383,62.7872
86.986,1.0433,62.6090
87.409,1.0484,62.4657
87.832,1.0534,62.2767
88.250,1.0585,62.0947
88.666,1.0635,61.8749
89.095,1.0685,61.6554
89.507,1.0736,61.4748
89.927,1.0786,61.3082
90.347,1.0837,61.1835
90.771,1.0887,60.9670
91.190,1.0937,60.7645
91.607,1.0988,60.5620
92.031,1.1038,60.3542
92.452,1.1089,60.1314
92.874,1.1139,59.9123
93.293,1.1190,59.7033
93.709,1.1240,59.5209
94.129,1.1290,59.3677
94.550,1.1341,59.1386
94.971,1.1391,58.9141
95.392,1.1442,58.7111
95.810,1.1492,58.5129
96.237,1.1542,58.2787
96.655,1.1593,58.0597
97.074,1.1643,57.8645
97.492,1.1694,57.6096
97.917,1.1744,57.3332
98.332,1.1794,57.0591
98.756,1.1845,56.7821
99.175,1.1895,56.5066
99.596,1.1946,56.2388
100.016,1.1996,55.9595
100.438,1.2046,55.7153
100.859,1.2097,55.5399
101.279,1.2147,55.3361
101.698,1.2198,55.1518
102.119,1.2248,54.9564
102.538,1.2298,54.7764
102.960,1.2349,54.6003
103.381,1.2399,54.4400
103.798,1.2450,54.3311
104.216,1.2500,54.1472
104.639,1.2550,53.9721
105.061,1.2601,53.8135
105.482,1.2651,53.6555
105.900,1.2702,53.4951
106.319,1.2752,53.3531
106.740,1.2802,53.1970
107.161,1.2853,53.0661
107.585,1.2903,52.9587
108.000,1.2954,52.7772
108.422,1.3004,52.5547
108.843,1.3054,52.3453
109.260,1.3105,52.1406
109.685,1.3155,51.9159
110.102,1.3206,51.7098
110.525,1.3256,51.5558
110.941,1.3306,51.3642
111.366,1.3357,51.1686
111.786,1.3407,50.9805
112.207,1.3458,50.7873
112.626,1.3508,50.6155
113.044,1.3558,50.4667
113.466,1.3609,50.3180
113.887,1.3659,50.1973
114.310,1.3710,50.1321
114.724,1.3760,50.0225
115.146,1.3810,49.9124
115.566,1.3861,49.7956
115.984,1.3911,49.6993
116.410,1.3962,49.5985
116.829,1.4012,49.5169
117.247,1.4063,49.4824
117.664,1.4113,49.3848
118.088,1.4163,49.3063
118.506,1.4214,49.2430
118.929,1.4264,49.1812
119.346,1.4315,49.1072
119.766,1.4365,49.0355
120.186,1.4415,48.9696
120.614,1.4466,48.9136
121.027,1.4516,48.8991
121.452,1.4567,48.8056
121.867,1.4617,48.7333
122.288,1.4667,48.6512
122.708,1.4718,48.5738
123.132,1.4768,48.4814
123.551,1.4819,48.4027
123.972,1.4869,48.3569
124.392,1.4919,48.2640
124.809,1.4970,48.1736
125.233,1.5020,48.0541
125.650,1.5071,47.9534
126.071,1.5121,47.8413
126.491,1.5171,47.7437
126.911,1.5222,47.6297
127.331,1.5272,47.5287
127.754,1.5323,47.4641
128.174,1.5373,47.3466
128.594,1.5423,47.2109
129.017,1.5474,47.0411
129.433,1.5524,46.8706
129.855,1.5575,46.6997
130.275,1.5625,46.5247
130.696,1.5675,46.3781
131.117,1.5726,46.1748
131.539,1.5776,45.9976
131.955,1.5827,45.8556
132.377,1.5877,45.7447
132.798,1.5927,45.6416
133.220,1.5978,45.5513
133.636,1.6028,45.4576
134.057,1.6079,45.3788
134.478,1.6129,45.3267
134.897,1.6179,45.2311
135.316,1.6230,45.1746
135.736,1.6280,45.1393
136.161,1.6331,45.1104
136.581,1.6381,45.0736
137.000,1.6431,45.0254
137.420,1.6482,45.0197
137.842,1.6532,44.9603
138.262,1.6583,44.8949
138.682,1.6633,44.8146
139.098,1.6683,44.7065
139.522,1.6734,44.5181
139.940,1.6784,44.3348
140.365,1.6835,44.1021
140.784,1.6885,43.8113
141.201,1.6935,43.5198
141.625,1.6986,43.1274
142.040,1.7036,42.7534
142.467,1.7087,42.3553
142.884,1.7137,42.0075
143.304,1.7188,41.6690
143.724,1.7238,41.3523
144.141,1.7288,41.0806
144.563,1.7339,40.7241
144.986,1.7389,40.3863
145.407,1.7440,40.0422
145.824,1.7490,39.7071
146.244,1.7540,39.3501
146.664,1.7591,39.0045
147.087,1.7641,38.6608
147.507,1.7692,38.3587
147.926,1.7742,38.0903
148.346,1.7792,37.7570
148.768,1.7843,37.4466
149.188,1.7893,37.1263
149.607,1.7944,36.8032
150.029,1.7994,36.4760
150.449,1.8044,36.1596
150.874,1.8095,35.8836
151.291,1.8145,35.5633
151.710,1.8196,35.2596
152.128,1.8246,34.9375
152.552,1.8296,34.6170
152.975,1.8347,34.3052
153.388,1.8397,33.9762
153.808,1.8448,33.5494
154.229,1.8498,33.0457
154.651,1.8548,32.6293
155.070,1.8599,32.3153
155.495,1.8649,32.0108
155.912,1.8700,31.7056
156.329,1.8750,31.4011
156.754,1.8800,31.1065
157.173,1.8851,30.8287
157.596,1.8901,30.5859
158.012,1.8952,30.3093
158.432,1.9002,30.0602
158.854,1.9052,29.8159
159.272,1.9103,29.6097
159.699,1.9153,29.4070
160.115,1.9204,29.2316
160.534,1.9254,29.0579
160.956,1.9304,28.9007
161.374,1.9355,28.7829
161.795,1.9405,28.6006
162.217,1.9456,28.4391
162.636,1.9506,28.2332
163.062,1.9556,27.9971
163.478,1.9607,27.7463
163.903,1.9657,27.4919
164.319,1.9708,27.2919
164.738,1.9758,27.0395
165.158,1.9808,26.7974
165.579,1.9859,26.5518
166.004,1.9909,26.3158
166.418,1.9960,26.0822
166.841,2.0010,25.8593
167.260,2.0060,25.6303
167.683,2.0111,25.4211
168.105,2.0161,25.2486
168.522,2.0212,25.0354
168.939,2.0262,24.8357
169.362,2.0313,24.6266
169.782,2.0363,24.4322
170.200,2.0413,24.2566
170.623,2.0464,24.0773
171.040,2.0514,23.9352
171.461,2.0565,23.7148
171.887,2.0615,23.5201
172.305,2.0665,23.3192
172.727,2.0716,23.1078
173.142,2.0766,22.8775
173.564,2.0817,22.6226
173.984,2.0867,22.3602
174.404,2.0917,22.1002
174.830,2.0968,21.8420
175.246,2.1018,21.4976
175.669,2.1069,21.1158
176.088,2.1119,20.6011
176.507,2.1169,19.9902
176.925,2.1220,19.2404
177.345,2.1270,18.6066
177.765,2.1321,18.1192
178.185,2.1371,17.7101
178.606,2.1421,17.4167
179.025,2.1472,17.1746