@o_lampe
thank you for the help. Yes you are right that would definetly be more elegant especially because i wouldn t need to send info about all the unused extruder. i thought just sending would be easier and to be honest from my setup i have no idea how to change my firmeware besides config.g and a handfull of other .g files that are present in the duet webinterface. if you could point me in the right direction i d be quite happy to learn though.
Latest posts made by erfreuterstudent
-
RE: Filament diameter sensor
-
RE: Filament diameter sensor
@o_lampe
Yes you are definetly right in the bestcase scenario i would delay the input until the moment of extrusion. but since my filament isn' t abruptly changing i'd be happy if it would work dumb like that. Of course your way would be much more sufisticated but i m quite happy getting this working for now. -
Filament diameter sensor
So recently i saw this video of Thomas Sanladerer (https://www.youtube.com/watch?v=RYgdLPe_T0c) and since i'm working with really unreliable experimental ceramic filament i wanted to implement this on my toolchanger.
Assambly was not a problem and since i have 4 inputs i wanted to feed the arduino with the individual data and just send the gcode (M221 Sx Dx) to the duet.
And here i m getting out of my comfort zone because my coding skills resamble that of a braindead monkey.
[code]
// select the input pin for the potentiometer
int sensorPin0 = A0;
// select the input pin for the potentiometer
int sensorPin1 = A1;
// select the input pin for the potentiometer
int sensorPin2 = A2;
// select the input pin for the potentiometer
int sensorPin3 = A3;// select the pin for the LED
int ledPin = 13;// variable to store the value coming from the sensor
int sensorValue0 = 0;
// variable to store the value coming from the sensor
int sensorValue1 = 0;
// variable to store the value coming from the sensor
int sensorValue2 = 0;
// variable to store the value coming from the sensor
int sensorValue3 = 0;int gcode0 = 0;
int gcode1 = 0;
int gcode2 = 0;
int gcode3 = 0;#include "GCodeSerial.h"
GCodeSerial output(Serial.ATmega328P);
void setup()
{
pinMode(ledPin,OUTPUT); Serial.begin(57600);
}
void loop(){sensorValue0 =
analogRead(sensorPin0);
gcode0 = ((sensorValue0-516)*0.73913043478)+62;sensorValue1 =
analogRead(sensorPin1);
gcode1 = ((sensorValue1-516)*0.73913043478)+62;sensorValue2 =
analogRead(sensorPin2);
gcode2 = ((sensorValue2-516)*0.73913043478)+62;sensorValue3 =
analogRead(sensorPin3);
gcode3 = ((sensorValue3-516)*0.73913043478)+62;//T0
if (gcode0 < 95) {delay(1000);Serial.println("");}
else{
if (gcode0 > 120) {delay(1000);Serial.println("NO FILAMENT");}
else{
digitalWrite(ledPin, HIGH);
delay(1000); digitalWrite(ledPin, LOW); delay(1000);
output.write("M221 S");output.write(gcode0);output.write(" D");output.write(A0-14);
}}
//T1
if (gcode1 < 95) {delay(1000);Serial.println("");}
else{
if (gcode1 > 120) {delay(1000);Serial.println("NO FILAMENT");}
else{
digitalWrite(ledPin, HIGH);
delay(1000); digitalWrite(ledPin, LOW); delay(1000);
Serial.write("M221 S");Serial.write(gcode1);Serial.write(" D");Serial.write(A1-14);
}}
//T2
if (gcode2 < 95) {delay(1000);Serial.println("");}
else{
if (gcode2 > 120) {delay(1000);Serial.println("NO FILAMENT");}
else{
digitalWrite(ledPin, HIGH);
delay(1000); digitalWrite(ledPin, LOW); delay(1000);
Serial.print("M221 S");Serial.print(gcode2, DEC);Serial.print(" D");Serial.println(A2-14);
}}
//T3
if (gcode3 < 95) {delay(1000);Serial.println("");}
else{
if (gcode3 > 120) {delay(1000);Serial.println("NO FILAMENT");}
else{
digitalWrite(ledPin, HIGH);
delay(1000); digitalWrite(ledPin, LOW); delay(1000);
Serial.print("M221 S");Serial.print(gcode3, DEC);Serial.print(" D");Serial.println(A3-14);
}}
}
[/code]it looks stupid but it works ... i think at least ... on my serialmonitor i recive for each filament the acording M221 command. There are still placeholders for too little filament or to big filament. But now for sending it to the duet ...
I have no idea how ... well i know i can use the paneldue port using a levelshifter as shown in the cnc style pendant discussion ... but i dont know how
i dont intend on using a panel due so it should be easy (very very oh so very easy) acording to
@danal said in CNC style Pendant:
@janvdg said in CNC style Pendant:
I was wondering if it is possible to send Gcode commands to the duet from a arduino board.
Yes, very easy. Very, very, very easy. Did I mention that it is fairly straightforward? Probably not hard? Have I beat this dead horse enough?
The port on the Duet that is intended to connect to a PanelDUE is a 3.3V TTL level serial port. The serial port on a standard Arduino is a 5 volt TTL level serial, so you'd need a level translator (couple of bucks from Sparkfun)... or, there are 3.3V microcontrollers, such as the ESP32 or ESP8266, both of which can be programmed from the Arduino environment. Very easy.
As I said in the post above, given one or two assumptions about "being in parallel with" a PanelDUE (or just not having a PanelDUE at all), this is extremely simple.
The key is, I'm not really interested in having a pendant, so I need to know that some number of people ARE interested... and if those people will post here in this thread, and/or contact me at "danal (dot) estes (at) gmail (dot) com", we can discuss how to prototype and pursue this.
here is a picture of the hardware not sure if that chaos helps anybody.
I would be really glad about help or input.