Skip to content

IoT code for illuminating a LED when I'm in a meeting

Notifications You must be signed in to change notification settings

szelenka/study-status-led

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Study Status LED

This repo contains the code for running CircuitPython on a ESP32-S2 prototyping board, to control illuminating a NeoPixel strip and using WiFi to get time from Adafruit IO.

In our case, we want the device to poll for the Public status of a particular user (i.e. the person currently occupying the Study Room), and animate the NeoPixel strip outside. This will allow others to know if the person in the room is available or not.

View a quick demo of it in action on YouTube!

Meeting Source

We primarily use Cisco Webex for virtual meetings, and they have a simple Bot API interface we can leverage via simple HTTP requests. In this case, we're just going to poll for the status of a person (myself). To simplify the code running on the ESP32-S2 we'll get my own details by calling the /v1/people/me endpoint.

Hardware

We wanted a rustic looking pipe that could illuminate. To complete the look, we also wanted to have some frame around the pipe where the LED would illuminate. To do this, we procured the following:

  1. Cut the Shiplap into 1' long strips, then secured them together with Wood Glue and some staples at a pre-defined offset
  2. Use a Dremel with diamond bits to cut the bottom off the Test Tubes to length
  3. Design and 3D Print LED strip holder, 1-in Bushing, and ESP32-S2 case Files available on PrusaPrinters
  4. Print out and/or spray-paint a light diffuser for the smaller Test Tube
  5. Drill hole behind each Floor Flange to pass wires through
  6. Chisel out a path for the wires and ESP32-S2 case
  7. Assemble

Setup

Installation on ESP32-S2 doesn't have the concept of PIP, so we'll need to copy over the libraries to the device.

You can do this manually, or using the Makefile to automate many of these steps:

make stage.lib.all copy-files

settings.py Format

from collections import namedtuple
from adafruit_led_animation.color import BLACK, GOLD, JADE, AMBER, PURPLE, AQUA

Sequence = namedtuple('Sequence', 'animation speed color')

SLEEP_INTERVAL = 5
CHECK_STATUS_EVERY_N_SEC = 15
MAX_RETRY_ATTEMPTS = 5
# WiFi
WIFI_SSID = '...'
WIFI_PASSWORD = '...'
WIFI_HOSTNAME = '...'
# NeoPixel
PIXEL_PIN = 'A1'
PIXEL_PER_STRIP = 11
PIXEL_STRIPS = 3
PIXEL_NUM = PIXEL_PER_STRIP * PIXEL_STRIPS
PIXEL_BRIGHTNESS = 0.5
# API
WEBEX_BASE_URL = "https://webexapis.com/v1"
WEBEX_BOT_TOKEN = "..."
WEBEX_USER_ID = "..."
# Datetime
TZ_OFFSET = -4
HOUR_START_OF_DAY = 6
HOUR_END_OF_DAY = 21
# Speeds
SPEED_OFF = 0.0
SPEED_SLOW = 0.07
SPEED_MED = 0.05
SPEED_FAST = 0.01
# Status Color
STATUS_ACTIVE = Sequence('Solid', SPEED_OFF, BLACK)
STATUS_CALL = Sequence('Pulse', SPEED_MED, AMBER)
STATUS_DONOTDISTURB = Sequence('Comet', SPEED_MED, GOLD)
STATUS_INACTIVE = Sequence('Solid', SPEED_OFF, BLACK)
STATUS_MEETING = STATUS_CALL
STATUS_OUTOFOFFICE = STATUS_INACTIVE
STATUS_PENDING = STATUS_MEETING
STATUS_PRESENTING = Sequence('Chase', SPEED_SLOW, PURPLE)
STATUS_UNKNOWN = STATUS_INACTIVE

About

IoT code for illuminating a LED when I'm in a meeting

Resources

Stars

Watchers

Forks

Packages

No packages published