You are on page 1of 31

ELECTRONICS AND COMMUNICATION ENGINEERING

MAY, 2020
SUBMITTED BY
Name of Students (Full Name) Enrolment No.
DIVANSHU SAINI SG-20561
KARTIKAY SG-20562
Branch:-E.C.E Semester:- 6TH
PROJECT FILE-:
Smart Glasses (SG)

🧑💻 🧑💻
PUNJAB UNIVERSITY SWAMI SARVANAND GIRI
REGIONAL CENTRE
HOSHIARPUR –146021
SUBMITTIED TO:-
DR.Ankur Singh Kang Sir

Page 1
INTRODUCTION
Smart-glasses or smart glasses are eye or head-worn wearable computers that offer
useful capabilities to the user. Many smart-glasses include displays that add
information alongside or to what the wearer sees.Alternatively, smart-glasses are
sometimes defined as glasses that are able to change their optical properties, such as
smart sunglasses that are programmed to change tint by electronic means.

Using the touch pad built on the side of the 2013 Google Glass to communicate with
the user's phone using Bluetooth. Man wearing a 1998 EyeTap, Digital Eye Glass.

A pair of smart-glasses can be considered an augmented reality device if it performs


pose tracking.

Superimposing information onto a field of view is achieved through an optical head-


mounted display (OHMD) or embedded wireless glasses with transparent heads-up
display (HUD) or augmented reality (AR) overlay. These systems have the capability
to reflect projected digital images as well as allowing the user to see through it or see
better with it. While early models can perform basic tasks, such as serving as a front
end display for a remote system, as in the case of smart-glasses utilizing cellular
technology or Wi-Fi, modern smart glasses are effectively wearable computers which
can run self-contained mobile apps. Some are handsfree and can communicate with
the Internet via natural language voice commands, while others use touch buttons.

Page 2
Like other computers, smart-glasses may collect information from internal or external
sensors. It may control or retrieve data from other instruments or computers. It may
support wireless technologies like Bluetooth, Wi-Fi, and GPS. A small number of
models run a mobile operating system and function as portable media players to send
audio and video files to the user via a Bluetooth or WiFi headset.Some smart-glasses
models also feature full life logging and activity tracker capability.

Smart-glasses devices may also have features found on a smartphone.Some have


activity tracker functionality features (also known as "fitness tracker") as seen in
some GPS watches.

Page 3
COMPONENT USED
-Arduino nano v3

-Bluetooth module HC-05

-Battery 3.7v 450mah

-Mirror

-10mm focal lens

-OLED Display 0.95 inches

-Reflector

1. Arduino Nano V3-: Arduino Nano is a surface mount breadboard embedded


version with integrated USB. It is a smallest, complete, and breadboard friendly. It
has everything that Diecimila/Duemilanove has (electrically) with more analog input
pins and onboard +5V AREF jumper. Physically, it is missing power jack. The Nano
is automatically sense and switch to the higher potential source of power, there is no
need for the power select jumper.

Nano’s got the breadboard-ability of the Boarduino and the Mini+USB with smaller
footprint than either, so users have more breadboard space. It’s got a pin layout that
works well with the Mini or the Basic Stamp (TX, RX, ATN, GND on one top, power
and ground on the other). This new version 3.0 comes with ATMEGA328 which offer
more programming and data memory space. It is two layers. That make it easier to
hack and more affordable.

Specifications:
Microcontroller Atmel ATmega328

Operating Voltage (logic level) 5 V

Input Voltage (recommended) 7-12 V

Input Voltage (limits) 6-20 V

Digital I/O Pins 14 (of which 6 provide PWM output)

Analog Input Pins 8

DC Current per I/O Pin 40 mA

Page 4
Flash Memory 32 KB (of which 2KB used by bootloader)

SRAM 2 KB

EEPROM 1 KB

Clock Speed 16 MHz

Features:
• Automatic reset during program download

• Power OK blue LED

• Green (TX), red (RX) and orange (L) LED

• Auto sensing/switching power input

• Small mini-B USB for programming and serial monitor

• ICSP header for direct program download

• Standard 0.1” spacing DIP (breadboard friendly)

• Manual reset switch

Power:
The Arduino Nano can be powered via the mini-B USB connection, 6-20V
unregulated external power supply (pin 30), or 5V regulated external power supply
(pin 27). The power source is automatically selected to the highest voltage source.

2. Bluetooth module HC-05-:


