Arun Magesh
Published © Apache-2.0

Arduino Glass - Open Source Augmented Reality Headset

A less than 10$ distraction-less, augmented reality development kit which allows you to experiment with both the software and hardware.

IntermediateFull instructions provided12 hours16,750
Arduino Glass - Open Source Augmented Reality Headset

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
SparkFun Triple Axis Accelerometer Breakout - ADXL335
SparkFun Triple Axis Accelerometer Breakout - ADXL335
×1
OLED Expansion
Onion Corporation OLED Expansion
×1
Grove starter kit plus for Intel Edison
Seeed Studio Grove starter kit plus for Intel Edison
×1
Custom fabricated PCB
OSH Park Custom fabricated PCB
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
Perma-Proto Breadboard Half Size
Perma-Proto Breadboard Half Size
×1
Buzzer
Buzzer
×1

Software apps and online services

ATC lite

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Schematics

Code

Arduino AR glasses

C/C++
#include "U8glib.h"

U8GLIB_SSD1306_128X64 u8g(10, 9);		// HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)


void draw(void) { //Sensor function
  
  u8g.setFont(u8g_font_osb21);  // font type
  u8g.drawStr( 0, 22, "thgiL"); //Light inverted
   u8g.setPrintPos(0, 44);  //print position x,y
   int a = analogRead(A0); //analog read lght sensor
   a = map(a, 0 , 1024, 0 , 100);  /// light to percentage
   u8g.setPrintPos(14, 44);  // print in next line
   u8g.print((int)a);  u8g.print("%"); // Print %
   
   u8g.drawStr( 0, 66, "dnS"); //Sound sensor
      u8g.setPrintPos(0, 88);  // next line
    
   int b = analogRead(A1); // Read sensor
   b = map(b, 0 , 1024, 0 , 100);//sound to percentahe
    u8g.setPrintPos(14, 88);  // next line
   u8g.print((int)b);  u8g.print("%"); // print %
   digitalWrite(2, LOW);
digitalWrite(3, LOW);
  
}
void ace(void) {  //Accelerometer function
  // graphic commands to redraw the complete screen should be placed here  
 // u8g.setFont(u8g_font_unifont);
  u8g.setFont(u8g_font_osb21); // 
  u8g.drawStr( 0, 22, "x:"); //X: Print
   u8g.setPrintPos(0, 44); 
   int a = analogRead(A2); // read x
   a = map(a, 0 , 1024, -100 , 100); // scaling
   u8g.setPrintPos(20, 22);  // next line
   u8g.print((int)a); // print
   
   u8g.drawStr( 0, 44, "y:"); // y: print
      u8g.setPrintPos(0, 44); // 
   
   int b = analogRead(A3); // read y
   b = map(b, 0 , 1024, -100 , 100); // scaling
    u8g.setPrintPos(20, 44);  // Next line
   u8g.print((int)b);  // print y
   digitalWrite(2, LOW);
digitalWrite(3, LOW);
 u8g.drawStr( 0, 66, "z:"); // z: print
      u8g.setPrintPos(0, 66);
   
   int c = analogRead(A4); // read z
   c = map(b, 0 , 1024, -100 , 100); /// scaling
    u8g.setPrintPos(20, 66);  // next line
   u8g.print((int)c);   // print z
   digitalWrite(2, LOW);
digitalWrite(3, LOW);
  
}

