Go Down

Topic: IR measuring using KY-022 (Read 1 time) previous topic - next topic

matiasparache

Hi everybody! In dizz days i've been trying to work on the infra-red interface between the keyes IR receptor ky-022. Using The librarie and all de sh#t, my objective is to read any signal who not comes neccesarly from The IR emmiter (ky-005). Are there any possibilities to decode another IR signal coming from someone other remote control? As I can read,is more "visualizable" to buy 2 chips,some push buttons, 2 ir leds, etc...  and program them since 0 ,but my intention is to use my KY-022 . I hope i can let you interpretate me a bit clearly. Many thanks for all data you can give me. I prey for Ohm to guide me in the send of The amateur hobbist. :D

OldSteve

You say you're using the library. Which library?

The "IRremote" library allows you to receive and decode or resend IR signals from a range of devices.
The examples provided with the library show how to use it.

IRremote library

To install and use this library, and to avoid conflicts, you need to remove the "RobotIRremote" library that's provided with the IDE. This is the later version of that library.
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

matiasparache

Yep, sctually i've trying to use The IRemote library,but i don't have in mind to erase The irrobot,gonna check it...when The arduino program is loading, i don't see any conflict wth The installed libraries, thanks for the orientation bro. If it works, i'll upload it

OldSteve

#3
Sep 10, 2016, 11:26 am Last Edit: Sep 10, 2016, 11:29 am by OldSteve
Yep, sctually i've trying to use The IRemote library,but i don't have in mind to erase The irrobot,gonna check it...when The arduino program is loading, i don't see any conflict wth The installed libraries, thanks for the orientation bro. If it works, i'll upload it
There is no advantage in keeping the RobotIRremote library. It's just an earlier version of the same library, written by the same author, Ken Shirreff.

Still, it appears that in later versions of the IDE, the old problem has been fixed. It wasn't previously possible to compile the later library with the old one in place. Now the compiler just gives a warning:-
Code: [Select]
Multiple libraries were found for "IRremote.h"
 Used: C:\Arduino Projects\Sketchbook\libraries\IRremote
 Not used: C:\Program Files (x86)\Arduino\libraries\RobotIRremote
You just need to double-check that the correct version of the library is actually used.

This is the original issue:- https://github.com/z3t0/Arduino-IRremote/issues/98

Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

matiasparache

I've deleted the irrobot librarie, and then download the irremote library, it works so perfectly, so thanks all of you brothas & sistas, michael Jackson says, 'you're not alone', and his right

matiasparache

In fact, the program works but i can't make them to read consistent signals, i mind, i need to find a way to debounce incoming signals. when i press the button of my remote control very fast, the serial monitor shows me 2 hexadecimal values, at least. I'll try to modify the IRremoteInt file instead the folder of the librarie, and try with other pins to make a clock compatibility. I have an arduino Mega 2560 and the default RECV_PIN is the 11. Otherwise, the pins 9, 6 and another more, they acts like a clocktimers as i understand, correct me if i'm wrong. To print the numbers in the display (7segments, common cathode), i've been using the DM74ls47N IC. my program is the following:




#include <IRremote.h>

int mensaje;
int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);
decode_results results;


int A = 4; // bit-1 del 7447
int B = 5; // bit-2     "
int C = 6; // bit-3     "
int D = 7; // bit-4     "


void setup()
{         
       Serial.begin(9600);
       irrecv.enableIRIn(); // Arranca el receptor Keyes K-022 

 pinMode(A, OUTPUT); 
 pinMode(B, OUTPUT); 
 pinMode(C, OUTPUT); 
 pinMode(D, OUTPUT);
 
}

void loop()

{
if (irrecv.decode(&results))
      {
        mensaje = results.value, HEX;
  switch (mensaje){
                    case 0x18A2: Serial.println(" = Modo 1"); break;
                    case 0x8A4: Serial.println(" = Modo 2"); break;
                    case 0x18A7: Serial.println(" = Modo 3"); break;
                    case 0x8A8: Serial.println(" = Modo 4"); break;
            default: Serial.println("Seleccione modo");
}
irrecv.resume(); // Recibir el prox valor
delay(20);       // Valores bajos imprimen mejor el monitor serie
}

  if(irrecv.decode(&results)) //algun hexa fue recibido?
{
    if(mensaje = "Modo 1") //si el hexa equivale a la señal 0x18A2
    {
        digitalWrite(A, LOW);
        digitalWrite(B, LOW);
        digitalWrite(C, LOW);
        digitalWrite(D, HIGH);
    }
    irrecv.resume();
}
 if(irrecv.decode(&results))
{
    if(mensaje = "Modo 2") //si el hexa equivale a la señal 0xC284
    {
  digitalWrite(A, HIGH);
  digitalWrite(B, LOW);
  digitalWrite(C, LOW);
  digitalWrite(D, LOW);
    }
    irrecv.resume();
}

 if(irrecv.decode(&results))
{
    if(mensaje = "Modo 3") //si el hexa equivale a la señal 0xC284
    {
  digitalWrite(A, HIGH);
  digitalWrite(B, LOW);
  digitalWrite(C, LOW);
  digitalWrite(D, HIGH);
    }
    irrecv.resume();
}
 if(irrecv.decode(&results))
{
    if(mensaje = "Modo 4") //si el hexa equivale a la señal 0xC284
    {
    digitalWrite(A, LOW);
  digitalWrite(B, HIGH);
  digitalWrite(C, LOW);
  digitalWrite(D, LOW);
    }
    irrecv.resume();
}
}



The result is to see variations and random numbers in the display, caused aparenttly for bad incoming signal readings.

INTP

#6
Sep 14, 2016, 04:11 am Last Edit: Sep 14, 2016, 04:12 am by INTP
Seeing different HEX codes from a single button push means there is a mismatch between what protocol you are decoding with and what protocol the remote is sending.
The garbage codes you're seeing are worthless. They don't mean anything. It isn't a debouncing issue or a bad signal issue.

matiasparache

Dear INTP, are you telling me, um,that the real problem is The protocol of  The reciever sensor, who they not supports something on The incoming signals of my remite control? If it's true, i have to try it with anoter r.c's and see what it happens. If i'm fail, maybe i can try with a un flip flop IC, but it's a kind triky for something who had to be more simple

kike

Hi people¡

I have only one problem with my IR project, IRLbegin was no declered in this scope

What can I do?

I need IRLbegin, but I have been looking for it, and I don´t find IRLbegin

Where or how can I get IRLbegin?

May be I don´t have a good version of IRremote.

I need a link

Thanks

kike

#include <IRLremote.h>

int INTERRUPCION = 0; //PIN 2

uint8_t protocolo = 0;
uint16_t direccion = 0;
uint32_t tecla = 0;

uint8_t oldSREG;

void setup(){
 IRLbegin<IR_ALL>(INTERRUPCION);
 Serial.begin(115200);
}


void IREvent (uint8_t protocol, uint16_t address, uint32_t command){
 protocolo = protocol;
 direccion = address;
 tecla = command;
}

void loop(){
 oldSREG = SREG;
 cli();

 if(protocolo!=0){
   Serial.print("Protocolo: ");
   Serial.print(protocolo);
   Serial.print(" Direccion: ");
   Serial.print(direccion, HEX);
   Serial.print(" Tecla: ");
   Serial.println(tecla, HEX);
   protocolo=0;
 }

 SREG = oldSREG;
 
}



This is the program I´ve checked,  in wich I don´t have IRLbegin declared

Go Up