We are the Borg.


“Mr Data, click ‘Continue reading’.”

Key Goals Summary:

  1. Make a device that can measure environmental conditions and relay to the user.
  2. Make it wearable.


In the interests of producing more wearable tech, I thought; what would be cooler than a Raspberry Pi attached to a pair of glasses that can show sensor data to the wearers eye?


I will of course require this fancy lot:

Components of Borg

The Borg Protocols

So I wanted something wearable – simple enough, I thought; get the usual Powerboost 500, battery, Pi combo all together with some sensors and whack in an OLED screen – after using Google Cardboard I realised I could use the lenses from said to make the screen readable close to the eye.

I had a scout around for some sensor kits, some were too big such as this, it would have worked but would have been a bit too bulky and I didn’t need the lighting – after some further searching I discovered the Enviro pHAT.

It covers anything a growing nerd could need to monitor, over 4 different sensors: Temp/Pressure/Light/Motion – hit the link above to see more.

Down to work

I hooked the board up to my Black HAT Hack3r and checked out this handy tutorial to get reading some data from it. Thank you Pimoroni.

Once it was reading out some data I decided to hook up the OLED screen on top, using jumper wires on the extended header.

So many sensors…

As usual the simple thought turns into a few hours of trying to figure out how everything is even wired. Thanks to this random person for figuring out the correct wiring for a Raspberry Pi, if you ever see this.

Once wired up it was OLED code time.

First I hit up a tutorial here. Then looked at some code from here. And also this handy stuff here.

I’d suggest the tutorial first followed by looking at the second links examples, these will get you setup writing stuff to the screen successfully. The third link has some further cool stuff for drawing shapes to the screen.

On my first attempts with the above I had some issues getting the screen to work, when trying to run text examples I ended up with a garbled screen – a bad feeling when you think you’ve busted a new piece of hardware in the first five minutes.

However I eventually discovered how to display a picture of a cat. With further trial and error I was able to display text – I combined this with the code for reading the Enviro pHat data and BEHOLD:

This is pretty sweet, right?

At this point I was excited – I moved onto making the text tidier and added some spacers to get the correct distance from the glasses + the lens:

The light level at the time was 37. Valuable knowledge.

After some tweaks and testing, the final code is on my GitHub.

As you can see the sensor data being read and displayed covers:

  • Light amount 0-255
  • RGB Light colour 0-255 per channel
  • Temperature and Pressure
  • Motion X, Y, Z
  • Heading to north – calculated to show the degrees to north

To switch off you simply hold a finger over the light sensor for 5 seconds and it will execute a shutdown command on the Pi – the light levels pretty much never hit zero unless the sensor is entirely covered and I thought this would be more efficient than adding in a shutdown button.

For information on setting up the Raspberry Pi and getting code to run on boot see my previous project post for more details here.

First Contact

With my old friend Sugru, some tie wraps and even some Blu Tack, the glasses were assembled:

24 hours of Sugru drying later it was of course time to try them on:

As you can see the weight of the hardware drags them to one side. So I will probably attach a counterweight to the left side at some point.

Further thoughts

This is a great proof of concept – and with the memory card imaged I can make more similar devices quickly, possibly using different sensors or information to be relayed to the user.

I could possibly use an IR camera and an IR LED and have night vision relayed to the OLED screen for a future project.




3 thoughts on “PiGlass

  1. tilakraj September 10, 2017 / 8:04 pm

    abstract plz


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s