Code Monkey home page Code Monkey logo

paniq-room-props's Introduction

paniq-room-props

paniq-room-props is a MicroPython library to program escape room props by microcontrollers with internet capabilites. The library detects and sets up the networking capabilites of the board (Wifi or Ethernet), makes it to operate as an MQTT client and gives standard programmable endpoints to customise the prop to behieve uniquely on certain MQTT and sensor events.

Supported devices:

Installation

1. Install the correct MicroPython firmware

Different boards require different MicroPython firmwares:

Download the correct UF2 file from the list above and install it onto the board:

  • Push and hold the BOOTSEL button and plug your board into the USB port of other computer. Release the BOOTSEL button after your Pico is connected. It will mount as a Mass Storage Device called RPI-RP2.
  • Drag and drop the MicroPython UF2 file onto the RPI-RP2 volume. Your Pico will reboot. You are now running MicroPython.

2. Transfer the project files to your board

Transfer the following files and directories to your device with the Thonny IDE or without Thonny.

|- lib (dir)
|- paniq_prop (dir)
|- config.py
`- main.py

IMPORTANT: At the next restart the board will connect to the network and will start operating as an MQTT client but the prop is not expected to be working at this stage. You need to provide unique configuration to each props by following the next step.

3. Edit config

The configuration is unique across all props. It details the board type, the network connections and the unique behaviour what to do in the game. You need to configure all prop differently according to what you want to use them in the game. You can find example configurations in the example-configs directory.

Open the config.py on the board by Thonny and edit it directly. You will need change at least the following properties to fit to your environment:

# MQTT topic names will be derived from the prop name. Make it unique acress all props
PROP_NAME = "Prop1"

# WIFI details for Raspberry PI Pico W
WIFI_SSID = "your-ssid"
WIFI_PASSWORD = "your-secret"

# Ethernet details for Wiznet W5100S-EVB-Pico
# There is no DHCP client in the etnernet driver so you need to specify all interface details
ETH_IP="192.168.1.20"

# IP of your MQTT broker
MQTT_SERVER_HOST="192.168.1.66"
# Make the MQTT client ID unique across all the props
MQTT_CLIENT_ID="Wiznet W5100S-EVB-Pico ETH 1"

# Topic patters need be in sync with your room server settings
MQTT_TOPIC_PREFIX = "Room/TestRoom"

# Topics to receive messages from
MQTT_TOPICS_TO_SUBSCRIBE = [
    # Subscribe to topics with room server control messages
    f"{MQTT_TOPIC_PREFIX}/Control/game:players",
    f"{MQTT_TOPIC_PREFIX}/Control/game:scenario",

    # Subscribe to the prop's own inbox topic
    MQTT_TOPIC_PROP_INBOX,
]


# Modify this function to do something specific on incoming MQTT messages
def on_mqtt_message(topic: str, msg: str):
    ...

# Modify this function to do something specific in the main loop
# Typically checking sensors, setting pin values and sending MQTT messages
from paniq_prop.mqtt import Mqtt
def check_sensors(prop_runtime_secs: int, mqtt: Mqtt):
    ...

If required set other details in the config.py.

In Action

paniq-room-props are compatible with xcape.io Room Server.

Xcape.io

paniq-room-props's People

Contributors

attila-giday avatar koszti avatar

Watchers

 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.