Author Topic: Improving PWM on a DIY Player piano  (Read 883 times)

0 Members and 1 Guest are viewing this topic.

Offline jord4231Topic starter

  • Regular Contributor
  • *
  • Posts: 91
  • Country: au
Improving PWM on a DIY Player piano
« on: May 04, 2021, 07:48:54 pm »
I'm looking for some ideas please.
Recently I have completed converting a regular upright piano in to a player piano.
It uses 88 24v solenoids that press the back of a piano key directly under the point where the mechanical action of the piano operates.

The solenoids are connected to shift registers (via a npn transistor) the shift registers are driven by an arduino that receives midi commands.
This all works ok however I find the fastest pwm frequency I can get is around 100hz. I feel this is a limitation of the arduino driving the 11 x 74HC595 .
This is not a problem if I am wanting to play full velocity notes, when I want to play softer or lower velocity notes I tend to find the solenoids will not fire or if they do they buzz loudly... too slower of a frequency I feel I need to be up around 100khz or so.

So I'm looking for some ideas to speed things up.
Ideally I'd like to continue using the shift register boards as all the transistors are soldered on to that board, quite a lot of them...
My thoughts so far are
1 Replace the arduino with something faster
2 Use a separate micro controllers for each of the shift register boards, maybe this will help dedicate more speed to each shift register board?
3 Replace the shift registers with dedicated multi channel pwm boards - last resort.
I'm sure that someone here will have a cleaver idea or two any help or tips would be great!

This is a link to the piano in action. I have since completed it but have not yet taken any video.
https://youtu.be/xp2ocvnNoJs
And yes the piano needs tuning!  :-DD

Offline phil from seattle

  • Super Contributor
  • ***
  • Posts: 1029
  • Country: us
Re: Improving PWM on a DIY Player piano
« Reply #1 on: May 06, 2021, 02:34:16 am »
Are you bit banging the '595s?   Then, a faster micro might make sense.  Or use DMA.  Or maybe SPI. 

If you use a RasPi Pico, you could use PIO. A group I'm working with is getting very good performance using PIO to output to a 74HCT595 chain.
« Last Edit: May 06, 2021, 02:36:11 am by phil from seattle »
 
The following users thanked this post: jord4231

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9008
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: Improving PWM on a DIY Player piano
« Reply #2 on: May 06, 2021, 03:06:00 am »
Consider a FPGA, something like an ICE40 would be a good start. Rewire the shift register inputs so that each one has its own data line from the FPGA, with shared clock and latch enable.

On tuning the piano, since the piano can play itself, write an app to play each note while using a microphone to check the frequency, then have it check each frequency against what it should be. I suppose the next logical step is to make it self tuning but that could get very complicated... Just telling which notes need adjusting and by how much would already help a lot.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 
The following users thanked this post: jord4231

Offline MathWizard

  • Super Contributor
  • ***
  • Posts: 1421
  • Country: ca
Re: Improving PWM on a DIY Player piano
« Reply #3 on: May 06, 2021, 09:06:07 am »
Cool project, if I was to ever attempt such a thing for my parent's piano, if u don't mind me asking about how many Yankee bucks is a project like this ? Was it hard to fit in the piano, any pictures ?
 
The following users thanked this post: jord4231

Offline Jan Audio

  • Frequent Contributor
  • **
  • Posts: 820
  • Country: nl
Re: Improving PWM on a DIY Player piano
« Reply #4 on: May 06, 2021, 03:47:10 pm »
You need a DAC for fastest response, PWM always need some smoothing.
You need a DAC for every note ?, use 1 DAC with many S&H.
« Last Edit: May 06, 2021, 03:48:46 pm by Jan Audio »
 
The following users thanked this post: jord4231

Offline jord4231Topic starter

  • Regular Contributor
  • *
  • Posts: 91
  • Country: au
Re: Improving PWM on a DIY Player piano
« Reply #5 on: May 15, 2021, 10:59:56 pm »
Cool project, if I was to ever attempt such a thing for my parent's piano, if u don't mind me asking about how many Yankee bucks is a project like this ? Was it hard to fit in the piano, any pictures ?
MathWizard I cost around $1000 AUD -  700 or so usd? including the piano

The internals excuse the cable management for now still got to get to that.

Are you bit banging the '595s?   Then, a faster micro might make sense.  Or use DMA.  Or maybe SPI. 

If you use a RasPi Pico, you could use PIO. A group I'm working with is getting very good performance using PIO to output to a 74HCT595 chain.

This is what I'm looking in to thanks Phil lots of research to do. Cheers

Offline jmelson

  • Super Contributor
  • ***
  • Posts: 2765
  • Country: us
Re: Improving PWM on a DIY Player piano
« Reply #6 on: May 16, 2021, 03:18:32 am »
I know you could do way better with a Beagle Bone, using the PRU microcontrollers.  There are a pair of 200 MHz 32-bit microcontrollers designed for fast I/O.  They have a limited number of direct I/O pins that can be toggled at 5 ns intervals.  I've used it on a couple projects where I needed faster I/O.

The PRUs have limited code space and limited dual port memory, but it should be plenty for this appilcation.

Jon
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf