Relay module and internal pull-up resistors I'm currently assembling a prototype of the lightning infrastructure (based on several MEGAs interconnected via RS485, as described in this other post) 

The prototype consists of three MEGAs, a couple of wall-push-button and the two relay modules here below:


250V 2A 8 Channel OMRON SSR G3MB-202P Solid State Relay Module For Arduino
5V 4 CH OMRON SSR G3MB-202P Solid Relay Module with Resistive Fuse For Arduino


Obviously I've:


connected one endpoint of each push-buttons to Arduino INPUT-PIN; the other endpoint to ground;
connected the relay-module control-pins to Arduino OUTPUT-PIN (and ensuring a properly connected ground).
connected lamps to relay-modules power connectors.


My question relates to "pull-up resistor": I've read in lots of places that when involving push-buttons, "pull-up resistors" are needed in order to prevent shorts between ground and input-pin. As such, there are lots of tutorial/videos on the web, showing a nice resistor added in the push-button circuit.

Further investigating, I've also learnt from the official documentation that "...There are 20K pullup resistors built into the Atmega chip that can be accessed from software....", by setting the pinMode() as INPUT_PULLUP or setting it to INPUT and the forcing a digitalWrite(&lt;PIN&gt;,HIGH).

So, I ended:


directly connecting the two relay-modules to MEGAs INPUT-PINs and...
...activating the internal pull-up, with digitalWrite(&lt;INPUT_PIN&gt;,HIGH);


Nothing more.

This is the second evening I'm "testing" my Arduino-luggage-prototype and... lamps are turning on/off like a charm, without any noticeable problem.

The question is: am I doing something nasty toward my MEGAs? Is the approach depicted above, a commonly-safe (as for the Arduino's health) approach?



P.S.: should you wonder about how the prototype looks like, here is a photo (actually, taken right after the first power-up ;-)
Connecting one side of a switch to ground and the other side to an input pin (with its pinmode set to INPUT_PULLUP) is a standard way of connecting control switches to an Arduino installation, and is not a problem.

Note, claims that built-in pull-ups are 20KΩ oversimplifies the situation.  See, for example, Table 28.2, DC Characteristics, in the ATmega48PA/88PA/168PA/328P specs, which shows a min value of 20KΩ for   I/O Pin Pull-up Resistors and a max value of 50KΩ.  I've measured resistances of about 40KΩ, IIRC, whenever I've measured the pull-up values.

Note, built-in pull-ups typically are of too much resistance to work as pull-ups for TWI/SPI/I2C communications.

Note, when you say in the question that you connected the relay-modules to input pins and they worked ok, I suppose that could be the case, but in general it is better to put i/o pins into output mode when you want to drive an output.  When you send LOW to an input pin, its built-in pull-up is turned off, the input impedance becomes high, and then the pin can float to any value between ground and Vcc. It might fail to turn off an attached device if that device also has high impedance.