Skip to content

Commit

Permalink
Updated README, Added Pinout Diagram, Adjustments to Code
Browse files Browse the repository at this point in the history
  • Loading branch information
ArlanPrado committed Apr 4, 2021
1 parent d8185f5 commit 5b752a1
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 13 deletions.
Binary file added Pinout Diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 41 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,45 @@
# RPico-Clone-Hero-Controller
Clone Hero guitar controller made with using Raspberry Pi Pico and CircuitPython.
# Raspberry Pico Guitar Hero Controller
Clone/Guitar Hero guitar controller made with using Raspberry Pi Pico and CircuitPython. Make anything a Guitar Hero controller!

Environment: MU editor + CircuitPython v6.2.0-rc.0 + adafruit_hid library
CircuitPython v6.2.0-rc.0 + adafruit_hid library

Uses the keyboard in Clone Hero.

Will upload a circuit diagram and maybe a video on me modding it.
## Instructions

Currently a work in progress.
1. Connect your Raspberry Pico to your pc and load into it CircuitPython.

2. Have code.py and adafruit_hid library downloaded. Load code.py into circuitpy and adafruit_hid into the "lib" folder.

[If you don't care about configuring the whammy and joystick skip this step]

3. Make sure the Pico has the Male Pin Header Connectors to connect your analog sticks and buttons. Open up the Guitar Hero guitar and check your values of the joystick and the whammy bar. For maximum usage of the whammy and joystick, modify the gamepad.move_joysticks values set in the while loop to your liking. Here's an example of how to modify the joysticks:

Enter statement "print(ana_whammy.value)" and "time.sleep(0.1)"
If the "zero" value of whammy bar is 31,000 then go down to at least 30,000 in the next operation.
Next "print(ana_whammy.value-30,000)"
If the maximum value of the whammy bar is around 24,000 go to at most 25,000.
You should have (ana_whammy.value-30000)/25000. Replace the previous value with this operation.

Make sure to save the code! The pico should light up if it works.

4. Connect your Pico with the controller buttons and analog sticks you want to use (pico diagram is included). Basic circuitry knowledge is recommended. Use a soldering iron, solder wick (in case of mistakes), wire (26AWG<), dupont jumper wires (male to female), and switches (Kailh low profile choc red for frets and Kailh BOX navy for strumbar).

5. To test out the controller search "Set Up USB game controllers" on Windows and select CircuitPython HID. You should be able to see all the buttons you connected working.

6. Set up controller in Clone Hero and enjoy!

## Resources

### Library and Driver

[CircuitPython for Pico Download](https://circuitpython.org/board/raspberry_pi_pico/)

[Adafruit CircuitPython HID Library](https://github.com/adafruit/Adafruit_CircuitPython_HID/releases)

### Helpful Resources

[How to Replace Fret Pads with Mechanical Keyswitches!](https://www.youtube.com/watch?v=wVMz653ncTs)

[How to use CircuitPython with Raspberry Pi Pico](https://dronebotworkshop.com/pi-pico-circuitpython/)

[Guitar Hero USB Controller w/Arduino and Java](https://www.instructables.com/Guitar-Hero-USB-Controller-With-Arduino/)
16 changes: 9 additions & 7 deletions code.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,9 @@

# button dictionary to the gamepad buttons
# current problem: want btn_plus and btn_minus to be the same button press. not possible
# on dictionary.
# on dictionary

# I think it possible. You can just add in the dictionary = {button_number: [btn_plus, btn_minus]}
# Then you'd have to iterate it differently and check if the value is a list and etc.
# Might not be elegant, but should be possible.

# cannot put btn as key, must be simple immutable datatype and hashable!
# cannot put btn as key, must be simple immutable datatype
buttons = {5 : btn_green, 2 : btn_red, 6 : btn_yellow, 1 : btn_blue,
9 : btn_orange, 3 : btn_star, 4 : btn_plus, 7 : btn_minus, 13 : btn_up, 14 : btn_down}

Expand All @@ -90,9 +86,15 @@
gamepad.press_buttons(gamenum)
else:
gamepad.release_buttons(gamenum)

# the limit on each analog stick is by the first value
# make limit -127 to 127
# adjust your joystick until limits are -127 to 127

gamepad.move_joysticks(int(ana_joy_x.value/64000 * 127 * 2 - 127),
int(ana_joy_y.value/65000 * 127 * 2 - 127),
int(ana_whammy.value/65520 * 127 * 2 - 127), None)
int((ana_whammy.value-30000)/25000 * 127 * 2 - 127), None)

#time.sleep(0.1)
#print(((ana_whammy.value-30000)/25000))

0 comments on commit 5b752a1

Please sign in to comment.