Go Down

Topic: iPhone controlled universal remote (Read 7173 times) previous topic - next topic

Hackmodford

Okay I got this idea for a Bluetooth enabled universal remote controlled via an iPhone. From my initial research it looks like I should use an Arduino Leonardo with this shield

http://www.seeedstudio.com/depot/bluetooth-low-energy-shield-p-1255.html?cPath=132_134

Am I on the right track? Any thoughts?

Hackmodford

Okay this is what I ended up doing.

Arduino UNO Rev3 http://www.seeedstudio.com/depot/arduino-uno-rev3-p-694.html?cPath=132_133
Bluetooth Low Energy Shield http://www.seeedstudio.com/depot/bluetooth-low-energy-shield-p-1255.html?cPath=132_134
Grove - Base Shield http://www.seeedstudio.com/depot/grove-base-shield-p-754.html?cPath=132_134
Grove - Cables http://www.seeedstudio.com/depot/grove-universal-4-pin-20cm-cable-5-pcs-pack-p-749.html?cPath=178_179
Grove - Infrared Emitter http://www.seeedstudio.com/depot/grove-infrared-emitter-p-993.html?cPath=139_204
Grove - Infrared Receiver http://www.seeedstudio.com/depot/grove-infrared-receiver-p-994.html?cPath=139_204

The beauty of this setup is that it's all off the shelf parts and shouldn't require any soldering.

I will make an iphone app the communicates via bluetooth and will put it on the store for anyone to use.

997_1

Best of luck! Looks like you have the right stuff ordered, keep us posted.

slavenm

Hi, I'm just doing on a similar project.

I hooked up a IR receiver and IR emitter to a breadboard and connected it to an Arduino Uno rev3 with an ethernet shield (pictured). IR receiver was used to capture the codes and emitter was sending them to devices that are to be controlled and the system works great for Apple Remote.

