Battery powered infrared devices considerations and design using open source tools and hardware

Designing battery powered devices that have to run for years on batteries is a challenge. If you look around you will see that most of the home appliances such as TVs, Music devices, Aircons, Heaters, Fans and so on are controlled using battery powered remote controls. The remote controls used with these devices should run for long periods of time on batteries.

 How is this achieved? Can we design a embedded custom remote control, by using open source hardware and software tools?

The Answer is Yes. We can use off-the-shelf low energy power consumption microcontrollers which will allow us to run on batteries for long periods of time. In this post we will review the possibilities with Atmel Atmega328P microcontroller, running at 16MHz and powered by 3.3V. We will also review and measure some off-the-shelf open source hardware development boards like Arduino, Olimexino etc.

 

We will review the following:

  •  Breadboarded Atmega328
  • Arduino UNO R3 Atmega328

  • Olimexino 328 uses Atmega328

 

According to the MCU specification the microcontroller supports sleep modes with minimal power consumption (Approximately 0.1uA).

 For the measurements we will use the BRYMEN 867s Digital Multimeter.

According to the MCU Specification we will have to power the Atmega with 3.3V in order to benefit from the lower current/power consumption. For the breadboarded version,we have just the Microcontroller, a quartz and two caps we are expecting to get the lowest result/ measurement.

 

In terms of software for our tests we will use a test program that will put the MCU in sleep mode, written for Arduino . The test program does really a simple thing – when the MCU is awaken / not in sleep mode it flashes the board LEDs for 5 times it waits for 10 seconds, then the microcontroller is forced to enter sleep mode. The sleep mode can be interrupted by grounding the INT0 pin of the MCU. The idea is that when in sleep mode all MCU peripheral and core is switched off and therefore we have minimal power consumption. Nothing is running in sleep mode, except for the logic that wakes up the MCU. The main program of the MCU is executed every time waken up, it does its thing and then it goes to sleep after a user defined period of time (usually several seconds after it performs a task.)

 

We have the following listing:

 /*———————————————————————-*

* Sleep demo for ATmega328P.                                           *

* Wire a button from digital pin 2 (INT0) to ground.                   *

* Wire an LED with an appropriate dropping resistor from pin D13 to    *

* ground.                                                              *

* Pushing the button wakes the MCU.                                    *

* After waking, the MCU flashes the LED, then waits 10 seconds before  *

* going back to sleep.                                                 *

*                                                                      *

* Jack Christensen 07May2013                                           *

*                                                                      *

* Tested with Arduino 1.0.5 and an Arduino Uno.                        *

* Test conditions for all results below:                               *

*   5V regulated power supply, fed to the Vin pin                      *

*   16MHz system clock                                                 *

*   Fuse bytes (L/H/E): 0xFF / 0xDE / 0×05                             *

*   Optiboot bootloader                                                *

*                                                                      *

* Uno R1                                                               *

*   38mA active, 26mA with MCU in power-down mode.                     *

*                                                                      *

* Uno SMD edition                                                      *

*   42mA active, 31mA power-down.                                      *

*                                                                      *

* Adafruit Boarduino                                                   *

*   Power select jumper set to “USB”, USB (FTDI) not connected.        *

*   15mA active, 3mA power-down.                                       *

*                                                                      *

* Adafruit Boarduino without power LED                                 *

*   12mA active, 0.1µA power-down.                                     *

*                                                                      *

* Breadboarded ATmega328P-PU                                           *

*   12mA active, 0.1µA power-down.                                     *

*                                                                      *

* This work is licensed under the Creative Commons Attribution-        *

* ShareAlike 3.0 Unported License. To view a copy of this license,     *

* visit http://creativecommons.org/licenses/by-sa/3.0/ or send a       *

* letter to Creative Commons, 171 Second Street, Suite 300,            *

* San Francisco, California, 94105, USA.                               *

*———————————————————————-*/

#include <avr/sleep.h>

 

const int LED = 13;                          //LED on pin 13

const unsigned long KEEP_RUNNING = 10000;    //milliseconds

 

void setup(void)

