Logic Solutions for Iron Pre Kits

The breadboard is your friend. I always build the circuit first on breadboard with jumper leads. Once everything works fine, then transfer the circuit to a more permanent board - either stripboard or for a more professional look, have a PCB made at a fab house in China. Most offer sweet deals of 10 boards for $5.00. But it means having to learn KiCad to design the board yourself.
 
I've drawn a diagram of how I think the relays should be driven from a microcontroller's I/O pins. I'm also fairly comfortable now with using 24V relays as opposed to 5V relays.

Note that the relays should be powered by it's own PSU, and not the PSU of the Iron Pre.

24V_Relay-Arduino_med.png
 
  • Like
Reactions: 1 user
Thank you for that, @ACnotDC. It's exactly why we have this separate thread, so that members can contribute and we can all learn from it. I'm not familiar with ULN2003A, but I will certainly have a look at it.

By the way, the diode in my diagram above is not a suppression diode, it's a flyback or flywheel diode. It's standard practice to use it with relays and it's also in the schematic of the Iron Pre.
 
Last edited:
It's quite interesting what ChatGPT says about the ULN2003A:

To use the ULN2003A to drive a 24V relay from an Arduino or similar microcontroller, you can follow these steps:

  1. Power Supply Connection: a. Connect the positive terminal of the 24V power supply to the VCC+ pin of the ULN2003A. b. Connect the negative terminal of the power supply to the GND pin of the ULN2003A. Also, connect this pin to the ground of the microcontroller.
  2. Relay Connection: a. Connect one end of the relay coil to the positive terminal of the 24V power supply. b. Connect the other end of the relay coil to one of the relay input pins (e.g., IN1) of the ULN2003A.
  3. Microcontroller Connection: a. Connect one of the microcontroller's digital output pins to the corresponding relay input pin (e.g., IN1) of the ULN2003A.
  4. Flyback Diode (optional): a. To protect against voltage spikes generated by the relay coil when it is turned off, you can connect a flyback diode across the relay coil in reverse-biased orientation. The cathode (marked end) of the diode should be connected to the positive terminal of the relay coil, and the anode should be connected to the negative terminal.
The ULN2003A provides internal clamping diodes, which help protect the transistor array from inductive kickback generated by the relay coil. However, adding an external flyback diode further enhances protection.

Make sure to choose the appropriate relay input pin on the ULN2003A for each relay you want to control. The ULN2003A has multiple channels, typically containing seven Darlington transistor pairs, allowing you to control up to seven relays independently.

By driving the appropriate input pin of the ULN2003A with a logic high signal from the microcontroller, the corresponding output will turn on, allowing current to flow through the relay coil and activating the relay.
 
Clamping diode = suppression diode = flyback diode = flywheel diode and so on... that's my understanding:cheers:
Don't belive all that chatGPT rambling, it hallucinates often, although in this case, the principle explained correctly

Look at application schm posted at #336 in "Iron Pre Essentials Kits For The DIYA Store- Register Your Interest":wave:
 
Official Court Jester
Joined 2003
Paid Member
I'm using ULN2803, PDIP-18 case, TTL, 5 V CMOS

bought drekload of them for cheap.....

when using those, by datasheet, no need for diodes parallel to relay coil, each of 8 Darlingtons is having clamp diode to common

of course, which demands that common (positive) is also taken to ULN
 
Last edited:
  • Like
Reactions: 1 user
It's quite interesting what ChatGPT says about the ULN2003A:

To use the ULN2003A to drive a 24V relay from an Arduino or similar microcontroller, you can follow these steps:

  1. Power Supply Connection: a. Connect the positive terminal of the 24V power supply to the VCC+ pin of the ULN2003A. b. Connect the negative terminal of the power supply to the GND pin of the ULN2003A. Also, connect this pin to the ground of the microcontroller.
  2. Relay Connection: a. Connect one end of the relay coil to the positive terminal of the 24V power supply. b. Connect the other end of the relay coil to one of the relay input pins (e.g., IN1) of the ULN2003A.
  3. Microcontroller Connection: a. Connect one of the microcontroller's digital output pins to the corresponding relay input pin (e.g., IN1) of the ULN2003A.
  4. Flyback Diode (optional): a. To protect against voltage spikes generated by the relay coil when it is turned off, you can connect a flyback diode across the relay coil in reverse-biased orientation. The cathode (marked end) of the diode should be connected to the positive terminal of the relay coil, and the anode should be connected to the negative terminal.
