Establishing ranges and sensor type musings

With the correct formula identified, I started to work on the Arduino implementation. As outlined in Blog #5, my first sketch could only compute the right fret number after manually inputting the corresponding distances. The next task was thus, to make a sketch that allows the setup to read the distance and then automatically output the correct fret number. As the hand is always nearer to the sensor than the fret, I determined that certain fret ranges must be defined. Arduino then must be able to recognize which distances coming from the sensor fall into which fret range and then output the correct fret. From my Excel calculations sheet (and in retrospective just from looking at the guitar), I noticed that the fret deltas (the difference between the distance to fret n and the distance to fret n+1) gradually decrease and that this decrease corresponds to the width of the fret. Since my fingers are always between the area of two frets, I can define a range of a fret with the upper value being the fret distance of fret n and the lower value being the fret distance of fret n-1.

Following this principle, I defined the following fret ranges:

Fret numberRange lower limit [cm]Range upper limit [cm]
0  
10,003,64
23,647,07
37,0710,31
410,3113,37
513,3716,25
616,2518,98
718,9821,55
821,5523,98
923,9826,27
1026,2728,43
1128,4330,47
1230,4732,40
1332,4034,22
1434,2235,93
1535,9337,55
1637,5539,08
1739,0840,53
1840,5341,89
1941,8943,18
2043,1844,39
2144,3945,53
2245,5346,62

I then implemented these ranges in my Arduino code using the if() function.

I then put the code to the test, and it works as planned – at least when using a flat surface (in my case a ruler) to act as the object whose distance is measured. Unfortunately, it does not work that well or consistently with my actual hand playing the guitar. Fingers placement on the fretboard is

  1. Different according to how the guitar is played. The hand and finger position differs for example when Barre chords are played compared to when single notes/a solo is played.
  2. Not like a flat surface (which is ideal for the ultrasonic sensor) but instead quite inconsistent and I think that sometime the sensor does not “know” which finger or other part of the hand is the relevant point from which to measure the distance from.

I decided to tackle this problem by firstly improving the rig that secures the ultrasonic sensor to the guitar neck/headstock figuring that my first version was too instable and placing the sensor in a non-optimal position. I therefore bought a hot glue gun and went to my mum and her cellar containing other tools and material. With these combined powers at my hands, I crafted two rigs that constitute a definite improvement over my first version as far as stability is concerned. The first rig places the sensor below the fret and the other rig places the sensor right on the fretboard itself.

Rig 1

Rig 2

The first rig however, gives similarly inconsistent results as the very first version. The second version looks more promising, but I am currently dealing with a reflection issue with the ultrasonic beam being reflected too early from the frets.

Unfortunately, this problem is reoccurring no matter what rig I try, and I cannot seem to get on top of it. I am thinking about changing the type of sensor from ultrasonic to time-of-flight sensor functions optically, measuring the distance using time and light. Another possibility would also be to use more than one sensor and combine the measurements to obtain a more accurate overall measurement.

Leave a Reply

Your email address will not be published. Required fields are marked *