Trying to switch a relay for lights with the octopus

I found this reddit post where someone uses the exact same relay module as me and it works. Only thing is his uses marlin. https://www.reddit.com/r/BIGTREETECH/comments/s2b9t5/switch_a_relay_with_the_octopus_v11/ No matter what I do the module is always on. Ive tried 5v rails/ 3v rails. Same outcome always. The weird thing is if I dont plug the input cable in, the relay is off, or if I plug it into an unregisterd pin its also off. But as soon as i register the pin. Its on always. Now i tried with endstop pins [output_pin my_pin] pin:PG11 value: 1 shutdown_value: 0
Reddit
From the BIGTREETECH community on Reddit
Explore this post and more from the BIGTREETECH community
76 Replies
blacksmithforlife
have you tried putting ! in front of the pin to invert the logic?
[output_pin my_pin]
pin:!PG11
value: 1
shutdown_value: 0
[output_pin my_pin]
pin:!PG11
value: 1
shutdown_value: 0
D00M-_
D00M-_2mo ago
yep and it dosent do anything its still on think i could run them off a fan header? they are 12v leds and pull about 2.3a
TheTik
TheTik2mo ago
Mine are off a heater header
D00M-_
D00M-_2mo ago
mine are 12v. Can you change the voltage on those?
TheTik
TheTik2mo ago
Ah, mine were 24V sorry Run two in series?
D00M-_
D00M-_2mo ago
i have 3=)) the fan mos datasheet says this Continous Drain Current 4.6 to 5.8 A and the 12v buck datasheet says this The AOZ1284 works from a 3.0V to 36V input voltage range, and provides up to 4A of continuous output current.
TheTik
TheTik2mo ago
Sounds like that should work, and bypass the relay entirely Oh, did you ever check that the pin was changing value when you turned the lights on/off in ratos?
D00M-_
D00M-_2mo ago
and the 12v psu yeah i did it dose change
TheTik
TheTik2mo ago
But the relay just didn't care, gotcha
D00M-_
D00M-_2mo ago
which is why i think its a software issue
TheTik
TheTik2mo ago
Wait, what?
D00M-_
D00M-_2mo ago
only after i designate the pin in printer.cfg dose it turn on
TheTik
TheTik2mo ago
If the pin changes like you expect why do you think it's software?
D00M-_
D00M-_2mo ago
because if the pin is not designated the module dosnt turn on. But once it is its on alwasy and if i change state high or low nothing votlage changes but it dosnt turn off i think this gives current [output_pin}
TheTik
TheTik2mo ago
So in ratos you're telling it to turn on and off, and the voltage at the pin is changing from zero to some voltage, right?
D00M-_
D00M-_2mo ago
yes the module need 150ma to turn on
TheTik
TheTik2mo ago
Then why are you blaming software? Sounds like it's doing exactly as expected
D00M-_
D00M-_2mo ago
cuz in marlin it works and klipper it dosnt
TheTik
TheTik2mo ago
You have marlin running on your octopus?
D00M-_
D00M-_2mo ago
nope:)) the guy on reddit does i posted a link to it above
TheTik
TheTik2mo ago
If the voltage at the pin is changing when you tell it to in klipper, then it is working as expected
D00M-_
D00M-_2mo ago
weird thing is if i add voltage to it manualy it dosnt turn on
TheTik
TheTik2mo ago
So the relay is broken?
D00M-_
D00M-_2mo ago
give me 2 min i have another one changed it with a fresh on thats in the bag and it behaves the same the module for the input only says it needs current on the input to trigger [output_pin] dose something that makes it be always on
TheTik
TheTik2mo ago
Feels like there is some basic electronic troubleshooting I'm struggling to think of from here
D00M-_
D00M-_2mo ago
im a try the fan headers and see whats up
TheTik
TheTik2mo ago
Good luck!
D00M-_
D00M-_2mo ago
well it works:)) now to see how long it will work
miklschmidt
miklschmidt2mo ago
@D00M-_ You probably need to connect the grounds of your buck, 24v psu and relay/mosfet. How did you connect everything?
D00M-_
D00M-_2mo ago
Hi mikl! Ive tried multiple combinations. Module has 3 pins. VCC, GND, IN. VCC to a 5v pin, GND to a GND pin, and IN to a pin with that can be designated. Also tried to do an open collector as you suggested in another post. https://discord.com/channels/582187371529764864/843098069200666634/863527623024050176 All that did was turn the whole relay module off and on. But it wouldnt switch states
D00M-_
D00M-_2mo ago
No description
D00M-_
D00M-_2mo ago
in this configuration, the relay is always on. When the pin is designated with [output_pin] if i undesignat it it turns off the [output_pin] does change the voltage of the pin if i add 5v manually to the IN pin nothing happens I i connect the module to a rpi that is not running klipper/ratos the module runs as intended Ive also tried to run it off the rpi with GPIO pin for input and same story happens. As soon as I designate with [output_pin] the relay is always on
03Julian04
03Julian042mo ago
So your problem is that the relay is always on even when the pin in is low ? Maybe you need a pull down resistor on the pin I got this on some Arduino if I don’t place a pull down resistor there are Creep currents
miklschmidt
miklschmidt2mo ago
Does it assume a 5V signal? Your gpio's operate at 3.3V, which won't work. You'd need a level shifter That doesn't make sense to me
D00M-_
D00M-_2mo ago
I literally followed this guide and it worked
D00M-_
D00M-_2mo ago
The Raspberry Pi Guide
Control electronics using a relay
A collection of tutorials to help set up and work with your Raspberry Pi
D00M-_
D00M-_2mo ago
And yes it dose work from a gpio
miklschmidt
miklschmidt2mo ago
You can do this in klipper too (rpi: as pin prefix)
D00M-_
D00M-_2mo ago
i have and it behaves the same on always
miklschmidt
miklschmidt2mo ago
That makes no sense
D00M-_
D00M-_2mo ago
ikr=))
miklschmidt
miklschmidt2mo ago
there is no difference
D00M-_
D00M-_2mo ago
as soon as i designate it its always on
miklschmidt
miklschmidt2mo ago
When you specify the pin as an output_pin it is set to whatever value you configured for that pin. By default output_pin's can only be 1 or 0 (low or high). But it's doing the exact same thing as the python codei n your link.
D00M-_
D00M-_2mo ago
in theory yes but in practice even on low its still on
TheTik
TheTik2mo ago
as measured?
D00M-_
D00M-_2mo ago
yes with a multimeter
TheTik
TheTik2mo ago
but then with a different setup, on the same pin, with the same voltage, the relay works correctly?
D00M-_
D00M-_2mo ago
yes
miklschmidt
miklschmidt2mo ago
So the voltages on the pin is the same, the 5v and gnd connections are the same, but it behaves differently? There's something missing 😄
D00M-_
D00M-_2mo ago
5v is to power the relay gnd is gnd and the input pin is for signal
TheTik
TheTik2mo ago
yeah, i'm going back to my earlier "there is some basic electronic troubleshooting I'm struggling to think of from here"
miklschmidt
miklschmidt2mo ago
gnd is how the signal returns to the MCU that controls it. If the signal doesn't have a return path it doesn't work. So if gnd on your relay isn't connected to gnd on whatever device you're controlling it with, it won't work.
D00M-_
D00M-_2mo ago
so when u wire it dont u put gnd to a gnd prin?
miklschmidt
miklschmidt2mo ago
Yes, multiple gnd pins if necessary
D00M-_
D00M-_2mo ago
theres only one:))
miklschmidt
miklschmidt2mo ago
that's how the meme "connect ALL THE GROUNDS" started No, there are ground connections on all your electronics
D00M-_
D00M-_2mo ago
well ive tried multiple locations the exp1 port the pi the endstops all the same
miklschmidt
miklschmidt2mo ago
You need to connect them simultaneously
D00M-_
D00M-_2mo ago
i dont understand what you mean
miklschmidt
miklschmidt2mo ago
You need gnd connections between all points in your system. So if your pi is powered by an external psu and your board is powered by the 24V psu, there's no gnd connection between the two. What you do is bridge the gnd connection on the 24V psu and the 5v psu. It's the same here.
D00M-_
D00M-_2mo ago
there is only one psu
miklschmidt
miklschmidt2mo ago
Your relay's gnd need to be connected to both the power source providing the 5v input and the mcu that controls the signal.
D00M-_
D00M-_2mo ago
the 24v im getting the 5v from either the mcu or the pi and the gnd respectivly
miklschmidt
miklschmidt2mo ago
then yeah that should work if it doesn't, i don't see any other cause than misconfiguration
D00M-_
D00M-_2mo ago
have you check the reddit post of the guy doing it with marlin on the octupus? ive also tried it his way and still no question whats t the alternative way or switching the lights on if not the relay method ? and can i keep it wired to my fan port?
TheTik
TheTik2mo ago
I have some 24V leds from IKEA that I wired to my heater port. Works great. Dimmable even
D00M-_
D00M-_2mo ago
these are 144/p ones, high intensity and i had them arround just want to exhaust all possilbe options before it go and buy new ones
TheTik
TheTik2mo ago
yeah, i was just answering the "alternative way"
Oldschoolhippie
Oldschoolhippie2mo ago
Just had a look at the Reddit post. The OP notes in the picture that the relay did not work with 5V. Therefore he changed to another pin with 3V, should be the one next to PB15 according to the pinout of the board. Did you test this? Another question: I know you want to use the existing LED's but the Octopus has a Neopixel port for 5V Neopixel LED's. These cost a few euros on Amazon (normally under 10 euros/dollars). Is it worth the stress to keep trying with the Relay or just get some Neopixels? 😅
miklschmidt
miklschmidt2mo ago
MOSFET (allows you to dim them too) and it's much smaller
03Julian04
03Julian042mo ago
You should test a pull down resistor
MDFPereira
MDFPereira2mo ago
some of this relays don't work correctly. Ask me how I know. Have plenty of them and only got results after changing module.
D00M-_
D00M-_2mo ago
can you recommend one?
MDFPereira
MDFPereira2mo ago
Tomorrow I can send you a pic of what I’m using
D00M-_
D00M-_2mo ago
oki thx
Want results from more Discord servers?
Add your server