Description
The cheapest relay modules for Arduino projects have a opto-coupler and a npn transistor.
It is turned on when the input is connect to GND or when the input is low.
That can cause problems with 3.3V boards, therefor in the future the normal active-high modules will probably be used more often.
The relay module documentation describes a active-low relay and the simulation is default a active-high relay. That is not consistent.
My suggestion is to improve the documentation and fix the simulation.
The "npn" or "pnp" is vague. A "active":"low" or "active":"high" is better, because that is independent of the electronics of the module.
My suggestion is to add the words "opto-coupler" and "led" to the documentation.
Operation
A relay is an electronic switch.
The "NC" means "Normally Closed" and the "NO" is "Normally Open". The "normally" is when the relay is not active (not powered).
Some relay modules have a opto-coupler which becomes active when the input signal is low (active-low).
Wokwi is set default to a high input level to activate the relay (active-high).
When the attribute "active" is "high" (default):
When the IN pin is high:
- It is on.
- The led on the relay module is on.
- The relay is activated (powered).
- COM is connected to NO.
When the IN pin is low or disconnected:
- It is off.
- The led on the relay module is off.
- The relay is not active (not powered).
- The COM is connected to NC.
When the attribute "active" is "low":
When the IN pin is high or disconnected:
- It is off.
- The led on the relay module is off.
- The relay is not active (not powered).
- The COM is connected to NC.
When the IN pin is low:
- It is on.
- The led on the relay module is on.
- The relay is activated (powered).
- COM is connected to NO.
The example is too simple. An Arduino Uno with a relay module will show better how to use it.
Is it possible to allow that a button can turn on the relay module ?
Test project: https://wokwi.com/projects/379207670237950977