Author Topic: Digital piano build  (Read 1977 times)

0 Members and 1 Guest are viewing this topic.

Offline Phil1977

  • Frequent Contributor
  • **
  • Posts: 731
  • Country: de
Re: Digital piano build
« Reply #25 on: September 20, 2024, 08:57:03 am »
Quote
If 10k would be at switch side of 1k you will be driving IC input with true 0 and not 1/11 of VCC.
Then you could replace 1k with 100k and 47n with 470p to make both state changes with almost the same time constant.

I wish I could understand what you wrote.  :-[

PGPG link proposed to further modify the resistance values to smaller currents and to corresponding lower capacitances. That´s for sure possible but I can't see a strict necessity for it.
With the circuit I proposed your low-level (pressed key) is 1/11 of VCC due to the ratio of the resistors. But that´s absolutely okay, for a 5V-system that means it´s slightly less than 0.5V, and everything below 1.35V is guaranteed to be detected as low by the shift register IC.
 

Offline PGPG

  • Regular Contributor
  • *
  • Posts: 229
  • Country: pl
Re: Digital piano build
« Reply #26 on: September 20, 2024, 12:21:18 pm »
If 10k would be at switch side of 1k you will be driving IC input with true 0 and not 1/11 of VCC.
Then you could replace 1k with 100k and 47n with 470p to make both state changes with almost the same time constant.

I wish I could understand what you wrote.  :-[

I wanted to show you step by step these operations but I have never inserted a graphic at this forum and I see I don't know how to do it.
I have experience only with KiCad forum and there I simply drag-drop file on my post and done. Never had any problem with it.

Here.
Dragging picture at post - not works.
I opened under post "Attachments and other options" and sometimes when I used "Select file" it was added under this box and box all the time said "File not selected".
At the end I managed to have there three lines in each I have file specified (I got it there by "Select file" and "Show all files" and then clicking my file.
In each line I have selected "Inline full-size image" and at the end of my message I have commands attachimg one by one starting from 1 to 3 (and my files have names ending with 1..3 in the same order, but in preview I have as attachment 1 info that here is C:\fakepath\Piano_2.png, but Piano_2 was selected for second attachment and not for first and C:\fakepath is not existing at my PC. Then as attachment 2 the same way is my Piano_3.png listed and then when I would expect attachment 3 I see info "Specified attachment is not availabe" what can be supposed is related to my first attachment that should be before those two. All files were selected by me the same way. Seeing difference I have selected them all once more time step by step.
Let us see what will be really shown.





[ Specified attachment is not available ]

Editing after posting.
I'm surprised that my attachimg=2 and attachimg=3 are shown as first and second (even in preview I see C:\fakepath) and still don't know what is wrong with my attachimg =1 (that should be before them).
So first picture that was a copy of original is simply not visible but those two are two steps previously described by me in text. I wanted to write the right sentences between them but now I don't know which text would be shown where as someway forum software sorts my attachimg differently than I see them in my post text.
« Last Edit: September 20, 2024, 12:28:44 pm by PGPG »
 

Online tooki

  • Super Contributor
  • ***
  • Posts: 12622
  • Country: ch
Re: Digital piano build
« Reply #27 on: September 21, 2024, 11:27:04 am »
Editing after posting.
I'm surprised that my attachimg=2 and attachimg=3 are shown as first and second (even in preview I see C:\fakepath) and still don't know what is wrong with my attachimg =1 (that should be before them).
So first picture that was a copy of original is simply not visible but those two are two steps previously described by me in text. I wanted to write the right sentences between them but now I don't know which text would be shown where as someway forum software sorts my attachimg differently than I see them in my post text.
This forum’s image handling is quite bad, so I have mostly given up trying to put them inline while writing. Most of the time I simply leave them as attachments and refer to them by name in the text, and if I reeeeeallly need them inline, then I do the inline tags as an edit afterwards. (I.e. post the message first, so that the attachments are uploaded and their order becomes known, then go back and edit the post.)
 

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9225
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: Digital piano build
« Reply #28 on: September 21, 2024, 01:13:45 pm »
Have you considered using computer keyboard switches? Those are already optimized for a similar application.
I know, I’ve been thinking about getting a scope for almost 10 years now, but somehow I’ve managed to get by without one so far.
Get a "LHT00SU1" scope + logic analyzer for about $25, used with the free software Sigrok. It's desirable to have one even if you have a nice scope since the record length is only limited by how much RAM your PC has.
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.
 

Offline PGPG

  • Regular Contributor
  • *
  • Posts: 229
  • Country: pl
Re: Digital piano build
« Reply #29 on: September 21, 2024, 02:08:56 pm »
This forum’s image handling is quite bad,

Good to know. I supposed it is only me having a problem with something that should simply be simple.

I suppose (but didn't checked) that may be the reason of my problems was that my files were at drive D:\...\...\...\MyFile.png and after inserting got path C:\fakepath\MyFile.png like software didn't understand that there are more drives than only C: but even having there (in preview) fakepath it found them (only 2 from 3).

By the way.
I didn't found the way to select part of somebodys text and then Quote it (only what I have selected). Is it possible or the only way is to quote all and delete what is not needed?
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 4346
  • Country: nl
Re: Digital piano build
« Reply #30 on: September 21, 2024, 02:51:29 pm »
By the way.
I didn't found the way to select part of somebodys text and then Quote it (only what I have selected). Is it possible or the only way is to quote all and delete what is not needed?

That is what I do too. Delete what is not needed. Have not found another option yet. To split something into separate sections I copy the [quote ..... line.

Offline PGPG

  • Regular Contributor
  • *
  • Posts: 229
  • Country: pl
Re: Digital piano build
« Reply #31 on: September 21, 2024, 07:20:56 pm »
That is what I do too.

I am really surprised. Before recently coming here I was only at one forum (KiCad since 2017). There I just select few words I want to answer for and click Quote and I have them quoted in new post (or in currently edited). If want to add picture, link or zipped project I just drag or copy what I need on my post and I see at once how my post will look like (need not to press Preview).
I came here because if someone asks there electronic question he is told that it is wrong place for his question and he should ask it here.
Here are much more people than there so for me it's really weird that forum software is hard to be used. It practically discourages writing.
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3855
  • Country: nl
Re: Digital piano build
« Reply #32 on: September 21, 2024, 07:42:45 pm »
I see a (probably temporary) circuit built on some matrix board, and that combined with long cables ("long" here is >100mm) is a bad combination. I also do not see any decoupling capacitors on that PCB, which makes the combination even worse.

I suggest you:
1. Add decoupling capacitors to those matrix PCB's.
2. Replace all connectors with IDC headers with at least twice as much pins, and then connect all the odd (or the even) pins to GND. This sort of shields the (presumably) TTL level signals over those cables.

Connecting all odd (or even) pins on an IDC connector is very easy on matrix PCB. Just solder a long wire over one row of the pins.

Do you have an oscilloscope? I guess that reflections and GND bounce and interference / EMC on those long cables with TTL signals will be horrible. Probably it helps if you put 50 to 100 Ohm resistors in series with the outputs of all the TTL IC's. Together with the cable impedance these form a lowpass filter and dampen nasty effects.

Some 20 years ago I built an Eprom programmer connected to an LPT port, and it completely drove me crasy why it did not work. It was mostly TTL IC's on matrix board, but it did have plenty of decoupling capacitors. After a few days of head scratching I built a second PCB, which had exactly the same symptoms. In the end I fixed it (both PCB's) by adding a 10nF capacitor to a signal over the LPT bus that was used as a latch for the TTL chips. Without that capacitor, it did not work reliably at all. With the 10nF capacitor it did work reliably, but only with an LPT cable of upto 1 meter. If I used a longer cable it picked up too much crosstalk and it overwhelmed that capacitor. Back then I did not have an oscilloscope. If you don't have an oscilloscope, go buy one first. Those things are indispensable when designing electronics, even for digital stuff like uC hardware and TTL stuff.
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3249
  • Country: us
Re: Digital piano build
« Reply #33 on: September 21, 2024, 07:58:57 pm »

2. Replace all connectors with IDC headers with at least twice as much pins, and then connect all the odd (or the even) pins to GND. This sort of shields the (presumably) TTL level signals over those cables.


There are only three or so digital signals between the boards. Would using a twisted pair for each signal help (each signal paired with a ground wire)?
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3855
  • Country: nl
Re: Digital piano build
« Reply #34 on: September 21, 2024, 09:24:06 pm »
Twisting the wires would probably also help a bit, but mostly because capacitive coupling is less when the wires are twisted (compared to a flatcable). If you want to go really fancy, you can use RS485 or CAN drivers for twisted pairs and use real differential signalling, That would be good for long distances but it's much overkill here.

But I'm no expert at signal integrity. If you want to know for sure, then buy a real scope and measure it (The toy scopes below EUR150 are fun, but not trustworthy enough to do any real work. I'm still amazed and flabbergasted by the amount of scope I got when investing EUR450 into a Siglent SDS1104X-E. If you're tight on budget you can limit yourself to two channels (which I consider the minimum) and still have a decent scope for EUR 300.

Earlier in this thread the LHT00SU1 It's a fun thing for EUR 35 (USBee clone, compatibility with Sigrok / Pulseview apparently), but I doubt very much that you will see on it what sort of a mess a TTL IC driving a meter of wire generates. I don't know how much latency you can tolerate with audio, but a low signalling frequncy combined with heavy enough filtering to dull the edges of the signals may be an option too.
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 8100
  • Country: ca
Re: Digital piano build
« Reply #35 on: September 21, 2024, 09:32:39 pm »
has anyone considered using an old cmos CD4014 with a 15v supply instead.
Use a 220k pullup and 220k series to the smoothing cap at each input pin.

The 4000 series cmos powered at 15 volt will require a significant 7 volt swing at each input to toggle from a logic 1 to logic 0.

Unlike the 5v powered 74HCxxx logic variant which toggles with a 2.5v swing.

You will will need a logic level shifter for the final serial link to the MCU board.
« Last Edit: September 21, 2024, 09:40:11 pm by BrianHG »
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3249
  • Country: us
Re: Digital piano build
« Reply #36 on: September 21, 2024, 10:44:35 pm »

Unlike the 5v powered 74HCxxx logic variant which toggles with a 2.5v swing.


The OP is using a Teensy 4.1 mcu board so Vcc is likely to be 3.3V.
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 8100
  • Country: ca
Re: Digital piano build
« Reply #37 on: September 22, 2024, 03:07:24 am »

Unlike the 5v powered 74HCxxx logic variant which toggles with a 2.5v swing.


The OP is using a Teensy 4.1 mcu board so Vcc is likely to be 3.3V.
So, an approximate 1.6v swing for the 74HCxxx series.
« Last Edit: September 22, 2024, 03:09:14 am by BrianHG »
 

Offline Phil1977

  • Frequent Contributor
  • **
  • Posts: 731
  • Country: de
Re: Digital piano build
« Reply #38 on: September 22, 2024, 05:58:09 am »
Please don't intimidate anyone with things that make it too complicated!

Timing integrity needs to be around 1ms, the used improvised button contacts will definitely not do better.

That means 10kHz of bandwidth per line are more than sufficient - and any higher frequency is anyhow filtered away by the proposed RC-filter (the combination of resistor and capacitor defines the simplest possible frequency filter - that´s why it´s called RC-filter.)

10kHz does neither need twisted pairs nor termination. It´s also no super high impedant input with the 10k-resistors. Probably super simple cabling as used by the OP is just fine.

It may be a good idea to use a twisted pair of cable (GND+signal) for the digital communication between the shift registers and the MCU.

And I personally like the low-key attitude the OP shows in his video. It´s nice to see you can do electronics also with simple methods like hand soldering and improvised buttons. Of course, *everything* could be engineered in a better way. But I think projects like this can be more inspiring if you see they are accessible without CAD- and FEM-designs or special components and materials.
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 4346
  • Country: nl
Re: Digital piano build
« Reply #39 on: September 22, 2024, 06:19:19 am »
Timing integrity needs to be around 1ms, the used improvised button contacts will definitely not do better.

To determine velocity you will need higher speeds than that 1ms.

A single note on message takes 1ms to send, so detecting a key press needs to be done with at least that speed, which for an 88 key piano means the scanning rate needs to be at minimum 88kHz. Still relatively slow, but for better performance I would double that speed.

Still no need to take a lot of special measures, but being aware of possible shortcomings never hurts when something starts to give problems. And that is what the OP is having, problems.

The responses on this forum do seem to intimidate beginners and amateurs though. The OP has not returned to follow up after the first page. I have seen this with many threads.

Offline Phil1977

  • Frequent Contributor
  • **
  • Posts: 731
  • Country: de
Re: Digital piano build
« Reply #40 on: September 22, 2024, 06:48:15 am »
Timing integrity needs to be around 1ms, the used improvised button contacts will definitely not do better.

To determine velocity you will need higher speeds than that 1ms.

Yes, but as far as I understood the OP the velocity detection is just an option for the future and he hasn't decided what system (two step, analogue force detection, ...) he wants to use for that.

And I think he just isn't active 24/7 but he is reacting to this thread  :-+
 

Offline TedWakeshawTopic starter

  • Newbie
  • Posts: 5
  • Country: pl
Re: Digital piano build
« Reply #41 on: September 23, 2024, 08:16:09 am »
The responses on this forum do seem to intimidate beginners and amateurs though. The OP has not returned to follow up after the first page. I have seen this with many threads.

The responses do not intimidate me. Yes, it's true that digital electronics is relatively new to me. I haven’t posted anything in the thread lately because there’s just so much to take in, and I need time to process it all. From the sources I studied, everything seemed so simple and straightforward, and I didn’t realize there could be so many issues with what appears to be a simple digital signal. I’m reading all the replies, trying to understand, and thinking about how to improve things based on your suggestions. I’m really grateful to everyone who has taken the time to contribute to this thread, and I truly appreciate every response and the willingness to help. I have a lot to learn, and I need time for that—time which I don’t always have as much of as I’d like.
 
The following users thanked this post: pcprogrammer


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf