A.IR Shield ESP8266/ESP32 TRx

From AnalysIR WiKi
Jump to navigation Jump to search
A.IR Shield ESP8266 TRx with Wemos D1 Mini

Where to purchase

Visit AnalysIR's IR Shop where you will find this and a range of similar Infrared solutions.

Data Sheet

The data sheet can be found by clicking here

Loading Firmware

  • You will receive a source copy of the firmware after your order is shipped. There is a version for ESP8266 and another version for ESP32.
  • The firmware provides an option to use a direct serial USB connection to AnalysIR or a networked WiFi connection (when on the same WiFi network).
  • The firmware may be reused for any non-commercial use or for commercial use only with an official 
A.IR shield. For other uses please contact AnalysIR for more details via the contact page.

SerialUSB Configure the definition for useWIFI as false to connect via serial USB.

WiFi Configure the definition for useWIFI as true to connect via WiFi. In addition you must also configure the definitions for AnalysIR PC IP address(ipAddressAnalysIR), SSID (mySSID) and WIFI password (myWiFiPassword)

The default port for communicating with AnalysIR is 9449 (declared via webServerPortAnalysIR). This should also match the setting for ESP port in your AnalysIR.ini file on the PC. (PORT_ESP8266NodeMCU and AIR_WEB_PORT)

  • First Disconnect the Shield from the Wemos D1 Mini (or ESP32)
  • Copy the supplied firmware into the Arduino IDE
  • Make sure you have added support for ESP8266(or ESP32) to the Arduino IDE. (If not do so now, before proceeding any further.)
  • If you have not used the ESP8266/ESP32 with the Arduino IDE before, please do so now and try out several of the example sketches before starting with this shield.
  • Make the configuration changes as discussed above within the sketch and proceed to compile using the Arduino IDE.
  • Once the compile completes successfully, you can proceed to load the firmware to the Wemos D1 Mini(or ESP32).
  • Then disconnect the Wemos D1 Mini/ESP32 and insert the shield, with the IR LEDs at the opposite end to the USB connector. Do not insert the shield until the correct firmware is loaded.
  • IMPORTANT
    • Make sure the IR LEDS are at the opposite end of the USB connector before inserting the shield and powering up. All of the pins of the Shield should be interted into the female headers of the Wemos D1 Mini.
    • For the ESP32 D1 Mini there will be 2 pin slots empty at the USB end of the 2 female headers. On the ESP8266 there will be no empty slots.
  • Insert the USB cable into the Wemos and into your Windows PC or other USB power source (WiFi only).
  • Start AnalysIR on the PC.
  • Serial/USB:
    • From AnalysIR, select the correct COM port number from the drop-down at the bottom of the Main window.
    • The indicator should turn dark green after a short delay.
    • Select A.IR Shield ESP8266 Serial from the Source menu.
    • You may now use AnalysIR with the shield attached for both receiving and sending IR signals.
  • WiFi
    • If connecting via WiFi follow the instructions above, except select A.IR Shield Esp8266 WiFi from the Source menu and configure the IP address & Port for ESP8266 in the AnalysIR.ini file.
    • The indicator should turn blue after a short delay.
    • The connections to/from AnalysIR for this shield using WiFi use http requests and as such will always be available, provide both systems are working.
    • You do not have to connect teh ESP to the USB on the AnalysIR PC, but if you do you will see some extra debug info displayed in the Log tab of the main AnalysIR Window.
  • Consult the AnalysIR User Guide for more info.

AnalysIR Setup

First make sure that you have purchased, installed and registered your copy of AnalysIR.

  1. Install the latest official release of AnalysIR from the downloads page. This must be installed before any 'dev' version.
  2. If your version is 1.16.100.8192 or below, make sure to request and install the latest 'dev' version, before proceeding.

There is no special configuration required to use via SerialUSB, However, to use via WiFi the following applies.

Configuration Required for WiFi only

  • First make sure that the IP Address(IPAddress_ESP8266NodeMCU) of your ESP8266 or ESP32 device is configured correctly in the AnalysIR.ini file
  • The IP address above should match that of your ESP8266 or ESP32 device on your local network.
  • Tip: the device will print the IPaddress out on serial USB port during setup
  • The port is 9499 by default. You can change to another port number, provided you update the ini file and the firmware on your device.
  • In the AnalysIR.ini file, configure the IP address (AIR_IPADDRESS) of the AnalysIR PC, the port number for the ESP device (PORT_ESP8266NodeMCU=9449) and the port number (AIR_WEB_PORT) for the built in web server.
  • These values should match the values set in your device firmware.
  • Use Menu->File->Explore from within AnalysIR to locate the correct directory for the AnalysIR.ini file.


From the Source Menu, select either A.IR Shield ESP8266 WiFi (CTRL+ALT+6) for WiFI use or A.IR Shield ESP8266 Serial (CTRL+ALT+7) for SerialUSB use.

IR Power Headers

Header JP1 is located at the rear of the shield, just above where the Wemos USB connector is. Insert one jumper into the x2 or x3 position to double the IR power. Insert both jumpers into the x2 and x3 position to triple the IR power. If you insert the jumpers in the vertical position (from IR Leds to USB) they have no impact and the IR Power will be x1.