Introduction
• It is used for many applications like wireless headset, game controllers,
wireless mouse, wireless keyboard, and many more consumer applications.
• It has range up to <100m which depends upon transmitter and receiver,
atmosphere, geographic & urban conditions.
• It is IEEE 802.15.1 standardized protocol, through which one can build
wireless Personal Area Network (PAN). It uses frequency-hopping spread
spectrum (FHSS) radio technology to send data over air.
• It uses serial communication to communicate with devices. It communicates
with microcontroller using serial port (USART).

Page 5
HC-05 Bluetooth Module
• HC-05 is a Bluetooth module which is designed for wireless communication.
This module can be used in a master or slave configuration.

HC-05 Bluetooth Module

HC-05 Bluetooth Module Pin Diagram

Bluetooth serial modules allow all serial enabled devices to communicate with each
other using Bluetooth.It has 6 pins,
1. Key/EN: It is used to bring Bluetooth module in AT commands mode. If Key/EN
pin is set to high, then this module will work in command mode. Otherwise by
default it is in data mode. The default baud rate of HC-05 in command mode is
38400bps and 9600 in data mode.
HC-05 module has two modes,
1. Data mode: Exchange of data between devices.
Command mode: It uses AT commands which are used to change setting of HC-05.
To send these commands to module serial (USART) port is used.
2. VCC: Connect 5 V or 3.3 V to this Pin.
3. GND: Ground Pin of module.
Page 6
4.TXD: Transmit Serial data (wirelessly received data by Bluetooth module
transmitted out serially on TXD pin)
5.RXD: Receive data serially (received data will be transmitted wirelessly by
Bluetooth module).
6. State: It tells whether module is connected or not.
HC-05 module Information
• HC-05 has red LED which indicates connection status, whether the Bluetooth
is connected or not. Before connecting to HC-05 module this red LED blinks
continuously in a periodic manner. When it gets connected to any other
Bluetooth device, its blinking slows down to two seconds.
• This module works on 3.3V. We can connect 5V supply voltage as well since
the module has on board 5 to 3.3 V regulator.
• As HC-05 Bluetooth module has 3.3V level for RX/TX and microcontroller
can detect 3.3 V level, so, no need to shift transmit level of HC-05 module. But
we need to shift the transmit voltage level from microcontroller to RX of
HC-05 module.
• The data transfer rate of HC-05 module can vary up to 1Mbps is in the range of
10 meters.

Specification of HC-05 Bluetooth Module
• Bluetooth version: 2.0 + EDR (Enhanced Data Rate)
• Frequency: 2.4 GHz ISM band
• Modulation: GFSK (Gaussian Frequency Shift Keying)
• Transmit power: Class 2 (up to 4 dBm)
• Sensitivity: -80 dBm typical
• Range: approximately 10 meters (or 33 feet) in open air
• Profiles supported: SPP (Serial Port Profile), HID (Human Interface Device)
and others
• Operating voltage: 3.3V to 5V DC
• Operating current: less than 50mA
• Standby current: less than 2.5mA
• Sleep current: less than 1mA
• Interface: UART (Universal Asynchronous Receiver/Transmitter)
• Baud rates: 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400,
and 460800
• Operating temperature: -20°C to 75°C (-4°F to 167°F)

Bluetooth communication between Devices
Bluetooth communication between Devices E.g. Send data from Smartphone terminal
to HC-05 Bluetooth module and see this data on PC serial terminal and vice versa.

Page 7
To communicate smartphone with HC-05 Bluetooth module, smartphone requires
Bluetooth terminal application for transmitting and receiving data. You can find
Bluetooth terminal applications for android and windows in respective app. store.

Bluetooth Module Serial Interface

So, when we want to communicate through smartphone with HC-05 Bluetooth


module, connect this HC-05 module to the PC via serial to USB converter.
Before establishing communication between two Bluetooth devices, 1st we need to
pair HC-05 module to smartphone for communication.
Pair HC-05 and smartphone:
Search for new Bluetooth device from your phone. You will find Bluetooth device
with “HC-05” name.
Click on connect/pair device option; default pin for HC-05 is 1234 or 0000.
After pairing two Bluetooth devices, open terminal software (e.g. Teraterm, Realterm
etc.) in PC, and select the port where we have connected USB to serial module. Also
select default baud rate of 9600 bps.
In smart phone, open Bluetooth terminal application and connect to paired device
HC-05.
It is simple to communicate, we just have to type in the Bluetooth terminal
application of smartphone. Characters will get sent wirelessly to Bluetooth module
HC-05. HC-05 will automatically transmit it serially to the PC, which will appear on
terminal. Same way we can send data from PC to smartphone.
Command Mode
• When we want to change settings of HC-05 Bluetooth module like change
password for connection, baud rate, Bluetooth device’s name etc.
• To do this, HC-05 has AT commands.
• To use HC-05 Bluetooth module in AT command mode, connect “Key” pin to
High (VCC).
• Default Baud rate of HC-05 in command mode is 38400bps.

