Closed DavidGriffith closed 6 years ago
Tried multimon-ng (https://github.com/EliasOenal/multimon-ng). Tones are detected correctly, but almost always multiple hits when only one press was made.
It was suggested to me that the problem with tone quality may have to do with excessive "twist", that is a mismatch of amplitude of the two tone components. Maybe if I add a parameter or two to play() that would modify this twist would help. Then I'd have to test each tone against a detector and oscilloscope.
Another thought... I'm using a Radio Shack bench amplifier for output. This thing hums and crackles when nothing is connected. Maybe that's making the tones hard to read.
Changed the sine table to 8-bit resolution. It turns out using 7-bit samples wasn't necessary at all. Tones seem to be recognized well now, but I'm still getting multiple hits. '0' and '#' do this every time. Other tones do so occasionally.
Here are four tracks containing the DTMF digit 1 tone sampled into Audacity. The top track was created by Audacity's DTMF plugin. The second track was generated from my bluebox plugged directly into a USB audio interface. The third track was generated from a Radio Shack pocket tone dialer model 43-139 held up to my laptop's built-in microphone. The bottom track is from my bluebox plugged into a Radio Shack mini amplifier model 2771008 and held up to my laptop's built-in microphone.
Offhand, I don't see any meaningful differences between my bluebox tones and tones generated from Audacity and the Radio Shack dialer.
Here it is again, but with the # digit. Top track is generated by Audacity. Bottom is from the bluebox directly plugged into the USB audio interface.
Frequency analysis of Audacity-generated #. Peaks are at 944 and 1479.
Frequency analysis of ATtiny85-generated #. Peaks are at 926 and 1458. This is way off from the standard of 941 and 1477.
Every tone is off. Everything 770 Hz or above is off by a factor of around 1.01. I suspect a timing problem is at the root of this.
Key | Ideal | Observed | Difference | Factor |
---|---|---|---|---|
1 | 697 | 704 | -7 | 0.9901 |
. | 1209 | 1197 | 12 | 1.0100 |
2 | 697 | 703 | -6 | 0.9915 |
. | 1336 | 1319 | 17 | 1.0152 |
3 | 697 | 698 | -1 | 0.9986 |
. | 1477 | 1466 | 11 | 1.0075 |
4 | 770 | 758 | 12 | 1.0158 |
. | 1209 | 1197 | 12 | 1.0100 |
5 | 770 | 759 | 11 | 1.0145 |
. | 1336 | 1319 | 17 | 1.0129 |
6 | 770 | 759 | 11 | 1.0145 |
. | 1477 | 1466 | 11 | 1.0075 |
7 | 852 | 841 | 11 | 1.0131 |
. | 1209 | 1197 | 12 | 1.0100 |
8 | 852 | 841 | 11 | 1.0131 |
. | 1336 | 1319 | 17 | 1.0129 |
9 | 852 | 841 | 11 | 1.0131 |
. | 1477 | 1466 | 11 | 1.0075 |
* | 941 | 927 | 14 | 1.0151 |
. | 1209 | 1197 | 12 | 1.0100 |
0 | 941 | 927 | 14 | 1.0151 |
. | 1336 | 1319 | 17 | 1.0129 |
# | 941 | 927 | 14 | 1.0151 |
. | 1477 | 1466 | 11 | 1.0075 |
2600 | 2600 | 2576 | 24 | 1.0093 |
Sorted chart of tones:
Ideal | Observed | Difference | Factor |
---|---|---|---|
697 | 704 | -7 | 0.9901 |
697 | 703 | -6 | 0.9915 |
697 | 698 | -1 | 0.9986 |
770 | 758 | 12 | 1.0158 |
770 | 759 | 11 | 1.0145 |
770 | 759 | 11 | 1.0145 |
941 | 927 | 14 | 1.0151 |
941 | 927 | 14 | 1.0151 |
941 | 927 | 14 | 1.0151 |
852 | 841 | 11 | 1.0131 |
852 | 841 | 11 | 1.0131 |
852 | 841 | 11 | 1.0131 |
1209 | 1197 | 12 | 1.0100 |
1209 | 1197 | 12 | 1.0100 |
1209 | 1197 | 12 | 1.0100 |
1209 | 1197 | 12 | 1.0100 |
1336 | 1319 | 20 | 1.0129 |
1336 | 1319 | 20 | 1.0129 |
1336 | 1319 | 20 | 1.0152 |
1336 | 1319 | 20 | 1.0129 |
1477 | 1466 | 11 | 1.0075 |
1477 | 1466 | 11 | 1.0075 |
1477 | 1466 | 11 | 1.0075 |
1477 | 1466 | 11 | 1.0075 |
2600 | 2576 | 24 | 1.0093 |
Multiplied 697 and 700 by 0.99. The rest by 1.01. Here are the resulting DTMF tones. Other tones coming later. I'm mostly pleased with this. The 697 and 700 tone multipliers should probably be changed.
Key | Ideal | Observed | Difference | Factor |
---|---|---|---|---|
1 | 697 | 680 | -17 | 0.9756 |
. | 1209 | 1219 | 10 | 1.0083 |
2 | 697 | 680 | -17 | 0.9756 |
. | 1336 | 1348 | 12 | 1.0090 |
3 | 697 | 680 | -17 | 0.9756 |
. | 1477 | 1477 | 0 | 1.0000 |
4 | 770 | 766 | -4 | 0.9948 |
. | 1209 | 1220 | 11 | 0.9910 |
5 | 770 | 766 | 4 | 1.0052 |
. | 1336 | 1348 | 12 | 1.0090 |
6 | 770 | 766 | -4 | 0.9948 |
. | 1477 | 1477 | 0 | 1.0000 |
7 | 852 | 852 | 0 | 1.0000 |
. | 1209 | 1219 | 10 | 1.0083 |
8 | 852 | 852 | 0 | 1.0000 |
. | 1336 | 1349 | 13 | 1.0097 |
9 | 852 | 852 | 0 | 1.0000 |
. | 1477 | 1477 | 0 | 1.0000 |
* | 941 | 939 | -2 | 0.9979 |
. | 1209 | 1219 | 10 | 1.0083 |
0 | 941 | 939 | -2 | 0.9979 |
. | 1336 | 1348 | 12 | 0.9910 |
# | 941 | 939 | -2 | 0.9979 |
. | 1477 | 1477 | 0 | 1.0000 |
Same multipliers, but with MF tones.
Key | Ideal | Observed | Difference | Factor |
---|---|---|---|---|
1 | 700 | 690 | -10 | 0.9857 |
. | 900 | 905 | 5 | 1.0056 |
2 | 700 | 690 | -10 | 0.9857 |
. | 1100 | 1099 | -1 | 0.9991 |
3 | 900 | 902 | 2 | 1.0022 |
. | 1100 | 1099 | -1 | 0.9991 |
4 | 700 | 690 | -10 | 0.9857 |
. | 1300 | 1303 | 3 | 1.0023 |
5 | 900 | 905 | 5 | 1.0056 |
. | 1300 | 1303 | 3 | 1.0023 |
6 | 1100 | 1099 | -1 | 0.9991 |
. | 1300 | 1303 | 3 | 1.0023 |
7 | 700 | 690 | -10 | 0.9857 |
. | 1500 | 1499 | -1 | 0.9993 |
8 | 900 | 905 | 5 | 1.0056 |
. | 1500 | 1499 | -1 | 0.9993 |
9 | 1100 | 1099 | -1 | 0.9991 |
. | 1500 | 1499 | -1 | 0.9993 |
KP | 1100 | 1099 | -1 | 0.9991 |
. | 1700 | 1700 | 0 | 1.0000 |
0 | 1300 | 1302 | 2 | 1.0015 |
. | 1500 | 1499 | -1 | 0.9993 |
ST | 1500 | 1497 | -3 | 0.9990 |
. | 1700 | 1700 | 0 | 1.0000 |
Other tones:
Tone | Ideal | Observed | Difference | Factor |
---|---|---|---|---|
UKRB | 1000 | 1004 | 4 | 1.0040 |
RB1 | 1700 | 1700 | 0 | 1.0000 |
RB2 | 2200 | 2207 | 7 | 1.0032 |
2600 | 2600 | 2601 | 1 | 1.0004 |
Multiplying 697 by 0.9999 gave me 703hz. Good. Doing the same for 700 gave me 700hz spot on.
The quality of the DTMF tones is a bit troublesome. I used multimon (https://sourceforge.net/projects/multimon) sampling from my laptop's build in microphone to check the tones. When a tone is played once, it is often detected twice or thrice. This doesn't happen if I play tones from a Radio Shack #43-139 pocket dialer. The problems happen more often with 7, 8, 9, *, 0, and #.
I tried an Android DTMF decoder app called "DTMF Decoder". They all stink to varying degrees. This had problems decoding digits from the third column. Again, no problems with the Radio Shack pocket dialer.
I need to get this thing on an oscilloscope to get a better idea of what's going on.
Possible culprits: