The AC Dimmer is designed to control the alternating current voltage, which can transfer current up to 4A/8A
The AC Dimmer is designed to control the alternating current voltage, which can transfer current up to 400V/8А. In most cases, Dimmer is used to turning the power ON/OFF for lamps or heating elements, it can also be used in fans, pumps, air cleaners, e.t.c.
Lately, Dimmer has become an often-used decision for smart home systems. For example, when you need to smoothly change the light brightness. The lamp is slowly turning ON or OFF, creating a comfortable atmosphere. Dimmer works most effectively with filament lamps. It’s less stable with low brightness dimmable LED lamps, but with moderate and high brightness it will perform a solid job. Note that luminescent lamps (gas discharge lamps) do not support dimming.
A power of the dimmer is isolated from the control part, to exclude the possibility of high current disruption to a microcontroller.
The logical level is tolerant to 5V and 3.3V, therefore it can be connected to the microcontroller with 5V and 3.3V level logic.
In Arduino, a dimmer is controlled with RBDdimmer.h library, which uses external interrupts and process time interrupts. It simplifies the code writing and gives more processing time for the main code. This is why you can control multiple Dimmers from one microcontroller.
You can download RBDDimmer.h library and a few examples in «Documents» or on GitHub. We are constantly updating our library, so we recommend checking for website updates or subscribe to our newsletter.
Dimmer is connected to Arduino controllers via two digital pins. First (Zero) to control the passing of Phase Null of AC, which is used to initiate the interrupt signal. Second (DIM/PSM) to control (dim) current.
Note that Zero requires connection to designated microcontroller pins (which are different depending on the model of Uno, Nano, Leonardo, Mega), since it tied to microcontroller interrupts.
This library can simplify user code with the following functions:
1. Function dimmerLamp - this function initializes the number of operating pin and is defined by the user
dimmerLamp dimmer(4, 2); dimmer output DIM/PSM is initialized on the pin 4 and zero-cross initialized on pin 2.
2. Function begin port initialization, timer and external interrupt from zero-cross.
dimmer.begin(NORMAL_MODE, ON/OFF); port initialization, work mode choice, ON/OFF.
Parameter 1: dimmer working modes consist of two choices - NORMAL_MODE and TOGGLE_MODE
a. NORMAL_MODE to make dimmer work in defined value from 0 to 100 (%) (integer)
Example of this mode located in \RBDdimmer\examples\SimpleDimmer
b. TOGGLE_MODE smooth change of dimming value up or down in a defined range.
This solutions implies change of dimming values by means of hardware timer, without using the cycle code.
Example of this mode located in \RBDdimmer\examples\SimpleToggleDimmer
Parameter 2: ON/OFF.
a. ON - turns timer ON, allows to use dimmer.
b. OFF - turns timer parameters OFF, prevents the use of dimmer.
3. Function setPower sets dimming value from 0 to 100%
4. Function getPower to display current dimming value
Example: Serial.print(dimmer.getPower()); Result 0~100 int
5. Function setMode sets and changes the work mode (NORMAL_MODE and TOGGLE_MODE)
6. Function getMode displays values of current work mode
Example: Serial.print(dimmer.getPower()); Result 0 (NORMAL_MODE) or 1 (TOGGLE_MODE)
7. Function setState sets dimming state ON/OFF
Example: dimmer.setState(ON); delay(100); dimmer.setState(OFF);
8. Function getState displays current state of dimmer
Serial.print(dimmer.getState()); Result 0 (OFF) or 1 (ON)
9. Function changeState changes dimmer state to the opposite one
Пример dimmer.setState(ON); delay(100); dimmer.changeState; delay(100);
10. Function toggleSettings smooth change of dimming value up or down in a defined range
Example located in \RBDdimmer\examples\SimpleToggleDimmer