-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslime.html
536 lines (402 loc) · 14.5 KB
/
slime.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<!--
EVERYTHING IS PHYSICAL
EVERYTHING IS FRACTAL
EVERYTHING IS RECURSIVE
NO MONEY
MO MINING
NO PROPERTY
LOOK AT THE INSECTS
LOOK AT THE FUNGI
LANGUAGE IS HOW THE MIND PARSES REALITY
-->
<title>SLIME</title>
<link href="data:image/x-icon;base64,AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAZ4efAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEREREREREREREREREREREREAAAAAAAAREQEREREREBERAREREREQEREBEAAAARAREQEQEREBEBERARAQAQEQEREBEBABARAREQEQEREBEBERARAAAAEQEREBERERERAREQEREREREBERAAAAAAAAEREREREREREREREREREREREAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" rel="icon" type="image/x-icon">
<!--Stop Google:-->
<META NAME="robots" CONTENT="noindex,nofollow">
<!--geometron javascript library-->
<script src="https://cdn.jsdelivr.net/npm/p5@1.7.0/lib/p5.js"></script>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.6.0/addons/p5.sound.js"></script>
</head>
<body>
<div id = "postbutton">POST</div>
<div id = "feedscroll">
<h1><a style = "color:blue;text-align:center;font-family:Comic Sans MS;margin:auto" href = "index.html">HOME</a></h1>
<h1>
SLIMEZISTOR
</h1>
<p>
The SlimeZistor is a relaxation oscillator which uses an LM358P op amp to charge and discharge a capacitor through some sample which is connected to the two probe wires. The schematic is as follows, and should be copied and pasted on the bottom of each unit:
</p>
<img src = "https://raw.githubusercontent.com/LafeLabs/trashotron/main/trashmagic/slimezistor-schematic-bottomsquare.png"/>
<p>
These are the kit parts:
</p>
<img src = "https://raw.githubusercontent.com/LafeLabs/trashotron/main/trashmagic/slimezistor-kit-parts.png"/>
<p>
Here are links to buy the parts from amazon(enough for about 50 units for about 40 dollars):
</p>
<ul>
<li>
<a href= "https://www.amazon.com/BOJACK-Ceramic-Capacitor-Assortment-Capacitors/dp/B07P7HRGT9/">$15 bojack capacitor kit</a>
</li>
<li>
<a href= "https://www.amazon.com/Projects-100EP51210K0-10k-Resistors-Pack/dp/B0185FIOTA/">$6.32 10k resistors 100 units</a>
</li>
<li>
<a href= "https://www.amazon.com/Yohii-Single-Right-Header-Connector/dp/B07C89T16T/">$10 50 pin 0.1 inch pitch right angle header strips</a>
</li>
<li>
<a href= "https://www.amazon.com/BOJACK-LM358P-Operational-Amplifier-LM358N/dp/B07WQWPLSP/">$7 50 units LM358P op amps</a>
</li>
</ul>
<h3>
<a href = "https://www.digikey.com/short/dr55prcw">$90 Digikey cart link with part set for 100 units</a>
</h3>
<p>
The circuit board is a 1x2 inch rectangle cut out of thin cardboard like a cereal box:
</p>
<img src = "https://raw.githubusercontent.com/LafeLabs/trashotron/main/trashmagic/slimezistor-trashboard-photo.png"/>
<p>
Remove pins 1,2, and 3 of the 8 pin IC:
</p>
<img src = "https://raw.githubusercontent.com/LafeLabs/trashotron/main/trashmagic/slimezistor-chip-legs-clipped1.png"/>
<img src = "https://raw.githubusercontent.com/LafeLabs/trashotron/main/trashmagic/slimezistor-chip-legs-clipped2.png"/>
<img src = "https://raw.githubusercontent.com/LafeLabs/trashotron/main/trashmagic/slimezistor-chip-legs-clipped3.png"/>
<p>
Assemble as follows, with 0.1 uF capacitor to the far left, then 1 uF and then the two to the far right which are horizontal are the 10 uF capacitors:
</p>
<img src= "https://raw.githubusercontent.com/LafeLabs/trashotron/main/trashmagic/slimezistor-trashboard-assembled.png"/>
<p>
This is a 5x blowup of the board, with parts labeled. Replicate this as a tool for replication to carry with you as you replicate the set:
</p>
<img src= "https://raw.githubusercontent.com/LafeLabs/trashotron/main/trashmagic/slimezistor-board-5x.png"/>
<p>
An array can also be cut out using a laser cutter with the following .svg file(cut out a 4 inch square of this, with the blue layer as raster and black layer as cut):
</p>
<img src = "https://raw.githubusercontent.com/LafeLabs/trashotron/main/trashmagic/slimezistor-trashboards-2x4.svg"/>
<p>
Here is an .svg of just one board:
</p>
<img src = "https://raw.githubusercontent.com/LafeLabs/trashotron/main/trashmagic/slimezistor-circuit-trash.svg"/>
<p>
This is what the bottom looks like after full assembly:
</p>
<img src= "https://raw.githubusercontent.com/LafeLabs/trashotron/main/trashmagic/slimezistor-board-bottom.png"/>
<p>
The enclosure is made from 4 squares each 4x4 inches in size cut from corrugated cardboard using the tools of Geometron:
</p>
<img src= "https://raw.githubusercontent.com/LafeLabs/trashotron/main/trashmagic/slimezistor-box-assembly-parts.png"/>
<p>
Stack and glue with Elmer's glue or wheat paste:
</p>
<img src= "https://raw.githubusercontent.com/LafeLabs/trashotron/main/trashmagic/slimezistor-box-assembly-2layers.png"/>
<p>
Second layer:
</p>
<img src= "https://raw.githubusercontent.com/LafeLabs/trashotron/main/trashmagic/slimezistor-box-assembly-3layers.png"/>
<p>
Add the circuit board to the box before adding the lid:
</p>
<img src= "https://raw.githubusercontent.com/LafeLabs/trashotron/main/trashmagic/slimezistor-box-assembly-withboard.png"/>
<p>
Full assembly with lid and rubber bands:
</p>
<img src= "https://raw.githubusercontent.com/LafeLabs/trashotron/main/trashmagic/slimezistor-box-assembly-assembled.png"/>
<p>
Fully assembled system with speaker connected to audio output and a solar panel connected to the USB power:
</p>
<img src= "https://raw.githubusercontent.com/LafeLabs/trashotron/main/trashmagic/slimezistor-sand.png"/>
</div>
<script>
let mic, fft;
C= 7.11e-7;
R = 1000;
gnarl = 1.0;
integral = 0;
frameIndex = 0;
slimeIndex = 0;
fcurve = [];
fplot = 0;
squaresize = 500;
if(innerWidth > innerHeight){
squaresize = innerHeight - 50;
document.getElementById("feedscroll").style.right = squaresize.toString()+ "px";
}
else{
squaresize = innerWidth - 50;
document.getElementById("feedscroll").style.right = "0px";
document.getElementById("feedscroll").style.top = squaresize.toString() + "px";
}
function setup() {
createCanvas(squaresize, squaresize);
mic = new p5.AudioIn();
mic.start();
fft = new p5.FFT();
fft.setInput(mic);
//background(0);
background(159,135,103);
}
charsize = 50;
slime = [];
slimesize = Math.floor(squaresize/3);
for(var index = 0;index < slimesize;index++){
var blankarray = [];
slime.push(blankarray);
}
function draw(){
let spectrum = fft.analyze();
nyquistFreq = sampleRate() / 2;
binFreq = nyquistFreq / (spectrum.length);
i1000 = Math.round(1000/binFreq);
stroke(0,255,0);
//background(159,135,103);
// line(0,height - 3*i1000,width,height - 3*i1000);
slime[slimeIndex] = spectrum;
strokeWeight(8);
for (let i = 0; i < spectrum.length; i++) {
//stroke(spectrum[i]);
n = 256;
H = spectrum[i]*360/n;
z = 255*(1 - Math.abs((H/60)%2 - 1));
if(H < 60){
red = 255;
green = Math.round(z);
blue = 0;
}
if(H >= 60 && H < 120){
red = Math.round(z);
green = 255;
blue = 0;
}
if(H >= 120 && H < 180){
red = 0;
green = 255;
blue = Math.round(z);
}
if(H >= 180 && H < 240){
red = 0;
green = Math.round(z);
blue = 255;
}
if(H >= 240 && H < 300){
red = Math.round(z);
green = 0;
blue = 255;
}
if(H >= 300 && H < 360){
red = 255;
green = 0;
blue = Math.round(z);
}
stroke(0);
point(frameIndex,height - 5*i);
// stroke('rgb(' + red + ',' + green + ',' + blue + ')');
if(spectrum[i]< 4){
stroke(159,135,103);
}
else{
stroke('rgba(' + red + ',' + green + ',' + blue + ',' + spectrum[i]/10 + ')');
}
point(frameIndex,height - 5*i);
}
// i1000 =
frameIndex += 3;
slimeIndex = frameIndex/3;
if(frameIndex > width){
frameIndex = 0;
}
}
document.getElementById("postbutton").onclick = function(){
post();
}
function post(){
saveslime();
png64 = document.getElementById("defaultCanvas0").toDataURL("image/png");
var timestamp = Math.round((new Date().getTime())/1000).toString();
var httpc = new XMLHttpRequest();
var url = "pngsave.php";
httpc.open("POST", url, true);
httpc.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
httpc.send("data="+encodeURIComponent(png64.substring(22))+"&filename=trashmagic/square" + timestamp + "-slime.png");//send text to filesaver.php
//location.reload();
newfilename = "trashmagic/square" + timestamp + "-slime.png";
var newbox = document.createElement("DIV");
newbox.classList.add("imagebox");
var deletespan = document.createElement("SPAN");
deletespan.innerHTML = "X";
deletespan.classList.add("deletespan");
deletespan.onclick = function(){
//delete the parent div of the image
//delete the file
var filename = this.parentElement.getElementsByClassName("filelabel")[0].innerHTML;
var httpc = new XMLHttpRequest();
var url = "deletefile.php";
httpc.open("POST", url, true);
httpc.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
httpc.send("filename=trashmagic/" + filename);//send text to deletefile.php
this.parentElement.parentElement.removeChild(this.parentElement);
}
newbox.appendChild(deletespan);
var newdiv = document.createElement("DIV");
newdiv.innerHTML = newfilename;
newdiv.className = "filelabel";
newbox.appendChild(newdiv);
var newimg = document.createElement("IMG");
newimg.src = png64;
newimg.classList.add("uploadimage");
newimg.classList.add("button");
newbox.appendChild(newimg);
if(document.getElementById("feedscroll").getElementsByClassName("imagebox").length > 0){
document.getElementById("feedscroll").insertBefore(newbox,document.getElementById("feedscroll").getElementsByClassName("imagebox")[0]);
}
else{
document.getElementById("feedscroll").appendChild(newbox);
}
}
function saveslime(){
//save slime object as data/slime.txt
var url = "filesaver.php";
var httpc666 = new XMLHttpRequest();
httpc666.open("POST", url, true);
httpc666.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
httpc666.send("data="+encodeURIComponent(JSON.stringify(slime,null," "))+"&filename=slime.txt");//send text to filesaver.php
}
upuploadImages = [];
var httpc9 = new XMLHttpRequest();
httpc9.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
upuploadImages = JSON.parse(this.responseText);
for(var index = upuploadImages.length - 1;index >= 0;index--) {
if(upuploadImages[index].includes("-slime")){
var newbox = document.createElement("DIV");
newbox.classList.add("imagebox");
var deletespan = document.createElement("SPAN");
deletespan.innerHTML = "X";
deletespan.classList.add("deletespan");
deletespan.onclick = function(){
//delete the parent div of the image
//delete the file
var filename = this.parentElement.getElementsByClassName("filelabel")[0].innerHTML;
var httpc = new XMLHttpRequest();
var url = "deletefile.php";
httpc.open("POST", url, true);
httpc.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
httpc.send("filename=trashmagic/" + filename);//send text to deletefile.php
this.parentElement.parentElement.removeChild(this.parentElement);
}
newbox.appendChild(deletespan);
var newdiv = document.createElement("DIV");
newdiv.innerHTML = upuploadImages[index];
newdiv.className = "filelabel";
newbox.appendChild(newdiv);
document.getElementById("feedscroll").appendChild(newbox);
var newimg = document.createElement("IMG");
newimg.src = "trashmagic/" + upuploadImages[index];
newimg.classList.add("uploadimage");
newimg.classList.add("button");
newbox.appendChild(newimg);
}
}
}
};
httpc9.open("GET", "dir.php?filename=trashmagic", true);
httpc9.send();
function keyPressed() {
if(key == 's'){
post();
}
}
</script>
<style>
body{
overflow:hidden;
background-color:#9f8767;
}
main{
position:absolute;
right:25px;
top:25px;
border-left:solid;
border-width:10px
}
#postbutton{
position:absolute;
top:2em;
left:5px;
font-family:Comic Sans MS;
font-size:1.5em;
border:solid;
border-radius:10px;
text-align:center;
border-width:5px;
width:8em;
cursor:pointer;
}
#postbutton:hover{
}
#feedscroll img{
max-width:80%;
display:block;
margin:auto;
margin-top:1em;
border:solid;
}
p{
margin:1em 1em 1em 1em;
font-size:1.5em;
font-family:Comic Sans MS;
}
h1,h2,h3{
font-family:Comic Sans MS;
text-align:center;
overflow:scroll;
}
a{
color:blue;
font-family:Comic Sans MS;
font-size:1.5em;
overflow:scroll;
}
#feedscroll{
position:absolute;
left:0px;
bottom:0px;
top:6em;
z-index:-2;
overflow:scroll;
background-color:#9f8767;
padding:1em 1em 1em 1em;
}
.deletespan{
color:red;
border:solid;
border-color:red;
border-radius:0.5em;
padding: 1em 1em 1em 1em;
cursor:pointer;
}
.deletespan:hover{
background-color:#ff000080;
}
.filelabel{
display:none;
}
.button{
cursor:pointer;
}
.button:hover{
background-color:green;
}
.button:active{
background-color:yellow;
}
.data{
display:none;
}
</style>
</body>
</html>