Sending text over infrared: Difference between revisions

From XPUB & Lens-Based wiki
Line 26: Line 26:
* [https://www.arduino.cc/en/software/ Arduino IDE]
* [https://www.arduino.cc/en/software/ Arduino IDE]
** [https://github.com/Arduino-IRremote/Arduino-IRremote IR Remote] library
** [https://github.com/Arduino-IRremote/Arduino-IRremote IR Remote] library
** [https://github.com/PaulStoffregen/PS2Keyboard PS2 Keyboard] library


* Soldering wand
* Soldering wand

Revision as of 00:44, 13 February 2026

Project by Soda & Ema

The idea

To send text messages in real time over infrared waves, and see what happens when the signal gets disturbed.

The intention is to set up this project in a public space, so people can use it both passively and actively. Passively: by walking in between the IR sender and receiver - Actively: by typing a message and reading what gets delivered.

People that passively walks across the IR signal will disturb the transmission of the message, letting who's on the other side interpret what the original message was. With that, we'd like to shine an interest in the materiality of forms of communication, which usually happens without being aware of their infrastructure. The ethereal "immateriality" of the IR waves becomes tangible and something simple as like sending a simple text message becomes questioned.

The process

Components
  • x2 Arduino UNO boards (provided by Soda)
  • Wires and 2 wiring boards (provided by Soda & from the XML)
  • A keyboard that uses the PS2 protocol [not USB] (from the XML)
  • 1602A display (from the XML)
  • IR receiver TSOP38238 (bought off from here)
  • IR transmitter (from the interaction station) (or you can take it from an old remote)
  • Various resistors (from the XML)
  • LED light (from the XML)
  • x2 5V powerbanks (from the interaction station) (or you can use batteries)
Tools
  • Soldering wand

IR sender

*****WHY A PS2 KEYBOARD AND NOT A USB ONE*******

PS2 Connector PinOut Diagram Male and Female Ports.png
PS2 male connector wired.jpg

the code [9600 Baud]

#include <PS2Keyboard.h>
#include <IRremote.hpp>

const int DataPin = 3;
const int ClockPin = 2;
const int IR_SEND_PIN = 9;
const int SendLEDPin = 8;

PS2Keyboard keyboard;

void setup() {
  Serial.begin(9600);

  keyboard.begin(DataPin, ClockPin);
  IrSender.begin(IR_SEND_PIN);

  pinMode(SendLEDPin, OUTPUT);
  digitalWrite(SendLEDPin, LOW);

  Serial.println("Keyboard to IR Sender Ready");
}

void loop() {

  if (keyboard.available()) {

    char c = keyboard.read();

    Serial.print("Sending character: ");
    Serial.println(c);

    digitalWrite(SendLEDPin, HIGH);

    // Send via IR
    IrSender.sendNEC(0x00, (uint8_t)c, 0);

    delay(60);

    digitalWrite(SendLEDPin, LOW);

    delay(20);
  }
}

IR receiver

The IR receiver is set up like this (see image) and to test if it works, u can use any kind of remote and press some buttons (it's also a good way to test your remote XD).

Open the image to see it clearly


The display used (1602A display) is set up like this

NOTE: probably using a 12k om resistor on V0 instead would be better

NOTE: The resistor on V0 we noticed that serves the purpose of dimmering the light in the background of the letters. If you don't use any resistor, you would see everything almost at the same brightness level and it's very hard to recognize the letters (but not from the sides).

the code [9600 Baud]

#include <IRremote.hpp>
#include <LiquidCrystal.h>

const int IRReceiverPin = 6;

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int cursorPosition = 0;

void setup() {
  Serial.begin(9600);
  IrReceiver.begin(IRReceiverPin);

  lcd.begin(16, 2);
  lcd.clear();

  Serial.println("IR Receiver Ready");
}

void loop() {

  if (IrReceiver.decode()) {

    if (IrReceiver.decodedIRData.flags & IRDATA_FLAGS_IS_REPEAT) {
      IrReceiver.resume();
      return;
    }

    uint8_t receivedCommand = IrReceiver.decodedIRData.command;

    if (receivedCommand >= 32 && receivedCommand <= 126) {

      char receivedChar = (char)receivedCommand;

      Serial.print("Received ASCII: ");
      Serial.print(receivedCommand);
      Serial.print("  Character: ");
      Serial.println(receivedChar);

      lcd.setCursor(cursorPosition, 0);

      if (cursorPosition < 16) {
        lcd.setCursor(cursorPosition, 0); 
      } else {
        lcd.setCursor(cursorPosition - 16, 1);
      }

      lcd.print(receivedChar);

      cursorPosition++;

      if (cursorPosition >= 32) {
        cursorPosition = 0;
      }
    }

    IrReceiver.resume();
  }
}