{

   //to minimize power consumption while sleeping, output pins must not source

   //or sink any current. input pins must have a defined level; a good way to

   //ensure this is to enable the internal pullup resistors.

 

   for (byte i=0; i<20; i++) {    //make all pins inputs with pullups enabled

       pinMode(i, INPUT_PULLUP);

   }

 

   pinMode(LED, OUTPUT);          //make the led pin an output

   digitalWrite(LED, LOW);        //drive it low so it doesn’t source current

}

 

void loop(void)

{

   for (byte i=0; i<5; i++) {     //flash the LED

       digitalWrite(LED, HIGH);

       delay(100);

       digitalWrite(LED, LOW);

       delay(100);

   }

   delay(KEEP_RUNNING);           //opportunity to measure active supply current

   digitalWrite(LED, HIGH);       //one blink before sleeping

   delay(100);

   digitalWrite(LED, LOW);

   goToSleep();

}

 

void goToSleep(void)

{

   byte adcsra = ADCSRA;          //save the ADC Control and Status Register A

   ADCSRA = 0;                    //disable the ADC

   EICRA = _BV(ISC01);            //configure INT0 to trigger on falling edge

   EIMSK = _BV(INT0);             //enable INT0

   set_sleep_mode(SLEEP_MODE_PWR_DOWN);

   cli();                         //stop interrupts to ensure the BOD timed sequence executes as required

   sleep_enable();

   //disable brown-out detection while sleeping (20-25µA)

   uint8_t mcucr1 = MCUCR | _BV(BODS) | _BV(BODSE);

   uint8_t mcucr2 = mcucr1 & ~_BV(BODSE);

   MCUCR = mcucr1;

   MCUCR = mcucr2;

   //sleep_bod_disable();           //for AVR-GCC 4.3.3 and later, this is equivalent to the previous 4 lines of code

   sei();                         //ensure interrupts enabled so we can wake up again

   sleep_cpu();                   //go to sleep

   sleep_disable();               //wake up here

   ADCSRA = adcsra;               //restore ADCSRA

}

 

//external interrupt 0 wakes the MCU

ISR(INT0_vect)

{

   EIMSK = 0;                     //disable external interrupts (only need one to wake up)

}

 

The code will flash the board leds 5 times, wait for 10 seconds, to allow us to make a measurement and then it will force the MCU to enter sleep mode.

 

We have tested breadboarded Atmega328, Arduino UNO R3 and Olimexino 328, as you can see from the code header, other people has tested and mesured also for other boards , based on Atmega328.

 

The results for the breadboarded Atmega328 are stunning – 0.1uA in sleep mode, though there is nothing else than the microcontroller, a quartz and 2 caps,powered by 3.3V. (the first pretendent )

 

The second in this list is the Olimexino 328 , running at 16MHz, powered by 3.3V. The board is designed with on board charger for connecting external batteries. In a running mode the total power consumption at 3.3V was about 7ma , in sleep mode this board consumes approximately 200uA, which makes it usable for battery powered devices. (Our second pretendent)

 

And finally the Arduino UNO R3 gave us high power consumption both active and sleep modes (  38mA active, 26mA with MCU in power-down mode ) which renders it unusable for designing battery powered infrared applications.

 

Conclusion:

 The user should either make a custom design , using the Atmega328 and create a design with low energy consumption in mind, or use the Olimexino 328 as a basis, which is open source hardware and it has a decent power consumption both active and sleep modes.

 

Downloads:

 

 

Windows Server 2012 drivers workaround for irdroid usb ir transceiver

Irdroid USB IR Transceiver v1.0

We got a nice email from a customer from the Irdroid community saying that the Irdroid USB Infrared Transceiver works without any drivers on Windows 10. He tested Also with Windows Server 2012 and there was a driver issue , using the drivers we provide from the download section. The Issue with Windows 8 and Windows Server 2012 is that signed USB ACM drivers are needed. Windows Server 2012 requires that all drivers need to be signed, The USB Infrared Transceiver can work with Windows 8 but the workaround is that you need to turn off the signed driver requirement.

You can deactivate the forcing of signed drivers by using following Settings. Open a Command Prompt (cmd) as Administrator and type in following two commands. bcdedit -set loadoptions DISABLE_INTEGRITY_CHECKS bcdedit -set TESTSIGNING ON With bcdedit you´re configurating the bootmenu of windows, so be careful. If something goes wrong you´ll need a windows dvd to repair the bootmanager. After a restart you can install the driver normally. You just have to confirm to install the unsigned driver, just like in older versions of Windows.

