{"id":1178,"date":"2016-05-03T17:07:43","date_gmt":"2016-05-03T08:07:43","guid":{"rendered":"http:\/\/otsuka.biz\/blog1\/?p=1178"},"modified":"2024-02-12T16:02:37","modified_gmt":"2024-02-12T07:02:37","slug":"hands-free-phone-system-with-rn52-and-pic24fj64gb002-part2","status":"publish","type":"post","link":"https:\/\/otsuka.biz\/blog1\/hands-free-phone-system-with-rn52-and-pic24fj64gb002-part2\/","title":{"rendered":"Hands-free phone system with RN52 Bluetooth module and PIC24FJ64GB002 : Part2"},"content":{"rendered":"<p>A new board is assembled for this Hands-free phone system, which is equipped with a speaker unit but is not with a microphone unit yet. \u00a0\u00a0 On the new board, the PIC microcontroller\u00a0powers up the RN52 module automatically and controls audio-volume by &#8220;-&#8221; or &#8220;+&#8221; key of\u00a0a keypad.<\/p>\n<p>&lt;&lt; Introduction in Japanese &gt;&gt;<\/p>\n<p>\u30d6\u30eb\u30fc\u30c8\u30a5\u30fc\u30b9\u30fb\u30cf\u30f3\u30ba\u30d5\u30ea\u30fc\u901a\u8a71\u306e\u70ba\u306e PIC24FJ64GB002 \u30de\u30a4\u30b3\u30f3\u57fa\u677f\u3092\u65b0\u3057\u304f\u4f5c\u6210\u3057\u305f\u3002RN52 \u3068 \u97f3\u58f0\u51fa\u529b\u30a2\u30f3\u30d7\u306f\u30c9\u30fc\u30bf\u30fc\u30fb\u30dc\u30fc\u30c9\u3068\u3057\u3066\u5b9f\u88c5\u3057\u3001USB \u30ad\u30fc\u30d1\u30c3\u30c9\u3001\u30b9\u30d4\u30fc\u30ab\u30fc\u3001\u30de\u30a4\u30af\u306f\u30b3\u30cd\u30af\u30bf\u306b\u3066\u63a5\u7d9a\u3059\u308b\u3002\u65b0\u3057\u3044\u30b7\u30b9\u30c6\u30e0\u3067\u306f PIC \u306e\u521d\u671f\u5316\u306b\u7d9a\u3044\u3066 RN52 \u3092\u81ea\u52d5\u7684\u306b\u8d77\u52d5\u3059\u308b\u4ed5\u69d8\u3068\u3057\u305f\u3002\u97f3\u91cf\u306f\u30ad\u30fc\u30d1\u30c3\u30c9\u306e\u30de\u30a4\u30ca\u30b9\u30fb\u30ad\u30fc\u3001\u30d7\u30e9\u30b9\u30fb\u30ad\u30fc\u3067\u8abf\u7bc0\u3059\u308b\u3002<\/p>\n<p>Mobile phone\u00a0 &lt;&#8211;\u00a0 Bluetooth\u00a0 &#8211;&gt;\u00a0 RN52\u00a0 &lt;&#8211;\u00a0 UART\u00a0 &#8211;&gt;\u00a0 PIC24FJ64GB002\u00a0 &lt;&#8211;\u00a0 USB\u00a0 &#8211;&gt;\u00a0 Keypad<\/p>\n<p><a href=\"http:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2016\/02\/HF-Bluetooth-Part2-1.jpg\" rel=\"attachment wp-att-1190\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1190\" src=\"http:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2016\/02\/HF-Bluetooth-Part2-1.jpg\" alt=\"HF Bluetooth-Part2-1\" width=\"2016\" height=\"1512\" srcset=\"https:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2016\/02\/HF-Bluetooth-Part2-1.jpg 2016w, https:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2016\/02\/HF-Bluetooth-Part2-1-300x225.jpg 300w, https:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2016\/02\/HF-Bluetooth-Part2-1-768x576.jpg 768w, https:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2016\/02\/HF-Bluetooth-Part2-1-1024x768.jpg 1024w\" sizes=\"auto, (max-width: 2016px) 100vw, 2016px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2016\/02\/HF-Bluetooth-Part2-2.jpg\" rel=\"attachment wp-att-1191\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1191\" src=\"http:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2016\/02\/HF-Bluetooth-Part2-2.jpg\" alt=\"HF Bluetooth-Part2-2\" width=\"2016\" height=\"1512\" srcset=\"https:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2016\/02\/HF-Bluetooth-Part2-2.jpg 2016w, https:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2016\/02\/HF-Bluetooth-Part2-2-300x225.jpg 300w, https:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2016\/02\/HF-Bluetooth-Part2-2-768x576.jpg 768w, https:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2016\/02\/HF-Bluetooth-Part2-2-1024x768.jpg 1024w\" sizes=\"auto, (max-width: 2016px) 100vw, 2016px\" \/><\/a><\/p>\n<p>Inputted numbers\u00a0are displayed\u00a0in\u00a0the first\u00a0line of the LCD\u00a0and the current connection status obtained with the Q command is\u00a0in the second line.<\/p>\n<p>&lt;&lt; PIC microcontroller board\u00a0&gt;&gt;<\/p>\n<p>New\u00a0test board\u00a0remade in March, 2016,\u00a0is compatible with that in my blog page on Aug. 31, 2014.<br \/>\n( In Japanese : \u5e73\u621026\u5e748\u670831\u65e5\u306e\u7a3f\u3067\u793a\u3057\u305f\u30dc\u30fc\u30c9\u3092\u65b0\u305f\u306b\u5236\u4f5c )<\/p>\n<p>Clock and pin connection of\u00a0the PIC24FJ64GB002 board\u00a0:<\/p>\n<p>FRC 8 MHz &#8211; 96 MHz PLL;<br \/>\n48 MHz for USB Module (96 MHz PLL divide by 2);<br \/>\n32 MHz for System Clock\u00a0(96 MHz PLL divide by 3);<\/p>\n<p>LED : RB0, RB1; \u00a0\u00a0 Switch (pull down) :\u00a0MCLR, RB2;<\/p>\n<p>LCD\u00a0(SC1602BBWB-XA-GB-G) :\u00a0RS &#8211; RB7, R\/W &#8211; GND, E &#8211; RB8, Data bus : DB4 &#8211; RB9, DB5 &#8211; RB13, DB6 &#8211; RB14, DB7 &#8211;\u00a0RB15;<\/p>\n<p>RA0 (assigned to U2RX) &#8211; RN52 pin 16 TX<br \/>\nRA1 (assigned to U2TX) &#8211; RN52 pin 17 RX<br \/>\nRB3 &#8211; RN52 pin 21 PWREN (to power up the RN52 module)<br \/>\nRB4 &#8211; RN52 pin 3 GIO2<br \/>\nRA4 &#8211; RN52 pin 11 GIO9<\/p>\n<p>&lt;&lt; RN52 board &gt;&gt;<\/p>\n<p>pin 3\u00a0\u00a0 GIO2\u00a0&#8211; \u00a0PIC pin 12 (RP4\/RB4)<br \/>\npin 11 GIO9\u00a0&#8211;\u00a0 PIC pin 11 (RA4)<br \/>\npin 16 TX\u00a0\u00a0\u00a0\u00a0 &#8211;\u00a0 PIC pin 2 (RP5\/RA0) assigned to U2RX<br \/>\npin 17 RX\u00a0\u00a0\u00a0\u00a0 &#8211;\u00a0 PIC pin 3 (RP6\/RA1) assigned to U2TX<br \/>\npin 21 PWREN &#8211; switch (pull high) and PIC pin 7 (RB3)<br \/>\nFor flow control is not used, RN52 pin 14 RTS is connected with RN52 pin 15 CTS.<\/p>\n<p>Default UART configuration of\u00a0the RN52 module :<br \/>\nBaud rate : 115,200 Kbps<br \/>\nBits : 8<br \/>\nParity : None<br \/>\nStop bits : 1<\/p>\n<p>&lt;&lt; Amplifier module &gt;&gt;<\/p>\n<p><span class=\"model_number_value\">OEP30W<\/span> (fully differential, class D, 30W power amplifier board)<\/p>\n<p>&lt;&lt;\u00a0Microphone\u00a0circuit\u00a0&gt;&gt;<\/p>\n<p><a href=\"http:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2016\/02\/Microphone-circuit.png\" rel=\"attachment wp-att-1214\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1214\" src=\"http:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2016\/02\/Microphone-circuit.png\" alt=\"Microphone circuit\" width=\"901\" height=\"304\" srcset=\"https:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2016\/02\/Microphone-circuit.png 901w, https:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2016\/02\/Microphone-circuit-300x101.png 300w, https:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2016\/02\/Microphone-circuit-768x259.png 768w\" sizes=\"auto, (max-width: 901px) 100vw, 901px\" \/><\/a><\/p>\n<p>&lt;&lt;\u00a0Sample code\u00a0&gt;&gt;<\/p>\n<p><div class='w3eden'><!-- WPDM Link Template: Default Template -->\n\n<div class=\"link-template-default card mb-2\">\n    <div class=\"card-body\">\n        <div class=\"media\">\n            <div class=\"mr-3 img-48\"><img decoding=\"async\" class=\"wpdm_icon\" alt=\"\u30a2\u30a4\u30b3\u30f3\" src=\"data:image\/svg+xml;base64,CiAgICAgICAgICAgIDxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgNDAgNDAiPgogICAgICAgICAgICAgICAgPGRlZnM+CiAgICAgICAgICAgICAgICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkaWVudCIgeDE9IjAiIHkxPSIwIiB4Mj0iMCIgeTI9IjEiPgogICAgICAgICAgICAgICAgICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSIjMjY5ZGVmIiBvZmZzZXQ9IjAiLz4KICAgICAgICAgICAgICAgICAgICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iIzI2YmRlZiIgb2Zmc2V0PSIxIi8+CiAgICAgICAgICAgICAgICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgICAgICAgICAgICAgIDwvZGVmcz4KICAgICAgICAgICAgICAgIDxnPgogICAgICAgICAgICAgICAgICAgIDxyZWN0IGZpbGw9InVybCgjZ3JhZGllbnQpIiB4PSIwIiB5PSIwIiB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHJ4PSIzIiByeT0iMyIvPgogICAgICAgICAgICAgICAgICAgIDx0ZXh0IHg9IjUiIHk9IjE5IiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxM3B4IiBsZXR0ZXItc3BhY2luZz0iMSIgZmlsbD0iI0ZGRkZGRiI+CiAgICAgICAgICAgICAgICAgICAgICAgIDx0c3Bhbj5MWkg8L3RzcGFuPgogICAgICAgICAgICAgICAgICAgICAgICA8dHNwYW4geD0iNiIgeT0iMjgiPl88L3RzcGFuPgogICAgICAgICAgICAgICAgICAgIDwvdGV4dD4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgPC9zdmc+CgoJCQk=\" \/><\/div>\n            <div class=\"media-body\">\n                <h3 class=\"package-title\"><a href='https:\/\/otsuka.biz\/blog1\/download\/hands-free-bluetooth-2\/'>Hands-free-bluetooth 2<\/a><\/h3>\n                <div class=\"text-muted text-small\"><i class=\"fas fa-copy\"><\/i> 1 \u30d5\u30a1\u30a4\u30eb <i class=\"fas fa-hdd ml-3\"><\/i> 45.85 KB<\/div>\n            <\/div>\n            <div class=\"ml-3\">\n                <a class='wpdm-download-link download-on-click btn btn-primary ' rel='nofollow' href='#' data-downloadurl=\"https:\/\/otsuka.biz\/blog1\/download\/hands-free-bluetooth-2\/?wpdmdl=3359&refresh=69de221bc67c01776165403\">\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/a>\n            <\/div>\n        <\/div>\n    <\/div>\n<\/div>\n\n<\/div> (A project of MPLAB X IDE containing HEX.file only)<\/p>\n<p>Based\u00a0on Microchip Libraries for Applications v2014_07_22<\/p>\n<p>&lt;&lt; Function of this set &gt;&gt;<\/p>\n<p>If you enter a telephone number, RN52 will initiate outgoing call automatically after 3 seconds.<\/p>\n<p>The maximum telephone number is 11 digits.<\/p>\n<p>Enter-key accepts incoming call, initiates outgoing call or\u00a0terminates call.<\/p>\n<p>Back-space key cancels a last inputted\u00a0number.<\/p>\n<p>Plus (+) key increases the volume.<\/p>\n<p>Minus (-) key reduces the volume.<\/p>\n<p>PIC-RB2-switch practices a factory reset of RN52.<\/p>\n<p>In Japanese :<\/p>\n<p>&lt;&lt; \u64cd\u4f5c\u65b9\u6cd5 &gt;&gt;<\/p>\n<p>\u96fb\u8a71\u756a\u53f7\u306f\u6700\u5927\uff11\uff11\u6841\u3001\u7d04\uff13\u79d2\u3067\u81ea\u52d5\u767a\u4fe1\u3002<\/p>\n<p>Enter key\uff1a\u7740\u4fe1\u5fdc\u7b54\u3001\u5f37\u5236\u767a\u4fe1\u3001\u5207\u65ad\u3002<\/p>\n<p>Back space\uff1a\uff11\u6587\u5b57\u30ad\u30e3\u30f3\u30bb\u30eb\u3002<\/p>\n<p>Plus (+) key : \u97f3\u91cf\u3092\u4e0a\u3052\u308b\u3002<\/p>\n<p>Minus (-) \u00a0key : \u97f3\u91cf\u3092\u4e0b\u3052\u308b\u3002<\/p>\n<p>PIC \u306e RB2-switch \u3067 RN52 \u3092\u5de5\u5834\u51fa\u8377\u6642\u8a2d\u5b9a\u306b\u30ea\u30bb\u30c3\u30c8\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A new board is assembled for this Hands-free phone system, which is equipped with a speaker unit but is not wi [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"vkexunit_cta_each_option":"","footnotes":""},"categories":[2,10],"tags":[],"class_list":["post-1178","post","type-post","status-publish","format-standard","hentry","category-pic","category-telephone"],"_links":{"self":[{"href":"https:\/\/otsuka.biz\/blog1\/wp-json\/wp\/v2\/posts\/1178","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/otsuka.biz\/blog1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/otsuka.biz\/blog1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/otsuka.biz\/blog1\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/otsuka.biz\/blog1\/wp-json\/wp\/v2\/comments?post=1178"}],"version-history":[{"count":2,"href":"https:\/\/otsuka.biz\/blog1\/wp-json\/wp\/v2\/posts\/1178\/revisions"}],"predecessor-version":[{"id":3360,"href":"https:\/\/otsuka.biz\/blog1\/wp-json\/wp\/v2\/posts\/1178\/revisions\/3360"}],"wp:attachment":[{"href":"https:\/\/otsuka.biz\/blog1\/wp-json\/wp\/v2\/media?parent=1178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/otsuka.biz\/blog1\/wp-json\/wp\/v2\/categories?post=1178"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/otsuka.biz\/blog1\/wp-json\/wp\/v2\/tags?post=1178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}