August 2, 2020

IR Software Remote Control

Filed under: electronics Himanshu @ 12:21 pm

This weekend, I reopened my boxes hosting electronic components with target to assess and validate couple of ideas that I had to build alternate interface to my TV, alternate to TV remote.

During discovery phase or say “feasibility study” of idea, i found 2 useful resources.

Arduino IR Remote is great library to work with proprietary protocol of different manufacturers, include one that I was looking for – Sony.

LIRC is great repository for referring codes to send to electronics device for several operation, including TV, but not limited to only TV.

Below is intermediate code that accepts number on serial, and depending upon entered number, sends IR signal to my TV.

#include <IRremote.h>
//https://github.com/z3t0/Arduino-IRremote/issues/580
//http://lirc.sourceforge.net/remotes/sony/RM-ED035

IRsend irsend;

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // send an intro:
  Serial.println("\n\nString toInt():");
  Serial.println();
}

void sendCommand(unsigned long signalValue){
  for (int i = 0; i < 3; i++) {  // sends code 3 times
    irsend.sendSony(signalValue, 12);
    delay(20);
  }
  delay(200);
}

void onOff() { sendCommand(0xA90); }
void input() { sendCommand(0xA50); }

void volumnUp() { sendCommand(0x490); }
void volumnDown() {  sendCommand(0xC90); }
void mute() { sendCommand(0x290); }

void priorProgram() { sendCommand(0x890); }
void nextProgram() { sendCommand(0x90); }

void homeKey() { sendCommand(0x070); }
void okay() {  sendCommand(0xA70); }
void upKey() { sendCommand(0x2F0); }
void downKey() { sendCommand(0xAF0); }
void leftKey() { sendCommand(0x2D0); }
void rightKey() { sendCommand(0xCD0); }
void exitKey() { sendCommand(0xC70); }
void infoKey() { sendCommand(0x5D0); }

void one() { sendCommand(0x010); }
void two() {  sendCommand(0x810); }
void three() { sendCommand(0x410); }
void four() { sendCommand(0xC10); }
void five() { sendCommand(0x210); }
void six() { sendCommand(0xA10); }
void seven() { sendCommand(0x610); }
void eight() {  sendCommand(0xE10); }
void nine() { sendCommand(0x110); }
void zero() { sendCommand(0x910); }

void audio() { sendCommand(0xE90); }

String inString = "";    // string to hold input
void loop() {
  // Read serial input:
  while (Serial.available() > 0) {
    int inChar = Serial.read();
    if (isDigit(inChar)) {
      // convert the incoming byte to a char and add it to the string:
      inString += (char)inChar;
    }
    // if you get a newline, print the string, then the string's value:
    if (inChar == '\n') {
      Serial.print("Value:");
      Serial.println(inString.toInt());
      switch (inString.toInt()){
        case 1:
          onOff();
          break;
        case 2:
          input();
          break;
        case 3:
          volumnUp();
          break;
        case 4:
          volumnDown();
          break;
        case 5:
          mute();
          break;
        case 6:
          priorProgram();
          break;
        case 7:
          nextProgram();
          break;
        case 8:
          homeKey();
          break;
        case 9:
          okay();
          break;
        case 10:        
          upKey();
          break;
        case 11:
          downKey();
          break;
        case 12:
          leftKey();
          break;
        case 13:
          rightKey();
          break;
        case 14:
          exitKey();
          break;
        case 15:
          infoKey();
          break;
        case 16:
          audio();
          break;        
      }
      inString = "";
    }
  }
}

August 15, 2012

Mathematics Reloaded

Filed under: electronics — Tags: , , , Himanshu @ 12:22 pm

I got stuck in one puzzle of electronics. Was understanding resistance of electron flow, current, and voltage by little different experiments. In one of them, I had created a very basic circuit that was starting from +v end of 1.5v battery (showing 1.4v on multimeter without resistance), 470k resister and multimeter into the circuit ending at –v end of the battery. On multimeter, I noticed 0.95v.  470k resister was the cause for the drop of voltage and it was dropping voltage by 0.45v (1.4v – 0.95v = 0.45v).

I thought of using one more 470k resister expecting it to drop further 0.45v and confirm that voltage drops  to 0.5v after second 470k resister. My reasoning was: 1.4v – 0.45v – 0.45v = 0.5v. But to my surprise I was seeing 0.71v on multimeter! Multimeter wasn’t in agreement of my mathematics, but I wasn’t fully convinced with multimeter’s mathematics. All I was thinking is “Why” second resister was not dropping the voltage as equally as the first.

After further thinking and learning on V=IR, I notice very simple and basic property in numerical series in which next number is created by adding 1 to the predecessor viz. 1, 2, 3, 4, …n. And that simple and basic property is: 2 is double of 1 but 3 isn’t double of 2. Further, weight of 3 is 50% more than 2, but weight of 4 is not 50% more than 3.

Of course it’s obvious but it wasn’t so obvious to me before this experiment!

June 12, 2012

Transistors are also De-amplifier

Filed under: electronics — Tags: , , , Himanshu @ 1:08 pm

I’m enjoying my exploration of electronics. While understanding about different building blocks, I learnt about Transistor. And I also learnt that transistors are also called amplifiers. During learning about their amplification capability, I also realized that they are certainly amplifier but they don’t generate electricity from air (unfortunately!). They need two input voltage one at Base and another at Collector. When Base is positively charged – low voltage applied to it, they allow higher voltage applied at Collector to pass towards Emitter, and that’s how they are called amplifier.

Me being fresher in electronics, I recommend other fresher to also note that if you see through transistors from Base to Emitter they are certainly amplifiers, but if you see through Collector to Emitter, they are de-amplifiers as they don’t generate electricity from air.

Powered by WordPress