TuxCon Kitty TV BGone Mod Irdroid

This year’s (2017) TuxCon open source Linux conference took place in Plovdiv, Bulgaria. On the second day of this gathering ( the Workshop day) we all got a free and open source soldering Kit – the TuxCon Kitty conference badge (Thank you Olimex). The kit included a Atmel Attiny85 microcontroller, the TuxCon kitty pcb a buzzer two leds (the Kitty eye’s) one battery, battery holder and several resistors, capacitors and diodes.

I was on the conference with my son and we had a lot of fun assembling the kits. The kid was really exited to make his own toy and play with the other kids, attending the conference. Weeks after the conference I found the TuxCon kitty badge in my drawer and decide to make something cool with the Kitty badge – To turn it into a TuxCon Kitty TV BGone Mod Irdroid – To make it possible to switch ON/OFF any television by simply replacing several components from the existing design. The software that I have used simply sends a bunch of TV Power (ON/OFF) infrared commands in a loop.

Hardware Mod:

  1. Remove / desolder R1,R2, R3 and R4

  2. Solder 22 Ohm 0805 resistor to R1

  3. Remove Led1 and solder IR LED (TSAL6200)

  4. Desolder D1 and solder a micro switch/button in its place

Software:

The TuxCon Kitty badge is compatible with Arduino and comes pre-programmed with a bootloader and default code. I have programmed a new TuxCon Kitty BGone firmware using a STK500 programmer and desoldering/soldering the MCU (I havent yet found a way to write HEX using the Arduino IDE / the default bootloader in ATTiny85 that shipped with the badge) . I have used a Tiny85 code by Mitch Altman + Limor Fried (Adafruit Industries)

Supported TV Brands:

Acer, Admiral, Aiko, Alleron, Anam National, AOC, Apex, Baur, Bell&Howell, Brillian, Bush, Candle, Citizen, Contec, Cony, Crown, Curtis Mathes, Daiwoo, Dimensia, Electrograph, Electrohome, Emerson, Fisher, Fujitsu, Funai, Gateway, GE, Goldstar, Grundig, Grunpy, Hisense, Hitachi, Infinity, JBL, JC Penney, JVC, LG, Logik, Loewe, LXI, Majestic, Magnavox, Marantz, Maxent, Memorex, Mitsubishi, MGA, Montgomery Ward, Motorola, MTC, NEC, Neckermann, NetTV, Nikko, NTC, Otto Versand, Palladium, Panasonic, Philco, Philips, Pioneer, Portland, Proscan, Proton, Pulsar, Pye, Quasar, Quelle, Radio Shack, Realistic, RCA, Samsung, Sampo, Sansui, Sanyo, Scott, Sears, SEI, Sharp, Signature, Simpson, Sinudyne, Sonolor, Sony, Soundesign, Sylviana, Tatung, Teknika, Thompson, Toshiba, Universum, Viewsonic, Wards, White Westinghouse, Zenith

Downloads:

Source and Firmware

Get a assembled kit:

Grab a assembled and tested TuxCon Kitty TV B Gone Mod (USD 12)

USB Infrared Transceiver workaround for : Failed to set rts/cts in recent Linux Kernels

 

Irdroid USB IR Transceiver v1.0

We have received reports from customers , that is some recent GNU Linux Kernel versions the serial USB ACM Class Driver is causing issues with the Irdroid USB Infrared Transceiver module / Linux kernel versions (above 3.18). Below is a workaround for the affected systems:

In GNU Linux kernel (3.18+), the CDC ACM Class Driver was updated and new features were introduced. These new features are not interoperable with old serial ACM hardware and demand from the USB Manufacturers to introduce additional features in their firmware in order to gain compatibility with the changes in the CDC-ACM driver.

The new driver requires devices to reply whether they support “RTS/CTS” feature. If this call is not implemented in the serial ACM hardware (in the firmware of the serial USB ACM devices), it causes device lock up’s, and fails to enumerate after several seconds of operation. The above affects also the Irdroid USB Infrared Transceiver module and causes inconvenience for the customers.

We have tested various workarounds for the above and came up with a fix, which for now requires the user to recompile the kernel with the USB ACM Driver below:

