SuperDuplex: An InfraRed Bootloader for Arduino…

NoMi Designs implemented an optical infrared Arduino bootloader based on the common 38kHz infrared remote modualtion.  Using the Asuro as inspiration, our bootloader goes a step further in that it works seamlessly from within the Arduino IDE, utilizing the STK500V2 protocol without modification.  
As described in detail below, due to hardware specifics and a low carrier frequency, the maximum data rate is 4200 baud and in practice about 4k baud reliably without error.  While not amazingly fast, this results in about 1 min 30 seconds to transfer a moderately large Arduino sketch of 20kb.  With the sketch loaded, the IR hardware also functions as a bidirectional half duplex serial link.  As itemized in the following list, the project as a whole is the sum of it’s parts:
  • Echo Cancellation Simplex
  • Continuous Demodulation
  • Demodulator Phase Delay
  • USB Transceiver (Software)
  • USB Transceiver (Hardware)
  • Arduino IR Transceiver
  • Arduino Bootloader
  • Board Specifications
Echo Cancellation Simplex
If you’ve ever talked to someone on speakerphone and heard your own echo, you can understand the confusion this creates.  This is the issue when adapting the normally full-duplex USB converter to infrared communication, while transmitting the reflected infrared bitstream is also being heard and it stuffs up the receive buffer like a bad head cold.  To make the bootloader work seamlessly with the Arduino IDE over modulated infrared, full duplex serial operation is blocked, this is achieved on both sides with software and/or hardware.
Continuous Demodulation
Almost all infrared receivers found in home appliances have an automatic gain control (AGC) circuit to account for variations in signal strength as well as ambient interference from fluorescent lights.  If your lucky, the datasheet for the part will state the maximum duty cycle for data transmission before the AGC normalizes the signal and kills the output.  From testing it appeared to be less than 5%, which is much too low to send appreciable amounts of data within a reasonable time frame.Ideally we want the AGC to allow a bit over 50% or no AGC at all.  Infrared demodulators without AGC are not common but thankfully, they do exist.  Besides being specifically purposed for high volume data transmission, they also find use in sensing and light barrier systems.  A couple of these devices are the TSOP58038 and the TSOP4038 from Vishay.
Demodulator Phase Delay
To reject ambient noise, the infrared data is modulated with a 38kHz carrier frequency, a digital one is represented as a tone and a digital zero as no tone.  When the demodulator sees the correct carrier frequency,  it outputs a digital one.  Inside the demodulator, the detection process is implemented in analog as a band pass filter and requires about 7 carrier waves to pass before it reports on the output.  It is this requirement that introduces as phase response delay of about 200 microseconds and which can be seen in the following signal capture of the transmission “Hello World”: The red signal is the 38kHz modulated send and yellow is the demodulated receive signal.  The received signal is phase shifted right a full bit width (200us), resolution is at 1ms per division.
USB Transceiver (Software)
For simplicity the computer side transceiver was first implemented in software with a spare Arduino and an IR shield.  A 120 ohm resistor is used to hold the Arduino’s reset pin high, preventing the transceiver from resetting.  It’s implemented using pinChange interrupt as a bit bang pass though, with the condition that when transmitting, the receiver is ignored.  As TTL serial signals are active low and the IR LED is active high, the transmission component is inverted.The Arduino, the IR shield and the logical truth table to make sense of it all.
USB Transceiver (Hardware)
Once the transceiver was proven in software, the design was moved into the hardware space.  This presented a couple of challenges in that the aforementioned phase delay made a logical OR difficult.  The solution was to implement a similar or longer delay on the TX line OR input.  As can be seen in the following schematic, this is implemented with a 100nF capacitor and 4k7 resistor, click for pops:  
The phase delay arrangement turns on quickly and turns off slowly,  adding about 2 milliseconds to block the receiver while transmitting using a bit of transistor logic.  As the signals are active low and the TX line is inverted, the gate function required for RXD is the logical OR between inverted TX and the demodulator output (refer to truth table for clarification).
Arduino IR Transceiver
On the Arduino side, all that is required for additional hardware is a demodulator and an IR LED, this makes for a very cheap Arduino sans FT232R converter.  The demodulator is connected directly to the Arduino UART receiver (Pin 0).  The IR LED connection takes inspiration from the Asuro bootloader, the LEDs anode is fed with a 38kHz PWM from Pin3 while the cathode is connected to Arduino Pin1, the UART Transmitter.  As TTL serial is active low, the LED lights with the 38kHz carrier when commanded by the UART.This schematic has been setup on a bread board Arduino, the basics which have been detailed in the previous post here:
Arduino Bootloader 
The existing bootloader was modified for half duplex by turning off the receiver while transmitting, 38kHz PWM was setup and some delay was added to handle the phase offset of the demodulator.  Prior to making changes, some effort was required to successfully compile the bootloader as documented here:
When uploading the IDE checks for the existence of the bootloader, so the hex, source and makefile need to be in the folder here: arduino-1.0\hardware\arduino\bootloaders\IRbbArduino\.  The source, hex and makefile can be downloaded here: IRbbArduino.
Board Specifications
The final bit of the puzzle is to let the Arduino IDE know who we are talking to.  We add a few lines of text to the end of the boards.txt file in \arduino-1.0\hardware\arduino\.  As seen below, it defines who, what and how we are talking.  The IDE must be restarted for these changes to apply:
############################################################## Arduino328 16MHz w/IR Bootloader@2400

ArduGate- Web Gateway for Arduino