The ULN2003A provides internal clamping diodes, which help protect the transistor array from inductive kickback generated by the relay coil. However, adding an external flyback diode further enhances protection.

Make sure to choose the appropriate relay input pin on the ULN2003A for each relay you want to control. The ULN2003A has multiple channels, typically containing seven Darlington transistor pairs, allowing you to control up to seven relays independently.

By driving the appropriate input pin of the ULN2003A with a logic high signal from the microcontroller, the corresponding output will turn on, allowing current to flow through the relay coil and activating the relay.
As I said chatGPT hallucinates and mixed up relay input and output pins of ULN2003A.
At 2. it should be:
2. Relay Connection: a. Connect one end of the relay coil to the positive terminal of the 24V power supply. b. Connect the other end of the relay coil to one of the relay output pins (e.g., OUT1) of the ULN2003A.

That's a cardinal error... no comment :smash:
 
Last edited:
Not sure if the following is useful, but I ran across the following project, while looking for ideas to implement a logic controlled attenuator with remote capabilities: http://vaneijndhoven.net/jos/relaixedpassive/index.html

He's open sourced it including the software, KiCad/Gerber files and so forth. I figured this might be a good project to start learning KiCad, and thinking maybe one of these could be adapted to use a more powerful SBC with ethernet/wifi.
 
Last edited:
Thanks @Skylar88 the ESP32 looks very cost effective for having networking/BT functionality. Very cool!

I'm wondering if the Relaixed board could be used as a balanced attenuator, if the resistors are well matched. It doesn't implement (stereo/side to side) balance control out the box.

He mentions that the resistors are of pretty high quality for SQ purposes.
 
It would be a pity if the Relaixed board doesn't have balance control - which obviously would take care of slightly mismatched channels.

I have mentioned before in the Iron Pre thread that I'm working on my own attenuator which sports balance control. It uses the ESP32 and stepper motors to turn two separate potentiometers for stereo channel attenuation. My interest in the Logic Solutions thread stems from my intention to include input channel selection, as well as a mute function which is achieved by switching off all the relays. And when unmuting, the reverse. It would even be possible, (although I haven't implemented it yet) to have a "soft mute", by reducing the volume to full attenuation over say, one second, or one and a half second period. Switching off the active input relay won't be necessary then. It uses a high contrast 2.4" TFT LCD display, IR remote and rotary encoder. I'll post more details another time.
 
  • Like
Reactions: 1 user
I'm wondering if the Relaixed board could be used as a balanced attenuator, if the resistors are well matched. It doesn't implement (stereo/side to side) balance control out the box.

After rereading your post, I want to mention that I doubt the Relaixed board could be modified to have channel balance control because the resolution is so course. 1dB steps would be too much to make subtle balance changes, I guess.
 
  • Like
Reactions: 1 user
I’m trying to compile a list of viable options for activating relays via typically 3.3V I/O pins of a microprocessor (Arduino, etc.)

So far in this thread, we’ve seen:

Transistors, eg. BC547, 2N3904
Darlington transistor arrays, eg. ULN2003A

What about logic level converters (shifter)? Anyone with experience of this? Keep in mind that we'd like to use 24V relays. Is it possible to shift that much?
 
If you want to use 24V relais with Arduino and ULN2003A you need power supply with 24V for relais and 12V for Arduino only.
For example: a small toroid with 2 x 12V, 2 x Graetz bridge and maybe some caps.
What do you need a logic level converter or shifter for?
 
A logic level converter would have been for shifting 5V to 3.3V for a micro that can't handle 5V on the I/O pins. But it was a misunderstanding on my part. It is not necessary in this application.

Yes, a separate relay power supply is needed. Power for the relays shouldn't come from the Iron Pre PSU.

Although an Arduino can operate on 12V, it is advisable to rather run it off 5V to make the task of the onboard voltage regulator easier.