i have a remote controller for medical use who send unknow IR signal i need to know witch button are pressed in Arduino.
Everytime i use remote controller with NEC protocol and Arduino library IRremote.h
but for this project i have no choice, so with IRremote.h i get wrong data everytime i press button all value change and length too, i tried other library and with library Infrared and sample allreaders i get something readable ass you see only some value change when other button pressed at end it near 4850 or 7350
the value of column 4 are 4850 or 7350 ramdomly everytime i press button
all value are not exectly the same everytime ±50
so my question, how can i create a value like hex value for NEC protocol with this raw data ?
my idea:
compare raw data with fixed value with margin of ±50 and if match one const raw data i return a fixed hex value for corresponding button
Thanks for answer and idea, belox are output get with allreaders demo, i keep pressed button s you see vaue are same ±50:
You say the IR remote uses an "unknown protocol", what makes you settle on the NEC protocol?
I'm sorry I did not understand your question, usually I use VCR TV remotes that are recognized in most arduino library
I have no idea how to interpret those numbers due to lack of information from you.
Sorry, this is output of sample "allreaders" library "infrared" add it in Arduino run sample with "s" and default value you wil get output like i post, i don't know how use it too i read code of library for now.
You say the IR remote uses an "unknown protocol", what makes you settle on the NEC protocol?
I'm sorry I did not understand your question, usually I use VCR TV remotes that are recognized in most arduino library
If it's an unknown protocol, you don't know what it is.
Yet you focus on a certain protocol.
That's contradictory. At the very least you should try multiple protocols if you don't know what it is, hoping that one of them works.
To find out what protocol it uses, and what modulation frequency, it's the easiest to ask the manufacturer.
That failing you could connect a generic IR photodiode to a scope, and see what frequency comes out. Then at least you know whether it's 38 kHz, or another frequency (e.g. 36 or 40 kHz).
with this library i get every ir pulse milliseconds so i thinked compare value with a range of error allowed.
With this i get every button pressed what do you think of it ? I don’t check every value i have no other ir remote controller sending something like that.
That one is good for 38kHz modulated signals. This is what most home electronics remotes use but it's not that unlikely that a manufacturer of medical devices uses another modulation frequency to not be interfered by other remotes.
So either ask the manufacturer or try the last tip of wvmarle to find that out. Posting hundreds of values that IRremote prints out won't help as long as you haven't fixed that problem.
I am the author of the library “Infrared” (or “Infrared4Arduino”). Glad that you are using it. I hope that you agree that it does have a few advantages in comparision with IRremote…
“Unknown protocol” means, as been said before, that the software does not recognize it directly. Unless you want ro use the raw signals as is, the way to go about is to ask a knowledgeable program (or person :-)) about it. I pasted some of your signals into IrScrutinizer (which is an open source program, also by myself), and it identified the signal as RECS80, This is an old protocol by Philips, sometimes found in somewhat “uncommon” products. RECS80 is not directly recognized by IRremote or Infrared4Arduino, it is an “unknown protocol”.
Offically, the RECS80 protocol has 38kHz modulation, but sometimes implementations select another frequency. However, you are receiving “nice” and stable data, so there is a reason to believe that your 38kHz receiver actually does the job. (In case you want to measure it, use a receiver like a TSMP58000, for example like this.)
You have already written a routine analyzing the raw signals, Analyse_IR_Receveid(). It is in principle solving the poroblem. You have obviously understood what is going on!
I just could not help myself, so I implemented a RECS80 decoder for Infrared4Arduino, and checked it into my Github repository. To use, check out the branch recs80 from the Github repository. You should then be able to do something like this:
#include <IrReceiverSampler.h>
#include <Recs80Decoder.h>
#define ENDING_TIMEOUT 35U
void setup() {
...
receiver = IrReceiverSampler::newIrReceiverSampler(BUFFERSIZE, RECEIVE_PIN);
receiver->setEndingTimeout(ENDING_TIMEOUT);
}
void loop() {
receiver->receive();
if (receiver->isEmpty())
Serial.println(F("timeout"));
else
{
Recs80Decoder decoder(*receiver);
if (decoder.getD() != 2 )
Serial.println(F("No decode"));
else {
switch (decoder.getF()) {
case 0:
Serial.println("On/Off");
break;
case 1:
Serial.println("Bust and bed down");
break;
default:
Serial.println(F("unknown command"));
}
}
Hope this helps. Please ask if something is unclear.
Life is weird sometimes I was writing you an e-mail when I wanted to check if there were any new answers to my topics before sending. And then I see that it's Christmas in the middle of July.
First thank you for this great library it's a remarkable job.
I tried to understand what you wrote in Recs80Decoder but for now I have not understood everything I need to research more about this protocol.
Anyway thank you again because I compiled and tried the example Recs80Decoder and it works perfectly here is the output I have by pressing all the buttons on the remote:
now i only need to register F, D, T Value and test them with getF(), ...
It's way better than what I wrote as code. Once again, thank you for your work.
If I wrote you it was for something else, I looked in the sources and I do not find how you do to blink the led, I was looking for references like led, blink, on, I find definitions in boarddefs.h but after i can not find where they are used in other files.
Can you help me please tell me which file to watch. Thank you, because flashing is a problem in a room without light with a transparent case.
I read your link and IrScrutinizer seem to be amazing too, i have save it if i need analyse a new IR remote controller.
All your signals seems to have D ("device address") equal to 2. F ("functiion number") is the interesting one, that is telling what command it is. T ("toggle") is flipping (toggling) every time you press a button on the remote (probably...); just ignore it.
The little snippet I wrote in my message illustrates what I think is to be done.
Blinking: "Christmas tree"-blinking like in IRremote is not (presently) supported. I consider it as a debug feature that was never removed. It costs processor cycles in a time-critical loop, even if it is made to be (runtime) disable-able. Possibly you can instead turn on a LED when you have received a "good" signal (only) -- that would be more high-level. If you absolutely want the IRremote-type blinking you can modify the ISR routine in IrReceiverSampler. If you want to do it cleanly, the best method is probably to write a subclass of IrReceiverSampler. say IrReceiverSamplerBlinker.
Thanks for reply, my mistake again i miss a = in my post not in my code.
demo error i get:
// libraries for get infrared code
#include <Arduino.h>
#include <IrReceiverSampler.h>
#include <MultiDecoder.h>
IrReceiver *receiver;
#define BAUD 115200
const unsigned int captureLength = 500;
const pin_t receiverPin = 3;
const microseconds_t markExcess = 50;
void setup() {
Serial.begin(BAUD);
Serial.setTimeout(10000);
Serial.flush();
int beginningTimeout = 3000;
int endingTimeout = 30;
receiver = IrReceiverSampler::newIrReceiverSampler(captureLength, receiverPin,
false, markExcess, beginningTimeout, endingTimeout);
Serial.println("Fin setup");
}
void loop() {
receiver->receive(); // combines enable, loop, disable
if (receiver->isEmpty())
Serial.println(F("timeout"));
else
{
MultiDecoder decoder(*receiver);
if (decoder.isValid())
{
if (decoder.getType() == recs80) // get message: error: 'recs80' was not declared in this scope
{
Serial.println(Analyse_IR_Receveid(decoder));
// how get decoder used in multidecoder so i not need create it again like that
Recs80Decoder recs80decoder(*receiver);
if (recs80decoder.isValid()) {
//recs80decoder.getD()
}
}
}
}
}
Thr reason that it does not compile is that Type does not belong to the global scope, it belongs to the class MultiDecoder. So you can still access it, but with the class name, i.e. MultiDecoder::Type::recs80.
Here is my suggested solution:
#include <IrReceiverSampler.h>
#include <Nec1Decoder.h>
#include <Recs80Decoder.h>
IrReceiver *receiver;
#define BAUD 115200
const size_t captureLength = 500;
const pin_t receiverPin = 5;
const microseconds_t markExcess = 50;
const milliseconds_t beginningTimeout = 3000;
const milliseconds_t endingTimeout = 30;
void setup() {
Serial.begin(BAUD);
Serial.setTimeout(10000);
Serial.flush();
receiver = IrReceiverSampler::newIrReceiverSampler(captureLength, receiverPin,
false, markExcess, beginningTimeout, endingTimeout);
}
void loop() {
receiver->receive(); // combines enable, loop, disable
if (receiver->isEmpty()) {
Serial.println(F("timeout"));
return;
}
Recs80Decoder recs80decoder(*receiver);
if (recs80decoder.isValid()) {
// Ignore everything with D != 2,
// F carries the command,
// T can be ignored.
if (recs80decoder.getD() == 2) {
unsigned int F = recs80decoder.getF();
switch (F) {
case 0:
Serial.println(F("Bust/Bed down"));
break;
case 1:
Serial.println(F("On/Off"));
break;
case 2:
Serial.println(F("xxx"));
break;
// ...
default:
Serial.println(F);
}
}
return;
}
Nec1Decoder nec1decoder(*receiver);
if (nec1decoder.isValid()) {
Serial.println(nec1decoder.getDecode());
// ...
return;
}
Serial.println(F("signal with unknown protocol received"));
}