ddribin / piano-lights-sw

Displays lights (LEDs) over piano keys
MIT License
3 stars 1 forks source link

Wiring diagram? #1

Closed freakintoddles2 closed 7 months ago

freakintoddles2 commented 7 months ago

Hey, this is super cool. I have been wanting to build something like this and could not find a decent code example to look at.

I am a relative novice with this sort of thing but I have built similar in the past and I'm sure I can figure this out too.

Do you happen to have a wiring diagram showing how everything is supposed to be wired up? The software part seems straightforward enough, just would love to either get a diagram or just some pictures maybe of how everything is connected on the hardware side. Cheers.

freakintoddles2 commented 7 months ago

also @ddribin I was wondering, do you think this chip https://www.tindie.com/products/badassmidi/midi-chip-midi-io-circuit-in-a-tiny-board-2pk/ would work fine vs the sparkfun one you used? If I'm just wanting to make a basic version, it didn't seem like the potentiometers were necessary. Thanks in advance for your help!

ddribin commented 7 months ago

Hi! Thanks for the kind words! The PCB design is in another repo:

https://github.com/ddribin/piano-lights-hw

If you go to the "Releases", I have a PDF of the schematic as well as 3D renders of the board, both front and back.

I don't have a whole lot of photos (I swear I had more photos), but here's some of the v2.0 insides and v3.0 in the case. The only difference between 2.x and 3.x is how the lights are hooked up. In v3.x, I added a connector instead of the wires being soldered straight to the board.

Piano Lights Insides v2 0 0

Piano Lights Final v3 0 1

ddribin commented 7 months ago

I didn't take a super detailed look at that board, but it looks okay, from a quick glance. It does have an optocoupler (H11L1) for isolation, but it is missing the DIN connectors, so you'll still need those to plug your cables in.

freakintoddles2 commented 7 months ago

@ddribin wow very nice pcb! Do you sell these or did you just make them for personal use?

freakintoddles2 commented 7 months ago

Also thanks for getting back to me here. This additional info is just what I needed to get started.

ddribin commented 7 months ago

Just made for myself. I hand soldered a couple of the boards.

freakintoddles2 commented 7 months ago

@ddribin I got my hardware and wired up everything on a breadboard for a simple PoC. I am using an esp8266, the midi chip I mentioned above, and a SK9822 led strip.

I updated the code to reference the pins I'm using for the most part, but I am confused about the following and would really appreciate your guidance:

Thank you in advance! Cheers.

ddribin commented 7 months ago

Hi. There is no constant for MIDI RX. It is set up automatically using MIDI_CREATE_DEFAULT_INSTANCE(), which uses the "default" serial port pins:

https://fortyseveneffects.github.io/arduino_midi_library/a00023.html

For Arduino's, there is only one hardware UART RX on pin 0:

https://www.arduino.cc/reference/en/language/functions/communication/serial/

You may need to explicitly set this using MIDI_CREATE_INSTANCE().

PIN_LED_GRN and PIN_LED_RED were originally mapped to the LEDs on the SparkFun MIDI shield, which are on pins 6 and 7 respectively:

https://www.sparkfun.com/products/12898

But, on my v2 and v3 PCBs, I moved PIN_LED_RED to pin 3 because it was easier to layout that way. PIN_LED_GRN is still set to pin 6, but it is not connected on my PCB. You can see this reflected in the hardware-v2 branch:

https://github.com/ddribin/piano-lights-sw/blob/hardware-v2/src/main.cpp

freakintoddles2 commented 7 months ago

Thanks for the response, I got it working! I really appreciate your help here. Cheers.

freakintoddles2 commented 7 months ago

@ddribin I wanted to share some updates I made to your code for my use case - I used the blur1d() function from fastLED library to spread the light out a bit more and fade the light instead of only lighting up a single led per key, then I also added an array to store key velocity, and started tracking the state of the sustain pedal

I am using them to control brightness of the LEDs based on key press velocity, and then also fade out the leds at different rates depending on whether the sustain pedal is being used. All in all, I think it visually makes a nice enhancement to make the LEDs more expressive to reflect how the piano is being played.

https://github.com/freakintoddles2/piano-lights-sw-enhanced/blob/main/src/main.cpp you can check out the updates there, I just forked your repo and manually pasted in my main.cpp code not all the other libraries etc yet (will figure that out later)

https://photos.app.goo.gl/typxAoGbPmAJpxPf7 here's a video of how it looks, let me know what you think! Also if you really like it, feel free to incorporate the visual updates I made into your version. Cheers.

ddribin commented 6 months ago

@freakintoddles2 Nice work! That looks super cool!