Understanding CNC controller board PCB schematic

Thread Starter

zazas321

Joined Nov 29, 2015
838
Hello. I am learning more about CNC and how to control one. I have come across the Teensy 4.1 CNC controller board and it looks cool:
https://github.com/phil-barrett/grblHAL-teensy-4.x

The schematic can be found here:
https://github.com/phil-barrett/grblHAL-teensy-4.x/blob/master/v2.07 schematic.pdf

I have been studying the PCB schematic bit by bit and trying to understand what is going on and I have a few questiosn:

1. What is the advantage of having opto isolated inputs ( limit switches and mechanical push buttons)

2.My biggest concern is regarding the IC's used on the 2nd page schematic:
1613636312821.png

External opto drivers, and relay drivers, I am not sure what are these used for and what to they do?

Since the relay output pins for example coolant, air and etc most likely require to control the relay, I would assume that there would be small relays implemented into the PCB, but thats not the case.

Can someone with hardware knowledge help me understand . Thanks in advance!
 

dendad

Joined Feb 20, 2016
3,781
Opto isolated inputs (and outputs) have the main advantage of keeping the controller isolated from the input devices (and outputs) so different power supplies can be used.
Also, a lot of external noise is eliminated, along with ground loops.
In a lot of cases, if the isolated inputs have no common connection to each other, it really simplifies the connections so active high or active low signals can be used. just have the inputs wired accordingly.
On most of the industrial control boards I have designed, the I/Os are isolated.
For example, most industrial control sensors are 24V, while the controller runs on 5V or 3.3V.
A lot of the time, the relays are not on the controller as it then allows the appropriate relays for the job to be used.

What is your concern regarding the relay driver IC?
 

Thread Starter

zazas321

Joined Nov 29, 2015
838
Thanks for the clarification regarding the IO isolation. I do not understand what is the use of the relay driver IC?. What is the point of using a relay driver ? Can I not just simply use a gpio and toggle a an external relay with that gpio?

I am not sure what kind of function this relay driver plays in this controller board. How is it going to control the relays?
 

MaxHeadRoom

Joined Jul 18, 2013
22,630
A relay driver IC is usually a simple method of interfacing relays to a logic controller of some kind, IOW the IC, which usually has multiple relay drivers complete with BEMF diodes built in, condenses any control unit.
Usually darlington arrays.
Max.
 

dendad

Joined Feb 20, 2016
3,781
Thanks for the clarification regarding the IO isolation. I do not understand what is the use of the relay driver IC?. What is the point of using a relay driver ? Can I not just simply use a gpio and toggle a an external relay with that gpio?

I am not sure what kind of function this relay driver plays in this controller board. How is it going to control the relays?
The relay driver is like an amplifier as the ports of the processor cannot drive enough current for a relay directly. The port can drive a buffer, like the relay driver or transistor to boost the current and voltage, or a small load like an LED directly, but not much else.
Also, having the driver there protects the processor to a certain extent from some external oops conditions, like a shorted load or incorrect voltage.
The 74AHCT541 chips can only drive about 20mA at 5V themselves, while the ULN2003 has a max 500mA at 50V rating.
The relays will be connected between the DC supply voltage and the ULN2003 pin.
It is often a good idea to look at data sheets.
https://www.ti.com/product/ULN2003A has a link to the data sheet.
Also, I found this that may be of interest...
https://microcontrollerslab.com/uln2003-introduction-pinout-example-features/
 
Last edited:

Thread Starter

zazas321

Joined Nov 29, 2015
838
Thanks both for the comments. I am not much of a hardware engineer myself I am more of a software developer. I had a chance to drive a relay a couple of times and most times the wiring was simmilar to :
1613711419588.png

What the Teensy 4.1 PCB is suggesting to add an additional component between the relay and the CPU ? Is my understanding correct?

Or the relay driver completely replaces the relay and can do its function by itself?


Or another case, Lets say I have 5V microcontroller and want to controll 24V relay. I assume with this driver I am able to convert my 5V signal to 24V and toggle my relay. Could that be the use of this driver IC?
 

dendad

Joined Feb 20, 2016
3,781
On that board, "Q1" is the driver transistor. The ESP32 drives the transistor base (or gate if it is a FET) and the transistor switched the relay.
The relay board above could be a 24V version if it had the correct relay installed. As it is, the circuit shows it driven from "Vin", and that may be 5V, but the ESP32 is driving the board with a 3.3V signal.
 

dendad

Joined Feb 20, 2016
3,781
If you want to switch 240VAC, another device to use is a Solid State Relay (SSR) and that presents itself to the processor as an LED.

The ULN2003 can drive 7 loads of up to 500mA, and 50V Max. But it is better to underrate it somewhat. All the loads usually have their +V supply common and the ULN2003 switches to 0V to operate the loads.
So, in many cases, the relay may not be needed, but if you want to switch AC, or larger loads, use the ULN2003 to drive relays that in turn switch the loads.

What is the actual load you want to drive? More details usually helps with good answers.
 

Thread Starter

zazas321

Joined Nov 29, 2015
838
I have a 24V relay which is connected to AC. This relay turns ON/OFF the air cooling for my cnc. So I need to send 24V signal to the relay to active my air cooling.

1613724759410.png


I would assume if I provide +24V to COM pin, and use one of the inputs for example 1B which is connected to my microcontroller, whenever I toggle that pin, I would be able to control the relay through 1C output pin.


However, If I want to control a DC load lets say 24V fan, which is rated for < 500mA, I could just wire it straight to the load without an additional relay.

Is my understanding correct?
 

dendad

Joined Feb 20, 2016
3,781
Try the following.
First, make sure the 24V common is connected to the processor common, and that is the "E" pin.
Second, as it is an inductive load, tie the "COM" pin to +24V.
Third, one end of the relay coil is also to +24V.
Lastly, the other end of the relay coil is to the "1C" (or whatever output you use) pin.
And, yes, a 24V load that is significantly less that 500mA can do away with the relay, just connected as the relay coil is.
BUT!!!
Have a look at the graphs on page 9 of the data sheet.
There is quite a large de-rating of the current depending on duty cycle and the number of ports in use.
For instance, if it is a "D" package, there is a limit of well under 100mA each if all are continuously on together.
And a bit over 300mA if just one is on full time.
 
Top