{"id":342,"date":"2010-02-06T18:50:59","date_gmt":"2010-02-06T22:50:59","guid":{"rendered":"http:\/\/nscadesign.ca\/mleblanc\/?p=342"},"modified":"2013-09-08T09:42:39","modified_gmt":"2013-09-08T12:42:39","slug":"decoding-dtmf-with-arduino-and-the-mt8870","status":"publish","type":"post","link":"http:\/\/blog.generaleccentric.net\/?p=342","title":{"rendered":"Decoding DTMF with Arduino and the MT8870"},"content":{"rendered":"<p><a href=\"http:\/\/nscadesign.ca\/leblanc.blog\/wp-content\/uploads\/2010\/02\/default.jpg\" rel=\"lightbox[342]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-343\" style=\"margin: 6px 12px;\" title=\"MT8870_demo\" src=\"http:\/\/nscadesign.ca\/leblanc.blog\/wp-content\/uploads\/2010\/02\/default.jpg\" alt=\"MT8870 demonstration\" width=\"120\" height=\"90\" \/><\/a>Last August I was experimenting with <a href=\"http:\/\/en.wikipedia.org\/wiki\/Dual-tone_multi-frequency\">DTMF<\/a> (dual-tone multi-frequency) and Arduino. I posted <a href=\"http:\/\/www.youtube.com\/watch?v=8v7AROrhecw\">a video<\/a> on YouTube that illustrates a proof-of-concept using the MT8870 tone decoder chip.<\/p>\n<p>A few people have asked me to include the code and schematics for this demonstration: the code is below, and the schematics were derived from the <a href=\"http:\/\/www.datasheetarchive.com\/MT8870-datasheet.html\">MT8870 datasheet<\/a>. Look for the figure titled &#8220;Single-Ended Input Configuration.&#8221;<\/p>\n<pre>\/***********************************************************\r\n DTMF Decoding with MT8870 chip\r\n************************************************************\/\r\nint keyvalue;\u00a0 \/\/ the number associate with the tone\r\n\r\nvoid setup()\r\n{\r\n Serial.begin(9600);\r\n pinMode(6, INPUT); \/\/input binary 1's digit from decoder chip\r\n pinMode(7, INPUT); \/\/input binary 2's digit from decoder chip\r\n pinMode(8, INPUT); \/\/input binary 4's digit from decoder chip\r\n pinMode(9, INPUT); \/\/input binary 8's digit from decoder chip\r\n}\r\n\r\nvoid loop()\r\n\r\n\/\/ first determine the base ten value of the key, from 0-11\r\n{\r\n if (digitalRead(6) == HIGH) \/\/if binary 1's is high\r\n {\r\n keyvalue = 1;\u00a0 \/\/make keyvalue equal 1\r\n }\r\n else\r\n {\r\n keyvalue = 0;\u00a0 \/\/otherwise make it zero\r\n }\r\n\r\n if (digitalRead(7) == HIGH)\u00a0 \/\/if binary 2's is high\r\n {\r\n keyvalue = keyvalue + 2;\u00a0 \/\/add \"2\" to keyvalue\r\n }\r\n if (digitalRead(8) == HIGH)\u00a0 \/\/if binary 4's is high\r\n {\r\n keyvalue = keyvalue + 4;\u00a0 \/\/add \"4\" to keyvalue\r\n }\r\n if (digitalRead(9) == HIGH)\u00a0 \/\/if binary 8's is high\r\n {\r\n keyvalue = keyvalue + 8;\u00a0 \/\/add \"8\" to keyvalue\r\n }\r\n \/\/ now convert keyvalues 9, 10 and 11 to \"0\", \"*\" and \"#\"\r\n if (keyvalue == 10)\r\n {\r\n Serial.println(\"0\"); \/\/print zero key\r\n }\r\n else\r\n {\r\n if (keyvalue == 11)\r\n {\r\n Serial.println(\"*\"); \/\/print asterisk key\r\n }\r\n\r\n else\r\n {\r\n if (keyvalue == 12)\r\n {\r\n Serial.println(\"#\"); \/\/print pound key\r\n }\r\n\r\n else\r\n {\r\n Serial.println(keyvalue); \/\/it isn't a special key so just print it\r\n }\r\n }\r\n }\r\n delay(100);\r\n}\r\n<\/pre>\n<p><a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-nc-sa\/2.5\/ca\/\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft\" style=\"border-width: 0pt; margin: 28px 8px;\" src=\"http:\/\/i.creativecommons.org\/l\/by-nc-sa\/2.5\/ca\/88x31.png\" alt=\"Creative Commons License\" width=\"88\" height=\"31\" \/><\/a><br \/>\n<span> Decoding DTMF with Arduino and the MT8870<\/span> by <a rel=\"cc:attributionURL\" href=\"http:\/\/blog.generaleccentric.net\/?page_id=2\">Michael B LeBlanc<\/a> is licensed under a <a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-nc-sa\/2.5\/ca\/\">Creative Commons Attribution-Noncommercial-Share Alike 2.5 Canada License<\/a>.<br \/>\nPermissions beyond the scope of this license may be available at <a rel=\"cc:morePermissions\" href=\"mleblanc@nscad.ca\">mleblanc@nscad.ca<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last August I was experimenting with DTMF (dual-tone multi-frequency) and Arduino. I posted a video on YouTube that illustrates a proof-of-concept using the MT8870 tone decoder chip. A few people have asked me to include the code and schematics for this demonstration: the code is below, and the schematics were derived from the MT8870 datasheet. &hellip; <a href=\"http:\/\/blog.generaleccentric.net\/?p=342\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Decoding DTMF with Arduino and the MT8870<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_links_to":"","_links_to_target":"","footnotes":""},"categories":[23,22],"tags":[29],"class_list":["post-342","post","type-post","status-publish","format-standard","hentry","category-arduino-electronics","category-electronics","tag-mt8870de"],"_links":{"self":[{"href":"http:\/\/blog.generaleccentric.net\/index.php?rest_route=\/wp\/v2\/posts\/342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.generaleccentric.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.generaleccentric.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.generaleccentric.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.generaleccentric.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=342"}],"version-history":[{"count":18,"href":"http:\/\/blog.generaleccentric.net\/index.php?rest_route=\/wp\/v2\/posts\/342\/revisions"}],"predecessor-version":[{"id":347,"href":"http:\/\/blog.generaleccentric.net\/index.php?rest_route=\/wp\/v2\/posts\/342\/revisions\/347"}],"wp:attachment":[{"href":"http:\/\/blog.generaleccentric.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.generaleccentric.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=342"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.generaleccentric.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}