The Procedure is as follows:

  • Depending on your distribution, you will have to download the Linux kernel source code, unzip, and configure for your system
  • Copy and replace the above files in /drivers/usb/class/….
  • Compile and install your new kernel.

Once you complete the above procedure you will have more stability for your serial ACM devices / hardware.

Update!!!

As of October 2017 All new Irdroid USB Infrared Transceiver modules ship with an updated firmware that provide support for the new USB  ACM Class Driver in Gnu Linux Kernel 3.18 + . For existing customers a firmware update procedure needs to be performed with the firmwarebelow:

 

Irdroid Eye Control

Irdroid Eye Control

Irdroid Eye Control

The Irdroid Eye Control application allows the user to control Infrared controlled appliances such as TVs, STBs and Music Appliances by using the Eye Control technology (*requires pre-installed Eye Control Hardware and Software) or via voice control commands in Windows. The application implements a Lirc/WinLirc client, optimized for the Eye Control. Irdroid Eye Control is free and open source software application. Sources and Binaries can be downloaded from https://github.com/Irdroid/Eye-Control

Application features:

  • Support for all major TV, STB, Video Manufacturers
  • Works with WinLirc and Lirc
  • Compatible with Irdroid USB Infrared transceiver.
  • Java Application
  • Compatible with Windows voice control

Requirements:

  • PC with Java installed.
  • Working WinLirc/Lirc
  • Pre-installed Eye Control Hardware and Software.

Example Application:

  • Allow people with disabilities to control TVs, STBs and more only by focusing their eyes at the Irdroid Accessibility remote control buttons by using their Eye Control Software and Hardware.
  • Allow people with disabilities to control TVs, STBs and more using their voice in Windows.

Add IR Eye Control for you Desktop / Laptop computer

Get Module Kit:

  • Infrared Eye Control Kit that includes the USB Infrared Transceiver, extension cable and Manual can be purchased from http://www.irdroid.eu

Contribution:

Want to contribute and help further developing Irdroid Accessibility? Pull requests are welcome via the project GitHub repository.

[ SOLVED ] Irdroid USB Infrared Transceiver and the Raspberry Pi3

Irdroid USB IR Transceiver and the Raspberry Pi3

Irdroid USB IR Transceiver and the Raspberry Pi3

User’s reported a bug in Lircd (v0.9.4 and below) that renders the DP Irtoy and the Irdroid USB Infrared transceiver modules unusable . When the lircd is started and and after sending a number of IR commands (sometimes it crashes after sending just one ir command ) to the Irdroid USB Infrared transceiver, the module gets de-enumerated and the only way to recover is to unplug and plug again the module in the USB port.

Last few months I am trying to fix this issue with no success then a few days ago I have received an email from a previous customer (Thomas Orgis l  Tnak you very much Thomas! ) who managed to find the bug in Lircd. Thomas has used the GDB in order to debug the issue and he found out that all happens in the “setPin” function in irtoy.c file. He contacted me to provide a patch see below:

— lirc-0.9.4d/plugins/irtoy.c.orig    2017-01-23 10:23:38.000000000 +0100
+++ lirc-0.9.4d/plugins/irtoy.c 2017-02-05 16:42:19.203099837 +0100
@@ -171,13 +171,16 @@
static int setPin(unsigned int pin, int state)
{
unsigned int mask = 1 << pin;
-
+#if 0
IOdirections &= ~mask;
if (state)
IOdata |= mask;
else
IOdata &= ~mask;
return setIOData();
+#else
+       return 0;
+#endif
}

I have tried to open a ticket in sourceforge providing the bugfix to the community , but they replied that this should be now fixed in lircd 0.9.4d (which is not the case). So I am providing here the lircd 0.9.4d with the above mentioned patch already applied so that the users can directly download , compile and install lircd and continue using their Irdroid USB Infrared Transceivers. I have tested the above lircd version with the patch on Raspberry Pi3 with raspbian installed , but it should also work on other GNU Linux Systems.

Downloads:

 

Irdroid USB IR Transceiver compatible with Mac OS X

USB IR Tranceiver compatible with Mac OS X

USB IR Tranceiver compatible with Mac OS X

The Irdroid USB Infrared Transceiver is compatible with Mac OS X and it is working without installing any drivers on the host system. The above is possible due to the fact that the Irdroid USB IR Transceiver enumerates as a serial ACM device. The drivers for these types of devices are built in all Mac OS X versions. When you plug the USB IR Transceiver in a free USB port on your Mac , the device shows up as /dev/cu.usbmodem00000001 .

