How can I reroute multiple signals from a 4 pin connector using a relay switch?

In summary, the conversation discusses the possibility of using a relay switch to reroute electrical signals and power to different destinations, specifically for a 4 pin connector. The individual is looking for a device that can control the switching of multiple signals and power through a single connector. The solution suggested is to use a set of MOSFETs or a 4 pole double throw latching relay. The individual also expresses concerns about finding the right type of relay and suggests using a set of DPDT switches as an alternative.
  • #1
Next_Of_Kintetic
15
5
TL;DR Summary
Does a relay switch that can reroute multiple signals and power exist? ie: for a 4 pin connector?
Hi,

First off, I want to say that I'm basically a noob when it comes to electrical engineering; I have some knowledge and took an intro to robotics course in college, but if I knew the answer to this question, then I wouldn't be here asking haha. So here it is:

From what I know, relay switches are typically something that can reroute an electrical signal or power to a different destination or turn it on/ off with a switch. But, you can't just use a typical relay (like a latching relay) to do that for something that carries multiple signals (ie: a 4 pin connector) as then everything (including the various signals) would get "mixed" together. So, what about a switch or device that can do it for multiple signals? Does something like that exist? Or would I need to get multiple relay switches for each potential pin, connect them to each pin separately, and then to switch them at the same time when needed? Is there a different solution out there?

Specifically what I want is something that can relay a 4 pin connector's multiple signals to a different destination. Even more specific, what I am really trying to do is -- say that I have a black box (maybe its a 3d printer) that sends electrical signals and power via 4 pin connector. And that 4 pin connector wire plugs into a motor (like an extruder), but I want to control which motor it actually sends those signals and power to. So, if I have two motors, I want to able to issue a command, a device will flip a switch, and the 4 pin connector's signals and power get rerouted to the other motor.

Question is -- is there an easy way to do that? Ie: is there a device I can buy where I can just plug a 4 pin connector input on one side, two 4 pin output connectors on the other side, and then something to control the switching? Or do I have to everything on a breadboard and then have 4 separate relays that have to be flipped at once? Would using a set of MOSFET(s) be the way to go in that case?

Any comments, suggestions, points of reference, pokes, questions, concerns, etc. are all welcome.
Just please no flaming or overheated discussions as this would cause blue smoke (props if you get the lame joke).
(And yes, this has to do with my 3D printer, but please do not suggest things like 3D Chameleon -- it will not work with my current intended setup).

Thanks again in advance.
 
Engineering news on Phys.org
  • #2
Welcome to PF.

Next_Of_Kintetic said:
Would using a set of MOSFET(s) be the way to go in that case?
Yes.
You need to define the power and signal levels, not the fact that they pass through a single connector.

Google "4 pole double throw latching relay"
 
  • Like
Likes Next_Of_Kintetic and sysprog
  • #3
Baluncore said:
Welcome to PF.Yes.
You need to define the power and signal levels, not the fact that they pass through a single connector.

Google "4 pole double throw latching relay"
Hi,

Thank you for responding back so quick.
Apologies for not responding sooner, I have been very busy the last few days.

This is exactly what I was looking for! However, I am trying to understand how it would work and what connections would be made specifically -- looking at the diagram below:
517ed3fcce395f991d000000.png

I am not sure how this would work now that I think about, because in essence I have a 4 pin connector which (from what I understand) carries two different signals, so you could for example connect the source connector's signal wires to T1 of P1 and P2, then connect circuit1's 4 pin connector signal wires to the T1 of P3 and P4. But, how/ where would you connect circuit2's 4 pin connector signal wires?
Would I have to combine this somehow with another 4PDT relay?
I guess I am confused in general as to what "terminal" on the relay switch gets mapped to what in the diagram.

Another concern of mine is that these are hard to find, and apparently ones that work with a signal to do the switching (ie: from say a raspberry pi or an arduino) is even harder to find. Would something like this be possible with a set of DPDT (double pole double throw) switches?

Thanks again.
 
  • #4
A single throw switch is a simple on/off switch with two terminals. A double throw switch has three terminals and can be wired for the shared terminal to either select one of the two inputs, or it can distribute a signal to one of the two loads.

The number of poles is the number of lines being switched. You say four.

You need a switch or relay that is described as 4PDT.
You could make that from a pair of 2PDT aka DPDT units.

Do you need a manual switch, or an electrical relay that must be powered while in one state, or a latching relay that holds it's last state selected without power?

Google '4PDT latching relay' and you will find a solution.

If you post a wiring diagram we can ask specific questions and give more specific advice.
 
  • Like
Likes sysprog
  • #7
berkeman said:
and got an error/exception thrown in what looks like Chinese...
A few address look-ups shows it is a Chinese company that makes PC Boards, probably in Beijing, running on Amazon AWS servers in the US, UK, and maybe others.

If you were on a work computer, try it at home as the address may have been blocked for security reasons.

Cheers,
Tom
 
  • Informative
Likes berkeman
  • #8
salmanshu322 said:
https://www.pcbway.com/project/shareproject/Programmable_WiFi_Digital_Relay_Switch_ESP8266.html
this link perform the best relay switch as your problem mentioned.
I appreciate the enthusiasm, but this is not what I am looking for -- and it would ultimately lead me back to the same issue. The issue is not that I need to control something wirelessly; that's what my Raspberry Pi is for (I use the GPIO pins to drive things by contacting the PI's local server through wifi, which then can send signals through the pins). The issue is having a relay switch essentially reroute all the inputs to a different destination based upon my command. I have the command part, now I need to build the rerouting part...
This makes me think that maybe I am not explaining something right.
Baluncore said:
...
Do you need a manual switch, or an electrical relay that must be powered while in one state, or a latching relay that holds it's last state selected without power?

Google '4PDT latching relay' and you will find a solution.

If you post a wiring diagram we can ask specific questions and give more specific advice.
Thank you again for the quick replies. I am trying hard to find time to respond back fast enough, but recently I have been a lot more swamped than usual.

