IR pulser and decoder

Hi all,

My intended project is for an infrared remote control over a stepper motor which is connected to a 6 Gang log pot for a six channel amp, the amp is not my project it's on of my friends, but we were talking and it cropped up somewhere and I thought I'd give it a shot.

I was looking around for IR tutorials and there is a lot of code I don't understand so I wrote my own code for how I thought I could get the remote part of it working and not the decoder.

Eventually I would like to have two arduinos, one with the buttons and the IR pulser and one with the task of decoding the IR pulses and then turning them into stepper motor motion.

So here goes,

int button = 13; // button
int button2 = 12; // button2
int irLED = 9; // IR LED
int val = 0;
int val2 = 0;

void setup()
{
pinMode(button, INPUT); // button
pinMode(button2, INPUT); //button2
pinMode(irLED, OUTPUT); //irLED
}

void loop()

{
val = digitalRead(button);
if (val == HIGH); {
digitalWrite(irLED, HIGH);
delay(200);
digitalWrite(irLED, LOW);
delay(200);
digitalWrite(irLED, HIGH);
delay(200);
digitalWrite(irLED, LOW);
}

val2 = digitalRead(button2);
if (va2l == HIGH); {
digitalWrite(irLED, HIGH);
delay(200);
digitalWrite(irLED, LOW);
delay(200);

}

The code is quite simple so you should know where I'm going with it.

What my questions are is, 1) Is this approach workable? Or am I going around it in the totally hamfisted way?

  1. What kind of code could I look at for the receiver providing the code I wrote above would work at all.

I know there are better ways to read buttons but I just wrote this off my head to put here and ask you guys so I'll probably incorporate that later.

Also, my friend with the amp would like to know how to drive one of these http://www.st.com/stonline/products/literature/ds/9227.pdf if it is at all possible with the Arduino?

I'm not asking you to write my code for me at all, I just want telling whether or not I should be taking this route, and I'm asking for some links to either tutorials or libraries I should be looking at. Thank you very much,

Aaron.

That chip you mentioned, the ST TDA7448, is interfaced with I2C, so you should look at the Arduino 'wire' library:

Don't forget to connect two pull-up resistors on the SCL and SDA lines.

Thanks very much for a direction to go in on that chip, I've had a quick look over and it's a little advanced for me right now, so I'll try and find something I can step up to that.

What about the IR pulser I mentioned? Would that work for what I want? I want it to send a few IR pulses to another Arduino and have the other decode them and act upon them.

You can use a single Arduino to do all of that. I just finished a (Sony) remote control to control a DAC, including volume and documented it here: www.hifiduino.blogspot.com .

If your timings are critical you might run into issues with delay() and friends. See the Playground and this forum for the many, many discussions on this. It may not matter for your application, but if you start to get weird results that change depending on seemingly unrelated code changes keep this in mind.

Literally all I need to do is, send out a signal from one Arduino, have the other decode it, then step a motor.

It only needs two different signals.

@The Clever Monkey, how many channels are in your amp? How are you controlling the volume signal? (This isn't a question about anything to do with Arduino, I know but..)