Project showcase
Nano IR Remote for DC Motors

Nano IR Remote for DC Motors © GPL3+

Hacked MP3 player remote as DC motor driver.

  • 1,951 views
  • 2 comments
  • 4 respects

Components and supplies

Apps and online services

About this project

This concept is implemented to drive two DC motors. The MP3 player remote is used to select the motor's speed and it's states.

In this project i used

  • Arduino Nano
  • L293D Motor Driver
  • 2 DC Motors
  • TSOP
  • MP3 Player Remote

1. Get the value from MP3 Player remote

2. Mask higher 16bit data by 0000FF value

3. Choose the desired option by arduino

Power button is used to turn ON and OFF by even and ODD number.

Speed is increased and decreased by 10

Hardware prototype output

Code

ProgramC/C++
#include "IRremote.h"

int receiver = 11;
int velocity1 = 100;
int velocity2 = 100;

int x;
int Power__ON = 0;

const int M1P1 = 7;
const int M1N1 = 8;

const int M2P2 = 9;
const int M2N2 = 10;

const int M1__Speed = 6;
const int M2__Speed = 5;

IRrecv irrecv(receiver);
decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn();
  pinMode(M1P1, OUTPUT);
  pinMode(M1N1, OUTPUT);
  pinMode(M2P2, OUTPUT);
  pinMode(M2N2, OUTPUT);
  pinMode(M1__Speed, OUTPUT);
  pinMode(M2__Speed, OUTPUT);
}
void loop()
{
  if (irrecv.decode(&results))
  {
    x = results.value & 0x0000ff;
    Serial.println(results.value, HEX);
    processIR();
    irrecv.resume();
  }
 
}
void processIR()
{
  if (x == 0x1f) //previous
  {
    Serial.println("Motor 1 rotates forward");
    digitalWrite(M1P1, HIGH);
    digitalWrite(M1N1, LOW);
    analogWrite(M1__Speed, velocity1);
  }
  else if (x == 0x57) //next
  {
    Serial.println("Motor 2 rotates forward");
    digitalWrite(M2P2, LOW);
    digitalWrite(M2N2, HIGH);
    analogWrite(M2__Speed, velocity2);
  }
  else if (x == 0x5d) //turn on
  {
    Power__ON = Power__ON + 1;
    int x = Power__ON % 2;
    Serial.println(x);
    if (x == 0)
    {
      Serial.println("Both Motor goes OFF");
      digitalWrite(M1P1, LOW);
      digitalWrite(M1N1, LOW);
      digitalWrite(M1P1, LOW);
      digitalWrite(M1N1, LOW);
      analogWrite(M1__Speed, 0);
      analogWrite(M2__Speed, 0);

    }
    else
    {
      Serial.println("Both Motor ready to run");
      digitalWrite(M1P1, HIGH);
      digitalWrite(M1N1, LOW);
      digitalWrite(M1P1, HIGH);
      digitalWrite(M1N1, LOW);
    }
  }
  else if (x == 0x67) // vol+
  {
    velocity1 = velocity1 + 10;
    analogWrite(M1__Speed, velocity1);
    Serial.println(velocity1);
  }
  else if (x == 0x97) // vol-
  {
    velocity1 = velocity1 - 10;
    analogWrite(M1__Speed, velocity1);
    Serial.println(velocity1);
  }
  else if (x == 0xdd) //mode
  {
    velocity2 = velocity2 + 10;
    analogWrite(M2__Speed, velocity2);
    Serial.println(velocity2);
  }
  else if (x == 0x3d) //equ
  {
    velocity2 = velocity2 - 10;
    analogWrite(M2__Speed, velocity2);
    Serial.println(velocity2);
  }
  else
  {

  }
  delay(500);
}

Schematics

Circuit Diagram
Ckt schem

Comments

Similar projects you might like

Nano Relay Module

Project showcase by Boaz Lawnce

  • 6,876 views
  • 0 comments
  • 8 respects

Arduino: Switching ON/OFF Appliances Using IR Remote

Project showcase by Naman Chauhan

  • 8,507 views
  • 0 comments
  • 117 respects

Wireless LED Lamp with IR Remote Control

Project showcase by Peter Wallhead

  • 4,577 views
  • 2 comments
  • 16 respects

TV Remote for Speakers - IR Translator

Project showcase by davelook

  • 987 views
  • 0 comments
  • 9 respects

Developing an IR Remote and Software Controller

Project tutorial by Steve

  • 18,070 views
  • 0 comments
  • 35 respects
Add projectSign up / Login