{"id":1564,"date":"2010-09-21T06:20:47","date_gmt":"2010-09-21T11:20:47","guid":{"rendered":"http:\/\/www.plastibots.com\/?p=1564"},"modified":"2014-12-21T06:32:33","modified_gmt":"2014-12-21T11:32:33","slug":"touch-sensor-multiplexing-on-the-nxt","status":"publish","type":"post","link":"https:\/\/www.plastibots.com\/index.php\/2010\/09\/21\/touch-sensor-multiplexing-on-the-nxt\/","title":{"rendered":"Old School Touch Sensor Multiplexing on the NXT"},"content":{"rendered":"<p>I find that I am often using this approach for getting more touch sensors on my NXT without using multiple ports. \u00a0So, for the sake of prosperity, I wanted to keep a record of the setup.<\/p>\n<p>If you are have a set of Cybermaster Touch Sensors hanging around, you can multiplex them for use on the NXT. \u00a0 Years ago, these sensors were quite rare, but now they can be readily found on Bricklink for a decent price. \u00a0For those that are unaware of these sensors, they are the trans-green (clear) touch sensors that come with the Cybermaster kit and look similar to the standard MINDSTORMS RIS ones, but with one significant difference &#8211; each of them have an inline resistor so that when the circut is closed, each passes \u00a0current with a different resistance. \u00a0In addition to this, the value returned varies depending on which combination of sensors is pressed. \u00a0So, not only can you detect individual sensors, you can also detect states of multiple sensors being pressed. \u00a0 \u00a0If my memory serves correct, you can detect 6 sensor states (1, 2 or 3 | 1 and 2 | 2 and 3| \u00a01 and 3 )<\/p>\n<p>You can program these sensors easily by setting them up as temp sensors using RAW values. You will get values between \u00a00 &#8211; 1023. \u00a0You can also code in such a way that you are looking for specific values (eg 655), as when a sensor is pressed, the resistance returns an exact value (it does not float between a number range). \u00a0Also dont forget that you will need an NXT to RCX converter cable.<\/p>\n<p>[ad name=&#8221;GoogleAS728x90ImgOnly&#8221;]<\/p>\n<p><br class=\"spacer_\" \/><\/p>\n<p><br class=\"spacer_\" \/><\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" style=\"vertical-align: top;\" src=\"\/image\/TouchSensorMultiplexer.gif\" alt=\"Cybermaster Touch Sensor Multiplexer\" width=\"700\" height=\"319\" \/><\/p>\n<p><br class=\"spacer_\" \/><\/p>\n<p><br class=\"spacer_\" \/><\/p>\n<p><strong>Sample RobotC program:<\/strong><\/p>\n<p><br class=\"spacer_\" \/><\/p>\n<div id=\"_mcePaste\" style=\"font-family: 'Courier New', Courier, mono;\">#pragma config(Sensor, S2, \u00a0 \u00a0 multiTouch, \u00a0 \u00a0 \u00a0 \u00a0 \u00a0sensorLightInactive)<\/div>\n<div id=\"_mcePaste\" style=\"font-family: 'Courier New', Courier, mono;\">task main()<\/div>\n<div id=\"_mcePaste\" style=\"font-family: 'Courier New', Courier, mono;\">{<\/div>\n<div id=\"_mcePaste\" style=\"font-family: 'Courier New', Courier, mono;\">while(true){<\/div>\n<div id=\"_mcePaste\" style=\"font-family: 'Courier New', Courier, mono;\">nxtDisplayTextLine(1, &#8220;Val: %d &#8220;,SensorRaw(multiTouch) );<\/div>\n<div id=\"_mcePaste\" style=\"font-family: 'Courier New', Courier, mono;\">wait1Msec(20); \/\/give the CPU a break.<\/div>\n<div id=\"_mcePaste\" style=\"font-family: 'Courier New', Courier, mono;\">eraseDisplay();<\/div>\n<div id=\"_mcePaste\" style=\"font-family: 'Courier New', Courier, mono;\">}<\/div>\n<div id=\"_mcePaste\" style=\"font-family: 'Courier New', Courier, mono;\">}<\/div>\n<p><strong>Sample NXT-g program:<\/strong><br \/>\n <a href=\"http:\/\/www.plastibots.com\/files\/CybermasterTouchSensorTest.rbt\">NXT-g Cybermaster Touch Sensor Multiplexer<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I find that I am often using this approach for getting more touch sensors on my NXT without using multiple ports. \u00a0So, for the sake of prosperity, I wanted to keep a record of the setup. If you are have a set of Cybermaster Touch Sensors hanging around, you can multiplex them for use on the NXT. \u00a0 Years ago, these sensors were quite rare, but now they can be readily found on Bricklink for &hellip; <a href=\"https:\/\/www.plastibots.com\/index.php\/2010\/09\/21\/touch-sensor-multiplexing-on-the-nxt\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":4,"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,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4,5],"tags":[55,56],"class_list":["post-1564","post","type-post","status-publish","format-standard","hentry","category-nxtrobots","category-rcxrobots","tag-cybermaster","tag-sensor-multiplexing","has_no_thumb"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pK41j-pe","jetpack_sharing_enabled":true,"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/posts\/1564","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/comments?post=1564"}],"version-history":[{"count":0,"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/posts\/1564\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/media?parent=1564"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/categories?post=1564"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/tags?post=1564"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}