• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » Dimming AC Powered LED with Arduino

By Abhishek Ghosh July 28, 2023 9:56 am Updated on July 28, 2023

Dimming AC Powered LED with Arduino

Advertisement

This guide contains instructions which involve handling 110/220V AC main supply which may create electric shock and death. Children and novices are suggested not to try this guide without monitoring by an expert. The AC light dimmer for Arduino is a type of modules which allow to vary the power of an alternating current. It has the same use as a transistor in direct current. It can be used to vary the brightness of a lamp supplied with 110V or 220V or to vary the speed of a fan, for example. Most of these modules are relatively costlier ($10 -$15) and not all the online shops store them.

You should try to use the AC dimmer module which works with this library:

Vim
1
https://github.com/RobotDynOfficial/RBDDimmer

Apart from LED, this module can also control the incandescent bulbs and fans. This module consists of BTA16-600B TRIAC, 4N26 optocoupler and MOC3021 optoisolator. The module looks like this one:

Advertisement

---

Dimming AC Powered LED with Arduino

This is 5A variant. These dimmers are controlled with RBDdimmer.h library, which uses external interrupts and process time interrupts. You can control multiple dimmers from one microcontroller. The module itself is quite unsafe as like any cheap priced China products.

As for wiring, the module is connected to the AX mains via the AC-IN terminal and the LED bulb is connected to the LOAD terminal block.

On the electronic side, the pins are connected as follows:

Vcc at pin 5 or 3.3V of the microcontroller (Arduino UNO or ESP2)
GND to ground GND of the microcontroller
Z-C at pin 2
PWM on pin 3

This is a chart of pins which you can use:

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
*  ---------------------- OUTPUT & INPUT Pin table ---------------------
*  +---------------+-------------------------+-------------------------+
*  |   Board       | INPUT Pin               | OUTPUT Pin              |
*  |               | Zero-Cross              |                         |
*  +---------------+-------------------------+-------------------------+
*  | Lenardo       | D7 (NOT CHANGABLE)      | D0-D6, D8-D13           |
*  +---------------+-------------------------+-------------------------+
*  | Mega          | D2 (NOT CHANGABLE)      | D0-D1, D3-D70           |
*  +---------------+-------------------------+-------------------------+
*  | Uno           | D2 (NOT CHANGABLE)      | D0-D1, D3-D20           |
*  +---------------+-------------------------+-------------------------+
*  | ESP8266       | D1(IO5),    D2(IO4),    | D0(IO16),   D1(IO5),    |
*  |               | D5(IO14),   D6(IO12),   | D2(IO4),    D5(IO14),   |
*  |               | D7(IO13),   D8(IO15),   | D6(IO12),   D7(IO13),   |
*  |               |                         | D8(IO15)                |
*  +---------------+-------------------------+-------------------------+
*  | ESP32         | 4(GPI36),   6(GPI34),   | 8(GPO32),   9(GP033),   |
*  |               | 5(GPI39),   7(GPI35),   | 10(GPIO25), 11(GPIO26), |
*  |               | 8(GPO32),   9(GP033),   | 12(GPIO27), 13(GPIO14), |
*  |               | 10(GPI025), 11(GPIO26), | 14(GPIO12), 16(GPIO13), |
*  |               | 12(GPIO27), 13(GPIO14), | 23(GPIO15), 24(GPIO2),  |
*  |               | 14(GPIO12), 16(GPIO13), | 25(GPIO0),  26(GPIO4),  |
*  |               | 21(GPIO7),  23(GPIO15), | 27(GPIO16), 28(GPIO17), |
*  |               | 24(GPIO2),  25(GPIO0),  | 29(GPIO5),  30(GPIO18), |
*  |               | 26(GPIO4),  27(GPIO16), | 31(GPIO19), 33(GPIO21), |
*  |               | 28(GPIO17), 29(GPIO5),  | 34(GPIO3),  35(GPIO1),  |
*  |               | 30(GPIO18), 31(GPIO19), | 36(GPIO22), 37(GPIO23), |
*  |               | 33(GPIO21), 35(GPIO1),  |                         |
*  |               | 36(GPIO22), 37(GPIO23), |                         |
*  +---------------+-------------------------+-------------------------+
*  | Arduino M0    | D7 (NOT CHANGABLE)      | D0-D6, D8-D13           |
*  | Arduino Zero  |                         |                         |
*  +---------------+-------------------------+-------------------------+
*  | Arduino Due   | D0-D53                  | D0-D53                  |
*  +---------------+-------------------------+-------------------------+
*  | STM32         | PA0-PA15,PB0-PB15       | PA0-PA15,PB0-PB15       |
*  | Black Pill    | PC13-PC15               | PC13-PC15               |
*  | BluePill      |                         |                         |
*  | Etc...        |                         |                         |
*  +---------------+-------------------------+-------------------------+
*

Here is a sample sketch:

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <RBDdimmer.h>
 
#define USE_SERIAL  Serial
#define outputPin  12
#define zerocross  5
#define potPin A0
const int potMin = 70;
const int potMax = 804;
int potValue;
 
dimmerLamp dimmer(outputPin);
 
int outVal = 0;
 
void setup() {
  USE_SERIAL.begin(9600);
  dimmer.begin(NORMAL_MODE, ON); //dimmer initialisation: name.begin(MODE, STATE)
}
 
void loop()
{
  potValue =analogRead(potPin);
 
correctValue();
  outVal = map(potValue, 22, 1023, 100, 0);
  USE_SERIAL.print("potValue:");
  USE_SERIAL.print(potValue);
  USE_SERIAL.print(" ");    
  USE_SERIAL.print(outVal);
  USE_SERIAL.println("%");  
  dimmer.setPower(outVal);
}
void correctValue()
{
   if(potValue <potMin)
  {
    potValue =potMin;
  }
  if(potValue >potMax)
  {
    potValue =potMax;
  }  
}

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Dimming AC Powered LED with Arduino

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • WordPress & PHP : Different AdSense Units on Mobile Devices

    Here is How To Serve Different AdSense Units on Mobile Devices on WordPress With PHP. WordPress Has Function Which Can Be Used In Free Way.

  • Arduino Door Bell With Push Button With 3 LED

    Here is Circuit Diagram, Code, List of Components & Demonstration Video of Arduino Door Bell With Push Button With 3 LED. It is easy project.

  • Arduino Basic Piano For Children (Pushbutton & Buzzer)

    Here is Arduino Basic Piano For Children With Pushbutton & Buzzer as Components. In Early ’90s Technology Was Limited and Worldwide there Were Few Electronic Toys.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • What is a Digital-to-Analog Converter (DAC)September 25, 2023
  • Tips on S Pen Air ActionsSeptember 24, 2023
  • Market Segmentation in BriefSeptember 20, 2023
  • What is Booting?September 18, 2023
  • What is ncurses?September 16, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy