Arduino IR Remote PWM | PC Week

Arduino IR Remote PWM

Saturday, February 9, 2019

Arduino IR Remote PWM

Arduino IR Remote PWM
Hello guys in this article I'm gonna show you how to control the brightness of a bulb, the speed of a motor using Arduino and IR remote. PWM signals are required to change the speed and brightness of various devices. To control brightness and speed, a PWM enabled pin should be selected in your Arduino. With the help of Arduino - IR remote PWM capabilities, we have an infinite number of possibilities.

We can use the ordinary IR library with a small piece of codes to control the PWM signal generated in the output pin. And if you are looking for controlling PWM of an AC device this method would not work for you but if you want to use this in any DC element ( MOSFET limitation) can be controlled with an additional driver circuit.

Arduino IR Remote PWM

This schematic gives an example project with Arduino Uno with an IR receiver and LED.Not All Arduino pin supports IR decoding so double check the supported pin from here


Before uploading the program you should be sure that you have configured the right Pin which is supported with IR library and IR library is preinstalled on your Arduino IDE Download IR Library

Program - Arduino IR Remote PWM

#include  
int RECV_PIN =3; 
int led1 = 5;
int ledpwm = 255; 
#define code1  33444015 
#define code2  33478695 
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
irrecv.enableIRIn();  
pinMode(led1, OUTPUT);
analogWrite(led1,ledpwm); 

void loop() {
if (irrecv.decode(&results)) {
unsigned int value = results.value;
switch(value) {
case code1:

ledpwm = ledpwm + 5;      
analogWrite(led1,ledpwm);             

break; 
case code2:
{
ledpwm = ledpwm - 5;     
analogWrite(led1,ledpwm);

break;           
}
irrecv.resume(); 
}
}

Configure Hardware - Arduino IR Remote PWM

Arduino IR Remote can be used with any Arduino board which supports the IR library. Choose an IR receiver which is suitable for the 5V application.

If you face any error double check the decoded IR code is correct or note, IR receiver is connected properly and the program is uploaded correctly

This program can be used with Un-official Arduino boards which supports the Above IR library

Check whether your device is supported by the IR library or not from here.

Conclusion

I Hope that you liked this post on Arduino IR Remote PWM. You can freely comment on your doubts and queries below.

If you liked this article, then please share this with your friends. You can also find us on Twitter, Facebook, YouTube, and Instagram.
bm

I'm an Electronics Engineer with years of experience in Blogging and DIY Projects. I like to make new gadgets and write contents related to technology and Blogging.

Disclaimer : Muhammed Fasil K is a participant in the Amazon Services LLC Associates Program, an affiliate program to earn commission by advertising and linking sites to Amazon products.