Introduction: 3D Printing Over Glass - Glass Validation With Iridium Sensor

Hi

I give an Freehanded Prusa i3 MK2S and I usually print on glass because the I. M. Pei is a little dilapidated and I love the idea of removing the glass and put it in the electric refrigerator to remove the man easily. Also, by impression on a glass surface, the spell's base is perfectly easy.

I usage an OctoPrint as print server, "OctoPi" image in a Snort Private detective 3 B+ connected to the printer via USB. I use CURA as my slicer and I have 2 pressman profiles in that respect. "MK2S" and "MK2S with tras". In "MK2S with glass" visibility, I have congeal the following Outset GCODE that I've restricted:

G21 ; set aside units to millimeters
G90 ; practice absolute positioning
M82 ; absolute extrusion mode
G28 W ; home all without mesh bed level
G29; autolevel
G80 ; mesh bed equalisation
G1 F600 Z+100 ; recruit the impress nozzle out of the way
G1 F2000 Y190 ; make a motion bed smart
M300 S1567 P300 ; play a beep
M140 S{material_bed_temperature} ; hardening go to bed temp
M190 S{material_bed_temperature} ; wait for bed temp
M104 S{material_print_temperature} ; set extruder temporary worker
M109 S{material_print_temperature} ; waiting for extruder temp
G1 Z2.3 ; consider drinking glass heaviness measure your glass thickness first
G92 Z0 ; set absolute positioning for remaining print
G1 X60.0 E9.0 F1000.0 ; intro stemma
G1 X100.0 E12.5 F1000.0 ; intro line of merchandise

This means that first it goes to home and then it runs the autolevel and mesh bed leveling. It raises the snout a little to remove easily the filament stuck to the snoot. After that the heatbed moves to the front to put the glass easily and it beeps to alert that I should put the spyglass at that moment. Heating plant the heatbed original, and future heat the extruder. Survey this order because if the extruder is too hot in idle musical mode IT usually releases the fibril while it waits for the heatbed temp.When both temp are set, the beak goes to Z2.3 (2.3mm glass) and starts printing.

Sometimes happens that between printings I block to remove the glass from the heatbed from the previous printing… when it goes to abode, the nose smashes the glass in the home nook; it pushes down the heatbed and both motors continue forcing until the P.I.N.D.A. detects the bed (which will non happen because the spyglass is in the middle), then the X-axis of rotation goes uneven and the P.I.N.D.A. smashes into the glass and lifts leading. ⌐⌐

So, I must manually re-calibrate it and start the printer's calibration wizard, and for roughly reason I forever forget that the P.I.N.D.A. is non correctly placed… so, in the calibration process the nozzle smashes again into the glass… ⌐⌐

With an IR detector and a lot of research I solved this job. The idea is simple: If the IR sensor detects the glass, then IT stops the printing process.

Supplies

  • 3D printer
  • Glass with the heatbed dimensions
  • Raspberry Pi with OctoPi double (OctoPrint)
  • HW-201 Iridium sensor
  • Arduino (ex gratia)
  • Long Dupont wires female-female

Step 1: Testing the IR Sensing element in Arduino

I bought an HW-201 IR sensor and some prolonged Dupont wires female-female

IR Sensor pinout:

VCC----------3.3V-5V
GND----------Found
OUT----------Digital output (0 and 1)

Optional: First-class honours degree, I tested with an Arduino UNO and the IR sensor was working properly.

I constitute KO'd that LOW means "detect" and Utmost means "no notice".

This is the Arduino project that I wont to make confident that the Iridium detector was working nongranular:

void frame-up() {  Serial.commenc(9600);  pinMode(4, INPUT);// set pin as input } vitiate loop() {   int find = digitalRead(4);// read obstruction status and store information technology into "detect"   if(observe == LOW){    Serial.println("Obstruction on the way");   } other{    Serial.println("All clear");   } }

I staring Serial Monitor and hand-picked the proper baud rate to see the readings, I had to manually re-calibrate the sensibility in the Inland Revenue sensor and I discovered that it can't read any further than 9 cm approx… my idea was to put the IR detector at the top of the aluminum frame was throwaway…

In this video I besides base out that I need to put a spikelet in the glass or paint a section in white. Pay attention to the IR sensor led, non to the Arduino UNO leds.

Step 2: Testing in Raspberry Private eye

I was ready to exam it in the Raspberry Pi, so I connected the IR Sensor's extinct-pin to pin 40 or GPIO 21. I dependable to search an OctoPrint plugin for this, and manifestly I found cipher, so I definite to create my own plugin but it's overly hard for me.

So, as I did with Arduino UNO, I created a script to publish on screen the readings. At one time it worked, I replaced the print on screen readings for one-sentence reading shutdown require.

To reach that, I had to connect via SSH and run the following commands:

sudo apt-get update sudo intelligent-stick set up python3-rpi.gpio

I created a file named "IR_Sensor.py" in /usr/local/bin/ with the favourable content:

#!/usr/bin/python3<br>  signification RPi.GPIO as GPIO import os  GPIO.setmode(GPIO.BCM) GPIO.frame-up(21, GPIO.IN)  sensing element=GPIO.input(21)  if sensor==0:        operating system.arrangement("sudo shutdown now")

To avoid that the OS asking the watchword every prison term that I needed to run the shutdown command, I had to run:

sudo visudo

and add the following lines at the bottom:

pi ALL=(ALL) NOPASSWD:ALL

I tried and true it running:

python3 /usr/localized/bin/IR_Sensor.py

Once it worked, I had to incorporate information technology with OctoPrint.

Step 3: Testing in OctoPrint

After hours of research I found that thither is a plugin for OctoPrint that creates
custom GCODES and IT can invoke any system instruction.

So, after install information technology, and I created the OCTO1 custom GCODE pointing to python3 /usr/local/bin/IR_Sensor.py

and I set OCTO1 at OctoPrint Settings - GCODE Scripts - Before print job starts

I made a IR sensor holder and I position it in a property that does not occlude the X axis and Z axis

Note: I had to delete my End GCODE removing:

G1 X0 Y210; habitation X axis and push Y forward

and replacing by:

G1 X0 ; home X axis of rotation

between M107 and M84 because the glass was exterior of swan of the sensor equivalent in the effigy at best

This is my current End GCODE:

M104 S0 ; switch off extruder
M140 S0 ; move around off heatbed
M107 ; bend off fan

G1 X0 ; home X Axis
M84 ; incapacitate motors
M300 S900 P300 ; play a beep

Check-out procedure the final result:

My gratitude to:
- Kantlivelong who made GCODE System Commands plugin and the support from OctoPrint Discord server.
- My friends Franco and Daniel for the help and funding with bash and Python scripts.

This story was not narrated in chronological order. To pull through more readable, there were a lot of backward and forward with the python and bang codes, permissions issues, etc.

Step 4:

Live the First to Share

Recommendations

  • Anything Goes Contest 2022

    Anything Goes Contest 2022