Hello Guest it is April 18, 2024, 07:25:17 PM

Author Topic: Arduino GPIO and sensors - has anyone done it?  (Read 1215 times)

0 Members and 1 Guest are viewing this topic.

Arduino GPIO and sensors - has anyone done it?
« on: February 20, 2019, 03:43:22 PM »
Hi,

so ive been using Mach 4 for a few months now and i would really like to be able to bring in some sensor values and inputs and outputs into mach 4 that my BOB doesn't support.

Specifically a water temp and flow sensor on my spindle and outputs for my shop vac, lights etc.

ive not seen anything specific for using an arduino for this. has anyone done it?

thanks
Raptor
Re: Arduino GPIO and sensors - has anyone done it?
« Reply #1 on: February 20, 2019, 04:03:29 PM »
Hi,
are any of the monitored inputs analogue?

If they are all ON/OFF types then its just a matter of digital inputs and outputs which could be controlled by
either PMC script or PLC script.

What motion controller are you using?

You could use a genuine PLC communicating with Mach via Modbus or serial.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Arduino GPIO and sensors - has anyone done it?
« Reply #2 on: February 20, 2019, 04:10:51 PM »
currently i am using a parallel port board, but im considering moving to a PoKeys or a Warp9 ESS.

the sensors i have hooked up to the arduino now is:

flow sensor:
https://www.adafruit.com/product/828?gclid=CjwKCAiAkrTjBRAoEiwAXpf9CRjsMO3gZVK2a2yW4xUgGDR3OFu6lz3xyUpw6CaN1Wa2ldT4fUcYphoCerYQAvD_BwE

temp sensor:
https://www.adafruit.com/product/381

they are reporting info back via MQTT right now. that is option b is to make mach4 work with MQTT.

serial or modbus would work also, but i don't know how to start integrating those with mach4

Offline MN300

*
  •  298 298
    • View Profile
Re: Arduino GPIO and sensors - has anyone done it?
« Reply #3 on: February 20, 2019, 05:03:53 PM »
Programming the Arduino for either of those sensors is not a beginner's job so well done if you have your Arduino reading the values.
Are you trying to transfer the numerical values to Mach4 or would high/low signals be enough?
The C10R10 BOB from CNC4PC works with the Warp 9 ESS.

Here is my crazy idea for the day. Set up dummy axes and use the Arduino tone() statement to generate fake index pulses which Mach4 would change to a "speed".
Re: Arduino GPIO and sensors - has anyone done it?
« Reply #4 on: February 20, 2019, 06:13:59 PM »
Hi,
the flow sensor is analogue. If you had a analogue comparator with an adjustable threshold the signal would
become ON/OFF and thereafter very easy to interface to Mach. Is ON/OFF control sufficient for your purpose?

The temp sensor is intriguing, I'm guessing that it has some sort of Delta-Sigma modulator built in. In order
to get a temperature reading it would be necessary to decode the signal. I'm guessing you are already doing that with
the Arduino? Can the temperature be reduced to an ON/OFF threshold?

If you want the temperature reported to Mach as a numeric value (digital rather than analogue) then you could
use any of the communication protocols between Mach and the Arduino. I'm not familiar with MQTT but there has
been some discussion on that exact subject on this board.

Quote
serial or modbus would work also, but i don't know how to start integrating those with mach4

Mach4 has both Serial and Modbus plugins, thus much of the interfacing to Mach has already been done. It would still
require that you use your Arduino to prepare signals to match the protocols expected by either of the Mach plugins.

Another possibility is to use Mach directly, ie have the pulse output signal connect directly to Mach and have a PLC or
PMC script monitor and decode the pulse signals resulting in a numeric value for temperature WITHOUT requiring
the value be transmitted to Mach for an external device.

Quote
but im considering moving to a PoKeys or a Warp9 ESS.

I commend that course of action. Its not that I have anything against Darwin but it is limited and Art has stated that it always will be.
Mach4 was ALWAYS intended to be complemented with and external motion controller. Both the 57CNC and the ESS
are worthy examples. I myself use an ESS and like it a great deal.

The 57CNC may be even better for you because, unlike the ESS, it has several analogue to digital converters built in. Thus you
could use one channel to measure and report a digital numeric value to Mach. The inclusion of the analogue channels in the
57CNC is a compelling sales feature.

Notwithstanding the 57CNCs flexibility its maximum pulse speed is considerably lower than the ESS. Additionally the ESS
plugin has received, in recent months, backlash compensation, lathe threading, spindle PID and in Beta testing as we
speak for a comprehensive THC feature. When all of these are taken together the feature set of the ESS is somewhat better
than the 57CNC and in fact rivals the more expensive Hicon by Vital Systems.

No doubt over the coming months/years the respective external motion controller manufacturers will be developing their
products in a manner to best capture new customers. Until recently I would have picked the flexibility of the 57CNC,
despite the speed disadvantage, to be a little better than the ESS. Now that equation I believe has swung in the ESS's favour.
The competition between them is very good for you and I as we get to benefit from their efforts. In truth either device
will work well.

Quote
The C10R10 BOB from CNC4PC works with the Warp 9 ESS.
This is indeed a good value BoB. You should note though it does not have a specific circuit to convert PWM to an analogue voltage
for a spindle speed control. There are other, rather more expensive boards that do have such a circuit but rather constrain the
user by dictating that certain of the ESS pins be dedicated. If however you don't mind making a few simple electronic circuits
with half a dozen components then the C10 is perfectly adequate and does not constrain the DIYer.
The MB2 breakout board by CNCRoom (approx. $180) is a highly regarded product. All three of the ESS ports are exploited.
While the manufacturer has made certain assumptions as regards the balance of inputs/outputs and the interfaces of each
it is none the less a capable board of good quality.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Arduino GPIO and sensors - has anyone done it?
« Reply #5 on: February 21, 2019, 02:18:26 PM »
Thanks all,

i will most likey go with the "have the arduino raise a pin and notify the BoB" methold until i can work out the serial communications.

My ultimate goal is to have the Temp readout in mach 4 but having it trigger a stop on high temp and low flow would be sufficient for now.
Re: Arduino GPIO and sensors - has anyone done it?
« Reply #6 on: February 25, 2019, 08:55:55 AM »
Using mach 3, I used an arduino Mega (Uno would be fine too) running a modbus slave program. Made it very easy to bring in a ton of I/O (including analog) and get it into Mach at around a 50ms update rate. Getting the modbus to talk was the hardest part, and that still wasn't bad.