How best to multiplex 12volt relays

Hi Folks,

after some advice to hopefully save some time.

I want to power (on/off) 4 18 volt lights and a 18 volt horn from a Makita battery using an ESP32 Nano and I'm asking the best way to wire this up.

This is not my first Arduino project.

These are the lights https://www.aliexpress.com/item/1005006168229960.html

So, normally powered by a car socket and the light pattern is changed by what I assume is a 12 volt pulse from a second button on the plug. There are only 3 wires to the light.

Getting power on/off is easy - I'll use a relays - I'll need 5 (4 lights, 1 horn)
But what is the best way to get the pulse ability so I can change the light pattern? Another 5 relays?

That makes 10 relays run off 10 D pins. Is there an easier way or a way with less relays? Cos I'm going to run out of pins pretty quick. IS there some sort of multiplexer arrangement that makes sense?

Thanks, in advance, for any replies.

N

Then you should know that you must supply a drawing of your idea.

Describe a car socket's specifications.

What pattern? Is there code involved? If so, you must post your code.

Three? Is this A/C?

What pulse?

For what?

1 Like

One could speculate... but I won't. I agree with @xfpd we need more info. If you can't or don't know how to make a diagram on a computer or website, a hand drawn that you photograph and upload is fine. + the rest of what @xfpd wrote.

Thanks for responding. Not my first project but it is my first post to this forum.





Drawing of idea uploaded - but the description still stands

The specifications of the car socket is irrelevant except that it obviously denotes the lights require 12 volt DC

"Light pattern" - also irrelevant as the light does this. There is no code. These are warning beacons designed to go on your car roof. Turn them on, they flash. Press the non latching button, they change their flashing pattern. See the 3 wires to the lights. 2 are power, but 1 is attached to the second, non latching button on the original plug (now removed). So I will need to send a "12 volt pulse" somehow which will move the pulse patter of the light on to it's next pattern.

"Three, is this AC" No - see above and the original description and the link of the actual item.

"Pulse" - See previous explanation

"Multiplexer - For what" - As explained - to potentially reduce the number of relays to turn all 4 lights on/off, the horn on/off and change the pattern of each light.

But - this is the crux of my question. How best to fill in the big question mark in my drawing and connect to Arduino to all of that.

You can use an MCP23017 MUX to control both the relays and the pulses. So you only need 2 pins for everything.
You can use optocouplers instead of relays for the pulse interface.
The common PC817 should work.

An Arduino have plenty of IO pins to cover two buttons and 8 outputs. But you shouldn't use relays for the lights, use MOSFET's instead.

Actually, @jim-p 's suggestion to use optocouplers are a better choice to interface with the ESP32.

You can use also A pins as digital pins .

OK, now we're talking. Thanks for the suggestions.

Unless someone points out how stoopid I am, I'll use a CD74HC4067 16-Channel Analog Digital Multiplexer Module in front of a 10 Channel Relay Module Module


This uses only 4 pins on the ESP32 but gives me full control of 10 12volt outputs. This is perfect for 4 Lights on/off, 4 lights pulse pattern change and 1 horn on/off.

And I have heaps of pins left for the 2 LCD displays and all the buttons needed to control the race starts.

Cheers

Oh, hang on - that multiplexer can only set one pin at a time. Still looking then....

maybe one of these MCP23017 as jim-p said

Now you need to start thinking how you will power everything. You don't want to wind up having to use many power supplies,18V, 12V, 5V and maybe more than one of each.

MCP23017 and a few PC817.

if by "patterns" & "pulse" you mean blinking your lights with specific period and frequency then you don't need any extra relays: you can use 5 ones you have. Just toggle them on and off.

May be using powerful MOSFET transistors is a better idea.

Possibly another relay or if the current to/from the yellow wire is low enough an optocoupler for each light pattern signal wire, yellow.

Have you connected a light up and worked out that the "signal" yellow wire needs to be connected momentarily to gnd or 12V?

How often will you be turning the power supply relays ON and OFF to each of the lights?

Will turning the light OFF, reset the flash pattern sequence?

Thanks.. Tom.... :smiley: :+1: :coffee: :australia:

Also be aware that the ESP32 Nano are 3.3V so you may need voltage translators in some set-ups

It needs 12 volts on the yellow wire. So I have grabbed a 10 channel relay. Gives me all I need.

The lights are turned on and off only a few times during the 5 minute start sequence of a race.

Press "Start" button - will turn on Orange light and toot horn
wait roughly 3 minutes then initiate 5 minute start sequence

At 5 minutes before the start - turn on Green tight and toot horn
At 4 minutes before start turn on Blue light and toot horn
At 1 minute before start turn off Blue light and toot horn
At 0 turn off Green light and long toot horn
30 seconds later - toot horn (signals "no more pumping" to the competitors)

If too many competitors are over the line early - hit a button that turns off all lights, turns on red and toots horn 3 times.

All this is pretty simple to code but does mean I need all 10 relays.

Yes, turning the lights off seems to reset the pattern sequence. TBH I might just leave them at their default first pattern. I'll see what it all looks like before deciding. But I have the relays if I need to change their patter each time.

Yeah, I got caught with the 3.3 volts in my last project and had to change to a UNO. But thanks for the heads up.

It's powered by a 18volt Makita battery with several step down buck convertors to get the 12 volts and 3.3 volts I need.

No as I already mentioned you can use optoisolators for the pulses. You could even use MOSFETs for the 12V so you don't need any relays.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.