Tag Archives: cnc milling machine

Universal Interface

The Universal Interface

It’s time to present a relatively simple yet useful device: the Universal Interface. The need for this little helper arised when building the control for my CNC milling machine. But that’s a major project that I will introduce another time. Today it’s only about this little board.

Universal Interface at work inside the CNC control cabinet

My challenge was that I had to connect to and from a variety of external devices. Such as coolant pumps, pneumatic valves, probes and the like. Input and output signals could be anything from 5V logic, open collector logic, 24V logic to a relay. And they could be active low or active high.

The backside

Some situations also required a bit of logic. Not much but still some. Something like an AND and an OR gate or so. None of those circuits were challenging to design. But there were several of those and I didn’t really want to custom design and build a board for each one. Besides the fact that some in- and outputs were not entirely final yet or could change in the future. In other words, I wanted a single design that is flexible enough to handle all the present and future little challanges.

A total of 4 such interfaces are at work in the CNC control

Now to the design. There are 3 inputs (A, B and C) plus an enable input (EN). Each of these inputs is 24V tolerant and can be equipped with pull-up or pull-down resistors. And each of them can be configured to be either active high or active low. And of course, each of these inputs is nicely debounced by running it trough an RC filter followed by a Schmitt triggered logic gate. The logic state of each input is indicated with an orange LED located next to the input.

The inputs

Next comes the logic part. It uses a 74HC151 8-input logic multiplexer. The three inputs A, B and C select, which of 8 possible inputs is selected. The logic value of these inputs is then determined by 8 resistors as shown below. This allows an arbitrary logic function to be implemented in hardware. Nothing on this board requires software, it’s all hardware.

A hardware-configured logic table

Then comes the output stage. There is only one single logic output but it is provided in multiple varieties:

First, there is a single-pole, double-throw (SPDT) relay that is good up to 250 volts and 10 amps.

Then there is a powerful open collector output that can drain up to 2 amps. Flyback diodes are already included so this output can directly be used to drive another relay, a motor or whatever.

Then there is a standard CMOS 5V logic output. It can source or drain up to something like 25mA, pretty standard really.

And then there is also a 24V logic output which can optionally be equipped with a pulldown resistor or as a push-pull output as you know it from a typical CMOS gate. It can easily sink or source something like 500mA, maybe more. Protection diodes are also provided.

The outputs

And then there is also the enable input. If the enable input is not active, the 5V, 24V and OC output will all enter a high-impedance state. Of course, the relay does not have a high-impedance state and will just remain in its unenergized (i.e. off) position.

The power supply

As this circuit was intended to for use in an industrial environment, its supply voltage is 24V. This could easily be changed to 12V by simply using the 12V version of the relay – nothing else needs to be changed. The 5V voltage for the logic and 5V output is generated by a switching power supply that is good for up to 1 amp output current (far more than ever needed here) and an input voltage up to 30 volts. There is plenty of capacity both at the input (220uF) as well as the output (680uF). And yes, it is also reverse-polarity protected.

Side by side

That’s all I can say about this device. I’m currently using 4 of them in my mill, with different configurations, and they all work reliably.

There is room for more.

As you never know what the future brings, there is room for 3 more of these little helpers in the control cabinet. And if something is to change, I can likely accomodate for that change by simply changing a few resistors.

Where the input signals get treated

As all my stuff (or most of it, anyway), this project is on github:
https://github.com/soldernerd/UniversalInterface.