For this project, I need a latching relay that holds its last state without power that can change its state when I send a signal and/ or power to it. I managed to find one online (known as a passive bistable/ latching DPDT relay), which can be referenced here:

https://www.amazon.com/dp/ELECTRONIC/?tag=pfamazon01-20

And there's also a pdf describing its operational parameters/ descriptions/ etc. here:
https://images-na.ssl-images-amazon.com/images/I/91zRJyb7eJL.pdf

I spent the last couple of days (when I had free time) researching this, and made a potential wiring diagram of what I am trying to do (with possible connections), but there a few things that I am not sure about. Here is the diagram:
4-pin-connector-relay-switch-v1.jpg

Circled in orange are the things that I am not sure about. Because for instance, what signal would I send to S or R, the inputs for this particular relay switch? As apparently both cannot be off for the relay to work (even if you send voltage).

Another issue that I am not sure about is voltage and ground connections - because in this case, I would have to use a splitter to connect the voltage pin from the main connector to both the voltage pins of the other connectors (the ones that go to separate motors). This is probably not ideal, and I am not sure if that would even work. Same goes for the ground connections.

So, that's basically what I have at the moment. Again, I am a newb, so there's a very good chance I am misunderstanding certain concepts here, and have created a monstrosity above. So any help or guidance would be appreciated.

Thank you again.
 
  • #9
If you want to control this with a Pi, can you just find an off-the-shelf latching relay board that has some standard serial interface for the control signals (like I2C, which will be more commonly available for relay boards compared to WiFi)? Here are some examples:

https://www.google.com/search?client=firefox-b-1-d&q=latching+relay+board+I2C

I've used I2C controlled (non-latching) relay boards in production test fixtures, and they are simple to use and work well, IMO.

1646264207748.png
 
  • #10
berkeman said:
If you want to control this with a Pi, can you just find an off-the-shelf latching relay board that has some standard serial interface for the control signals (like I2C, which will be more commonly available for relay boards compared to WiFi)? Here are some examples:

https://www.google.com/search?client=firefox-b-1-d&q=latching+relay+board+I2C

I've used I2C controlled (non-latching) relay boards in production test fixtures, and they are simple to use and work well, IMO.

View attachment 297799
I'm a bit confused here. How would this help exactly? Maybe I misunderstood your comment about l2c being more commonly available than Wifi on relay boards).

But, I specifically want to use Wifi. I want to sit on my lazy bum, from my computer on third floor, press a button on my computer screen, it sends a signal to my router, the router talks to my PI, the PI talks to the relay switch, the relay switch -- switches the motors being used (and these motors, the PI, and the relay switch would be all located in the basement for example).

I have the WIFI already set up, it sends signals to the PI, the PI takes care of everything else - it can talk to a relay switch. The only thing I need now is for that relay switch to do the switching.

... Or did you mean standard relay board as a replacement for the DPDT relay?
 
  • #11
Next_Of_Kintetic said:
But, I specifically want to use Wifi. I want to sit on my lazy bum, from my computer on third floor, press a button on my computer screen, it sends a signal to my router, the router talks to my PI, the PI talks to the relay switch, the relay switch -- switches the motors being used (and these motors would be located in the basement for example).
You want to use WiFi between your computer and the Pi. The Pi controls the Relay Board using I2C because they can be co-located, right?
 
  • #12
berkeman said:
You want to use WiFi between your computer and the Pi. The Pi controls the Relay Board using I2C because they can be co-located, right?
Uh, what? There's no l2C being used here (at least as far as I know). The PI comes with a Wifi module built in. The computer can already talk to the PI. At the moment, that current relay is not connected to the PI (I have yet to buy it), so it is not talking to any relays via a standard interface.

This honestly should have nothing to do with Wifi in general (that was more like background information which I think may have confused everyone - that or I am misunderstanding your question).

But to give you an example of how I am thinking about this, I have another relay switch which is a standard relay that turns on when you supply it with a voltage. My PI is connected to that one via the GPIO pins, which all they do is just send a voltage to the terminal of that relay switch. That's it. No fancy signals and no interface being used, just a simple activation current and voltage.

I essentially want to do the same thing (if possible) with a DPDT relay switch (or something like that as was mentioned before), except the input signals would come from the 3d printer -- those are the signals I want to reroute, while the PI pins would simply control the power being supplied to that relay.
 
  • #13
Next_Of_Kintetic said:
..., while the PI pins would simply control the power being supplied to that relay.
I think you mean control to the relay.
There are two control inputs to a latching relay. So you need two logic bits to control a latching relay. You only need to produce a short pulse when you want to select the channel.
A pulse to coil 1 causes it to switch to connect the common Cn to output An.
A pulse to coil 2 causes it to switch to connect the common Cn to output Bn.
When both control pulses are off it will hold the last state, without coil power. When you turn the equipment off and on again, a latching relay will still be in the last selected state.
 
  • #14
Next_Of_Kintetic said:
Uh, what? There's no l2C being used here (at least as far as I know). The PI comes with a Wifi module built in. The computer can already talk to the PI. At the moment, that current relay is not connected to the PI (I have yet to buy it), so it is not talking to any relays via a standard interface.

This honestly should have nothing to do with Wifi in general (that was more like background information which I think may have confused everyone - that or I am misunderstanding your question).

But to give you an example of how I am thinking about this, I have another relay switch which is a standard relay that turns on when you supply it with a voltage. My PI is connected to that one via the GPIO pins, which all they do is just send a voltage to the terminal of that relay switch. That's it. No fancy signals and no interface being used, just a simple activation current and voltage.
The Pi does not have enough power in general on its GPIO signals to drive the relay directly. It is best to use a relay board that contains the relay drivers, and just control that relay board via some interface. I2C is a very common interface for this application, SPI is probably another one that is commonly used.
 
  • #15
