Welcome to this tutorial on creating a triggerbot using Python and an Arduino Pro Micro. This guide will walk you through the process, from setting up your development environment to configuring the Arduino and Python scripts. By the end, you’ll have a functioning trigger bot that can be used in games with color detection.
Github Source: https://github.com/slyautomation/color-triggerbot
For the video guide watch this!
Requirement
- Hardware: Arduino Pro Micro (or any Arduino compatible with USB HID), USB cable.
- Software: PyCharm, Arduino IDE, Python 3.10, Git.
Amazon:
Item | Image | Cost ($USD) |
KEYESTUDIO Leonardo R3 Microcontroller Development Board with USB Cable Kit | $13.99 | |
Arduino USB Host Shield | $21.99 | |
Arduino Leonardo R3 | $24.90 | |
Soldering Iron | $9.99 | |
Solder Wire | $8.99 | |
Arduino Pro Micro | $18.88 |
Aliexpress:
Step 1: Set Up Your Development Environment
1.1 Install PyCharm
Download and install PyCharm from JetBrains. Need a guide to install pycharm and python? Check out this guide! Install Pycharm and Python: Clone a github project
1.2 Clone the Slip Automation GitHub Repository
Open a terminal and clone the repository:
git clone https://github.com/slyautomation/color-triggerbot.git
Or copy the contents from https://github.com/slyautomation/color-triggerbot
1.3 Open the Project in PyCharm
- Launch PyCharm.
- Open the cloned repository folder in PyCharm.
1.4 Set the Python Interpreter
- Go to
File > Settings > Project: <your_project_name> > Python Interpreter
. - Select Python 3.10. If it’s not listed, click the gear icon and add Python 3.10.
Step 2: Configure Arduino
2.1 Install the Arduino IDE
Download and install the Arduino IDE from Arduino’s website.
2.2 Add Necessary Libraries
- Download the HID Mouse Reports library from this link.
- Copy the folder and paste it into the Arduino libraries directory (usually found in
Documents/Arduino/libraries
).
2.3 Load the Arduino Script
- Open the Arduino IDE.
- Open the script from the cloned repository that corresponds to the Arduino Pro Micro.
- For the Pro Micro, you’ll use
adruino_keyboard_press.ino
.
- Select the correct board (
Arduino Pro Micro
) and port from theTools
menu.
- Click
Verify
to compile the script. - Click
Upload
to upload the script to your Arduino.
Step 3: Configure Python Script
3.1 Install Required Python Packages
In PyCharm, open the terminal and run the following commands:
pip install opencv-python
pip install keyboard
3.2 Update Script Settings
Open the Python script in the repository and make the following changes:
- Port Configuration: Ensure the COM port in the script matches the port your Arduino is connected to. This is typically something like
COM12
. - Color Configuration: Update the color value in the script to the color you want the trigger bot to detect. For example:
color_to_use = 'red'
if color_to_use == 'purple':
lpoint = [135, 35, 20]
upoint = [155, 255, 255]
if color_to_use == 'yellow':
lpoint = [22, 46, 255]
upoint = [38, 255, 255]
if color_to_use == 'red':
lpoint = [0, 90, 90]
upoint = [4, 235, 255]
Color Configuration:
To change the trigger bot to detect cyan color using HSV (Hue, Saturation, Value) color space, you need to set the lower and upper thresholds for the cyan color. The HSV values for cyan typically range as follows:
- Hue: around 80 to 100 (depends on the exact shade of cyan)
- Saturation: 100 to 255 (depends on how vibrant the cyan is)
- Value: 100 to 255 (depends on the brightness of the cyan)
# Define the lower and upper thresholds for cyan in HSV color space
lpoint = [80, 100, 100]
upoint = [100, 255, 255]
3.3 Run the Python Script
- Right-click the script in PyCharm.
- Select
Run
.
Step 4: Testing and Adjustments
4.1 Open a Game with Color Detection
Launch a game that uses color detection for triggering actions (e.g., shooting when a specific color is detected on the screen).
4.2 Configure In-Game Settings
- Change the secondary firing option in your game settings to match the key press defined in your Arduino script.
- Or if using a usb host shield no change is needed as you can still use the aimbot ino to action the clicks, the python code for the triggerbot will only send mouse clicks instead of movement as well.
4.3 Test the Trigger Bot
- Move the in-game crosshair over the target color.
- The trigger bot should automatically trigger the firing action.
Step 5: Optional Adjustments
5.1 Adjust Color Detection Parameters
- If the trigger bot is not responsive, tweak the color detection parameters.
- Uncomment the display lines in the Python script to visualize the detection process:
- Line 75, 76, 85 and 86
75 #cv2.drawContours(image, contours, -1, (255, 0, 0), 1)
76 #cv2.circle(image, (pt[0], pt[1]), radius=1, color=(0, 0, 255), thickness=-1)
....
85 #cv2.imshow("images", image)
86 #cv2.waitKey(5)
5.2 Fine-Tune Firing Modes
- The script supports different firing modes such as pistol and auto. Adjust these modes using function keys (F1, F2, F3) as defined in the script.
5.3 Error Handling
- If you encounter any errors, ensure all dependencies are correctly installed.
- Check for any missing libraries and install them via PyCharm’s terminal or the Arduino Library Manager.
Conclusion
You’ve now set up a functional trigger bot using Python and an Arduino Pro Micro. This setup can be customized and extended for various use cases in gaming and automation. Experiment with different settings and fine-tune the system to your needs. Enjoy your new trigger bot!
Here’s a demo in deathmatch!
Hi!, I seem to get to the point where i have the images window showing me the contours of the color detected, but for some reason i cant get either the micro pro or leonardo with usbhost to send a click or keyboard press when the contoured color is passed over with the mouse, I tried all 3 ino files, i have tried all your other projects with success, not sure why this one is stumping me. It must be a problem with my .py file somewhere? I have all dependencies? Your valorant aimbot works very well through my leonardo with usb shield so not sure why not this one? As they seem similar in respect where you can use the aimbot.ino for this trigger bot and also the normal aimbot. Thanks for your work!
What is the difference between using Pro Micro and Arduino Leonardo? You didn’t really explain much why it is useful here.
радиаторы отопления трубчатые вертикальные купить http://www.vertikalnyeradiatory.ru.