To use it on your Mac, you will also need the LIRC application software( Linux Infrared Remote control) for Mac OS X , available for Download from our github repository (see the links at the end of this article) . The LIRC software will allow you to use the Transmit and Receive feature of the Irdroid USB IR Transceiver. By using the software you can use your Mac to control almost any appliance that accept Infrared Commands, you can also record / scan existing remote control by using the infrared receive feature built in the Irdroid USB IR Transceiver.

More Info:

Purchase a module:

Downloads:

 

Infrared Task Automation with Irdroid on Mac OS X

Irdroid USB Infrared Transceiver support Mac OS X

Irdroid USB Infrared Transceiver support Mac OS X

Last year I had the chance to play with an old MacBook ( Late 2006 model ), running Mac OS X Mountain Lion and OS X Mavericks as a second OS installed on the hard drive. Originally I purchased the MacBook online from a second-hand store, and I intended to use it for the development of a  iOS proprietary Application for one of our clients. Now that the project is finished I decided to use the MacBook to play with LIRC and the USB Infrared transceiver, allowing the machine to transmit and receive Infrared signals.  In the past we have received questions from Irdroid user’s regarding the possibility of using the Irdroid USB Infrared Transceiver on Mac OS X. The above was not possible until now, because Lirc couldn’t compile on Mac OS X without doing changes to the original LIRC source code.

The Irdroid USB Infrared Transceiver module enumerates in the host system as a serial ACM device. In OS X the serial USB ACM driver is shipped and supported natively, which means that you don’t have to install any additional drivers and the module should enumerate “out-of-the-box” once plugged in a free USB port.

Considering the above and in order to have a fully functional Infrared Transmit and Receive environment in Mac OS X the only remaining thing that we need is a port of LIRC for Mac OS X, because LIRC manages the infrared transactions and provide utilities for transmitting and receiving infrared signals. LIRC is based on Linux and it can be easily ported to Mac OS X because Mac OS X is a POSIX operating system.

Used Tools:

  • Mac OS X Mountain Lion

  • Homebrew / brew v.1.1.7 (for installing GCC and dialog*required by the LIRC setup scripts)

  • GCC 4.9.3 (installed and compiled using Homebreq/brew)

  • Xcode 5.1.1

  • Xcode 5.1.1 command line utilities (installed via Xcode)

To make a port of LIRC one needs to replace the #include <linux/types.h>  (Because we are no longer using Linux) with a custom include file defining the relevant types for Mac OS X.For the above I have created a custom include file that replaces the <linux/types.h> and named it <my_custom_types.h> . Next I replace <linux/types.h> with #include “my_custom_types.h” in all source files that contained <linux/types.h> . I also had to install the “dialog” using brew as the LIRC version I used uses “dialog” for the setup and configuration process.

After that in order to make the configuration for my system I runned the ./configure.sh configuration script which generated a Makefile and configuration for my particular system (Mac OS X Mountain Lion) . After that make && make install compiled successfully and I was surprised to see a fully functional LIRC daemon working  with my old Mac.

I had to create a “rc.local” file in /etc/ so that lircd is called on boot and also LIRC needs the directory /var/run/lirc created on boot ,which is a separate lin in /etc/rc.local file.

The contents of rc.local are as follows:

mkdir /var/run/lirc

lircd –device=/dev/cu.usbmodem00000001 –listen=8765

the above commands create the required directories on boot and also start the lirc daemon. As you can see on Mac OS X the serial ACM devices are enumerated as /dev/cu.usbmodemxxxxxxxx (that is Apple’s way of naming these) . In my case the Irdroid USB Infrared transceiver enumerated as /dev/cu.usbmodem00000001 .

The other thing that you need to do is to get a sample lircd.conf file and copy it into /etc/lirc/lircd.conf  (this is the default location for lircd configuration files)

Depending on your configuration you may have to open port 8765 in Mac OS X firewall settings in order to be able to access the running LIRC daemon from another system on your local network, or using a LIRC client running on your Android Smartphone.

Transmitting Infrared signals:

If you will use LIRC locally only, then you can use the “irsend” utility for transmitting infrared commands.