Baluncore said:
I think you mean control to the relay.
There are two control inputs to a latching relay. So you need two logic bits to control a latching relay. You only need to produce a short pulse when you want to select the channel.
A pulse to coil 1 causes it to switch to connect the common Cn to output An.
A pulse to coil 2 causes it to switch to connect the common Cn to output Bn.
When both control pulses are off it will hold the last state, without coil power. When you turn the equipment off and on again, a latching relay will still be in the last selected state.
Oh, that makes so much more sense now that I think about it. Of course! - you're right.
In my current relay setup (the non-DPDT), its a heavy duty relay that turns on when the PI sends a voltage, which in this case is a signal (which controls it, telling it to switch states). I completely forgot its plugged into the outlet, which is what actually powers the relay itself. (duh).
So I should be able to just connect two different GPIO pins to correspond to the two different inputs.
But then, I still need something to power that relay switch itself, which brings me to my next question...
berkeman said:
The Pi does not have enough power in general on its GPIO signals to drive the relay directly. It is best to use a relay board that contains the relay drivers, and just control that relay board via some interface. I2C is a very common interface for this application, SPI is probably another one that is commonly used.
I knew that beforehand, which is why originally I was thinking I could have a transistor or mofset which would connect to one of the GPIO pins of the PI, and then that could power/ drive the relay. But, since I just realized that the GPIO pin would instead be used for the input terminals of the relay, which would mean I would need to power the relay some other way - I would need something else that connects to the voltage terminal.
I mean, I could just get an adapter and plug that into an outlet and call it a day, but then the question becomes--- how would I ground all that?
More specifically, there does not seem to be a terminal or place to connect ground wire for the coil of the relay. So how would that work?

As for getting a relay board to drive it, that is something I would need to take a look into / do more research on. But, currently my thinking is that it might be overkill for this, because then it will go PI -> Relay Driver -> Relay -> 4 pin connector -> motor. I was hoping this would be more compact, but perhaps if I start to expand to multiple motors and multiple relays, that might be the way to go. Still, would need to research it more.
 
Last edited:
  • Like
Likes berkeman
  • #16
OK! It looks like we are (finally) all getting on the same page about what is needed.

PI-Relay-Motor.png

This is a case of we have to work 'backwards' from the motor to the PI to figure out the details of what is needed.

  1. The motors already exist so the first thing to do is find a relay that can handle the motor voltage and current when the Motor starts, and then determine the protective circuit, if any, to protect the relay when the motor(s) shut off. So the Motor specifications will be needed.
  2. Next is to see if the chosen relay is available with a 12VDC coil (probably the easiest to interface to), or maybe a 5VDC coil. (3.3V relays are scarce, especially if the have to handle motor currents.)
  3. Then is the Relay Driver design; an interface circuit that can drive the relay coil. Also needed is protection for the Driver circuit when the relay coil shuts off.
  4. And now the task is to design the interface between the Relay Driver and the PI computer. Probably one or two transistors with a few resistors, or maybe an Integrated Circuit (IC, or Chip).

What is left is to choose a power source (12VDC?) for the relay(s).
You May want to add a few Pilot Lamps (LEDs?) so you can see what is energized and what isn't at any time. This make troubleshooting a lot easier both at the first time you turn it on and later when something stops working (besides they look cool :wink:).

I just checked the schematic in your post#8 above, (https://www.physicsforums.com/posts/6605635/) and what I describe here is the driver(s) to your 'R1' and 'S1' pins. It is unclear if the PI 4 pin breakout board can directly drive the motor(s). Are the 'B', 'A', 'V' pins designed to connect directly to the extruder motors, or are they GPIO (logic level) signals that the extruder expects and then the extruder drives the motors with its own power?

If the extruder powers the motor(s), then the block I labeled Motor Power would be the existing motor leads in the extruder.

Yeah, a lot to digest and wrap your head around here. But the project sure seems doable, and you will definitely learn a lot along the way!

Cheers,
Tom
 
  • Like
Likes berkeman
  • #17
Finally had some free time, so I updated the diagram/ schematic. Here is how it looks like now:
4-pin-connector-relay-switch-v2.jpg

To clear up a few things, here are a few notes:
- I'm still not sure if a relay driver is even needed in this case. So this schematic does not include it.

- The 'B', 'A', 'V' (and GRND) pins are part of a jst jumper cable that comes attached to the 3d printer
(nothing to do with the PI pins). That jumper cable is usually attached to a single motor. What I want to do is relay that jumper cable, coming from the 3d printer, to a different (but same type) motor based on a signal.

