setup - smouldery/shock-collar-control GitHub Wiki
NOTE: this has been tested on Raspbian GNU/Linux 9 (stretch), and the automated script SHOULD work from a clean install once you have a working internet connection (this is required). results on other versions or on an existing raspbian 9 install.
refer to the below images for a pinout first, the pi: pin 2 and 4 are 5v, one to each module. pin 9 and 14 are GND. you can use any GND but each module needs one. pin 11 is the TRANSMITTER data line and pin 13 is the RECEIVER data line.
RECEIVER pinout:
TRANSMITTER pinout:
NOTE: this has been tested on Raspbian GNU/Linux 9 (stretch), and the automated script SHOULD work from a clean install once you have a working internet connection (this is required). results on other versions or on an existing raspbian 9 install.
- get your raspberry pi working and connected to the internet, with a working install of Raspbian, and make sure hardware
- navigate to the folder you'd like to install it. this is usually your home drive (you can use
cd ~/
to do this) - download https://raw.githubusercontent.com/smouldery/shock-collar-control/master/setup.sh to your pi - you can use the following command:
wget https://raw.githubusercontent.com/smouldery/shock-collar-control/master/setup.sh
- make sure your discord bot is set up and you have the token, for help on this see this guide
- make the script executable with
sudo chmod +x setup.sh
- run the script and provide your TOKEN when prompted, using
sudo ./setup.sh
(the script has to run as root due to the files we're modifying, and since we're installing packages.). this script will reboot your pi and it SHOULD start your bot automatically (make sure it's been invited to a channel). if it doesn't work first time, try rebooting your pi withsudo reboot
manual install - most of these need to be run as root, the code will assume you're using 'sudo' not logged in as root.
- update package list with
sudo apt-get update
- install python and pip, and pigpio + python3 pigpio
sudo apt-get install python3 python3-pip pigpio python3-pigpio
- install python module with
sudo pip3 install discord
- make the main bot directory with
sudo mkdir /opt/collarbot/
- download the python script and config file from github with
sudo wget -O /opt/collarbot/collarbot.py 'https://raw.githubusercontent.com/smouldery/shock-collar-control/master/collarbot.py'
andsudo wget -O /opt/collarbot/collarbot_config.py 'https://raw.githubusercontent.com/smouldery/shock-collar-control/master/collarbot_config.py'
- add your bot token to the config file
sudo echo "TOKEN = '<yourtoken>' >> /opt/collarbot/collarbot_config.py
(replace with your discord bot token before running this!) 6.5 set permissions on these filessudo chown -R nobody /opt/collarbot/
andsudo chmod -R 755 /opt/collarbot/
- download the systemd service using
sudo wget -O /etc/systemd/system/collarbot.service 'https://raw.githubusercontent.com/smouldery/shock-collar-control/master/collarbot.service'
- add user 'nobody' to gpio user group
sudo usermod -a -G gpio nobody
8.5 set permissions on systemd servicechmod 755 /etc/systemd/system/collarbot.service
- reload systemd using `sudo systemctl daemon-reload
- enable the pigpio daemon to start on boot and start it
sudo systemctl enable --now pigpiod
- enable start on boot for your bot using
sudo systemctl enable --now collarbot
(also starts it)
in 5-10 seconds your bot should be working - no reboot required!
make sure your collar is on etc. follow the 'encoding' instructions for your collar but transmit using the BOT not the remote to encode it to the bot. i'm working on a way to have both the remote and the bot work at once but with the current code that won't be possible.
you can check the transmitter is working in theory by using something like piscope to check pin 17 is transmitting.
if you have a receiver connected, you can also use piscope to check it's transmitting correctly (check pin 27)