Strange Behavior: Arduino Mega, non-latching relay, a switch, and solenoid

Hi all,

Set up:
Arduino Mega;
Rotary encoder's "switch" pin connected to pin 8;
non-latching relay's "signal" pin connected to pin 25;
A switch is connected to the "always on" port of the relay and then connected to the solenoid for manual control of the solenoid (solenoid switch);

I have a piece of software that, to keep things brief, does something specific once the "push button/ switch" of the rotary encoder is pressed. However, if I press the solenoid switch, the software somehow registers that as a button press of the rotary encoder.

This is indeed really strange, given that the solenoid has no direct input lines into the Arduino. What could possibly cause this?

Can I provide any other info?

Thank you again.

What could possibly cause this?

A wiring error or a software error, or a design error.

Can I provide any other info?

Essential if you want a better answer. Start with a schematic, a clear photograph of the wiring and the code posted correctly using code tags.

Check your relay has a diode across it and the relay current required is within the range of your power supply.

You use some strange terms I don’t understand, like the “always on port”.

Got it, sorry about that.

For the schematic, is there a particular software that you'd prefer I use?

No, pen and paper is best, then photograph the results.