- The relay's sole purpose is to relay those jst jumper pins ( 'B', 'A', 'V' (and GRND)) to another motor of the same type if it gets a signal from my PI. Both motors are 42-40 Stepper Motors
(more info here: https://creality3d.shop/products/creality-42-40-stepper-motor-with-round-shaft).

- Essentially within my diagram, the way I have wired it is that CX and CY correspond to B and A respectively. Then what I have is SY and RY connect to one motor, while SX and RX connect to the other. So when the relay switches, it connects CX to SX or RX AND connects CY to SY or RY.
Meaning that no matter what position the relay is in, one of the motors is receiving both channels (B and A) while the other one receives none of the inputs from the 3D printer.

- The PI is just sending logic level signals to S1 / R1, which are specifically only related to the relay itself (nothing to do with the motor or extruder). They are what tell the relay switch to either switch to S or R, which eventually correspond to either motor 1 or motor 2.

- The term of 'Extruder' is misleading. Common issue with human terminology is that it sucks. It really should say filament driver - since it drives the filament or 'ink' of a 3D printer using a motor that spins gears with teeth that grab onto the filament and push it into the hot-end of the 3d printer (but that's not important).

- The voltage to the relay could be supplied via an adapter to an outlet.
-------------------------------------------------------------------------------------

...(~phew). Okay. Still a few things to figure out though:

- The most crucial of which (in my opinion) is where/ how do I ground some of these components? For example, when you connect the PI's pins to the relay switches inputs (S and R), aren't they connecting to a coil which acts like an electromagnet to pull the switch latch? In which case, shouldn't these wires need to be grounded in order to complete the circuit and allow it to work?

- Is using a splitter wire okay/ correct for the voltage between the two motors? I basically want to reroute the voltage from the 3D printer jst jumper cable as well to either one motor or the other.

- The relay expects a 119mA current signal for switching. There is no way a PI pin can supply that. Looking at how my other beefy relay works, it looks like it uses some kind of an opto-isolator to basically be able to take in a few mAmps from the PI as signal to then drive the actual relay. The max current for any PI pin is around 3 mAmps (conservatively, but apparently can go up to 16). This is something I need more research into, but I'm guessing the relay drivers that were discussed previously have this capability?

Hope that answers some questions you guys had. And I know its a lot to take in / digest (definitely a lot for me haha), so take as much time as you need. Any help, as always, is appreciated and welcome.

Thank you again.
 
  • #18
Next_Of_Kintetic said:
Summary:: Does a relay switch that can reroute multiple signals and power exist? ie: for a 4 pin connector?


It seems that you are trying to drive two stepper motors. Given the complexity of suggested solutions to provide a relay driver and 4 poles of relay switching it would seem to be just as easy to provide a second stepper motor driver for the second motor.

When choosing which approach to take remember the holding torque of a stepper motor will only be maintained if it is continuously powered. So if the mechanical load applies a torque while the motor is disconnected via the relay solution the motor position can slip.
 
  • #19
GrahamN-UK said:
It seems that you are trying to drive two stepper motors. Given the complexity of suggested solutions to provide a relay driver and 4 poles of relay switching it would seem to be just as easy to provide a second stepper motor driver for the second motor.

When choosing which approach to take remember the holding torque of a stepper motor will only be maintained if it is continuously powered. So if the mechanical load applies a torque while the motor is disconnected via the relay solution the motor position can slip.
Uh, this would defeat the whole purpose. Essentially here's the big picture summary-- My 3d printer is a black box. I have no idea what signals and power it sends to the original extruder/ filament driver/ motor normally. Re-creating that would be a pain and super complex. So, because of that, I still want my 3d printer to power and send signals to the original motor as usual. I just want a relay switch in between to redirect that power and signals to a different motor if I tell it to.
-------------------------------------------------------------------
... I also know its been a while, but does anyone have any answers to my questions in my previous post?
I mean, does the diagram make sense?
Again, any help is welcome. Thank you again.
 
  • Skeptical
Likes berkeman
  • #20
Next_Of_Kintetic said:
Uh, this would defeat the whole purpose. Essentially here's the big picture summary-- My 3d printer is a black box. I have no idea what signals and power it sends to the original extruder/ filament driver/ motor normally. Re-creating that would be a pain and super complex. So, because of that, I still want my 3d printer to power and send signals to the original motor as usual.
Wait, what? Did I miss the memo? You are wanting to reverse engineer the drive signals to your 3D printer without understanding how 3D printers are driven? Hopefully I'm misunderstanding your posts...
 
  • #21
Next_Of_Kintetic said:
... I also know its been a while, but does anyone have any answers to my questions in my previous post?
I mean, does the diagram make sense?
YES!

The various GND, GRND, signals (the ones with a "?") should be connected together.

We have a better chance of deciding the need for a relay driver if you can tell us
the part number on:
1) that 'optoisolator' that drives
2) the 'other beefy relay'
3) 'relay you have chosen'

Cheers,
Tom
 
  • #22
berkeman said:
Wait, what? Did I miss the memo? You are wanting to reverse engineer the drive signals to your 3D printer without understanding how 3D printers are driven? Hopefully I'm misunderstanding your posts...
No, no. Haha. Geez, am I that bad at explaining my thoughts?
I am specifically NOT trying to do that. No reverse engineering - I want to leave that stuff alone. That's why instead of doing something like that, I just want to redirect whatever signals (and power) its sending through its 4 pin jst connector cable to somewhere else. It's basically a circuit relay/ rerouting circuitry. That's all.

Tom.G said:
...
We have a better chance of deciding the need for a relay driver if you can tell us
the part number on:
1) that 'optoisolator' that drives
2) the 'other beefy relay'
3) 'relay you have chosen'

Cheers,
Tom
1-2) The beefy relay (reference is here: https://www.amazon.com/dp/B00WV7GMA2/?tag=pfamazon01-20) is not part of the diagram. It currently exists on my other setup and it will only exist for this setup as essentially a separate silo. I was only using it as an example to describe what I could potentially look at in terms of how the manufacturer solved the issue of providing enough current to its built in relay driver. I was saying that apparently it uses an optoisolator to do this trick, but how it does so, is still something I am not sure about/ need more time to do research.

3) The relay I have chosen (at the moment) was already referenced a few posts ago.
Here is the link:
https://www.amazon.com/ELECTRONICS-SALON-Passive-Bistable-Latching-RT424F05/dp/B00M91M9WK/
It has a reference sheet located here:
https://images-na.ssl-images-amazon.com/images/I/91zRJyb7eJL.pdf

There are a few different versions of it, but I was specifically referencing the 5V (operating voltage) version.

Tom.G said:
YES!

The various GND, GRND, signals (the ones with a "?") should be connected together.
Which would make sense, but don't you have to worry about certain ground connections not being a sufficient enough grounding? Ie: if you have too high a current or voltage going through a system, you could potentially oversaturate the ground to the point where it stops being a ground, and then you end up frying everything.
...
An offshoot question (also from my previous post), is there any reason that using a splitter wire for the wire carrying the voltage (from the 3d printer) would not work? If I hook it up to two different motors, and only at most one is ever in use, could that still cause potential losses within the voltage being carried to one of those motors?
 
  • #23
