{"id":20,"date":"2018-10-05T02:07:02","date_gmt":"2018-10-05T05:07:02","guid":{"rendered":"http:\/\/www.quilombodigital.org\/wordpress\/?p=20"},"modified":"2021-03-27T00:08:49","modified_gmt":"2021-03-27T03:08:49","slug":"a-l-s-communication-device-using-arduino","status":"publish","type":"post","link":"https:\/\/www.quilombodigital.org\/wordpress\/?p=20&lang=en","title":{"rendered":"A.L.S COMMUNICATION DEVICE USING ARDUINO MICRO PRO"},"content":{"rendered":"\n<p>(Updated 03\/27\/2021)<\/p>\n\n\n\n<h2>INTRODUCTION<\/h2>\n\n\n\n<p>The father of a friend has ALS (Amyotrophic lateral sclerosis) and recently things got more complicated, with great loss of his movements. I wanted to help, so I did some research in ways to enable him to keep communicating with his family. I have some electronics knowledge, so I thought I could use some common components I have laying around, and the result is this small project. Feel free to use and ask for information about how to do it.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignleft is-resized\"><img src=\"http:\/\/www.quilombodigital.org\/alsarduinosensor\/images\/image3.jpg\" alt=\"\" width=\"250\" height=\"300\"\/><\/figure><\/div>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img src=\"http:\/\/www.quilombodigital.org\/alsarduinosensor\/images\/image7.jpg\" alt=\"\" width=\"513\" height=\"308\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"video-container\"><iframe title=\"1 - ALS Communication device using Arduino \/ Dispositivo de comunica\u00e7\u00e3o para ELA utilizando Arduino\" width=\"720\" height=\"405\" src=\"https:\/\/www.youtube.com\/embed\/28gcnCMDawY?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"video-container\"><iframe title=\"2 - ALS Communication device using Arduino \/ Dispositivo de comunica\u00e7\u00e3o para ELA utilizando Arduino\" width=\"720\" height=\"405\" src=\"https:\/\/www.youtube.com\/embed\/qM-6vG1uTIY?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img src=\"http:\/\/www.quilombodigital.org\/alsarduinosensor\/images\/image8.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2>COMMUNICATION SOFTWARE<\/h2>\n\n\n\n<p>The communication software I have chosen is the same used by Stephen Hawking, gently developed and open-sourced by Intel.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img src=\"http:\/\/www.quilombodigital.org\/alsarduinosensor\/images\/image6.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>The software name is ACAT and can be downloaded here:<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/intel\/acat\/releases\">https:\/\/github.com\/intel\/acat\/releases<\/a><\/p>\n\n\n\n<p>There are support for other languages than english, like brazilian portuguese, my native language.\nThe software is actually simple, there are two types of interaction with it: with a webcam, that detects the smallest cheek movements, or with a trigger, represented by the F12 keyboard key. I tested the webcam detection, and it works ok, but I wanted something to use while he still has some few movements, like at the feet, jaw or any other body area. What I noticed from my research is that each person has his specific needs, so be prepared to adapt it for each environment. The software is simple and usable. Most common words and phrases become more accessible, and make things easier.\nThe only real setting you have to worry about is the timing of the character\/word selection, so it does not goes too fast.<\/p>\n\n\n\n<h2>ELECTRONICS<\/h2>\n\n\n\n<p>When researching and testing approaches, I have tested several different kinds of sensors, like touch sensors, tilt sensors, etc, and most of them were not sensitive enough.\nI finally tested the idea with an accelerometer and it worked very well.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3>SENSOR<\/h3>\n\n\n\n<p>I tested three types of accelerometers, the MMA8452, the MPU6050 and the ADXL377. I chosed the MMA8452 because it is really easy to program, it is cheap, and for this project there is no need for a really advanced accelerometer.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img src=\"http:\/\/www.quilombodigital.org\/alsarduinosensor\/images\/image1.jpg\" alt=\"\" width=\"325\" height=\"325\"\/><\/figure>\n\n\n\n<h3>PARTS<\/h3>\n\n\n\n<ul><li>Arduino Micro Pro<\/li><li>Accelerometer MMA8452<\/li><li>Potentiometer 10k<\/li><li>Green Led<\/li><li>1k resistor<\/li><li>Switch<\/li><li>Usb cable<\/li><li>Plastic box PB-112\/2 &#8211; 36 x 85 x 124 mm<\/li><\/ul>\n\n\n\n<h3>SCHEMATICS<\/h3>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img src=\"https:\/\/www.quilombodigital.org\/wordpress\/wp-content\/uploads\/2021\/03\/image-8.png\" alt=\"\" class=\"wp-image-149\" width=\"642\" height=\"497\" srcset=\"https:\/\/www.quilombodigital.org\/wordpress\/wp-content\/uploads\/2021\/03\/image-8.png 786w, https:\/\/www.quilombodigital.org\/wordpress\/wp-content\/uploads\/2021\/03\/image-8-300x232.png 300w, https:\/\/www.quilombodigital.org\/wordpress\/wp-content\/uploads\/2021\/03\/image-8-768x595.png 768w\" sizes=\"(max-width: 642px) 100vw, 642px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img src=\"https:\/\/www.quilombodigital.org\/wordpress\/wp-content\/uploads\/2021\/03\/image-4.png\" alt=\"\" width=\"712\" height=\"589\"\/><\/figure>\n\n\n\n<h3>ARDUINO PROGRAMMING<\/h3>\n\n\n\n<p>The arduino program I developed is quite simple. It just tries to detect if there was too much motion, using a median of the accelerometer values, and a threshold defined by a potentiometer. When it detects the movement, it sends a F12 key press and waits for 500 millis for debounce.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include \"elapsedMillis.h\"\r\n#include \"RunningMedian.h\"\r\n#include \"Wire.h\"\r\n#include \"SFE_MMA8452Q.h\"\r\n#include \"Keyboard.h\"\r\n\r\nint potPin = A10;\r\nint ledPin = A9;\r\nint enabledPin = A8;\r\nint tolerance = 0;\r\nint val = 0;\r\nbool blocked = false;\r\nbool pressed = false;\r\nMMA8452Q acelerometro(0x1C);\r\nRunningMedian samplesx = RunningMedian(15);\r\nRunningMedian samplesy = RunningMedian(15);\r\nRunningMedian samplesz = RunningMedian(15);\r\nelapsedMillis timeElapsed;\r\n\r\nvoid setup()\r\n{\r\n    pinMode(ledPin, OUTPUT);\r\n    pinMode(enabledPin, INPUT_PULLUP);\r\n    digitalWrite(ledPin, LOW);\r\n    acelerometro.init();\r\n    Keyboard.begin();\r\n}\r\n\r\nvoid loop()\r\n{\r\n    bool enabled = digitalRead(enabledPin);\r\n    if (enabled) {\r\n        val = analogRead(potPin); \/\/ read the value from the sensor\r\n        tolerance = val;\r\n        if (acelerometro.available()) {\r\n            acelerometro.read();\r\n            samplesx.add(acelerometro.x);\r\n            samplesy.add(acelerometro.y);\r\n            samplesz.add(acelerometro.z);\r\n            if (!blocked) {\r\n                bool tmpx = (acelerometro.x > (samplesx.getAverage() + tolerance)) || (acelerometro.x &lt; (samplesx.getAverage() - tolerance));\r\n                bool tmpy = (acelerometro.y > (samplesy.getAverage() + tolerance)) || (acelerometro.y &lt; (samplesy.getAverage() - tolerance));\r\n                bool tmpz = (acelerometro.z > (samplesz.getAverage() + tolerance)) || (acelerometro.z &lt; (samplesz.getAverage() - tolerance));\r\n                if (tmpx || tmpy || tmpz) {\r\n                    Keyboard.press(0xCD); \/\/F12\r\n\r\n                    digitalWrite(ledPin, HIGH);\r\n                    blocked = true;\r\n                    pressed = true;\r\n                    timeElapsed = 0;\r\n                }\r\n            }\r\n        }\r\n    }\r\n    if (pressed &amp;&amp; (timeElapsed > 100) ) {\r\n        Keyboard.release(0xCD); \/\/F12\r\n        pressed = false;\r\n    }\r\n    if (blocked &amp;&amp; (timeElapsed > 500) ) {\r\n        digitalWrite(ledPin, LOW);\r\n        blocked = false;\r\n    }\r\n}<\/code><\/pre>\n\n\n\n<h2>ARDUINO LIBS<\/h2>\n\n\n\n<p>There were three libs used in this project. Two can be directly installed through the IDE, and one has to be manually installed using the zip file:<\/p>\n\n\n\n<ul><li>RunningMedian -&gt;&nbsp;<a href=\"https:\/\/playground.arduino.cc\/Main\/RunningMedian\">https:\/\/playground.arduino.cc\/Main\/RunningMedian<\/a><\/li><li>ElapsedMillis -&gt;&nbsp;<a href=\"https:\/\/playground.arduino.cc\/Code\/ElapsedMillis\">https:\/\/playground.arduino.cc\/Code\/ElapsedMillis<\/a><\/li><li>SFE_8452Q -&gt;&nbsp;<a href=\"https:\/\/cdn.sparkfun.com\/assets\/learn_tutorials\/2\/4\/9\/SFE_MMA8452Q-library.zip\">https:\/\/cdn.sparkfun.com\/assets\/learn_tutorials\/2\/4\/9\/SFE_MMA8452Q-library.zip<\/a><\/li><\/ul>\n\n\n\n<h2>ACAT SOFTWARE INTEGRATION<\/h2>\n\n\n\n<p>Programming the Arduino using the Arduino IDE is a relatively simple process and there are several tutorials available on the internet.<\/p>\n\n\n\n<p>The ACAT software, after being installed, is configured to use a video camera. In our project we will not use it, so you can click on the item AcatConfig-&gt; Actuator and leave only the detection of F12 enabled. If you want to test, you can open a browser window and see that when you tap the accelerometer the developer console of the browser opens and closes, as it also uses the F12 key.<\/p>\n\n\n\n<p>Adjusting the system is simple. after leaving the accelerometer connected to the finger or another part of the body, with it at rest, move the potentiometer until the led lights up. This is the maximum sensitivity. At this point, just turn the potentiometer back a little so that the led goes out and at that moment any movement will trigger and fire the F12 key.<\/p>\n\n\n\n<h1>CONCLUSION<\/h1>\n\n\n\n<p>The final result is a system that is affordable, has a very good sensitivity and I hope it can help a lot of people, with ALS or any other disabilities.<\/p>\n\n\n\n<p>If you liked this project, think a little more about you spare time, and remember that no matter what is your religion, or your beliefs, you frequently can see that good karma always came back in different ways.<\/p>\n\n\n\n<p>If you need help just contact me.<\/p>\n\n\n\n<p>Ricardo Andere de Mello\nquilombodigital@gmail.com<\/p>\n","protected":false},"excerpt":{"rendered":"<p>(Updated 03\/27\/2021) INTRODUCTION The father of a friend has ALS (Amyotrophic lateral sclerosis) and recently things got more complicated, with great loss of his movements. I wanted to help, so I did some research&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":47,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[17],"tags":[],"_links":{"self":[{"href":"https:\/\/www.quilombodigital.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/20"}],"collection":[{"href":"https:\/\/www.quilombodigital.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.quilombodigital.org\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.quilombodigital.org\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quilombodigital.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=20"}],"version-history":[{"count":20,"href":"https:\/\/www.quilombodigital.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/20\/revisions"}],"predecessor-version":[{"id":150,"href":"https:\/\/www.quilombodigital.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/20\/revisions\/150"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.quilombodigital.org\/wordpress\/index.php?rest_route=\/wp\/v2\/media\/47"}],"wp:attachment":[{"href":"https:\/\/www.quilombodigital.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=20"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quilombodigital.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=20"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quilombodigital.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=20"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}