Cnc and Arduino

Hello !

I’ve started a project with a CNC controlled machine and Arduino. I made a kind of “scanner” where I have a 3 axis motor that helps a pen to move around following x-axis, y-axis and z-axis.
So I installed Grbl, UGS, and did all the blablabla (settings,…).

Now, I’m stuck. If I want to replace the pen with a sensor, be it a heat sensor, magnetic sensor or anything, how can I, in the same time, acquire position and data (simultaneously) ?

In order to do that, I tried to solve this problem by dividing it into 2. Acquiring coordinate, and then timing it with data acquisition.

So I made a pattern for the cnc to follow (made of Gcode). But here I only give him 2 coordinates to go to, but there’s no instruction between these 2 coordinates. So I was thinking of using the Controller State (which is showing real time coordinate) of UGS, but couldn’t find anything on it being able to send shown data.

So my questions are :
Is it even possible to do that I want ? <=> Acquiring position and data simultaneously

Best regards,

Is it even possible to do that I want ? <=> Acquiring position and data simultaneously

Yes you can do what you want but being a single core processor it can not do it simultaneously. You want to move your rig and then acquire the data.

Gcode is not designed to send back data but you could incorporate it in the acknowledgment message you send back to what ever system is feeding your Arduino with Gcode.

Thanks for your reply.

Ok I understand the concept.

But if I use a sensor that is not connected to an Arduino board (like a 3D magnetic sensor 2Go board from Infineon), how can I use this solution ? (but I'm still using Arduino IDE to acquire data).

And I don't understand what you meant but "whatever system is feeding your Arduino with Gcode", I'm just giving UGS (which is an interface made to be more friendly-using, correct me if I'm wrong) Gcode for the motor to follow a pattern. So it's safe to say that my sensor is not linked with UGS, in this case, how can I give back an acknowledgment message ?

But if I use a sensor that is not connected to an Arduino board (like a 3D magnetic sensor 2Go board from Infineon), how can I use this solution ? (but I'm still using Arduino IDE to acquire data).

Sorry I have no idea what you mean. How can the IDE acquire data, all it can do is to show what is being sent over a serial port.

I'm just giving UGS (which is an interface made to be more friendly-using, correct me if I'm wrong) Gcode for the motor to follow a pattern.

How are you giving UGS Gcode? With Gcode you send a command and then wait until that command is complete before sending the next one. To indicate the command is complete a message of some sort must be sent back to the UGS ( what ever that is ) to say it is complete.

The main problem here is that you have not described your current setup adequately, maybe you don't understand how it is working.

Please read this:- How to use this forum it will tell you what information you need to supply in order for us to have a chance of giving you an accurate answer. I told you what you need to do in principle but you seem to be unable to implement it, therefore we need more information. It could be that your current state of knowledge is not yet up to tackling your problem.