Next_Of_Kintetic said:
My 3d printer is a black box. I have no idea what signals and power it sends to the original extruder/ filament driver/ motor normally. Re-creating that would be a pain and super complex. So, because of that, I still want my 3d printer to power and send signals to the original motor as usual. I just want a relay switch in between to redirect that power and signals to a different motor if I tell it to.
If I've understood this correctly you want to power a second extruder via a change-over switch but not amend the 3D printer ("a black box"). How is the unmodified printer controller going to cope with controlling the second extruder in a different position which it doesn't know about? Are you planning to switch back to the original extruder and expect the controller to be able to carry on where it left off?

Next_Of_Kintetic said:
please do not suggest things like 3D Chameleon -- it will not work with my current intended setup.
Well, 3D Chameleon does let you swap filaments. If this is still an intended setup rather than a purchased setup perhaps you can still amend your design to something that will work.

We seem to have an XY problem here. You're asking about problem Y (how to switch a set of signals) but you are likely to get better advice if you asked how to solve problem X - your top level problem, whatever that is. What is your top level objective? Are you trying to print with two filaments? Print two copies of an object with different extruders? Something else?

> From the diagram in #17 "the motor it normally connects to runs on a nominal voltage of 4.83 V."

Are you mixing up the DC voltage drop across the resistance of a stepper motor winding with the supply voltage used by its driver?
 
  • #24
Next_Of_Kintetic said:
Which would make sense, but don't you have to worry about certain ground connections not being a sufficient enough grounding? Ie: if you have too high a current or voltage going through a system, you could potentially oversaturate the ground to the point where it stops being a ground, and then you end up frying everything.
Well... it depends. For instance that can be a real problem if you are using a common Ground (or Common) wire for both low voltage signals, maybe from a sensor, and also for power to something that draws a high current, maybe a motor. The higher current that the motor draws can create a signal in the common Ground wire that is stronger than the signal from the sensor. Then whatever is trying to read the sensor ends up also reading the motor current. Oops!

In that case, separate Ground wires would be used. Except for a few special cases, all Grounds get connected together somewhere in the overall system. Just make sure that each wire is large enough for the total current it is expected to carry.
Next_Of_Kintetic said:
An offshoot question (also from my previous post), is there any reason that using a splitter wire for the wire carrying the voltage (from the 3d printer) would not work? If I hook it up to two different motors, and only at most one is ever in use, could that still cause potential losses within the voltage being carried to one of those motors?
That is not a problem. There will be losses in a wire only when there is current flowing thru it.

Cheers,
Tom
 
  • #25
GrahamN-UK said:
If I've understood this correctly you want to power a second extruder via a change-over switch but not amend the 3D printer ("a black box"). How is the unmodified printer controller going to cope with controlling the second extruder in a different position which it doesn't know about? Are you planning to switch back to the original extruder and expect the controller to be able to carry on where it left off?
We need to be careful about terminology here. And I might be the one using it incorrectly, but to me, an extruder refers to the "filament driver" (not including the hot end). It's the motor that pushes filament into a tube that eventually goes into the hot-end (the thing that "prints" the filament). So all it has to do essentially is just spin (using its gears to grab the filament, thus pushing the filament into a tube). Considering the overall simplicity of the action, we do not have to care about what position the motor was beforehand, we just want to it to spin when the 3d printer tells it to.

GrahamN-UK said:
Well, 3D Chameleon does let you swap filaments. If this is still an intended setup rather than a purchased setup perhaps you can still amend your design to something that will work.
I have looked at the setup. From the way I understand it, I highly doubt it will work. As part of the set up for 3D Chameleon, it has an important electric switch that helps it determine when it does switching between filaments. That switch attaches to the moving base plate of a printer, and its operation depends on the movement of that baseplate. But, what if you do not have moving baseplate, and instead only a moving hot end (ie: like a creality cr-30 print mill, which has no real base plate but instead a belt that it prints on)? -- then it won't work. This is the issue I run into, and hence my quest for a DIY project.

GrahamN-UK said:
We seem to have an XY problem here. You're asking about problem Y (how to switch a set of signals) but you are likely to get better advice if you asked how to solve problem X - your top level problem, whatever that is. What is your top level objective? Are you trying to print with two filaments? Print two copies of an object with different extruders? Something else?
You might be right. I think I was trying to simplify the problem by reducing its scope and complexity for others, but in turn may have made things worse haha. Okay, fair enough -- basically my end goal is that I want to switch filament drivers when one filament driver (or extruder) runs out of filament.

The way I imagine it working like is the following:
-> printer exists with two spools of filament, each filament spool is attached to a separate filament driver, both filament drivers feed into a tube, each tube connects to an overall main tube, the main tube is connected to the hot end
-> now, we begin printing
-> printer is printing
-> runs out of ink (oh no!)
-> sensor detects this and sends this information to my raspberry Pi (computer that monitors and controls the print job)
-> Pi realizes this, alerts me, pauses the print, and initiates the filament change protocol, then sends a signal to the relay switch
-> relay switch reroutes the 4 pin connector signals and power to my other filament driver/ motor
-> filament change protocol completes using the rerouted motor/ filament driver
-> Pi resumes printing, but since the relay switch is latching, we stay on the same motor/ filament driver, continuing to print using the other spool of filament
-> print finishes, I change the used up spool of filament when I feel like it
-> never worry about running out of filament during a print again
-> party like its 1999.

GrahamN-UK said:
> From the diagram in #17 "the motor it normally connects to runs on a nominal voltage of 4.83 V."

Are you mixing up the DC voltage drop across the resistance of a stepper motor winding with the supply voltage used by its driver?
You're probably right. Like I said, I'm a newb. But that V4.83 may indeed be just the average voltage running through the motor at any given time, and not the amount actually being supplied to it. But, actually, according to the diagram, it won't really matter, since the voltage for both motors will be coming from the 3d printer anyway. The relay will not be rerouting the voltage, only the signals. So whatever the 3d printer supplies normally to one motor, I will use a splitter, hook it up to both, and when the relay switches signals, the printer should supply the voltage to the other one - at least I think that should work.

