Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

State Machine

Treating the Design Studio as one grand Moore Machine, exposing outputs to users and mentors.

input/ (Pure Input)

magnet_holder.scad

Magnet holder for cylinder magnet

sunfoundry_sensor_kit.pdf

See Lesson 8 for instructions on Digital Reed Switch sensor usage. Uses magnetic field to determine whether door is open.

python-ultimaker-api/

Ultimaker http request API in Python written for the Design Studio. Might run into issues with firmware upgrades that invalidate currently available request APIs.

Not listed

machine/ (Input + Output)

schematic-pi/

Schematic of I/O circuitry

KiCad project with a schematic for the state machine's circuitry. To export updated schematic to SVG, select "Plot schematic" from menu.

poller-pi/

Build Status

Physical presence of the state machine in the Design Studio. Bundles sensory inputs into a JSON and sends them to public-endpoint/ over a websocket at / (root) route

public-endpoint/

Build Status

iot.vanderbilt.design (link won't show anything, doesn't serve any actual HTTP stuff)

Websockets server that routes data from the poller-pi to sign/ and site-overrides/ clients. Runs on Heroku, protected behind Cloudflare.

The below documentation is a general description of what's important. There's more specific documentation in the code itself.

  • input
    • / (root) route
      • Receives JSON updates from poller-pi/
    • weather.py Vanderbilt Stadium WeatherSTEM for current weather
      • sometimes returns gibberish, only displayed if there is a degrees symbol in it
    • mentors.py Google Sheet containing mentor shifts
  • output
    • /sign route
      • Serves open status to sign/ clients
    • /printers route
      • Serves printer images to site-overrides/ clients
    • /hours route
      • Serves calculated hours for the Design Studio
  • logic (main.py)
    • input-dependent
      1. Receive update from poller-pi. If no update received within 30s, proceed with an update containing empty state.
      2. Check if update actually changes the state.
      3. If so, send the updated states to clients connected to output endpoints. Else, do nothing.
      4. Repeat
    • output-dependent
      • client joins
        1. Send current state
        2. Add to keep-alive list
      • client leaves
        1. Remove from keep-alive list
      • keep alive (needed to stop Heroku from dropping long-running connections)
        1. Send current state to all clients every 50s

output/ (Pure Output)

- Live Printer Feeds
- Live Sign Status
- Live Hours
- Current Schedule

sign/

Netlify Status

sign2.vanderbilt.design

React single-page progressive web app served by Netlify. Displays whether open, mentors if open, weather, and time.

Two outputs:

  • Sign as an iframe on vanderbilt.design
  • Fullscreen Chromium tab in Kiosk Mode on Raspberry Pi connected to two monitors
    • This is the same pi as poller-pi/ and driver-pi/

site-overrides/

Netlify Status

Affects main site, vanderbilt.design.

Originally written by @yunyu, various visual improvements/fixes to the Design Studio Wordpress website including but not limited to:

  • Add printer live feeds
  • Add status sign
  • Add dynamic hours
  • Hide unfriendly youtube video & Vanderbilt social media links
  • Make Wordpress theme column-sizes expand/contract properly on desktop and mobile

driver-pi/

Client of public-endpoint at /sign route that runs on the Pi. Drives MOSFET gate pin to HIGH to activate relay. Changes synchronously with sign/.

T9A.pdf

T9AS1D12-5 SPST 5VDC Relay used to switch 120VAC for the traditional open sign above the door.

  • Switches black cable connection
  • White and green are connected directly

2N7000-D.pdf

N-type Signal MOSFET that hooks GND on the Raspberry Pi to the relay. 3.3V I/O pins are not powerful enough to drive the relay so this is needed to do the heavy lifting.

About

Code and Designs for the Design Studio as a State Machine (Sign, Realtime Sign Status + Printer Feeds, and Scheduler)

Resources

License

Releases

No releases published

Packages

No packages published