{"id":739,"date":"2015-01-17T20:00:02","date_gmt":"2015-01-17T11:00:02","guid":{"rendered":"http:\/\/otsuka.biz\/blog1\/?p=739"},"modified":"2024-02-12T15:39:28","modified_gmt":"2024-02-12T06:39:28","slug":"%e3%82%bf%e3%83%83%e3%83%81%e3%82%bb%e3%83%b3%e3%82%b5%e3%83%bc-touch-sensor","status":"publish","type":"post","link":"https:\/\/otsuka.biz\/blog1\/%e3%82%bf%e3%83%83%e3%83%81%e3%82%bb%e3%83%b3%e3%82%b5%e3%83%bc-touch-sensor\/","title":{"rendered":"\u30bf\u30c3\u30c1\u30bb\u30f3\u30b5 Touch sensor with PIC18F2550: capacitive voltage divider (CVD)"},"content":{"rendered":"<p><span class=\"word_illustration_english\">An experiment of a t<\/span>ouch sensor using an A\/D Converter (capacitive voltage divider : CVD)<\/p>\n<p>&lt;&lt; Introduction in Japanese &gt;&gt;<\/p>\n<p>\u96fb\u5b50\u56de\u8def\u3092\u6307\u3067\u89e6\u308b\u3068\u5c40\u6240\u56de\u8def\u306e\u9759\u96fb\u5bb9\u91cf\u306b\u5909\u5316\u304c\u751f\u3058\u308b\u3002\u3053\u306e\u5909\u5316\u3092\u6349\u3048\u308b\u3053\u3068\u306b\u3088\u308a\u30bf\u30c3\u30c1\u30bb\u30f3\u30b5\u304c\u5b9f\u73fe\u3067\u304d\u308b\u3002Microchip Technology \u793e\u304b\u3089\u306f\u3001\u5bb9\u91cf\u691c\u77e5\u30e2\u30b8\u30e5\u30fc\u30eb(CSM)(Application Notes: AN1171), \u5145\u96fb\u6642\u9593\u8a08\u6e2c\u30e6\u30cb\u30c3\u30c8(CTMU)(Application Notes: AN1250) \u3092\u5b9f\u88c5\u3057\u305f\u88fd\u54c1\u304c\u8ca9\u58f2\u3055\u308c\u3066\u3044\u308b\u304c\u3001\u4eca\u56de\u306e\u30bf\u30c3\u30c1\u30bb\u30f3\u30b5\u5b9f\u9a13\u306f\u5c02\u7528\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u306f\u306a\u304f\u3001\u901a\u5e38\u306e A\/D converter \u3092\u7528\u3044\u3066\u306e\u9759\u96fb\u5bb9\u91cf\u65b9\u5f0f\u5206\u5727\u56de\u8def(CVD) (Application Notes: AN1298, AN1478) \u3067\u884c\u3063\u305f\u3002<\/p>\n<p>\u30bf\u30c3\u30c1\u30bb\u30f3\u30b5\u306b\u89e6\u308c\u3066\u3044\u308b\u9593\u306f LED \u3092\u70b9\u706f\u3055\u305b\u3001\u540c\u6642\u306b\u30bb\u30f3\u30b5\u56de\u8def\u306e\u96fb\u4f4d\u3092 LCD \u306b\u8868\u793a\u3055\u305b\u308b\u3002<\/p>\n<p><a href=\"http:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2014\/12\/Touch-sensor.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-862 size-full\" src=\"https:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2014\/12\/Touch-sensor.jpg\" alt=\"Touch sensor\" width=\"540\" height=\"424\" srcset=\"https:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2014\/12\/Touch-sensor.jpg 540w, https:\/\/otsuka.biz\/blog1\/wp-content\/uploads\/2014\/12\/Touch-sensor-300x236.jpg 300w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><\/a><\/p>\n<p>While you touch\u00a0the sensor circuit,\u00a0the LED is turned on.<br \/>The LCD displays real-time voltage of the touch-sensor circuit.<\/p>\n<p>&lt;&lt;\u00a0Test\u00a0board\u00a0&gt;&gt;<\/p>\n<p>The\u00a0test board is the\u00a0UBW\u00a0board\u00a0of my page on Jan. 16, 2014.<\/p>\n<p>A\/D converter : CH1(AN1)(RA1), CH2(AN2)(RA2);<br \/>CH1 is used to charge\u00a0a charge holding capacitor (CHOLD).<br \/>CH2 is connected to a touch pad.<\/p>\n<p>Bootloader : RC0 &#8211; LED, RC1 &#8211; LED, RC2 &#8211; switch2 (pull down), MCLR &#8211; switch1 (pull down);<\/p>\n<p>LCD (SC1602BBWB-XA-GB-G) : RS &#8211; RB2, R\/W &#8211; GND, E &#8211; RB3, Data bus &#8211; RB4\uff5eRB7;<\/p>\n<p>&lt;&lt; Sample code &gt;&gt;<\/p>\n<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\/touch-sensor\/'>Touch Sensor<\/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> 213.61 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\/touch-sensor\/?wpdmdl=3351&refresh=69e145ba1f0f81776371130\">\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/a>\n            <\/div>\n        <\/div>\n    <\/div>\n<\/div>\n\n<\/div>\n<p>My\u00a0project\u00a0with MPLAB X IDE and XC8\u00a0has three configurations.<\/p>\n<p>1)\u00a0\u00a0\u00a0 Offset_0_including_config:<\/p>\n<p>This HEX file is\u00a0written into a PIC MCU with a programmer.<\/p>\n<p>TouchSensor including confg.c\u00a0has\u00a0a macro set of\u00a0configuration for my UBW board.<\/p>\n<p>2)\u00a0\u00a0\u00a0 Offset_0x800_for_bootloader (for a\u00a0USB bootloader).<\/p>\n<p>3)\u00a0\u00a0\u00a0 Offset_0x1000_for_bootloader\u00a0(for a USB bootloader).<\/p>\n<p>&lt;&lt; Degree of voltage separation with a 10-bit A\/D converter &gt;&gt;<\/p>\n<p>5\/1024 [V\/bit] = 5000\/2024[mV\/bit] on the conditions of VREF- of 0-volt and VREF+ of 5-volt.<\/p>\n<p>&lt;&lt;\u00a0Reference &gt;&gt;<\/p>\n<p>1)\u00a0\u00a0\u00a0 Microchip Technology, AN1298:\u00a0Capacitive Touch Using Only an ADC (\u201cCVD\u201d);<\/p>\n<p>2)\u00a0\u00a0\u00a0 BitTradeOne,\u00a0Ltd\u00a0( <a title=\"http:\/\/a-desk.jp\/\" href=\"https:\/\/bit-trade-one.co.jp\/support\/download\/\">Download:\u00a0\u30bf\u30c3\u30c1\u30bb\u30f3\u30b5<\/a> );<\/p>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>An experiment of a touch sensor using an A\/D Converter (capacitive voltage divider : CVD) &lt;&lt; Introductio [&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,1],"tags":[],"class_list":["post-739","post","type-post","status-publish","format-standard","hentry","category-pic","category-unclassification"],"_links":{"self":[{"href":"https:\/\/otsuka.biz\/blog1\/wp-json\/wp\/v2\/posts\/739","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=739"}],"version-history":[{"count":2,"href":"https:\/\/otsuka.biz\/blog1\/wp-json\/wp\/v2\/posts\/739\/revisions"}],"predecessor-version":[{"id":3352,"href":"https:\/\/otsuka.biz\/blog1\/wp-json\/wp\/v2\/posts\/739\/revisions\/3352"}],"wp:attachment":[{"href":"https:\/\/otsuka.biz\/blog1\/wp-json\/wp\/v2\/media?parent=739"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/otsuka.biz\/blog1\/wp-json\/wp\/v2\/categories?post=739"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/otsuka.biz\/blog1\/wp-json\/wp\/v2\/tags?post=739"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}