Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brianlesko/dualsense-arduino-pwm-wifi
Control the PWM output of an arduino using a dualsense PS5 controller through wifi
https://github.com/brianlesko/dualsense-arduino-pwm-wifi
Last synced: about 20 hours ago
JSON representation
Control the PWM output of an arduino using a dualsense PS5 controller through wifi
- Host: GitHub
- URL: https://github.com/brianlesko/dualsense-arduino-pwm-wifi
- Owner: BrianLesko
- License: mit
- Created: 2024-01-30T00:30:06.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-04-03T00:18:04.000Z (7 months ago)
- Last Synced: 2024-04-03T01:42:30.349Z (7 months ago)
- Language: Python
- Size: 38.6 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE.md
Awesome Lists containing this project
README
# wireless arduino control using a PS5 controller
Control a Pulse Width modulation (PWM) pin of an Arduino ESP32 microcontroller using a Dualsense PS5 remote, wirelessly over a wifi network.
## Dependencies
This code uses the following libraries:
- `streamlit`: for building the user interface.
- `numpy`: for creating arrays.
- `matplotlib`: for plotting the stepper motor visualization
- `hidapi`: for accessing usb connections on the host device
## Usage
1. fork the repository
2. change the wifi SSID and password as well as the PS5 remote vendorID and productID in 'app.py'
4. Run the arduino nano.py file on an arduino nano esp32 running mircopython
5. run the streamlit app with the following command in your terminal
```
Streamlit run app.py
```This will start the local Streamlit server, and you can access the interface by opening a web browser and navigating to `http://localhost:8501`.
## How it Works
The app as follows:
1. The hidapi library is used to initiate a connection to the PS5 controller
2. The dualsense class is used to decode the received bytes
4. the matplotlib library is used to create a visualization of the received signal from the triggers
3. Streamlit is used to display the figure
4. The ethernet class and UDP Socket communication is used to send the bytes to an IP address
5. The app loops indefinitely until quit
6. The Arduino connects to the internet, then receives the UDP signal and decodes it, then sets its PWM pin appropriately.
## Repository Structure
```
repository/
├── app.py # the code and UI integrated together live here
├── customize_gui # class for adding gui elements
├── dualsense.py # The class used to decode received bytes from the wired controller
├── requirements.txt # the python packages needed to run locally
├── .gitignore # includes the local virtual environment named my_env
├── ethernet.py
├── robot.py
└── docs/
└── preview.png # preview photo for Github
```
## Topics
```
Python | Streamlit | Git | Low Code UI
Sketchpad | HIDapi | decode bytes | PS5 | Sony | Dualsense | external device | communication
custom classes
Self taught coding | Mechanical engineer | Robotics engineer
```
╭━━╮╭━━━┳━━┳━━━┳━╮╱╭╮ ╭╮╱╱╭━━━┳━━━┳╮╭━┳━━━╮
┃╭╮┃┃╭━╮┣┫┣┫╭━╮┃┃╰╮┃┃ ┃┃╱╱┃╭━━┫╭━╮┃┃┃╭┫╭━╮┃
┃╰╯╰┫╰━╯┃┃┃┃┃╱┃┃╭╮╰╯┃ ┃┃╱╱┃╰━━┫╰━━┫╰╯╯┃┃╱┃┃
┃╭━╮┃╭╮╭╯┃┃┃╰━╯┃┃╰╮┃┃ ┃┃╱╭┫╭━━┻━━╮┃╭╮┃┃┃╱┃┃
┃╰━╯┃┃┃╰┳┫┣┫╭━╮┃┃╱┃┃┃ ┃╰━╯┃╰━━┫╰━╯┃┃┃╰┫╰━╯┃
╰━━━┻╯╰━┻━━┻╯╱╰┻╯╱╰━╯ ╰━━━┻━━━┻━━━┻╯╰━┻━━━╯
follow all of these for pizza :)