This post is way too long haha. But, as always, any answers, comments, questions, etc. are welcome.
Thanks again.
 
  • #26
Tom.G said:
The various GND, GRND, signals (the ones with a "?") should be connected together.
No, look at that circuit, it's a mess. The wall wart doesn't belong there and there is no signal coming from the Pi.

Next_Of_Kintetic said:
3) The relay I have chosen (at the moment) was already referenced a few posts ago.
Here is the link:
https://www.amazon.com/ELECTRONICS-SALON-Passive-Bistable-Latching-RT424F05/dp/B00M91M9WK/
It has a reference sheet located here:
https://images-na.ssl-images-amazon.com/images/I/91zRJyb7eJL.pdf

There are a few different versions of it, but I was specifically referencing the 5V (operating voltage) version.
That's not the relay board you want, pick one with a built in driver like this https://czh-labs.com/products/elect...version-for-arduino-raspberry-pi-8051-pic-495

1648166706950.png

  • Connect your 5V wall wart between VDD and GND (the GND adjacent to VDD; do NOT connect this to any other ground, the whole point of the opto-isolator is to isolate the relay from the Pi!) Make sure you get the polarity correct (check the wall wart with a multimeter and if it reads 5V and you have the leads plugged in correctly the wall wart wire on the red lead is VDD; if it reads -5V the black lead is VDD).
  • Connect IN_A to a GPIO pin.
  • Connnect the bottom GND to Pi GND.
  • Connect the A pin on the printer to C1 and the B pin to C2.
  • Connect the A pin on the first extruder to NC1 and the B pin to NC2.
  • Connect the A pin on the second extruder to NO1 and the B pin to NO2.
  • Connect all 3 V pins on the printer and the extruders together.
  • Connect all 3 GND pins on the printer and the extruders together.
  • Relay B is spare, don't connect anything to it.
Now when you send the GPIO pin LO (OFF) the first extruder will be connected to the signal from the printer and when you send it HI (ON) the second extruder will be connected. Note that depending on which GPIO pin you use (pull-up or pull-down) one or the other extruders will be connected on power up until your software switches the pin.

It's much easier when you show what the problem is and let us work out the solution. If you guess what you think the solution is we then have to guess what the problem is and nobody knows anything for sure!

(Note you could also use an I2C relay board like @berkeman suggested - the I2C is between the Pi and the relay driver, its got nothing to do with WiFi - but I couldn't find one with a DPDT relay).
 
Last edited:
  • Like
Likes Next_Of_Kintetic and berkeman
  • #27
I should have mentioned that if it was my project I'd use a proper microcontroller instead of the Pi. I would enclose the whole thing in a box and power the relays from the 5V from the wall wart (I know I said you don't want to do that but that is because I don't know what else is plugged into the Pi e.g. HDMI. If you only have the control board and wires from the printer and the wall wart inside a plastic enclosure you don't have to worry about opto-isolating the board).

I'd use one of these: https://thepihut.com/products/adafruit-feather-m0-wifi-atsamd21-atwinc1500 but they are very difficult to get hold of now (I have one in my box of toys but you can't have it!). An alternative would be an ESP32 if you are happy with 100% Chinese technology, otherwise a similar M0 or M4 Feather board with a separate ATWINC-1500 WiFi module.
 
  • #28
Next_Of_Kintetic said:
We need to be careful about terminology here. And I might be the one using it incorrectly, but to me, an extruder refers to the "filament driver" (not including the hot end). It's the motor that pushes filament into a tube that eventually goes into the hot-end (the thing that "prints" the filament). So all it has to do essentially is just spin (using its gears to grab the filament, thus pushing the filament into a tube). Considering the overall simplicity of the action, we do not have to care about what position the motor was beforehand, we just want to it to spin when the 3d printer tells it to.

There seem to be two definitions of extruder. https://all3dp.com/1/3d-printer-extruder-nozzle-guide/ suggests extruder can either mean "exclusively the motor and associated parts that push and pull the filament" or "the entire assembly including the hot end". You seem to be using the former definition whereas I lean towards the latter as that seems closer to the usage of extruder in non-3D printing contexts.

A normal extruder (using the former definition) pushes the filament into a single tube. With your proposal you'll need to ensure that filaments coming from two extruders can reliably feed into the single feed tube.

Next_Of_Kintetic said:
-> Pi realizes this, alerts me, pauses the print, and initiates the filament change protocol, then sends a signal to the relay switch
You wanted to treat the printer as a black box and not change it. How then are you going to pause a print and get the printer to feed the second filament to the hot end of the print head?

There's an existing method to cope with the filament running out. That is to use a filament (runout/break) sensor along with printer firmware that monitors the sensor. If the filament runs out the printer pauses the print, allows the user to replace the filament then resumes printing.

Is there some reason you can't use that method and have to invent your own?
 
  • #29
GrahamN-UK said:
You wanted to treat the printer as a black box and not change it. How then are you going to pause a print and get the printer to feed the second filament to the hot end of the print head?
You'll need to update the printer firmware to cope with that. That's not treating it as a black box.
 
  • #30
pbuk said:
No, look at that circuit, it's a mess. The wall wart doesn't belong there and there is no signal coming from the Pi.
I'm a little bit confused by this statement. I agree the circuit is messy, but there is a signal coming from the pi. It would be coming from the GPIO pins. Although, as you point out later, and now I am realizing it myself, there needs to be a relay driver of some kind that receives that signal instead, and then drives the actual relay accordingly (since those pins don't have enough power to do so by themselves).

pbuk said:
That's not the relay board you want, pick one with a built in driver like this https://czh-labs.com/products/elect...version-for-arduino-raspberry-pi-8051-pic-495

