Simple question: How to read from IO
-
@dc42 I believe that my scenario is not a very common one. I am working on a complex algorithm to measure the 2D/3D-geometry of my workpiece. The algorithm is to complex to implement it in gcode, therefor I implement a supersiving software layer in python (think about a python-gcode wrapper) which calculates the algorithm. Then, the supervising software optimize the 3dprinter.
-
Curious side question: Where are you running the Python?
-
Visions of automated probing are running through my head .... could be as simple as setting resolution for x and y, setting a range of x and y and telling the printer to measure every point. Might be painfully slow but hey, it could do it. Put every value into a spreadsheet which can then be imported into Fusion360 and presto, the beginnings of a model. Obviously some hand work is required.
As a side question, just exactly how accurate is a 3D scanned object? Are the scanned objects dimensionally accurate or could manually probing increase accuracy?
In any case, having a probing tool head for quality control of a printed object might be interesting. -
@Danal currently on the RPI. Ohhhh Danal, you are the author of the wrapper which I use. Great to meet you here! Thanks for your amazing work. I started with forking your project (https://github.com/DanalEstes/PythonDSF)
-
@JBisc said in Simple question: How to read from IO:
@Danal currently on the RPI. Ohhhh Danal, you are the author of the wrapper which I use. Great to meet you here! Thanks for your amazing work. I started with forking your project (https://github.com/DanalEstes/PythonDSF)
There's another choice now as well: DuetWebAPI. Requires network connectivity to the printer (can, but not required to, run on the attached Pi) and also abstracts away V2 to V3 differences.
-
@dc42 said in Simple question: How to read from IO:
@JBisc, you will need to create a GPIO port attached to your chosen pin using M950 with the J option, before you can see it in sensors.inputs.
If I use M950 by
M950 J4 C"io4.in"
I can get only a ditgital input by calling
M409 K"sensors.inputs"
which is not what i want.
If I define my sensor by
M308 S4 P"io4.in" Y"linear-analog" A"MySensor" F0
I don't know a method to return my analog sensor value (to the RPI). Does somebody has an idea?
-
Ok it seems to be easy:
just call
M308 S4
to get the sensor value.
-
@JBisc said in Simple question: How to read from IO:
I don't know a method to return my analog sensor value (to the RPI). Does somebody has an idea?
When you say "return to the Pi", what would happen? Push? Pull? what code reads it or responds or...
What do you want to happen?
-
I implemented in the following way now:
My python programm on the RPI sends
M308 S4
and i parse the response (on the RPI)
Sensor 4 (MySensor) type Linear analog using pin io4.in, reading 3.8, last error: success, unfiltered, range 0.0 to 1.0
to get the sensor value
-
You could also get it by using M409 to request that value from the object model.
-
@dc42 said in Simple question: How to read from IO:
M409
I remember that you posted in another post that analog values are not included in the current object model
-
@JBisc said in Simple question: How to read from IO:
@dc42 said in Simple question: How to read from IO:
M409
I remember that you posted in another post that analog values are not included in the current object model
Raw analog inputs are not included, but the readings from configured sensors are:
20/04/2020, 09:55:19 m409 k"sensors.analog[0].lastReading" {"key":"sensors.analog[0].lastReading","flags":"","result":21.5}
-