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(<PIN>,HIGH)
.
So, I ended:
- directly connecting the two relay-modules to MEGAs INPUT-PINs and...
- ...activating the internal pull-up, with
digitalWrite(<INPUT_PIN>,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 ;-)