{"id":2333,"date":"2022-03-03T18:59:31","date_gmt":"2022-03-03T23:59:31","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/?p=2333"},"modified":"2022-03-20T21:28:44","modified_gmt":"2022-03-21T01:28:44","slug":"kinetic-crit-stove-top-temperature-indicator-james-kyle","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/?p=2333","title":{"rendered":"Kinetic Crit: Stove-top Temperature Indicator &#8211; James Kyle"},"content":{"rendered":"<p><span style=\"text-decoration: underline\"><strong>Problem:<\/strong><\/span><\/p>\n<p>Stoves are a common household product for anyone with a kitchen and extremely useful in giving a person some autonomy over their life. However, they are by nature extremely hazardous because they deal with high temperatures. Although many electric stovetops have indication lights for when the surface is hot, these indications do nothing to help a blind user know when the stovetop is hot and not safe to touch.<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"text-decoration: underline\"><strong>Solution:<\/strong><\/span><\/p>\n<p>To solve this problem, I have decided to make a stove top temperature indicator that relies on sound and proximity to the stovetop to indicate when a surface is safe to touch. A set of ultrasonic rangers determines when an object is near and how far away the object is from the stove top. If the stovetop is too hot, the device then uses vibration motors to bounce around and audibly indicate the ensuing danger. The user also has an override button to turn the vibration off because the device cannot discern the difference between intentional and unintentional object placement on the hot stove.<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"text-decoration: underline\"><strong>Proof of Concept:<\/strong><\/span><\/p>\n<p>For a proof of concept, I have built a smaller version with one ultrasonic for each x and y components of the stove top. There are only two vibration motors as well just to show the possibility. In a real version of the concept, the vibration motors would be placed in a resonating surface such as a bell to create more noise and alert the user better.<\/p>\n<figure id=\"attachment_2370\" aria-describedby=\"caption-attachment-2370\" style=\"width: 846px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" class=\"wp-image-2370\" src=\"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/wp-content\/uploads\/2022\/03\/IMG_7517-225x300.png\" alt=\"\" width=\"846\" height=\"1128\" srcset=\"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/wp-content\/uploads\/2022\/03\/IMG_7517-225x300.png 225w, https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/wp-content\/uploads\/2022\/03\/IMG_7517-768x1024.png 768w, https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/wp-content\/uploads\/2022\/03\/IMG_7517-1152x1536.png 1152w, https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/wp-content\/uploads\/2022\/03\/IMG_7517-1536x2048.png 1536w, https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/wp-content\/uploads\/2022\/03\/IMG_7517-1200x1600.png 1200w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><figcaption id=\"caption-attachment-2370\" class=\"wp-caption-text\">Top down view of entire setup<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p><span style=\"text-decoration: underline\"><strong>Demo:<\/strong><\/span><\/p>\n<div style=\"width: 360px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-2333-1\" width=\"360\" height=\"640\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/wp-content\/uploads\/2022\/03\/IMG_7516.mp4?_=1\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/wp-content\/uploads\/2022\/03\/IMG_7516.mp4\">https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/wp-content\/uploads\/2022\/03\/IMG_7516.mp4<\/a><\/video><\/div>\n<p>&nbsp;<\/p>\n<p><span style=\"text-decoration: underline\"><strong>Code:<\/strong><\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\">\/\/Temperature stuff\r\nconst int tempSensor = A0;\r\nfloat stoveTemp;\r\nfloat stoveTempThreshold = 40; \/\/ [*C]\r\nfloat c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;\r\n\r\n\r\n\/\/Vibration motor stuff\r\nconst int vibrationMotor1 = 6;\r\nconst int vibrationMotor2 = 7;\r\nconst int vibrationMotorCount = 2;\r\nint vibrationMotors[vibrationMotorCount] = {vibrationMotor1, vibrationMotor2};\r\n\r\n\r\n\/\/Object detection stuff\r\nconst int trigPin1 = 12;\r\nconst int echoPin1 = 13;\r\nconst int trigPin2 = 8;\r\nconst int echoPin2 = 9;\r\nfloat dangerDistance = 5; \/\/Distance threshold\r\n\r\n\r\n\/\/E-stop stuff\r\nconst int stopButton = 3;\r\n\r\n\r\n\/\/Logical stuff\r\nbool stoveIsHot;\r\nbool objectOnStove;\r\nbool userOverride = false;\r\n\r\n\r\n\/\/Debounce Stuff\r\nunsigned long debounceTimer = 0;\r\nunsigned long debounceDelay = 100;\r\nbool prevButtonState = false;\r\nbool currButtonState = false;\r\nbool lookForPress = true;\r\n\r\n\r\n\r\nvoid setup()\r\n{\r\n\r\n  pinMode(trigPin1, OUTPUT); \/\/ Sets the trigPin as an Output\r\n  pinMode(echoPin1, INPUT); \/\/ Sets the echoPin as an Input\r\n  pinMode(trigPin2, OUTPUT); \/\/ Sets the trigPin as an Output\r\n  pinMode(echoPin2, INPUT); \/\/ Sets the echoPin as an Input\r\n  pinMode(tempSensor, INPUT);\r\n  pinMode(stopButton, INPUT_PULLUP);\r\n\r\n  pinMode(vibrationMotor1, OUTPUT);\r\n  pinMode(vibrationMotor2, OUTPUT);\r\n\r\n  attachInterrupt(digitalPinToInterrupt(stopButton), stopNoise, LOW);\r\n\r\n  Serial.begin(9600); \/\/ Starts the serial communication\r\n\r\n}\r\n\r\nvoid loop()\r\n{\r\n\r\n  if (prevButtonState != currButtonState) {\r\n    debounceTimer = millis();\r\n    prevButtonState = currButtonState;\r\n  }\r\n\r\n  if (millis() - debounceTimer &gt; debounceDelay) {\r\n    lookForPress = true;\r\n  }\r\n\r\n\r\n  if (!userOverride) {\r\n    stoveIsHot = checkStoveTemp();\r\n\r\n    if (stoveIsHot) {\r\n      objectOnStove = checkStoveSpace();\r\n    }\r\n  } else {\r\n    vibrateMotors(0);\r\n  }\r\n  \r\n\r\n\r\n}\r\n\r\n\r\n\r\nint getDistance(int trigPin, int echoPin) {\r\n\r\n  long duration;\r\n  int distance;\r\n\r\n  \/\/ Clears the trigPin\r\n  digitalWrite(trigPin, LOW);\r\n  delayMicroseconds(2);\r\n  \/\/ Sets the trigPin on HIGH state for 10 micro seconds\r\n  digitalWrite(trigPin, HIGH);\r\n  delayMicroseconds(10);\r\n  digitalWrite(trigPin, LOW);\r\n  \/\/ Reads the echoPin, returns the sound wave travel time in microseconds\r\n  duration = pulseIn(echoPin, HIGH);\r\n  \/\/ Calculating the distance\r\n  distance = duration * 0.034 \/ 2;\r\n  \/\/ Prints the distance on the Serial Monitor\r\n  return distance;\r\n\r\n}\r\n\r\n\r\nbool checkStoveTemp() {\r\n\r\n  const int stoveTempThreshold = 40;\r\n  static float stoveTemp;\r\n  static bool DANGER;\r\n\r\n  stoveTemp = analogRead(tempSensor);\r\n  stoveTemp = log(stoveTemp);\r\n  stoveTemp = (1.0 \/ (c1 + c2 * stoveTemp + c3 * stoveTemp * stoveTemp * stoveTemp));\r\n  stoveTemp = stoveTemp - 353.15;\r\n  \/\/Serial.println(stoveTemp);\r\n\r\n\r\n  if (stoveTemp &gt; stoveTempThreshold) {\r\n    if (!DANGER) {\r\n      DANGER = true;\r\n      Serial.println(\"WARNING...DANGER!!\");\r\n    }\r\n  } else {\r\n    if (DANGER) {\r\n      DANGER = false;\r\n      Serial.println(\"Surface is safe to touch now\");\r\n    }\r\n  }\r\n\r\n  return DANGER;\r\n}\r\n\r\n\r\n\r\n\r\nbool checkStoveSpace() {\r\n\r\n  static bool moveHand = false;\r\n  static const int numberOfDistanceSensors = 2;\r\n  static float distanceReadings[numberOfDistanceSensors];\r\n  static int distanceSensorPins[2 * numberOfDistanceSensors] = {trigPin1, echoPin1, trigPin2, echoPin2};\r\n\r\n\r\n  \/\/Check ultrasonic rangers\r\n  for (int i = 0; i &lt; numberOfDistanceSensors; i++) {\r\n    int currTrig = distanceSensorPins[2 * i];\r\n    int currEcho = distanceSensorPins[2 * i + 1];\r\n    distanceReadings[i] = getDistance(currTrig, currEcho);\r\n  }\r\n\r\n\r\n  \/\/Indicate danger if something is close to stove\r\n  for (int i = 0; i &lt; numberOfDistanceSensors; i++) {\r\n    if (distanceReadings[i] &lt; dangerDistance) {\r\n\r\n      Serial.println(\"MOVE YOU HAND!!\");\r\n\r\n      \/\/Make warning noise\r\n      vibrateMotors(1);\r\n\r\n      return true;\r\n\r\n    }\r\n  }\r\n\r\n\r\n  \/\/Turn off warning noise\r\n  vibrateMotors(0);\r\n\r\n\r\n  return false;\r\n}\r\n\r\nvoid vibrateMotors(int vibrationSpeed) {\r\n  for (int i = 0; i &lt; vibrationMotorCount; i++) {\r\n    digitalWrite(vibrationMotors[i], vibrationSpeed);\r\n  }\r\n}\r\n\r\n\r\nvoid stopNoise() {\r\n\r\n  if (lookForPress) {\r\n    currButtonState = !currButtonState;\r\n    lookForPress = false;\r\n\r\n    if (userOverride) {\r\n      userOverride = false;\r\n    } else {\r\n      userOverride = true;\r\n    }\r\n\r\n  }\r\n\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Problem: Stoves are a common household product for anyone with a kitchen and extremely useful in giving a person some autonomy over their life. However, they are by nature extremely hazardous because they deal with high temperatures. Although many electric stovetops have indication lights for when the surface is hot, these indications do nothing to &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/?p=2333\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Kinetic Crit: Stove-top Temperature Indicator &#8211; James Kyle&#8221;<\/span><\/a><\/p>\n","protected":false},"author":29,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/index.php?rest_route=\/wp\/v2\/posts\/2333"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/index.php?rest_route=\/wp\/v2\/users\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2333"}],"version-history":[{"count":4,"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/index.php?rest_route=\/wp\/v2\/posts\/2333\/revisions"}],"predecessor-version":[{"id":2398,"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/index.php?rest_route=\/wp\/v2\/posts\/2333\/revisions\/2398"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/48-339\/s2022\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}