Page 8
• Following are some AT command generally used to change setting of
Bluetooth module.
• To send these commands, we have to connect HC-05 Bluetooth module to the
PC via serial to USB converter and transmit these command through serial
terminal of PC.

Alternate options for HC-05 Bluetooth Module
1. HC-06 Bluetooth module: This is a similar module to the HC-05, but it is
limited to a slave role only. It has a smaller form factor and is generally
cheaper than the HC-05. However, it does not support some of the advanced
features of the HC-05, such as the ability to enter AT mode to configure the
module.
2. HM-10 Bluetooth module: This is a more advanced Bluetooth module that
supports Bluetooth 4.0 (BLE) and can act as both a master and slave device. It
also supports a wider range of AT commands for configuring the module, and
has a longer range than the HC-05. However, it is generally more expensive
than the HC-05.
3. RN-42 Bluetooth module: This is another Bluetooth module that supports both
the SPP and HID profiles, similar to the HC-05. It has a longer range than the
HC-05 and supports faster data rates. However, it is also more expensive and
may require additional configuration to work properly.
4. ESP32 Bluetooth module: This is a powerful Wi-Fi and Bluetooth module that
includes a dual-core processor and support for both Bluetooth Classic and
BLE. It is more expensive than the HC-05, but offers more advanced features
and capabilities.
5. nRF24L01+ Wireless module: This is a wireless module that operates at
2.4GHz and uses a different protocol than Bluetooth. It is generally cheaper
than Bluetooth modules and can be used for applications where a shorter range
and lower data rate are acceptable.

3. Battery 3.7V 450mAH-: 3.7V 450mAH (Lithium Polymer) Lipo


Rechargeable Battery also known as Lipo or Lipoly batteries are thin, light and
powerful. This battery has a capacity of 450mAH. These Batteries are widely used in
GPS, DVD, ipod, Tablet PC, MP4 Player, Power Bank, Mobile Backup Power
Supply, Bluetooth Speaker, IOT and other DIY and Industrial applications.

Page 9
Specifications of 3.7V 450mAH Lipo Battery KP-372224:
1.Voltage: 3.7V
2.Battery Type: Lithium Polymer
3.Battery Chemistry Type: LiPO
4.Capacity: 450mAh
5.Size : 24x22x3.7 (in mm)
4. 10mm Focal Lens-:
• led lens, focal length, lens led,Cheap led lens,High Quality focal length, China
lens led Suppliers
• All pictures shown are for illustration purpose only.Actual product may vary
due to product Enhancement
• CATEGORY TYPE:Measurement & Analysis Instruments
• Diameter 10mm Focal length 10mm PMMA LED lens : Clear, 10mm
• Efficiently Working Device.

5. OLED Display 0.95 Inches-: OLED display which is made of resolution


96x64 pixels, diagonal size 0.95 inch. This Passive Matrix OLED is built in with
SSD1305 IC; it can communicate via 6800/8080 8-bit parallel, I2C, SPI interface.
The supply voltage for logic of WEO009664A is 3V, 1/64 driving duty; display with
50% check board current is 6mA@12Vcc (typical value). It can be operating at
temperatures from -40℃ to +80℃; its storage temperatures range from -40℃
to +85℃.
The visible portion of the OLED measures 0.95" diagonal and contains OLED
96x64 pixels is very suitable for portable device since it is much brighter,
much higher contrast, wider viewing angle and lower current consumption
than conventional LCD. WEO009664A COG OLED displays are ultra thin,
lightweight and low power consumption which is great for handheld device,
meters, smart grid, IoT, etc.

Page 10
DRAWING

Interface Pin Function


