Champaign-Urbana Community Fab Lab
Champaign-Urbana Community Fab Lab

Arduino Introduction Assignment – Nicholas Agate

     For the Arduino Introduction Assignment, I wanted to create a solution to issues with my stove. After I finish cooking, I will sometimes forget to turn one of the burners off. The lights on the stove are not very bright and this makes it harder for me to realize that the stove is still on. So, I set out to prototype an Arduino device that would automatically switch the stove top dial to off. The idea is that a temperature sensor would be linked to the Arduino along with a servo that would turn the stove dial after a certain amount of time passed and there was a positive heat reading. Please see the storyboard for my idea below.

     The first step was to set up the KY-028 temperature sensor and get it to recognize a heat source. I found a guide for doing this on the website arduinomodules.info, and I successfully got the sensor to turn on and link with the Arduino. I also used the code that was supplied on this webpage, but I ran into issues when trying to get the sensor to recognize heat and communicate with the Arduino. The temperature sensor utilizes a physical threshold detector called a potentiometer, and this is where I believe I ran into the problem. The Arduino was supposed to receive a “high” signal when the potentiometer had its threshold surpassed and then light up the Arduino’s LED, but the LED was constantly lit up (“KY-028 Digital Temperature Sensor Module.”). Thus, I tried adjusting the potentiometer to heighten the threshold but with no results. Please see the Arduino, temperature sensor, and arduinomodules.info’s code below .

     After testing the temperature sensor, I moved on to the servo to see if I could get it to operate. I used a very helpful YouTube video by educ8s.tv and was able to get the servo running. I followed the video’s instructions and set the servo up and wrote its code (“Arduino Tutorial: Using a Servo SG90 Arduino.”). I then played with the code’s variables to see how the servo could be manipulated and ended up changing the speed at which the servo swung. Please see the videos of my servo in action, and educ8s.tv’s code below.

     Finally I knew that I would need the temperature sensor to detect heat after a specific amount of time had elapsed and then cause the servo to turn on and perform its task. I already got stuck on the temperature sensor, so I knew that I would not end up with a working prototype. However, I tried to splice the two tutorials’ code together in order to create the prototype’s code. In the beginning of the program, all of the variables from the arduinomodules.info’s code are defined. The setup section then outlines the initial parameters for both the temperature sensor and servo. Following this, I tried to utilize arduinomodules.info’s and educ8s.tv’s code to make a loop that would engage the servo when a “high” signal is picked up by the Arduino from the temperature sensor. Unfortunately I could not get the code to be uploaded to the Arduino due to errors. I got the error messages “a function-definition is not allowed here before ‘{‘ token” and “expected intializer before ‘servo'”. I searched various forums to try to solve the problem, but I could not resolve it before the deadline. Please see the spliced code below.

     I enjoyed this project because I had fun seeing what I could get to function properly. Although I ran into hiccups with the temperature sensor, searching for solutions caused me to learn a lot more about it. If I were to do this assignment again, I think that I would spend more time attempting to write my own code for these devices. This would allow me to learn a lot more and possibly fix the issues with the code that I ran into. Thank you for reading.

Works Cited

“Arduino Tutorial: Using a Servo SG90 Arduino.” YouTube, uploaded by educ8s.tv, 2 January 2016, https://www.youtube.com/watch?v=SfmHNb5QAzc.

“KY-028 Digital Temperature Sensor Module.” ArduinoModulesInfo, 29 Jan. 2019, arduinomodules.info/ky-028-digital-temperature-sensor-module/.