View attachment 298890
  • Connect your 5V wall wart between VDD and GND (the GND adjacent to VDD; do NOT connect this to any other ground, the whole point of the opto-isolator is to isolate the relay from the Pi!) Make sure you get the polarity correct (check the wall wart with a multimeter and if it reads 5V and you have the leads plugged in correctly the wall wart wire on the red lead is VDD; if it reads -5V the black lead is VDD).
  • Connect IN_A to a GPIO pin.
  • Connnect the bottom GND to Pi GND.
  • Connect the A pin on the printer to C1 and the B pin to C2.
  • Connect the A pin on the first extruder to NC1 and the B pin to NC2.
  • Connect the A pin on the second extruder to NO1 and the B pin to NO2.
  • Connect all 3 V pins on the printer and the extruders together.
  • Connect all 3 GND pins on the printer and the extruders together.
  • Relay B is spare, don't connect anything to it.
Now when you send the GPIO pin LO (OFF) the first extruder will be connected to the signal from the printer and when you send it HI (ON) the second extruder will be connected. Note that depending on which GPIO pin you use (pull-up or pull-down) one or the other extruders will be connected on power up until your software switches the pin.
Hmmm... interesting. But, isn't the issue with this relay that it is not a latching relay? So, it would have to keep being powered in order just to maintain a switched position? I mean, I guess its not a huge deal, but then every time I turn on the printer, I would either have to keep the relay powered all the time (which would be stupid in my opinion) to maintain the state or have a way of saving that state by determining which motor (and thus, which gpio pin) was used last and then have the relay switch accordingly if needed.

Also, another issue is that according to the manufacturer, the "board does not have opto-isolation." So that might need to be addressed in some way...

pbuk said:
It's much easier when you show what the problem is and let us work out the solution. If you guess what you think the solution is we then have to guess what the problem is and nobody knows anything for sure!
That's fair. And I apologize for that, and thank everyone for being so patient with me in that regard.
I just assumed the original problem boiled down to just rerouting a 4 pin connector, but I just did not realize the other complexity of the entire system would end up rearing its head and complicating things. The thing is, I am not an electrical engineer; so, due to that lack of experience, certain problems feel like they should have easy solutions in my mind, including this one. But, obviously, that's not always the case. Anyway, I guess its a lesson for next time...

Additional replies to the other replies coming soon.
Thanks again.
 
  • #31
pbuk said:
I should have mentioned that if it was my project I'd use a proper microcontroller instead of the Pi. I would enclose the whole thing in a box and power the relays from the 5V from the wall wart (I know I said you don't want to do that but that is because I don't know what else is plugged into the Pi e.g. HDMI. If you only have the control board and wires from the printer and the wall wart inside a plastic enclosure you don't have to worry about opto-isolating the board).

I'd use one of these: https://thepihut.com/products/adafruit-feather-m0-wifi-atsamd21-atwinc1500 but they are very difficult to get hold of now (I have one in my box of toys but you can't have it!). An alternative would be an ESP32 if you are happy with 100% Chinese technology, otherwise a similar M0 or M4 Feather board with a separate ATWINC-1500 WiFi module.
Here's the thing. My Pi is what talks to my 3d printer. It uses OctoPrint to send gcode to essentially tell the printer what to do when printing. That same Pi also controls a beefy relay switch, which is connected to the printer as well. Currently, when I contact my Pi through Wifi, I can click on a button on my computer, that goes through my local wifi, tells my Pi to activate a GPIO pin, that then sends a signal to the beefy relay, the beefy relay turns on, causing everything connected to the beefy relay to also turn on, including the 3d printer and also a lamp to light up the room. Once that happens, I can also click buttons on my computer to tell the printer to print something.
So basically, all of that is already set up; I do not want to change all that. And essentially, I am just trying to extend that functionality and design.

I cannot use a microcontroller to talk to my printer (at least not easily; it would be like re-inventing the wheel). So, basically, I would still need the PI, but then adding a microcontroller to the system to just talk to the relays does not make sense to me; it feels like an un-needed "middle man" component.
To me, it makes more sense to just use one main board (the Pi - who I already can talk to through my computer) do all the talking, and tell other components to do their specific function. Then have those components do those specific functions (ie: Pi should just tell the relays to switch, and they switch).
This also gives me extra control all in one place instead of having to deal with multiple points of contact.

Let me know if I misunderstood something though.
Thanks again.
 
  • Like
  • Love
Likes pbuk and Tom.G
  • #32
GrahamN-UK said:
There seem to be two definitions of extruder. https://all3dp.com/1/3d-printer-extruder-nozzle-guide/ suggests extruder can either mean "exclusively the motor and associated parts that push and pull the filament" or "the entire assembly including the hot end". You seem to be using the former definition whereas I lean towards the latter as that seems closer to the usage of extruder in non-3D printing contexts.

A normal extruder (using the former definition) pushes the filament into a single tube. With your proposal you'll need to ensure that filaments coming from two extruders can reliably feed into the single feed tube.
And again, this is why human terminology sucks. I always thought the same way, that basically the hot end should be called the extruder, and whatever pushes the filament into the tube should be a "filament driver", since as you said, that would make sense outside of 3d printer contexts. But, when I run into others or on other forums who talk about 3d printers, a lot of them refer to the former definition of extruder -- so much to the point where it has become part of my lexicon. It's unfortunate...

And yes, my plan is that they have their own tube, and then all those tubes get funneled into a main tube. Something like that exists, just need to find it or worst case scenario, make one. The case where both get funneled into the main tube at the same time should not happen, since I would activate the "filament change protocol", which would get rid of all filament in the main tube currently, before activating the other motor to start shoving more filament into the main tube.

GrahamN-UK said:
You wanted to treat the printer as a black box and not change it. How then are you going to pause a print and get the printer to feed the second filament to the hot end of the print head?

There's an existing method to cope with the filament running out. That is to use a filament (runout/break) sensor along with printer firmware that monitors the sensor. If the filament runs out the printer pauses the print, allows the user to replace the filament then resumes printing.

