Somatosensory TV Remote Controller

来自Microduino Wikipedia
1304410487@qq.com讨论 | 贡献2015年10月22日 (四) 04:10的版本 (Created page with "{{Language| Somatosensory TV Remote Controller}} {| style="width: 800px;" |- | ==Objective== To have a remote control of a TV through somatosensory operation. By moving the po...")
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航搜索
Language English

Objective

To have a remote control of a TV through somatosensory operation. By moving the position of the remote controller, you can change TV channels or volume.

Principle

Use three-axis acceleration sensor MPU6050 to detect the remote controller's movement and the infrared transmission sensor to control the TV by matching code.

Equipment

Module Number Function
Microduino-CoreUSB 1 Core board
Microduino-Sensorhub 1 Sensor pin board
Microduino-10DOF 1 Vector sensor module
Microduino-IR transmitter 1 Infrared transmission sensor
Microduino-Converter 1 Pin board
Microduino-BM 1 Battery management


Hardware Buildup

  • Setup 1:Stack CoreUSBk, 10DOF and Sensorhub together.
  • Setup 2:Connect the infrared transmission sensor to the D3 pin of Sensorhub through the pin board.
Microduino-sensorhub rule.JPG

Software Debugging

  • TV infrared control code definition. Here we adopt NEC encoding format.
#define ITEM+  0x02FDD827  //TV program+ 
#define ITEM-  0x02FDF807  // TV program -
#define VOL+  0x02FD58A7   //Volume+
#define VOL-  0x02FD7887   // Volume -

MPU6050 accelgyro;       //Three-axis acceleration sensor 
IRsend irsend;           //Infrared transmission
  • Three-axis acceleration sensor initialization
Serial.println("Initializing I2C devices...");
accelgyro.initialize();    //IIC device initializes. 
Serial.println("Testing device connections...");
Serial.println(accelgyro.testConnection() ?"MPU6050 connection successful" : "MPU6050 connection failed");   //MPU6050 has been connected.
  • Judge the movement status of the controller. (Move rightwards: TV program+ Leftwards: TV program - Upwards: Volume+ Downwards: Volume -)
 accelgyro.getAcceleration(&ax, &ay, &az);   //Acquire accelerator values. 
    Ax = ax/16384.00;      
    Ay = ay/16384.00;
    Az = az/16384.00;
    
    if(Ay >= 0.6 )      //Have detected the remote controller starts to move rightwards.
    {
      irsend.sendNEC(ITEM+,32);   //Send channel change code 
      delay(1000);      //Delay time and wait until it stops moving. 
    }
    else if(Ay <= -0.6) //Have detected the remote controller starts to move leftwards. 
   {
      irsend.sendNEC(ITEM-,32);   
      delay(1000);     
    }
    else if(Az >= 1.5)   //Have detected the controller starts to move upwards. 

    {
      irsend.sendNEC(VOL+,32);   
      delay(1000);
    }
    else if(Az <= 0.5)   //Have detected the controller starts to move downwards. 
    {
       irsend.sendNEC(VOL-,32);  
       delay(1000);
    } 
    delay(100);
  • Note: If you think the infrared transmission sensor's remote control distance is short, you can reduce current-limit resistance on the infrared sensor to increase transmission distance.

Program

[MicroduinoMotionRemoteTV]

Result

By moving leftwards or rightwards, the remote controller can change TV channels. By moving upwards or downwards, it can control TV volume. You can also add attitudes to control TV's other functions.

Video