Bear in mind that the shield has 2 IR Emitters, which are configured in such a way as to deliver double the IR over using a single LED, for the same power budget. We usually, configure both a TSAL6100 and a TSAL6200 which are identical except that they emit at different angles, thus giving both wide angle and long range coverage for all your signals.

Inserting Shield into Wemos D1 Mini

Make sure the 2 IR Leds are at the same end as the PCB antenna on the Wemos D1 Mini (opposite end to the USB connector). All pins of the shield should be inserted into the female headers.

Inserting Shield into ESP32 D1 Mini

Make sure the 2 IR Leds are at the same end as the PCB antenna on the ESP32 D1 Mini (opposite end to the USB connector). All pins of the shield should be inserted into the female headers. There will be 2 slots empty on hte female headers at the USB end.

LEDs

There are 2 LEDs. The first is located on the Wemos D1 Mini (usually blue). This LED is on the same IO pin as the IR send pin of the shield. After start-up it will always appear on. If this is an issue, it is relatively easy to remove this LED with a soldering iron. FOr the ESP32, the LED on board the module is not used. The second LED is at the front of the shield and after startup will briefly flash red as IR signals are transmitted. However, when both IR power jumpers are installed, the LED may not flash or be very dim. This is normal behaviour and is related to the use of the red LED as part of the constant current driver circuit for the IR LEDs.

Pinouts Wemos D1 Mini

Most of the Wemos D1 Mini pins are unused by the shield, with the following exceptions:

  • 3V3 - powers the IR receive circuit.
  • 5V - used to power the IR LEDs
  • GND - common ground
  • D5 - This pin is used as the input pin for the standard IR receiver.
  • D6 - This pin is used as the input pin for the standard IR Learner.
  • D4 - This pin is used as the IR send pin.
  • D7,D1 - unused, but either may be jumpered on the rear of the shield to replace D5. In this case the trace on R1(D5) must be cut and the pads on R3(D7) or R13(D1) must be bridged. This allow you to use alternate IO pins for the IR Receiver or disbale it.
  • D8,D2 - unused, but either may be jumpered on the rear of the shield to replace D6. In this case the trace on R2(D6) must be cut and the pads on R4(D8) or R14(D2) must be bridged. This allows you to use alternate IO pins for the IR Learner or disbale it.

Pinouts ESP32 D1 Mini

Most of the Wemos D1 Mini pins are unused by the shield, with the following exceptions:

  • 3V3 - powerd the IR receive circuit.
  • 5V - used to ppower the IR LEDs
  • GND - common ground
  • 18 - This pin is used as the input pin for the standard IR receiver.
  • 19 - This pin is used as the input pin for the standard IR Learner.
  • 16 - This pin is used as the IR send pin.
  • As above the receiver pins may be jumpered on the rear of the shield. In this case the traces must be cut and the pads must be bridged. This allow you to use alternate IO pins for the IR Receivers or disbale them. As there are ample pins available on the ESP32, we do not see the need to re-route pins for the ESP32.

Customisation

  • You may customise the provided firmware for incorporation into your own sketches, without using AnalysIR or for standalone mode.
  • Always take care of potential 5v -> 3V conflicts
  • If you wish to use alternative pins, it is possible to carefully cut traces and rewire to alternative pins. However, you will need to make the appropriate adjustments to the firmware. Also note the alternate options descrived above.

Sending IR signals from AnalysIR

To send with AnalysIR - just do Menu->Power Tools->Send IR

Sending IR signals without AnalysIR using A.IR format

If you want to do your own sending with the A.IR shield all you need to do is send as follows over serial (or WiFi/LAN etc):

Sample Signal 1 - RC6 - 36kHz $36:2666,-889,444,-889,444,-444,444,-444,1333,-1333,444,-444,889,-444,444,-889,444,-444,889,-889,444,-444,444,-444,444,-444,444,-444,889,-889,444,-444,444,-444,444,-83774,2666,-889,444,-889,444,-444,444,-444,1333,-1333,444,-444,889,-444,444,-889,444,-444,889,-889,444,-444,444,-444,444,-444,444,-444,889,-889,444,-444,444,-444,444,;

Sample Signal 2 - NEC - 38kHZ $38:9000,4500,560,560,560,560,560,1690,560,560,560,560,560,560,560,560,560,560,560,1690,560,1690,560,560,560,1690,560,1690,560,1690,560,1690,560,1690,560,560,560,560,560,1690,560,560,560,560,560,560,560,1690,560,560,560,1690,560,1690,560,560,560,1690,560,1690,560,1690,560,560,560,1690,560,39928,9000,2188,560,95838,9000,2192,560,;

$ - is the start char 36 (or 38, 30, 33, 40, 56) - is the carrier frequency in kHz. [45 is a special case for 455kHz] next are the pulses in uSecs each followed by a comma (including the last one). the first pulse is always a mark. The ‘-‘ for spaces may be omitted. Space characters (’ ‘) are ignored. ; - is the termination character, which tells A.IR to send the message.