ArduGate is a web gateway for Arduino. It makes interactions between in-browser JavaScript and Arduino possible. It is made up of a serial-to-HTTP gateway, some JavaScript routines performing communication with AJAX and an agent sketch running on Arduino. This makes developing a up-stream application for Arduino that runs on any platform with a browser a lot easier.
Arduino is connected to the computer running ArduGate via USB, bluetooth, Xbee or any kind of serial communication. ArduGate runs as a standalone HTTP deamon, serving on port 8880 by default, and works as a gateway between Arduino and the web world.
Right now access to following Arduino APIs/objects are implemented in JavaScript:
  • pinMode
  • digitalRead/digitalWrite
  • analogRead/analogWrite
  • EEPROM (read/write)
  • Servo (attach/detach/read/write)
  • Wire (begin/requestFrom/beginTransmission/endTransmission/read/write)
Getting Started
To get started using ArduGate with Arduino, please follow these steps:
  1. Download and extract ArduGate files
  2. Find the agent sketch (agent.ino) in the distribution, build it and download to Arduino board
  3. Run ArduGate.exe. In the opening window, click “Open Demo Page” button.
  4. In the demo page, choose the correct COM port which Arduino is connected to, and click Connect.
  5. You are ready to play with Arduino in your browser with the demo page.
ArduGate Demo Page


The key concept is using JavaScript inside the web browser to interact with Arduino. Here are several demostrating JavaScript code clips. You will find the code similar to that in an ordinary Arduino sketch.

Blinking LED

<script language="javascript" src="serial.js"></script>
<script language="javascript" src="arduino.js"></script>
<script language="javascript">
var port = "COM18";
var ledOn = false;

self.setInterval(blink, 1000);

function StartBlink()
    if (!Connect(port, 57600)) {
        alert("Error connecting with Arduino on " + port);
    pinMode(13, OUTPUT);

function StopBlink()

function blink()
    if (connected) {
        digitalWrite(13, ledOn ? HIGH : LOW);
        ledOn= !ledOn;

<input type="button" value="Start" onClick="StartBlink()" />
<input type="button" value="Stop" onClick="StopBlink()"/>

Accessing EEPROM

/* write a byte of 0x80 to EEPROM at address 0xA0*/
var address = 0xA0;
var data = 0x80;
if (EEPROM.write(addr, data))
 /* success, now read back from EEPROM */
 data =;

Controlling a servo

/* create servo object */
var myServo = new Servo();
/* attach servo to pin 3 */
/* set servo angle */
/* get servo angle */
var angle =;
alert("Current angle is " + angle);

Accessing I2C

function WriteI2C(address, data)

function ReadI2C(address)
 // request 1 byte
 Wire.requestFrom(address, 1);
 var ret =;
 if (ret == null) alert("Error reading I2C");
 return ret;


Currently ArduGate works on Windows and Linux (only Ubuntu is tested). The Windows version comes as application with a window, while the Linux version and upcoming MAC OS X version is command line interface.
ArduGate running on Ubuntu Linux

ArduGate running on Windows

ArduGate is going to be ported to embedded Linux, so it will be able to run on some routers. A long-term goal is to port the serial-to-HTTP gateway to iOS and Android which will be very exciting.


Source Code

The ArduGate source code is distributed under GPLv2 license. It is hosted on SourceForge, including the serial-to-HTTP gateway which is developed as a feature of MiniWeb, the agent sketch for Arduino, and the JavaScript libraries which provide simplified access to Arduino.
The subversion repository:
svn checkout svn://

WI-FI blocker

A wallpaper to protect its Wi-Fi

Researchers in Grenoble have had an original idea: to prevent a Wi-Fi network from being hacked, with a wallpaper insulation, which no longer allows waves to leave the apartment.Other utilities may be found in such technology, such as protection of sensitive individuals to electromagnetism.
Last week, a prototype of this " revolutionary wallpaper "was presented to the press by its creators. It protects data from a network connected via Wi-Fi for any theft or intrusion, since it has the ability to filter out electromagnetic waves of a wireless LAN, and without disturbing the wave of radio frequency or relief.
Advantage, the device also works for the waves of mobile phones, while still allowing users to contact an emergency number, if needed. He is even able to filter " up to three frequencies at once . "
A wireless network is provided with protections that can be cracked by the crafty. If you put wallpaper on the walls around an office or apartment, your wifi works well but it can not be hacked , "he explained at demonstration Pierre Lemaitre-Auger, a researcher at the Polytechnic Institute Grenoble Institute of Technology who developed the product. 
The design was done in collaboration with the Centre Technique du Papier, by a team comprising a total of 4 persons. The finished product has an appearance design: it is covered with geometrical tracings with conductive ink (ink containing silver particles), and if you do not, do not worry: you can cover it by the wallpaper of your choice, without it alters its filtering properties.
In addition, the harmfulness of electromagnetic waves is still under debate: " Many people are interested in the problems of electrosensitivity, by the fact that the waves would be dangerous to health , "said Pierre Lemaitre-Auger. Problem in which the product will meet, as it will provide "people who want the opportunity to protect themselves and have a very low oven in their apartment . " The scientist added that its use in this context may be especially in hospitals, theaters or bedrooms.
And, if there is a problem of porosity, it could be totally suppressed by extending the technology to flooring, ceilings and windows, as pointed out by Guy Eymin Petot Tourtollet, CTP.
Finally, this wallpaper, the price would be " reasonable "and" equivalent to a classic wallpaper mid-range ", could be commercialized in the early months of 2013, as requested by the Finnish company Ahlstrom, who comes to offer in the exclusive license.