Alex Glow
Published

Get Started with OpticSpy + Arduino

The OpticSpy signal decoder lets you interpret hidden messages in light! Here, we use an Arduino microcontroller to broadcast the message.

BeginnerProtip1 hour4,330
Get Started with OpticSpy + Arduino

Things used in this project

Hardware components

OpticSpy
×1
Adafruit Feather HUZZAH with ESP8266 WiFi
Adafruit Feather HUZZAH with ESP8266 WiFi
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

Adafruit Feather demo code (by Joe Grand)

C/C++
This causes an LED to blink on the Feather HUZZAH, which broadcasts a custom secret message that can be read by the OpticSpy.
/*
  
  Optical Covert Channel Demonstration       
                                                         
  Author: Joe Grand, Grand Idea Studio [@joegrand]             
  
  Program Description:
  
  This program uses the Adafruit Feather HUZZAH ESP8266's on-board red LED as an
  optical covert channel. Optical covert channels transmit data by modulating visible 
  light in a way that is undetectable to the human eye. ASCII printable data is sent 
  via the LED using a standard UART interface (in this case, the SoftwareSerial library).

  More details about this example and the hardware needed to receive the data
  can be found at: 
  http://www.grandideastudio.com/portfolio/optical-covert-channels/

  Revisions:
  
  1.0 (March 1, 2018): Initial release
  
*/

#include <SoftwareSerial.h>

#define txPin    0   // Serial output (connects to the on-board LED)
#define rxPin    13  // Serial input (unused, but required by the library)

// Set up a new serial port
SoftwareSerial opticSerial =  SoftwareSerial(rxPin, txPin);

char const msg_covert[] = {"Huzzah! This is a secret message hidden in light!\n"};

void setup()  // Setup code (called once on start-up)
{
  // Define pin modes
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);

  // Setup Arduino Serial Monitor
  Serial.begin(9600);
  while (!Serial);        // Wait until ready
  Serial.println("\n\nOptical Covert Channel Demonstration");
  
  // Setup Optical Covert Channel Serial Port
  opticSerial.begin(19200);
  while (!opticSerial);   // Wait until ready
  
  Serial.print("Exfiltrating data via LED: ");
  Serial.println(msg_covert);
  Serial.flush();         // Wait for all bytes to be transmitted
}

void loop()  // Main code (runs repeatedly)
{
  opticSerial.print(msg_covert); // Transmit secret message through the LED
  opticSerial.flush();           // Wait for all bytes to be transmitted
      
  //Serial.print("+");  // Display progress indicator on Serial Monitor (for testing)
  //Serial.flush();     // Wait for byte to be transmitted

  delay(2);           // Delay to let receiver properly synchronize
}

Credits

Alex Glow

Alex Glow

145 projects β€’ 1571 followers
The Hackster team's resident Hardware Nerd. I love robots, music, EEG, wearables, and languages. FIRST Robotics kid.
Thanks to Joe Grand.

Comments