Intro: Water Flow Sensor Interlock
Swansea Hackspace has recently bought a Laser Cutter,
it is a bargain basement one imported from china, as you can guess it has absolutely nothing in the way of safety interlocks or protections, so we have been working to fix that. The obvious one of interlocks on the doors and access panels is easy and has been fixed with some industrial reed switch units, but we would also like to protect the laser tube from accidental damage by including water flow in the interlock.
One of our members donated the above flow sensor, it turns out to be an M3236 sensor from Omega Technologies, this accepts a 5 - 24v power supply, and outputs a sequence of pulses depending on the rate of flow of liquid. Now clearly this can't be directly coupled to the interlock loop of the laser power supply, so a circuit is required.
Step 1: A Simple Microcontroller Circuit
To interpret the stream of pulses from the sensor we will use an ATtiny85 microcontroller, this will count the pulses and when the desired flow rate is achieved it will close a relay, completing the interlock circuit.
To help with diagnostics an RGB LED is fitted, and for configuration an small trim pot is used to set the threshold flow rate. The relay is a small reed relay where the coil current is low enough to be directly driven my the microcontroller.
The centre tap of the trim pot attaches to an analog input, the flow sensor to a digital interrupt pin, and the LED uses just two spare output pins (red, green)
I designed the PCB layout using Fritzing as the components were fairly simple.
Step 2: PCB and Assembly
The PCB was isolation milled using a desktop CNC milling machine, the holes were also drilled by the CNC machine. All components are standard through hole ones, and is quickly soldered together. With the various connecting wires soldered directly into the board.
The flow sensor is also fitted with hosetail adaptors to fit the rubber tubing the laser tubes water supply uses.
Step 3: Program the ATtiny
The microcontroller was programmed using a standard Arduino Uno in ISP mode, the program is quite simplistic, the flow sensor input triggers an interupt routine which increments a counter. the main loop runs around waiting for one second to have passed, then compares the flow counter to the desired threshold value. it then sets the LEDs and Relay output appropriately. And finally re-reads the trim pot for the next loops threshold value.
The full source and fritzing diagrams can be found on git Flowsenor git