Acorn (BBG) sensing water flow for spindle motor cooling?

All things related to the Centroid Acorn CNC Controller

Moderator: cnckeith

Post Reply
mikes
Posts: 94
Joined: Thu Jan 04, 2018 3:09 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No
Location: New Albany, OH

Acorn (BBG) sensing water flow for spindle motor cooling?

Post by mikes »

Hello all,

In my cnc router build I am using a water cooled spindle motor. As I am sure you all know, the motor relies on a flow of cooled water that is supplied by a separate pump. I have the pump setup to run when the steppers are powered. It could be done a bit more sophisticated with a control line on the Acorn or possibly the VFD, but that is not what I am asking about.

I'm concerned about the pump failing and not knowing about it until it is to late, and the motor is fried. I have ordered one of the hall effect flow sensors that can detect coolant flow from 1-30 L/min. That will work great for my pump's flow. Now the question is how best to integrate that into the Acorn. I was thinking of just programing a nano Arduino to count pulses from the sensor and open a dry contact if the count stops or falls below a threshold value. The dry contact can then be put in series with the drive ok line, and signal a problem to the Acorn, which will then shut the whole thing down. That should work great.

However, we have this very powerful embedded controller (the BBG) attached to the Acorn breakout with (if I am not mistaken) two slave controllers that could very easily monitor the count coming from the flow sensor. I know we can create macros, but only for I/O that is exposed via the Acorn. Is there any possibility to add this? I don't think it will be possible to do without an enhancement from Centroid. I would expect there are a number of hardware counters doing nothing on the BBG. Would it just need a mapping to the I/O, and associated code.

Another idea, I am doing nothing with the encoder input on the Acorn. Would that be the place to look.

Thoughts?

Mike
DannyB
Posts: 109
Joined: Mon Jan 15, 2018 1:11 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: Yes
CNC Control System Serial Number: A900712
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Acorn (BBG) sensing water flow for spindle motor cooling?

Post by DannyB »

This is possible without enhancement from centroid, you can just add some code to the PLC program to do it and use an existing input on the acorn.
You can also expose it to the macros.
You control this entirely. They just put a nice wizard to do the PLC source generation :)

You'd want to make sure to save a copy because rerunning the wizard will overwrite the plc program.

Just take the source the wizard outputs and start from there.

Take a look at the PLC manual, here

What you are trying to do should be really easy and hopefully obvious (about 20-30 lines, assuming what you want is counting, and when rate falls below certain amount for certain time, issue spindle fault)
Most of these sensors typically output 4-5 pulses per liter/min, so you don't really risk missing pulses.

Some are pwm, and you could either treat it as an analog signal or a digital one.

Otherwise, if you find you need help writing the code, folks here are generally helpful.

it will look STH like this (Caveats: I don't have an acorn plc program in front of me, only oak, and i'm only spitballing here to give you an idea).

Code: Select all

<in sections declaring variables>

FlowSensor IS INP<correct input number> ; Flow sensor pulse input
FlowCount IS W<next unused number> ; Number of pulses in our computation window
FlowRate IS FW<next unused number> ; flow in liters/min
FlowTimer IS T<next unused number> ; timer for how often to compute average flow rate

<later on in code>
; Count flow sensor pulses
IF FlowSensor THEN FlowCount = FlowCount + 1 

; compute flow average over every 60 seconds
IF InitialStage THEN FlowTimer = 60000
IF True SET FlowTimer

; See if timer triggered
IF FlowTimer > 60000 THEN  FlowRate=<math to convert pulse count into FlowRate>, FlowCount = 0, RST FlowTimer

IF FlowRate < 30.0 ; If flow is too low
THEN FaultMsg_W = SPINDLE_FAULT_MSG, SET SpindleFault_M ; You could make up your own message as well, this uses the spindle fault one
mikes
Posts: 94
Joined: Thu Jan 04, 2018 3:09 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No
Location: New Albany, OH

Re: Acorn (BBG) sensing water flow for spindle motor cooling?

Post by mikes »

Thanks DannyB! I was overthinking this. You're right, a simple sampling of the input should capture the pulses. I have yet to jump into the PLC programing, but this sounds like a perfect reason to. I'll start reading now... :D
DannyB
Posts: 109
Joined: Mon Jan 15, 2018 1:11 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: Yes
CNC Control System Serial Number: A900712
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Acorn (BBG) sensing water flow for spindle motor cooling?

Post by DannyB »

Yeah, just keep in mind the code i posted will not count pulses :)
It just assumes the signal is on for a while and off for a while.
(IE it a long continuous pulse with a a very long duty cycle).

If you want to count the actual pulses, use a one shot

Something like:

IE

Code: Select all

FlowOneShot is PD1

if FlowInputSignal then (FlowOneShot)
if FlowOneShot then FlowCount = FlowCount + 1
 
(I'm assuming the pulses are not that short that you'd have to put it in a fast stage or modify the input debounce bits)
mikes
Posts: 94
Joined: Thu Jan 04, 2018 3:09 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No
Location: New Albany, OH

Re: Acorn (BBG) sensing water flow for spindle motor cooling?

Post by mikes »

Right, I was just reading about one-shots, and thought they may fit the need to count the pulses. I think I will give them a try. May be eventually it would be nice to figure out how to display a real-time flow value.

There is one thing regarding one-shots I found confusing in the PLC documentation. It was regarding SET and RST, the documentation appears contradictory as is stated you can not SET or RST a one-shot, but then shows an example for eact. This is on page 20, see an excerpt below:

Set – SET
SET turns on any of the Bit variables. The bit value is set to 1 and evaluates to true when
checked. That is to say that any of the Outputs, Memory Bits, Timers, Stages, Fast-Stages
and System Variables that are bits can have this keyword used on them. One-Shots cannot
be SET.
An example of using this is IF 1==1 then SET MEM1.
Data Types that can be used with SET Example of using SET
Memory Bits IF 1==1 THEN SET MEM2
Outputs IF 1==1 THEN SET OUT2
Inputs IF 1==1 THEN SET INP2
Timers IF 1==1 THEN SET T2
Stages IF 1==1 THEN SET STG2
Fast Stages IF 1==1 THEN SET FSTG2
One-Shots IF 1==1 THEN SET PD2

Reset – RST
Reset turns off any of the Bit variables. The bit value is set to 0 and evaluates to false when
checked. That is to say that any of the Outputs, Memory Bits, Timers, Stages, Fast-Stages
and System Variables that are bits can have this keyword used on them. One-Shots cannot
be RST
. An example of using this is IF 1==1 then RST MEM2.
Last Modified 2018-08-21 07:50:09 AM Page 20 of 144
P:\Docs\_Docs working\CNC11 PLC Programming Manual\CNC12 PLC Programming Manual.odt
Data Types that can be used with RST Example of using RST
Memory Bits IF 1==1 THEN RST MEM2
Outputs IF 1==1 THEN RST OUT2
Inputs IF 1==1 THEN RST INP2
Timers IF 1==1 THEN RST T2
Stages IF 1==1 THEN RST STG2
Fast Stages IF 1==1 THEN RST FSTG2
One-Shots IF 1==1 THEN RST PD2
DannyB
Posts: 109
Joined: Mon Jan 15, 2018 1:11 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: Yes
CNC Control System Serial Number: A900712
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Acorn (BBG) sensing water flow for spindle motor cooling?

Post by DannyB »

My guess is that they copy/pasted it :)

It definitely won't work.
I've been working on adding linting to the vscode extensions i wrote using mpucomp, and mpucomp will definitely give a compile error message if you try to SET or RST a one shot.
Post Reply