A.IR Shield ESP8266/ESP32 TRx

From AnalysIR WiKi
Revision as of 11:04, 8 September 2017 by AnalysIR (talk | contribs)
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.
  • The firmware provides an option to use a direct serial USB connection to AnalysIR or a networked WiFi connection (only 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 addion you must also configure the definitions for SSID (mySSID) and WIFI password (myWiFiPassword)

The default port for communicating with AnalysIR is 9449 (declared via webServerPortAnalysIR)

  • First Disconnect the Shield from the Wemos D1 Mini
  • Copy the supplied firmware into the Arduino IDE
  • Make sure you have added support for ESP8266 to the Arduino IDE. (If not do so now, before proceeding.)
  • If you have not used the ESP8266 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(Wemos).
  • Then disconnect the Wemos D1 Mini 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.
  • 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 coneections to/from AnalysIr for this shield using WiFi uses http requects and as such will always be available, provide both systems are working.
  • Consult the AnalysIR User Guide for more info.

AnalysIR Setup

Required for WiFi only - First make sure that the IP Address and port numbers for ESP8266 are configured correctly in the AnalysIR.ini file (Use Menu->FIle->Explore from within AnalysIR to locate the correct directory) Select either A.IR Shield ESP8266 WiFi (CTRL+ALT+6) or A.IR Shield ESP8266 Serial (CTRL+ALT+7) from the Source Menu.

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 one jumper 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 bot a TSAL6100 and a TSAL6200 which are identical except that they emit at different angled, thus giving both wide angle and long range coverage for all your signals.

Inserting Shield into Wemos D1 Mini

Make sure the the 2 IR Leds are at the same end as teh 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.

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. 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

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
  • 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.

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 not 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

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.

Network Connections to A.IR Shield ESP8266 TRxover 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, 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

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

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

For receiving IR

//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);

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