example:

# irsend SEND_ONCE Samsung_TV Power

Next you can do some useful infrared task automation, with irsend and Cron , scheduling infrared commands etc.

Receiving and decoding Infrared Signals:

There are two utilities which you can use for reading infrared signals with Lirc – irrecord and irw .

The “irw” utility will allow you to “watch” the received pulse – space IR sequencies directly in the console.

The “irrecord” utility will allow you to scan and record your existing remote controls and storing the recorded commands into a lirc configuration file.

You can record your remote by issuing :

# irrecord –device=/dev/cu.usbmodem00000001 mylirc.conf

Used Tools (Software and Hardware):

Downloads:

Recording Air Conditioner remote controls using Irdroid

 

Recording Air conditioner remote controls with Irdroid

Recording Air conditioner remote controls with Irdroid

Recording Air Conditioner (AC) infrared remote controls can be a challenge, when using conventional methods for recording IR remote control codes with LIRC (The Linux Infrared Remote control software package).Recording off-the-shelf TV / STB infrared remote control includes running the irrecord utility that comes with LIRC and recording the physical infrared remote buttons one after another and storing the data into a flat text file. The above procedure is standard for recording home appliance IR remotes, except for Air Conditioner remote controls.

OK, what is different about the AC infrared remote controls ?

Well, the difference is that the AC infrared remote control codes are longer in comparison with any TV, DVD, STB or any other IR controlled equipment. The main difference is the way these infrared remote controls work.

The AC remote control sends all its settings (current state) at once (in one infrared code sequence) . That means when you set for example a temperature, air direction , mode etc these are all send with one IR command which contains all the current settings (current state) with other words all the data in the remote. It means that normally we can’t record remote buttons individually by pressing each button and recording with LIRC, as with every button press we get the remote current state, not a single pressed button.

We can record ON command, OFF command in combination with the current setting/state (mode – heat, current temperature;air direction etc) . We can do that using a patched version of the IR record utility, which is part of the LIRC software package which will allow us to record longer infrared commands.

The LIRC irrecord utility assumes maximum infrared code length of 200 bits, which is a limitation and it is not enought as most of the ACs are using code length > 200bits (some are using code length of ~500 bits) .To change the setting, we need to edit the source file irrecord.c that comes with the version of LIRC , attached to this article.

In particular we have to edit line #109 of irrecord.c

  • #define MAX_SIGNALS 200

this defines the maximum signal length that irrecord shall consider as valid. We shall change that to :

  • #define MAX_SIGNALS 600 (to have some reserve and make sure we cover all ACs with code length over 500 bits)

After changing the file we have to compile LIRC by issuing:

./configure
make
make install

*My configuration for the above procedure was a Laptop running Ubuntu Linux 14.04 LTS
*In Windows the user needs to download WinLIRC, edit the irrecord.c file and recompile the software

After the install process finishes we should be able to use the Irdroid USB IR Transceiver or the Irdroid-Rpi (infrared transceiver for Raspberry Pi) in combination with irrecord to record any AC infrared remote control code in RAW form.

The irrecord syntax:

irrecord -f -d /dev/ttyACMx /etc/lirc/lircd.conf

*depending on your configuration and the number of the serial ACM devices used in your system the ttyACMx can be ttyACM0 or any other number depending on the number of serial ACM devices in enumerated in your system.

the irrecord -f option forces the program to go in a RAW IR record mode (it will not try to decode any of the known IR protocols like RC5, RC6 etc)

Example lircd.conf file with a scanned toshiba Air Conditioner ON command :

begin remote

name Toshiba
flags RAW_CODES
eps 30
aeps 100

gap 1000000

begin raw_codes

name ON
3285 1578 447 405 405 405
426 1173 469 383 426 1173
469 383 426 383 426 383
426 1173 469 1173 469 383
426 383 426 383 426 1173
426 1194 426 405 405 405
405 447 383 447 383 405
405 405 405 405 405 405
405 405 405 405 405 405
405 405 405 405 405 1215
405 405 405 405 405 405
405 405 405 405 405 405
405 405 405 1215 405 405
405 405 405 405 405 405
405 1215 405 405 405 405
405 405 405 405 405 405
405 405 405 1237 405 405
405 1215 405 1215 405 1215
405 1215 405 1215 405 1215
405