But then I tried recording Sony codes from a remote and every time I pressed a button my IR receiver would show a different code (I'm using the IRremote library). Another problem: Ethernet shield is using a lot of energy so I hope your solution with a low power Bluetooth module will be better.


Hackmodford

I'm in the same boat right now. It's all hooked up and I can read the codes. But every time I press the button it seems like a different code is sent.

Ontop of that the Vizio remote shows an unrecognized protocol. Is there a better IR library to use?

Hackmodford

Does anyone have a solution to getting more than one code sent by the remote?

iisfaq

Which remote are you having problems with?

Chris

Hackmodford

My Vizio remote and my Sony remote for my sound system.

iisfaq

I have a Sony tv remote, but not an audio remote. I do not know the brand Visio.

I have recently decoded my Mitsubishi heat pump remote. It sent 180 bits of data for every key press.

I will see what I get with a Sony tv and let you know how I get on.

Chris

iisfaq

#9
Apr 06, 2013, 10:36 pm Last Edit: Apr 06, 2013, 10:45 pm by iisfaq Reason: 1
Using a Sony TV Remote I get results like this - quite repeatable

The following is pressing the buttons 1-6 (the repeat codes represent what is being sent out the IR transmitter - the longer you hold it down the more it repeats) In my case a quick press generated 3 repeats.

Code: [Select]

1000000000000000100000000
1000000000000000100000000
1000000000000000100000000

1010000000000000100000000
1010000000000000100000000
1010000000000000100000000

1000100000000000100000000
1000100000000000100000000
1000100000000000100000000

1010100000000000100000000
1010100000000000100000000
1010100000000000100000000

1000001000000000100000000
1000001000000000100000000
1000001000000000100000000

1010001000000000100000000
1010001000000000100000000
1010001000000000100000000


Here is my simple script

Code: [Select]

#include <Arduino.h>
#include <IRremote.h>

// Receive on Digital Pin 4
int RECV_PIN = 4;

decode_results results;
int incomingByte = 0;
IRrecv irrecv(RECV_PIN);

void setup()
{

/* add setup code here */
Serial.begin(57600);
Serial.println("Startimg....");

irrecv.enableIRIn(); // Start the receiver


}

void loop()
{
if (irrecv.decode(&results)) {
int count = results.rawlen;

// Skip the first byte - just a timing since last packet recevied.

for (int i = 1; i < count; i++) {

if (1==0)
{

if (results.rawbuf[i]< 10)
Serial.print("  ");
else if (results.rawbuf[i]< 100)
Serial.print(" ");
Serial.print(results.rawbuf[i]);
Serial.print(" ");
}
else {
if (results.rawbuf[i] == 8)
Serial.print("0");
else
Serial.print("1");
}
}
Serial.println("");
irrecv.resume(); // Receive the next value
}
}




In my code you will see it displays a binary 0 or 1 depending if the value is 8 or not. This could change depending on the device.

So to test that out change the code that says if (1==0) to if (1 == 1) in the script to use that section of the code which prints out the actual values read.


Special Note:

I have also modified the code in the IRRemote.cpp file in the IRRemote library to return values that do not change so much.

Basically when it saves values it calls this function to fix up the values to make them consistent.

Code: [Select]

unsigned int fixTimer(unsigned int t)
{
if (t <  20)
return 8;
else if (t < 31)
return 24;
else if (t < 33)
return 32;
else
              return t;
}



See http://wiki.crowe.co.nz/Mitsubishi%20Heat%20Pump.ashx to see what I changed.

This could explain why you are seeing different values - using the code on my wiki page I get consistent values of 8 and 24 on the Sony remote.

Chris

iisfaq

I just commented out my FixTimer function from the previous reply

and using the raw output of numbers I was getting this

Code: [Select]

47  12  11  12  12  12  12  12  11  12  12  12  12  11  12  12  23  12  12  12  12  12  11  13  11
47  12  12  11  12  12  12  12  11  12  12  12  12  11  12  12  24  11  12  12  12  12  11  13  11
48  12  11  12  12  12  12  11  12  12  12  12  11  12  12  12  23  12  12  12  12  11  12  12  12
47  12  24  11  12  12  12  12  11  12  12  12  12  11  12  12  24  11  12  12  12  12  11  12  12
47  12  24  11  12  12  12  12  11  12  12  12  12  12  11  12  24  11  12  12  12  12  12  11  12
47  12  23  12  12  12  12  11  12  12  12  11  12  12  12  12  23  12  12  12  12  11  12  12  12


You can see then numbers 11 and 12 and 3 and 24 - so this slight difference may be something you are seeing?

Chris

Hackmodford

I made the changes you showed.

This is what I got from pressing the 1 (BD) button 4 times

Code: [Select]
11000010000
000010000
1010100
0010000
00001
10100
000010000
10101
10001
00001
10101
0010101
00101
10000

iisfaq

#12
Apr 07, 2013, 02:05 am Last Edit: Apr 07, 2013, 02:25 am by iisfaq Reason: 1
Can you change it so it uses the actual value instead of 0 and 1

Search the script for

if (1==0)

and change to

 if (1 == 1)

When you run it you will get raw values which may or may not help.


Also try the code with different remotes - if you are still getting garbage then

* What pin is your sensor connected to?
* Have you got another sensor to try?


Chris

iisfaq

I also came across this which may help you but not until we determine why you are getting strange values.

http://www.hifi-remote.com/sony/

chris

Hackmodford

I made the change. I get this result when pressing the 1(BD) button 4 times.

Code: [Select]
Startimg....
  8   8   8   8 119   8   8   8   8
37   8 112   8  24   8   8
  8   8  24   8 112
114   8   8   8   8
  8   8 142   8   8   8   8
  8   8  24   8 111   8   8   8   8
  8   8   8   8 118   8   8   8   8
36   8 112   8  24   8   8
  8   8  24   8 112
113   8   8   8   8
  8   8   8   8 155
  8   8   8   8 160
  8   8 125   8   8   8   8
  8   8   8   8 119   8   8   8   8
  8   8   8   8 122   8   8

Go Up