Pin Symbol I/O Function
Number
Reserved Pin(Supporting Pin)
N.C. The supporting pins can reduce the influences
1 -
(GND) from stresses on the function pins. These pins
must be connected to external ground.
Power Supply for OLED Panel
2 VCC P This is the most positive voltage supply pin of
the chip.It must be supplied externally.
Ground of Logic Circuit
This is a ground pin. It also acts as a reference
3 VSS P
for the logic pins. It must be connected to
external ground.
Page 11
Power Supply for Logic Circuit
4 VDD P This is a voltage supply pin. It must be
connected to external source.
Power supply for interface logic level.
It should be match with MCU interface voltage
5 VDDIO P
level. VDDIO must always be equal or lower
than VDD.
6 Communicating Protocol Select
BS1
I These pins are MCU interface selection input.
7 BS2
See the following table:
Chip Select
This pin is the chip select input. The chip is
8 CS# I
enabled for MCU communication only when
CS# is pulled low.
Power Reset for Controller and Driver
9 RES# I This pin is reset signal input. When the pin is
low, initialization of the chip is executed.
Data/ Command Control
This pin is Data/Command control pin. When
the pin is pulled high, the input at D7~D0 is
treated as display data. When the pin is pulled
low, the input at D7~D0 will be transferred to
the command register. For detail relationship to
MCU interface signals, please refer to the
10 D/C# I
Timing Characteristics Diagrams.
When the pin is pulled high and serial interface
mode is selected, the data at SDIN is treated as
data. When it is pulled low, the data at SDIN will
be transferred to the command register. In I2C
mode, this pin acts as SA0 for slave address
selection.
Read/ Write Selector Write
This pin is MCU interface input. When
interfacing to a68XX-series microprocessor, this
pin will be used as Read/Write (R/W#) selection
input. Pull this pin to “High” for read mode and
11 R/W# I
pull it to “Low” for write mode.
When 80XXinterface mode is selected, this pin
will be the Write (WR#) input. Data write
operation is initiated when this pin is pulled low
and the CS# is pulled low.
Page 12
Read/Write Enable or Read
This pin is MCU interface input. When
interfacing to a68XX-series microprocessor, this
pin will be used as the Enable (E) signal. Read/
write operation is initiated when this pin is
12 E/RD# I
pulled high and the CS# is pulled low.
When connecting to an 80XX-microprocessor,
this pin receives the Read (RD#) signal. Data
read operation is initiated when this pin is pulled
low and CS# is pulled low.
13
14 Host Data In put/ Output Bus
These pins are 8-bit bi-directional data bus to be
15 connected to the microprocessor’s data bus.
16 When serial mode is selected, D1 will be the
D0~D7 I/O serial data input SDIN and D0 will be the serial
17 clock input SCLK. When I2Cmode is selected,
18 D2 & D1 should be tired together and serve as
SDAout & SDAin in application and D0 is the
19 serial clock input SCL.
20
Current Reference for Brightness Adjustment
This pin is segment current reference pin. A
21 IREF I
resistor should be connected between this pin
and VSS. Set the current lower than 10µA.
Voltage Output High Level for COM Signal
VCOM This pin is the input pin for the voltage output
22 O
H high level for COM signals. A capacitor should
be connected between this pin and VSS.
Power Supply for OLED Panel
23 VCC P This is the most positive voltage supply pin of
the chip.It must be supplied externally.
Ground of Analog Circuit
24 VLSS P This is an analog ground pin. It should be
connected to VSS externally.
Reserved Pin(Supporting Pin)
N.C. The supporting pins can reduce the influences
25 -
(GND) from stresses on the function pins. These pins
must be connected to external ground.

Page 13
6. Reflector-: an object that reflects light and shines when light shines on to it
Origin and usage
The word reflector comes from the Latin word ‘reflector’ meaning ‘turn back’. It
dates back to the 1660s in English, though it didn’t become associated with vehicles
until the early 20th century, sometime around 1909.

Example:- Reflector refers to an object, usually made of plastic, that appears to glow
or shine when light reaches it. Reflectors are most frequently found on bicycles and
products associated with safety for drivers or pedestrians.

The plastic reflectors attached to the spokes of a bicycle wheel provide safety and
increase visibility for riders to travel at night. When a car approaches the bicycle in
the dark, its headlights shine on the plastic reflector and reflect the light back, making
the reflector look like it’s glowing. This helps drivers see bicycle riders more easily
and helps prevent accidents.

Sometimes, joggers or walkers wear special clothing with reflector tape so they can
be seen more easily in the dark. Like plastic reflectors, this tape reflects the light and
appears to glow when it is exposed to car headlights or street lamps. Road workers
also wear safety clothing and use equipment like cones or road blocks with reflectors
on them in order to improve their visibility when working at night.

Safety reflectors can be purchased in a variety of stores and websites online, making
it easy for pedestrians, cyclists, road workers and others to increase their visibility in
the dark and keep themselves safe.

Reflectors come in a variety of colours, including yellow, orange, red and white. The
reflectors on tape or clothing items usually look silver in the light but glow bright
white when reflecting light in the dark.

Page 14
PROJECT SMART GLASSES

Supplies

• Arduino nano v3
• Bluetooth module HC-05
• Battery 3.7v 450mah
• Mirror
• 10mm focal lens
• OLED display 0.95 inches
• Reflector

Prototype

I built my first prototype of these glasses a while back and their main capability was
taking pictures and doing basic text recognition and then giving the user some
information on it with Wolfram. For example, if it took a picture of say a detour sign,
the glasses would recognise the text and give the user a definition; however, these
glasses were very buggy and the text recognition had a very long delay. After some
consideration For the new version, I decided this feature wasn't very practical and if
the user wanted that information they could just ask the chat bot anyway. I decided
this iteration should focus more on reliability and efficiency while still adding more
features. I think I have done that successfully considering the last prototype didn't
even have a battery.

INTRODUCTION
Now a days, the usage of wireless communication has been developed and the
gadgets involves in the usage of the wireless communication are being released and
selling like a hot cake and this is the prototype which comes under the wireless
Page 15
communication which is used as a device by which the notifications that we receive
in the mobile for example calls, messages and other type of notifications can be
viewed in front of our eye. This will help the people to get the know their
notifications even if they are their work and for people who are driving and there will
be no disturbance for drivers even because we will project the display on the
transparent material and the letters which we project are not dark so it will not create
any disturbance and also helps bikers to know about their notifications even in
driving in the heavy traffic and in the cities whether it is important and it will help the
user to not to miss their notifications

PROBLEM FORMULATION
The main problem that we identified to get this idea is that many people are facing
some issues to check their phone notifications while they are working especially
some people who need to sit and work for long time and also for the people who are
driving in the heavy traffic which has been the common issue all over the world and
the people are searching for the device that can resolve their issue that to make the
easy way to get to know their notification which helps the people and the solution to
get to use the smart glasses by which the user can connect the mobile to the device
and check the notification which he got while they are working and also driving in
heavy traffic
BLOCK DIAGRAM

HC-05(Bluetooth Module)
Bluetooth module establishes the connection between the mobile and the Arduino and
we design it in a way which is to send the serial data to the Arduino Bluetooth
module by establishing the connection by connecting the TX pin to the receiver pin in
the The Arduino and also able to receive data by the RX pin by connecting it with TX

Page 16
pin in the Arduino and this is also the most important component of the project which
connects both devices together

Arduino Nano:
The Arduino Nano is a small, complete and breadboard friendly and it is very small
so that it can be attached to the leg of spectacles. Arduino nano is made up with a
crystal oscillator of frequency 16 MHz and it will produce a clock of exact frequency
using the constant voltage and this Arduino nano has total of 22 pins which there 14
digital pins and 8 analogue pins. This has a number of facilities for establishing
connection with the computer or another Arduino or any other device like micro
controllers and the main the ATmega328 provides UART TTL serial connection
which is of 5 V and in these digital pins the pin 0 is the digital receiver pin and pin1
is the transmission pin. This is coded in the Arduino IDE software.

Page 17
OLED Display
OLED display is nothing but the organic light emitting diode display which are
mainly used for the digital displays for the mobiles television screens and also
computer monitor, and it is flash light emission technology which is by placing a
series of organic thin films which are in between the two conductors when there is the
application of electric field the light will be obtained and this oled emits display
transparent oled is used in front of display screens such as in airplanes which helps in
the display of any notification such as day, time, phone call ,messages etc.

Mirror and Magnification Glasses


Mirror and magnification glass are used in the prototype making that is 3d model
which we will place magnification glass in front of the mirror which we will place in
front of the OLED display with inclination of 45 degrees so that it will project the
notification on transparent screen and wires are soldiered in the way of circuit
diagram

Connecting Wires
connecting wires are used to establish the connection between the OLED display,
Bluetooth module and the Arduino which will be soldiered, and this will be
connected, and the entire module will be kept in the model which will be attached to
the glasses

Page 18
CIRCUIT DIAGRAM

WORKING
In this paper, we are discussing about the smart glasses using Arduino which is used
for establishing communication with mobile here the mobile is connected with the
Bluetooth module and the entire work can be observed through an application. We
need to supply power to the Arduino by using a battery After establishing the
connection with the HC-05 Bluetooth module then the connection is established as
we connected the transmission node of the HC-05 to the receiver node of the Arduino
and this Arduino will receive the transferred notification and this converts the past
information to the format which will be displayed in the Organic light emitting diode
display which will be displayed there through the reflecting mirror and projected in
front of the glass of our normal spectacles and this will gives the notifications which
are arrived in our mobile phone this entire model will be placed on the side of one leg
of the spectacles
ADVANTAGES:-
1. No need to carry mobiles in hand always
2. Easy of operation
3. Maintenance will be simple

Page 19
APPLICATIONS
One of the growing trends of wearable computing is Head Mounted Displays (HMD),
as the head is a great gateway to receive audio, visual information. To make worth
out of technology trends and to make life more easier by wearable computing
devices. The aim is to assist people to use augmenting real life with extra information
constantly and ubiquitously.

The purpose of the project is to minimise the use of mobile phones while working.
The Smart specs help to avoid spams messages and calls received on the phone. Thus,
it gives choices to use the phone urgently or not. One can use it at the places where
mobile has to be kept at silent mode for eg. Workplace, Library, Hospitals ,etc. It can
be useful for handicapped or disabled people.

Augmented glasses are innovative, fresh, exciting and bring attention to users who
perceive it as useful, valuable, helpful and time saving. It is simple to use, control,
convenient and user-friendly.

The smart glasses can be implemented in workplaces where using phones during
work hours is strictly prohibited. Even the price issue then can be sponsored by the
company to its employees. In this way Employees won’t be kept away from any
urgent work calls, family emergencies, etc

FULL CODE

########Section_1##########
import sys
import bs4
from bs4 import BeautifulSoup as soup
from urllib.request import urlopen
import os
import sys
from luma.core.interface.serial import i2c
from luma.core.render import canvas
from luma.oled.device import ssd1306, ssd1325, ssd1331, sh1106
import time
import datetime
import wolframalpha
import speech_recognition as sr
import pyaudio
import wikipedia
from picamera import PiCamera
import dropbox
import picamera
from twilio.rest import Client
Page 20
##########Section_2###########
contacts= {'Pizza Hut': "718-822-2909", 'Papa John's': "415-586-7272", 'Friend3':
"316-316-316"}

#Wolfram
app_id = ('') #WolfRam Alpha ID

#Dropbox
dropbox_access_token= "" #Unique Dropbox token

#Twilio
twilio_account_sid = '' #You will find this information in your Twilio account
twilio_auth_token = ''
twilio_client = Client(twilio_account_sid, twilio_auth_token)

client = wolframalpha.Client(app_id)
res = client.query('what is the temperature in San Fransisco') #Replace with the name
of your city
answer = next(res.results).text
str1 = answer
str2 = str1.split('(', 1)[0]

bad_chars = [';', '|', '(', ')', '+', '=', '1'] #We use this to remove all of the characters that
Espeak can't say

num = ["05", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "0"] #At these
points in every hour the glasses will refresh the weather data

#######Section_3#################

def util2():
cdt = datetime.datetime.now()
min1 = str(cdt.minute)
hour = str(cdt.hour)

with canvas(device) as draw:


draw.text((0, 0), hour, fill = "blue")
draw.text((11, 0),":", fill = "blue")
draw.text((15, 0), min1, fill = "blue")
draw.text((0, 0), "___________", fill = "yellow")
#draw.text((0, 9), date, fill = "white")
draw.text((33, 0), str2, fill = "white")
#draw.text((0, 115), "...", fill = "white")

Page 21
def util3():
cdt = datetime.datetime.now()
min1 = str(cdt.minute)
hour = str(cdt.hour)

with canvas(device) as draw:


draw.text((0, 0), hour, fill = "blue")
draw.text((11, 0),":", fill = "blue")
draw.text((15, 0), min1, fill = "blue")
draw.text((0, 0), "___________", fill = "yellow")
#draw.text((0, 9), date, fill = "white")
draw.text((33, 0), str2, fill = "white")
draw.text((0, 115), "...", fill = "white")

def listen():
print('listening...')
util3()
#with canvas(device) as draw:
#draw.text((0, 115), "...", fill = "white")
os.system('arecord -d 4 -f cd -t wav -D
bluealsa:DEV=A0:18:12:00:9D:55,PROFILE=sco test.wav') #Replace the MAC
address with that of your hedset

r = sr.Recognizer()
try:
harvard = sr.AudioFile('test.wav')
with harvard as source:
audio = r.record(source)
global val
val = r.recognize_google(audio)
print(val)
except:
print('sorry I couldnt understand')

def say(statment):
statment1 = statment.replace(" ", "_")
os.system('espeak ' + str(statment1) + ' -ven+f3 -k5 -s130 --stdout | aplay -D
bluealsa:DEV=A0:18:12:00:9D:55,PROFILE=sco') #Change the MAC address here
as well

Page 22
def query(query):
client = wolframalpha.Client(app_id)
res = client.query(query)
answer = next(res.results).text
answer1 = answer.partition('\n')[0]
print(answer1)

def start_up():
hour1 = int(datetime.datetime.now().hour)
if hour1 >= 0 and hour1 < 12:
#print('computer: good morning')
say('good_morning')
elif hour1 >= 12 and hour1 < 20:
#print('computer: good afternoon')
say('good_afternoon')
else:
#print('computer: good evening')
say('good_evening')
say('how may i help you')

def send_sms(person, msg_to_text):


if person in contacts:
#say('What would you like to say')
#listen()
message = twilio_client.messages \
.create(
body= msg_to_text,
from_='+YourTwilioNumber', #PUT YOUR TWILIO PHONE NUMBER
HERE, sry for caps
status_callback='http://postb.in/1234abcd',
to= contacts[person]
)

serial = i2c(port=1, address=0x3C)#Put in the address of your display


device = ssd1306(serial, rotate=1)

text = ("What would you like to say? ")


text1 = ('\n'.join([text[i:i+11] for i in range(0, len(text), 11)]))

cdt = datetime.datetime.now()
#date = str(cdt.day) + "/" + str(cdt.month) + "/" + str(cdt.year)

start_up()
Page 23
def utilitys():
cdt = datetime.datetime.now()
min1 = str(cdt.minute)
hour = str(cdt.hour)

with canvas(device) as draw:


draw.text((0, 0), hour, fill = "blue")
draw.text((11, 0),":", fill = "blue")
draw.text((15, 0), min1, fill = "blue")
draw.text((0, 0), "___________", fill = "yellow")
#draw.text((0, 9), date, fill = "white")
draw.text((33, 0), str2, fill = "white")
if min1 in num:
client = wolframalpha.Client(app_id)
res = client.query('what is the temperature in San Fransisco')
answer = next(res.results).text
str1 = answer
str3 = str1.split('(', 1)[0]
draw.text((33, 0), str3, fill = "white")

def util(func1):
cdt = datetime.datetime.now()
min1 = str(cdt.minute)
hour = str(cdt.hour)

with canvas(device) as draw:


draw.text((0, 0), hour, fill = "blue")
draw.text((11, 0),":", fill = "blue")
draw.text((15, 0), min1, fill = "blue")
draw.text((0, 0), "___________", fill = "yellow")
#draw.text((0, 9), date, fill = "white")
draw.text((33, 0), str2, fill = "white")
draw.text((0, 64), func1, fill = "white")

def upload_img():
file = open('img.txt', 'r')
file51 = file.read()
file.close()
file45 = int(file51)
file45 += 1
global img
img = 'img{}.jpg'.format(file45)
print(img)

Page 24
def save_img():
file1 = open('img.txt', 'r')
file99 = file1.read()
file1.close()
file100 = int(file99)
file100 += 1
file2 = str(file100)
open('img.txt', 'w').close()
new_num = open('img.txt', 'w')
new_num.write(file2)
new_num.close()
print(file2)

def upload_vid():
file3 = open('vid.txt', 'r')
file61 = file3.read()
file3.close()
file47 = int(file61)
file47 += 1
global vid
vid = 'vid{}.h264'.format(file47)
print(vid)

def save_vid():
file3 = open('vid.txt', 'r')
file101 = file3.read()
file3.close()
file102 = int(file101)
file102 += 1
file7 = str(file102)
open('vid.txt', 'w').close()
new_num2 = open('vid.txt', 'w')
new_num2.write(file7)
new_num2.close()
print(file7)

########Section_4#############

while True:
utilitys()
listen()
try:
if len(val) >= 2:
Page 25
if 'news' in val:
news_url="https://news.google.com/news/rss"
Client=urlopen(news_url)
xml_page=Client.read()
Client.close()
soup_page=soup(xml_page,"xml")
news_list=soup_page.findAll("item")
# Print news title, url and publish date
i=0
util('news...')
for news in news_list:
print(news.title.text + "\n")
say(news.title.text)
#print(news.link.text)
#print(news.pubDate.text)
#print("-"*60)
i += 1
time.sleep(1)
if i == 3:
break
del val
util("news...")
time.sleep(3)

if 'exit program' in val:


os.system('pkill -f main.py')
del val

if 'SMS' in val:
del val
say('who would you like to send a text to?')
listen()
dude = str(val)
del val
say('what would you like to say')
listen()
msg_to_send = str(val)
del val
send_sms(dude, msg_to_send)
util("SMS sent!")
time.sleep(3)

if 'time' in val:
Page 26
cdt1 = datetime.datetime.now()
h = cdt1.hour
m = cdt1.minute
print(str(h) + ':' + str(m))
say(str(h))
say(str(m))

del val
util("time...")
time.sleep(3)

if 'picture' in val:
camera = PiCamera()
upload_img()
img_name = img
camera.start_preview()
time.sleep(5)
camera.capture(img_name)
camera.stop_preview()
save_img()
dropbox_path= "/SmartGlassesAPI/{}".format(img_name) #Go to your
Dropbox profile and make a folder named SmartGlassesAPI
computer_path = r'/home/pi/{}'.format(img_name)
client = dropbox.Dropbox(dropbox_access_token)
client.files_upload(open(computer_path, "rb").read(), dropbox_path)
print('image saved to dropbox account')
say('image save to drop box account')
del img
del val
util("saved...")
time.sleep(3)

if 'play my music' in val:


util("music...")
time.sleep(2)

#replace the 00:00:00:00:00:00 with the MAC address of your headset


os.system('aplay -D bluealsa:DEV=00:00:00:00:00:00,PROFILE=sco /home/pi/
Desktop/Imagine.wav')
del val
say('would you like me to play the next song')
listen()
if 'yes' in val: #Dang I guess I should have stored this in a variable

Page 27
os.system('aplay -D bluealsa:DEV=00:00:00:00:00:00,PROFILE=sco /home/
pi/Desktop/BeautifulName.wav')
del val
say('would you like me to play the next song')
listen()
if 'yes' in val: #Lol, you have to do it again
os.system('aplay -D bluealsa:DEV=00:00:00:00:00:00,PROFILE=sco /home/
pi/Desktop/Oceans.wav')
del val
if 'no' in val:
del val
continue

if 'video' in val:
upload_vid()
vid_name = vid
#vid_name = str(vid_name)
with picamera.PiCamera() as camera:
camera.start_recording(vid_name)
time.sleep(30)
camera.stop_recording()
save_vid()
new_vid_name = vid_name.replace('.h264', '.mp4')
command = "MP4Box -add {} {}".format(vid_name, new_vid_name)
subprocess.call([command], shell=True)
dropbox_path= "/SmartGlassesAPI/{}".format(new_vid_name)
computer_path = r'/home/pi/{}'.format(new_vid_name)
client = dropbox.Dropbox(dropbox_access_token)
client.files_upload(open(computer_path, "rb").read(), dropbox_path)
time.sleep(3)
print('video saved to dropbox account')
say('video save to drop box account')
del vid
del val
util("saved...")
time.sleep(3)

#############section_5######################

try:
client1 = wolframalpha.Client(app_id)
res1 = client1.query(val)
answer1 = next(res1.results).text
answer2 = answer1.partition('\n')[0]
Page 28
for i in bad_chars:
answer2 = answer2.replace(i, '')
print(answer2)
say(answer2)
except:
try:
print(wikipedia.summary(val, sentences = 1))
say(wikipedia.summary(val, sentences = 1))
except:
print('')
del val
except:
print(' ')
#del val
################THE_END##########################

Page 29
Conclusion

Congratulations! I have successfully built may own smart glasses.The report


demonstrates how to build smart spectacle with basic features. Basic features like
times, date, notification indifferent scenarios. This architecture is designed to be cost-
effective and it is very environmentally friendly. As this is the first prototype of our
design but, with utmost probability min future we are going to wear these glasses.

The prototype just contains the basic feature of notification such as time and date,
messages and calls. The next version can include advanced features like checking
humidity of surrounding, temperature and many others. Audio assistance, smart
speakers and voice controlling functions can be include din advanced versions. A
camera can be added to smarts pentacles for facial recognition. As it develops for face
recognition, we can push the limitation further by including 360°view.

Using Machine learning and Artificial Intelligence these glasses can be used for
reading texts which will be beneficial for blind people. Improvisation can be done at
an advanced level, a virtual reality environment can be provided. Also, smart glasses
have vast scope in Augmented Reality. As technology advances navigation options
along with audio options can be added.

Page 30
Page 31

You might also like