https://github.com/redduckbot/discord-laser-tripwire-bot
Laser trip wire setup involves a Discord bot that notifies you.
https://github.com/redduckbot/discord-laser-tripwire-bot
discord discord-bot laser raspberrypi tripwire
Last synced: 2 months ago
JSON representation
Laser trip wire setup involves a Discord bot that notifies you.
- Host: GitHub
- URL: https://github.com/redduckbot/discord-laser-tripwire-bot
- Owner: RedDuckBot
- Created: 2024-07-30T21:46:58.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-08-04T05:08:41.000Z (10 months ago)
- Last Synced: 2025-02-13T07:35:23.357Z (4 months ago)
- Topics: discord, discord-bot, laser, raspberrypi, tripwire
- Language: Python
- Homepage:
- Size: 9.53 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Watch Laser Trip Wire with Discord Bot
This project utilized two Discord bots to watch a laser trip wire where a master bot,
named Wire_Bot, a.k.a Hal, who responded to certain commands in general chat. The images below demonstrate what prompts Hal would respond to, and the last two pictures show a simple setup for the trip wire.
![]()
![]()
![]()
![]()
# Hardware & Circuits
Here's a list of components used in the project:| |Components |
|--| --|
|1| Raspberry Pi 3B+ |
|2| Light Dependent Resistor (LDR)|
|3| 1uF Capacitor|
|4| N-MOSFET|
|5| 470Ω Resistor|
|6| 5V Laser Diode|Next, lets take a look at the two circuits.
### Light Sensor Circuit
![]()
### Laser Circuit
![]()
# Setup & Run Application
Create two Discord bots and provide them with read and send permissions for your chosen server. The bot Wire_Bot, the master bot, responds to chat commands and since we don't want this bot to be blocked when watching the trip wire, another bot, Watch_Bot, is assigned this task (which was only used to log on to noftify general chat that the wire has been tripped, and then immediately logs off).### Test Circuits
After setting up both the laser and light sensor circuits make sure they are working by using the 'test_devices.py'.### Store Bot Tokens & Define General Chat ID
In the root directory of the project create a file '.env'. This will contain a safe place for storing the tokens for the bots. Add the tokens and the following variables to '.env':
```
DISCORD_TOKEN=[Add token for Wire_Bot]
DISCORD_TOKEN2=[Add token for Watch_Bot]
```
Next, in files 'main.py' and 'watch_bot.py', there is a global variable called 'GENERAL_CHANNEL_ID', that must be defined using your server's general chat ID.### Run Main
Finally, install necessary packages used in this project:
```
pip install -r ./docs/requirements.txt
```Then, start running the application:
```
python main.py
```Expect the bot, Hal, to greet you in general chat, as shown in the bellow image:
![]()
When done with application, close main program with 'Ctrl + c'