Giter VIP home page Giter VIP logo

on-air-light's Introduction

On-Air Light

An offline-first IoT project on-air light for video meetings, using ESP32 & JavaScript with Moddable XS.

While the materials demonstrate using an ESP32 development board, it is possible using an ESP8266 with the same code (updated pins probably required) since Moddable runs on both platforms.

Materials

Wiring Diagram

breadboard wiring

Setup

The dev environment was bootstrapped and managed using xs-dev; however, that is not required if you want to go through the Moddable set up instructions manually or has been done previously.

After cloning this project repo, the ssid and password config fields in the manifest.json to match your WiFi details. The project does not require any Internet access (i.e. "offline-first"), just a shared network for local Web UI and HTTP API control.

After wiring the hardware materials together to match the documented diagram, the code can be uploaded to the board.

Using xs-dev:

xs-dev run --device esp32

Using mcconfig:

mcconfig -d -m -p esp32

Once the LEDs are green for 3 seconds, the web UI should be available at http://on-air.local/.

web interface

There are some HTTP API endpoints for checking and controlling the light outside of the web UI:

  • GET /api/state: returns the current color if the light is on, otherwise returns [1023, 1023, 1023] as "off"
  • POST /api/toggle: toggles the state of the light, using the last used color if the light is off
  • POST /api/color: expects a color field in the body to set the color of the light, returns 204 status code if successful

Deployed Project

External box: external box

Internal layout: internal box

Breadboard wiring: close up of breadboard wiring

Computer Camera event daemon

Run using pm2 to control long running process:

pm2 start daemon/index.mjs --name on-air

The script (daemon/index.mjs) watches the standard output stream from log stream on MacOS for Camera events that include "turn off" and "turn off" messages. When it sees one of those messages, it will make a POST request to the /api/toggle endpoint at the http://on-air.local host. If it cannot reach on-air.local, it will log the error and continue watching the log output.

on-air-light's People

Contributors

hipsterbrown avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.