end raw_codes

end remote

*The above example represents a ON command, and the current remote state (mode heat,22 degrees celsius, swing mode). You maybe noticed that there are repeating codes like 405, 1215, 1173 , these are the bit representations normally a sequence of zero’s and one’s . these numbers also represent the pusle / space IR signal length in microseconds. The big number in the begining is the so called “lead-in” “informing” the receiver that a infrared command starts.

Initially the program will try to identify the so-called “IR Gap” , it will ask you to press different buttons from the physical remote control. Even if the Gap is not found you can still continue and record button presses from the target remote and store them in a flat lircd.conf file, which is later used by lircd for reproducing the recorded infrared signals.

*The recorded remote control in the above example was for an old Toshiba Air Conditioner. A friend of mine asked me whether he can use one of the Irdroid modules to control (Turn On and Off) the Air Conditioner at his office. In particular to do that using WinLirc in Windows. I have successfully scanned the physical remote control and tested successfully with the target AC. Later on I find out a nice automation utility for windows which has plugins for LIRC and a Scheduler, giving the option to schedule infrared remote control commands. Convenient , isn’t it?

Downloads:

Hardware:

Infrared task automation in Linux using the Irdroid USB Infrared Transceiver

This is a Blog post with example usage of the Irdroid USB Infrared Transceiver in Linux for Infrared Task Automation. In the past we had a number of project that inluded creating scripts and cron jobs for executing sequences of infrared commands one after another , defined in scripts / macro’s .

In particular we had a client who needed to send a IR command to a number of STBs (IPTV distribution company) to wake them up from “sleep mode” every couple of hours, before the STB goes sleep mode.

The above task is achievable using the Irdroid USB Infrared Transceiver in Linux, or using the Irdroid-Rpi in combination with a Raspberry Pi.

In practice the client’s hardware configuration consisted of a transcoding server, running Ubuntu 14.04 and a LIRC Daemon for sending / receiving infrared commands. In this particular project my task was to set this box to work with the Irdroid USB Infrared Transceiver and issue a “Menu” command for the particular STB every 5 hours (which avoids the unit/s entering “sleep mode”) .

Tools used:

Tasks:

  • Compiling and installing LIRC on the Linux transcoding machine
  • Digitizing the Infared Remote Control used to control these STBs
  • Setting a CRON Job to send a infrared command every 5 hours

 

First I had to download a patched version of LIRC, compatible with the Irdroid USB Infrared Transceiver from the Irdroid.com download section (see the links at the end of this article). To use the patched version of LIRC , I had to compile it using the standard commands in linux:

  1. ./configure
  2. make
  3. make install

After installing LIRC, you will need a lircd.conf file which holds the remote control commands either in RAW form (pulse / space sequences) or a decoded HEX values / depending on the protocol these can be with different length.

For the above project the original remote control was not already available in the LIRC database (http://lirc.sf.net/remotes) , therefore I had to scan and record the remote control using the “irrecord” utility. The Irrecord utility comes with the LIRC package and it is used to record, decode and store the infrared signals from any (almost) infrared remote.

The Irdroid USB Infrared Transceiver enumerates as a standard Serial ACM device and if you dont have other serial ACM devices in the system it should enumerate automatically as ttyACM0 available as /dev/ttyACM0 .

To record the target remote I have used the command “irrecord -d /dev/ttyACM0 /etc/lirc/lircd.conf” . Once that command is issued you will be asked (in console mode) to make random button presses, which allows irrecord to analize and try to decode the target remote control protocol, then you will be asked to push and name every single button and at the end to save the configuration file and exit. Once done you should end up with a lircd.conf file located at /etc/lirc/lircd.conf .

To start LIRC issue “sudo lircd –device=/dev/ttyACM0 –listen=8765” this will instruct LIRC to listen on port 8765 on All interfaces .

Then you should be able to issue commands :

“irsend SEND_ONCE Remote_name Button_name”

Finally I had to set a cron job to run every 5 hours and issuing the “Menu” command in order to avoid the STBs going in “sleep mode”

That is done via Cron :

0 */5 * * * irsend SEND_ONCE Remote_NAME Remote_COMMAND

The above will send our command every 5 hours.

Downloads:

 


Dont have a Irdroid USB Infrared Transceiver?

- You can purchase one from HERE