To explain what I meant with those transistors and diodes:
This is only one relay and I left out the motor, because it is irrelevant for the explanation and drawing all 4 relays would just add confusion.
First we have the K8055. The output ports of a K8055 are open collector outputs. That means that they have a very high resistance when the port is OFF and a very low resistance draining to ground when the port is ON.
On to the PNP transistor Q. What does that thing do? It acts like a mini relay. It allows current to flow from the emitter (connected to +12V) to the collector (connected to the relay coil) if the base connected to the two resistors R1 and R2 is 0V or “pulled low”. It is “ON” then. It does not allow that flow or is “OFF” when there is a certain voltage at the base.
How do we control that? With the two resistors and the K8055. Let us assume that resistor R2 has 10 times the resistance of R1. If the K8055-OUT port is off, nothing flows through R1 and R2 pulls the base of Q “high”. That turns Q “OFF”, so the relay coil gets no current. But when we turn the K8055 port “ON”, then most of what comes through R2 is going through R1 to ground. That pulls the base of Q “low”, which turns Q “ON” and now the coil gets current.
The last part of the puzzle is the diode D. A diode is like a one-way valve. It lets current easily flow in one direction, but not the other. This is a protective diode that is needed because we are switching a coil (called an inductive load). They are often called free wheeling diodes, clamping diodes … whatever. The point of that thing is to keep the transistor working more than once! A coil builds a magnetic field. What unfortunately happens when we turn the transistor off is that the collapsing magnetic field will induce electricity back into the coil. This results in a spike of possibly many hundreds of volts … with no way to go except to force their way through the “closed” transistor. Not good. With that clamping diode, this electricity is just short circuited back into the coil and the resistance of the coil itself will take care of it in a short period of time.
When ordered online the transistors should not cost more than $0.70 a piece, the diodes less than $0.20 and the resistors are a few pennies. The biggest item on that bill will be shipping and handling.
All that’s left is picking the right values for the transistor, the diode and the two resistors.