void message(void) { // Message function
 u8g.setFont(u8g_font_unifont);
  u8g.drawStr( 0, 55, "========"); ///ASCII Message art
  u8g.drawStr( 0, 66, "|  __  |");
  u8g.drawStr( 0, 77, "|______|");  
  digitalWrite(2, LOW);
digitalWrite(3, LOW);
 
   
}
void left(void) { // left navi function
 
 u8g.setFont(u8g_font_osb21); // ASCII left arrow
  u8g.drawStr( 0, 55, " <<<");
  u8g.drawStr( 0, 66, "<");
  u8g.drawStr( 0, 77, " <<<");  
  digitalWrite(2, LOW);
digitalWrite(3, LOW);
  
}
void right(void) {
 
 u8g.setFont(u8g_font_osb21); // ASCII right arrow
  u8g.drawStr( 0, 55, " >>>");
  u8g.drawStr( 0, 66, "      >");
  u8g.drawStr( 0, 77, " >>>");  
  digitalWrite(2, LOW);
digitalWrite(3, LOW);
}
void up(void) {
 
 u8g.setFont(u8g_font_osb21); //ASCII UP arrow
  u8g.drawStr( 0, 55, "  ^^");
  u8g.drawStr( 0, 66, " ^^^^");
  u8g.drawStr( 0, 77, " ^^^^");  
  digitalWrite(2, LOW);
digitalWrite(3, LOW);
}
void vib(void) { // Vibrator
 
digitalWrite(2, HIGH);  // .5 sec buzz
  digitalWrite(3, LOW);
  delay(500);         
  digitalWrite(3, HIGH);
  digitalWrite(2, LOW);    // .5 sec vibb
  delay(500);
  digitalWrite(3, LOW);
}
void call(void) {
  
 u8g.setFont(u8g_font_unifont); //ASCII CAll 
  u8g.drawStr( 0, 55, "  ==}");
  u8g.drawStr( 0, 66, " ||");
  u8g.drawStr( 0, 77, " ||");  
  u8g.drawStr( 0, 88, "  ==}");  
  digitalWrite(2, LOW);
digitalWrite(3, LOW);
  
}
void lig(void) {
 
 
}


void setup(void) {
   Serial.begin(9600);
   pinMode(2, OUTPUT); // Buzzer pin
  pinMode(3, OUTPUT);  // Vibrator pin
 
   u8g.setRot90(); // flip screen
  
  // set SPI backup if required
  //u8g.setHardwareBackup(u8g_backup_avr_spi);

  // assign default color value
  if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
    u8g.setColorIndex(255);     // white
  }
  else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
    u8g.setColorIndex(3);         // max intensity
  }
  else if ( u8g.getMode() == U8G_MODE_BW ) {
    u8g.setColorIndex(1);         // pixel on
  }
  else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
    u8g.setHiColorByRGB(255,255,255);
  }
}

void loop(void) {

  while (Serial.available() > 0) { //HC05 pin 
  
    int red = Serial.parseInt(); // Read the integer
digitalWrite(2, LOW);
digitalWrite(3, LOW);
if (Serial.read() == '.') { // check for Next value 
  if(red==1) ////condition statement
  {
 
         u8g.firstPage();  
           do {
                 draw(); 
                 } while( u8g.nextPage() );
  
            delay(50); //delay for each display execution
  
  }

  else if(red==2)
  {
     u8g.firstPage();  
           do {
                 message(); 
                 } while( u8g.nextPage() );
  
            delay(50);
  }
  else if(red ==3)
  {
     u8g.firstPage();  
           do {
                 left(); 
                 } while( u8g.nextPage() );
  
            delay(50);
  }
    else if(red ==4)
  {
     u8g.firstPage();  
           do {
                 right(); 
                 } while( u8g.nextPage() );
  
            delay(50);
  }
    else if(red ==5)
  {
     u8g.firstPage();  
           do {
                 up(); 
                 } while( u8g.nextPage() );
  
            delay(50);
  }
    else if(red ==6)
  {
     
                 vib(); 
               
  }
    else if(red ==7)
  {
     u8g.firstPage();  
           do {
                 call(); 
                 } while( u8g.nextPage() );
  
            delay(50);
  }
  else if(red ==8)
  {
     u8g.firstPage();  
           do {
                 lig(); 
                 } while( u8g.nextPage() );
  
            delay(50);
  }
  else if(red ==9)
  {
     u8g.firstPage();  
           do {
                 ace(); 
                 } while( u8g.nextPage() );
  
            delay(50);
  }
  
  }
  }            

}

Credits

Arun Magesh

Arun Magesh

3 projects • 42 followers
hello.. hellooo i am arun. hardcore fan of electronics. it makes me happy. be with me and feel me.

Comments