Is there some reason you can't use that method and have to invent your own?
uh what? I was referring to the 3d printer as a black box in a completely different context. It's essentially a black box because you do not need to know what signals it is sending to the motors/ extruders - if you want to relay those same signals to a different motor or location, you should be able to just relay them, and thus pretend whatever is sending them is essentially a black box.

As for coping with filament running out -- I am not inventing my own, I want to use that method, but make it more "automatic". Ocotoprint, the framework that my Pi uses for talking to the 3d printer, has this functionality already. You can basically tell it to pause and wait for filament replacement before resuming. And obviously, you can tie it into using a sensor associated with the printer.
But, you still have to physically go to the printer yourself and do the change manually.
I want to avoid that, be super lazy, and have something else do that so that it continues printing.
And then when I feel like it, just replace one of the filament spools.
The whole point of this project is to have my system to do the filament replacement for me.
But, that is an end goal.

Right now, the first step would be to get it to switch motors/ extruders/ filament drivers when I send a command to my Pi.

Hope that makes sense.
Thanks again.
 
Last edited:
  • Like
Likes Tom.G
  • #33
Next_Of_Kintetic said:
I'm a little bit confused by this statement. I agree the circuit is messy, but there is a signal coming from the pi. It would be coming from the GPIO pins.
There are only connections to pins marked "3.3V" which is pins 1 and 17 on a Pi connector. If they were meant to be GPIO pins then you should have marked them as such, although it doesn't really matter because...

Next_Of_Kintetic said:
Although, as you point out later, and now I am realizing it myself, there needs to be a relay driver of some kind that receives that signal instead, and then drives the actual relay accordingly (since those pins don't have enough power to do so by themselves).
Indeed.

Next_Of_Kintetic said:
Hmmm... interesting. But, isn't the issue with this relay that it is not a latching relay? So, it would have to keep being powered in order just to maintain a switched position?
No, when unpowered it is in the "NC" (normally connected) position.

Next_Of_Kintetic said:
I would either have to keep the relay powered all the time (which would be stupid in my opinion)
This is what relays are designed for.

Next_Of_Kintetic said:
Also, another issue is that according to the manufacturer, the "board does not have opto-isolation."
No it doesn't, but if you are only switching the low voltage control lines that's not really a problem.

The advantages of the board I specified are that it is cheap, easily available, works at the 3.3V signal level of a Pi, has a DPDT and is easy to wire to the Pi. You could use 2 SPDT relays, or even 4 SPST relays but I don't know if your printer could tolerate failure conditions where it was driving two feeders at once, and as this is your first foray into electronics you should keep it simple.
 
  • #34
Next_Of_Kintetic said:
Here's the thing. My Pi is what talks to my 3d printer. It uses OctoPrint to send gcode to essentially tell the printer what to do when printing.
I missed that part, yes of course in this case there is no point not using the Pi.
 
  • Like
Likes Next_Of_Kintetic
  • #35
Sorry for the late reply, been quite busy for most of the week. But here we go...

pbuk said:
There are only connections to pins marked "3.3V" which is pins 1 and 17 on a Pi connector. If they were meant to be GPIO pins then you should have marked them as such, although it doesn't really matter because...
Ah. I see what you mean. Fair enough.
Although, couldn't I use those as well to send signals to the relay board that you linked?

pbuk said:
No, when unpowered it is in the "NC" (normally connected) position.
That's kind of the point I was making though. Because then what happens if I switched to the "NO" position last time before I turned off the 3d printer. If I also turned off power to the relay (or let's say a surge happens, power gets cut off), then the relay reverts back to its NC state. When power comes back on, wouldn't it remain in the NC state unless something tells it to switch again? Wouldn't this cause an issue?

For example, imagine the following scenario:
- Printer runs out of filament
- Relay is currently on NC position (so filament associated with the "NC" motor has run out)
- All the fancy logic happens and Pi says "switch" to the relay
- Relay switches from NC to NO position in order to reference / use the other motor and filament associated with that motor. So, now the filament is coming from the filament spool associated with the "NO" motor.
- Filament change occurs as it should
- Everything is working fine
- Power surge happens (Oh no!)
- Power comes back online, but relay has no idea of its previous state
- Printing resumes with filament associated with the other motor (the "NO" motor)
- But, because the relay never switched back, the "NC" motor spins (the one that had its associated filament run out at the beginning), while the "NO" motor stays motionless. (Oops...)

So basically, I could end up sending signals to the wrong motor as a result. So, either I would have to keep the relay switch powered on all the time (but if a power surge happens, this would still reset the switch to NC, which messes with the way I imagined it working) OR I would have find some way to save the relay's state (which might be possible since I could potentially save it as an environmental variable on the Pi's server, but then I would need to figure out if the Otcopi framework can even access that)...

pbuk said:
No it doesn't, but if you are only switching the low voltage control lines that's not really a problem.
Wait, and this is probably my overall confusion about the subject, but I thought the point of opto-isolation is to protect high voltage surges from other parts of the system from wrecking circuitry that is not resistant to that high voltage. I mean, do I not have to worry about a high surge occurring within the relay from say the wall wart and then "cascading" back to the Pi? Is it only something to only worry about in terms of the voltages you are switching between?

pbuk said:
The advantages of the board I specified are that it is cheap, easily available, works at the 3.3V signal level of a Pi, has a DPDT and is easy to wire to the Pi. You could use 2 SPDT relays, or even 4 SPST relays but I don't know if your printer could tolerate failure conditions where it was driving two feeders at once, and as this is your first foray into electronics you should keep it simple.
I agree. And thank you for recommending it. I think it might be the way to go, but as I lack the experience, I'm just trying to make sure "I cross my T's and dot my I's" so to speak. I am not trying to find flaws or anything specifically wrong with it; I'm just trying to see in my mind how it would work within the system and any potential things I might have overlooked or if there is anything I need to work-around as a result.

As always, all answers are welcome and appreciated.
Thanks again.
 
Last edited:
Back
Top