This project allows you to control and monitor a camera over a WebSocket connection using a button and a NeoPixel indicator on a CircuitPython-supported microcontroller.
- Button Control:
- Single press toggles the camera's recording state.
- Double press disconnects from the camera.
- State Monitoring:
- Displays the camera's current state using a NeoPixel indicator:
- Green: Idle
- Red: Recording
- Yellow: Transition to idle
- Displays the camera's current state using a NeoPixel indicator:
- WebSocket Communication:
- Communicates with the camera server to send and receive commands.
-
Prepare Your CircuitPython Board:
- Install the latest version of CircuitPython on your board.
- Add the code.py file,
cpwebsocketsandlib/folder to the root of your board.
-
Configure Your Settings:
- Edit the
main.pyfile to replace:SSIDwith your Wi-Fi network name.PASSWORDwith your Wi-Fi password.WEBSOCKET_URLwith the WebSocket URL of your camera (e.g.,ws://<camera_ip>:<port>/rcp).
- Edit the
-
Power the Board:
- Connect the board to power. It will automatically connect to Wi-Fi and the camera's WebSocket server.
-
Interact with the Button:
- Single Press: Toggles the camera's recording state.
- Double Press: Disconnects the WebSocket connection.
-
Monitor Camera State:
- The NeoPixel will update based on the camera's current state:
- Green: Idle
- Red: Recording
- Yellow: Transition to idle
- The NeoPixel will update based on the camera's current state:
Replace the placeholders in the code with your values:
# Wi-Fi credentials
SSID = ""
PASSWORD = ""
#Camera IP
IP = ""This code uses a neopixel to reflect the status of the camera, if your board doesn't have a neopixel you can replace the code to use a regular onboard LED
This repository is released under the MIT License.
Using a fork of uwebsockets originally created by danni.