The maximum number of marks & spaces that can be sent/received in one signal/Tx is controlled by the value of maxPULSES in the firmware.

As you can see this is just a 'raw signal mode' and easy to construct your own signals, when not using it with AnalysIR. AnalysIR, can export an IR signal in this A.IR format. Naturally, you can modify the firmware to send in any format you choose.

Sending signals with CURL

Users can send signals from any PC or server or device that supports CURL, as follows:

curl -X POST -d @/filepath/signal.txt http://192.168.0.21:9449/analysir.signal

where

  • filepath is the location of the data file containing the signal
  • signal.txt is the name of the file containing the signal format (Default is A.IR format)
  • 192.168.0.21 is the IP address of the shield module
  • 9449 is the port of the configured webserver on the shield module
  • analysir.signal is the web page for sending signals

You should configure the curl command values above to suit your own setup, for each device that you have.

The contents of the data file provided is as follows: analysir=$38:9000,4500,560,560,560,560,560,1690,560,560,560,560,560,560,560,560,560,560,560,1690,560,1690,560,560,560,1690,560,1690,560,1690,560,1690,560,1690,560,560,560,560,560,560,560,1690,560,560,560,560,560,560,560,560,560,1690,560,1690,560,1690,560,560,560,1690,560,1690,560,1690,560,1690,560,39915,9000,2325,560,;

where

  • analysir= tells the module that the signal data is in A.IR format as follows.
  • the signal data starts with a $ followed by the carrier frequency (eg 38: or 38kHz). This is then followed by the RAW signal timings. The first value (9000 above) must always be a mark.
  • spaces, +, and - characters are ignored. Commas, colons and semi-colons are important parts of the signal syntax. If any other character is found before the terminating semi-colon then an error will be created and the signal aborted in error. CR or LF characters before the terminating semi-colon will generate an error condition and the signal will be aborted.

Sending Test signals from a HTML POST form

Below we have provided an example HTML page on our servers that can be used to quickly send test signals on your local network using the Shield with both ESP8266 & ESP32 modules. Open the following webpage from our server: https://www.analysir.com/sendsignal.html and you will be presented with a basic web form (with some javascript). Simply fill out the IP address and port for your target device, copy the example signal provided into the Signal text area (or use the default provided). Click the Submit Signal button and you should see the red led on the shield blink as the signal is sent. Now continue with your own signals for any test you want to carry out.

If you experience any issues - double check the IP address, Port are correct and that the WiFi version of the firmware is loaded onto the ESP module with the correct SSID, password, IP address and port. Once you have verified the correct operation, feel free to copy the test page to your own server (or filesystem) for additional testing. To generate your own signals in A.IR raw format, use the export feature of AnalysIR or simply use a text editor to build the correct format.

Network Connections to A.IR Shield ESP8266 TRx over WiFi

Some additional tips for connection over WiFi to the A.IR Shield ESP8266 TRx from AnalysIR:

We have implemented a webserver inteface at both ends ro send and receive signals.

If you want to create your own sending utility(not covered above), please contact us via the contact page for details. Using this method it is easy to quickly create smart phone, tablet and PC based interfaces for sending IR signals.

BAUD Rate

The default BAUD Rate is set at 115,200 bps and may be amended within the firmware. AnalysIR, expects the default value

Precautions

  • Disconnect power
    • Before inserting or removing the shield.
    • Before uploading the firmware for the first time. The shield should not be inserted when uploading the provided firmware or if another firmware is loaded onto the Wemos D1 Mini.
    • When changing jumper settings
    • When installing the optional programming resistor.
  • Do not install the Shield unless the firmware below is loaded onto the Wemos D1 Mini.
  • The orientation of insertion is critical to avoid damage. (See above)
  • Read all of these notes, before connecting.

Using the A.IR Shield ESP8266 TRx with the ESP8266IRremote library

You should just use the following line(s) in your sketch to reflect the use of the A.IR Shield ESP8266 TRx.

For sending IR (Wemos D1 Mini)

IRsend irsend(2); // An IR LED is controlled by GPIO pin 2 (D4)

For receiving IR (Wemos D1 Mini)

//Note: D5 is the default receive pin in the library example.

// An IR detector/demodulator is connected to GPIO pin 14(D5 on a NodeMCU board).

uint16_t RECV_PIN = 14;

IRrecv irrecv(RECV_PIN);

TRx vs Tx Shield

The TRx Shield is the same as A.IR Shield ESP8266/ESP32 Tx, except the TRx has dual IR receivers and no 3.5mm jack.

Use the TRx when you:

  • Need to receive signals or measure carrier frequency – with or without AnalysIR
  • Need to decode or reverse engineer signals.
  • Don’t need to use an IR blaster cable

Use the Tx when you:

  • Need to use an IR blaster cable
  • Need to send IR in 2 different positions (inside/outside cabinet)
  • Need to send to multiple devices in different positions
  • Don’t need Rx or decoding capability.

Getting Support

If you need additional support please open a new issue in our IRforum - under Products:Support Requests.

More Information

If...

  • There is a topic not covered here or
  • You would like us to add some more information or
  • You have a tip to add or
  • you have noticed a mistake

then let us know via the contact page