Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/brianlesko/dualsense-arduino-pwm-serial

Control the PWM signal of an arduino with a dualsense controller. Both devices wired into the same computer
https://github.com/brianlesko/dualsense-arduino-pwm-serial

Last synced: about 20 hours ago
JSON representation

Control the PWM signal of an arduino with a dualsense controller. Both devices wired into the same computer

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
```
 


 

╭━━╮╭━━━┳━━┳━━━┳━╮╱╭╮ ╭╮╱╱╭━━━┳━━━┳╮╭━┳━━━╮
┃╭╮┃┃╭━╮┣┫┣┫╭━╮┃┃╰╮┃┃ ┃┃╱╱┃╭━━┫╭━╮┃┃┃╭┫╭━╮┃
┃╰╯╰┫╰━╯┃┃┃┃┃╱┃┃╭╮╰╯┃ ┃┃╱╱┃╰━━┫╰━━┫╰╯╯┃┃╱┃┃
┃╭━╮┃╭╮╭╯┃┃┃╰━╯┃┃╰╮┃┃ ┃┃╱╭┫╭━━┻━━╮┃╭╮┃┃┃╱┃┃
┃╰━╯┃┃┃╰┳┫┣┫╭━╮┃┃╱┃┃┃ ┃╰━╯┃╰━━┫╰━╯┃┃┃╰┫╰━╯┃
╰━━━┻╯╰━┻━━┻╯╱╰┻╯╱╰━╯ ╰━━━┻━━━┻━━━┻╯╰━┻━━━╯

 

X Logo             GitHub             LinkedIn

follow all of these for pizza :)