Categories

Follow

The Wemos IR controller shield

In this small article we take a look at the IR controller shield, this is a shield which can act as an IR receiver and sender, here are some details about the shield

  • 1x IR receiver (38kHz)
  • Configurable IO (Default: Sender – D3/GPIO0, Receiver – D4/GPIO2)

Lets see a picture of the shield, you can see the IR reciever and the 4 emitters around the outside, so quite a good design this.

 

The shield uses the follwoing pins, so they would be unavailable for other devices that you use

D1 mini Shield
D3 Send
D4 Receiver

 

Code

You need to install the IRremote ESP8266 Library first. There are a few test examples but i simply wanted to see the code returned from a keypress. The default test examples had a bit more data than I really wished.

I have also noticed false codes getting returned at times, I have not figured this out yet. Looking at possible solutions although a few mention capacitors and noise.

#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>
#if DECODE_AC
#include <ir_Daikin.h>
#include <ir_Fujitsu.h>
#include <ir_Gree.h>
#include <ir_Haier.h>
#include <ir_Kelvinator.h>
#include <ir_Midea.h>
#include <ir_Toshiba.h>
#endif  // DECODE_AC
 
#define RECV_PIN D4
#define BAUD_RATE 115200
#define CAPTURE_BUFFER_SIZE 1024
 
 
#if DECODE_AC
#define TIMEOUT 50U  
#else  
#define TIMEOUT 15U  // Suits most messages, while not swallowing many repeats.
#endif  
 
#define MIN_UNKNOWN_SIZE 12
 
 
// Use turn on the save buffer feature for more complete capture coverage.
IRrecv irrecv(RECV_PIN, CAPTURE_BUFFER_SIZE, TIMEOUT, true);
 
decode_results results;  // Somewhere to store the results
 
 
void setup() 
{
  Serial.begin(BAUD_RATE, SERIAL_8N1, SERIAL_TX_ONLY);
  while (!Serial)  // Wait for the serial connection to be establised.
    delay(50);
  Serial.println();
  Serial.print("IRrecvDumpV2 is now running and waiting for IR input on Pin ");
  Serial.println(RECV_PIN);
 
#if DECODE_HASH
  // Ignore messages with less than minimum on or off pulses.
  irrecv.setUnknownThreshold(MIN_UNKNOWN_SIZE);
#endif  // DECODE_HASH
  irrecv.enableIRIn();  // Start the receiver
}
 
 
void loop() 
{
  if (irrecv.decode(&results)) 
  {
    // print() & println() can't handle printing long longs. (uint64_t)
    serialPrintUint64(results.value, HEX);
    Serial.println("");
    irrecv.resume();  // Receive the next value
  }
  delay(200);
}

 

Testing

Go ahead and press various keys on your remote, this is a couple of keys that I tested. They were 3, 4 and 5 and I did press them multiple times this was not bounce or multiple return codes

FF7A85
FF7A85
FF7A85
FF7A85
FF10EF
FF10EF
FF10EF
FF38C7
FF38C7

 

 

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

  

  

  

*