{"id":66,"date":"2023-12-19T15:56:43","date_gmt":"2023-12-19T15:56:43","guid":{"rendered":"https:\/\/commons.mtholyoke.edu\/zcmeidgn\/?p=66"},"modified":"2023-12-19T15:56:43","modified_gmt":"2023-12-19T15:56:43","slug":"doorbell","status":"publish","type":"post","link":"https:\/\/commons.mtholyoke.edu\/zcmeidgn\/2023\/12\/19\/doorbell\/","title":{"rendered":"Doorbell"},"content":{"rendered":"\n<h5 class=\"wp-block-heading\">Reflection<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">For this project I decided to stick with a very traditional doorbell, just press the \u201cbutton\u201d outside and then there will be a \u201cding dong\u201d or in this case a buzzing sound. I used the code from the resources \u20187 capacitive touch sensors\u2019 but edited it to just 2 capacitive touch sensors. I used the lid from my previous music box project as the door. Then, I just used copper tape and an alligator clip, so when I would touch the copper take from one side, there would be a buzzing sound. Once it was done it worked, but I decided to include an led on the \u2018inside\u2019 so it would notify the person inside in case they didn\u2019t hear the buzzing. In this case I would consider this the role of (growth) mindset, since I wanted to try something new.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, I was not able to get it to work how I wanted it. Both the light and the buzzing sound would start as soon as I connected the negative leg of the led to a ground pin. I\u2019m not sure if it was because I did not do the circuit part well, or if it was the coding part that I needed to change. So, I just left it like that, although it didn\u2019t work like I thought it would, it still is an interactive project. Once I touched the negative leg of the led with the alligator clip, it started buzzing and the light flickered.\u00a0\u00a0<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Final product<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/photos.app.goo.gl\/Rh3opjggC1fdeJeA9\">https:\/\/photos.app.goo.gl\/Rh3opjggC1fdeJeA9<\/a><\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Code<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ 2 capacitive touch sensors: A4 - A5\r\n\r\n\r\n\r\n\r\n#include &lt;Adafruit_CircuitPlayground.h&gt;\r\n\r\n\r\n#define NOTE_G3 196\r\n\r\n\r\n\r\n\r\n\/\/ we light one pixel at a time, this is our counter\r\n\r\n\r\nuint8_t pixeln = 0;\r\n\r\n\r\nint capSensorPins&#091;] = { 3, 2 };\r\n\r\n\r\nint numCapSensors = 2;\r\n\r\n\r\nint ledForCap&#091;] = { 0, 1, 3, 4, 6, 8, 9 };\r\n\r\n\r\n\r\n\r\n\/\/ { 3, 2, 0}\r\n\r\n\r\n\/\/ { A4, A5}\r\n\r\n\r\n\/\/ 3 -&gt; A4, 2 -&gt; A5, 0\r\n\r\n\r\n\r\n\r\nint THRESHOLD = 1000;\r\n\r\n\r\n\r\n\r\nvoid setup() {\r\n\r\n\r\nSerial.begin(9600);\r\n\r\n\r\nCircuitPlayground.begin();\r\n\r\n\r\n}\r\n\r\n\r\n\r\n\r\nvoid loop() {\r\n\r\n\r\n\r\n\r\n\/\/ for each pin that could be a capacitive touch sensor\r\n\r\n\r\nfor (int i = 0; i &lt; numCapSensors; i++)\r\n\r\n\r\n{\r\n\r\n\r\n\/\/ print the information about what we are sensing\r\n\r\n\r\nSerial.print(\"Capsense #\");\r\n\r\n\r\nSerial.print(capSensorPins&#091;i]);\r\n\r\n\r\nSerial.print(\": \");\r\n\r\n\r\nSerial.println(CircuitPlayground.readCap(capSensorPins&#091;i]));\r\n\r\n\r\n\r\n\r\n\/\/ if the value we sense is large enough\r\n\r\n\r\nif (CircuitPlayground.readCap(capSensorPins&#091;i]) &gt; THRESHOLD)\r\n\r\n\r\n\/\/ light the associated neopixel\r\n\r\n\r\nCircuitPlayground.setPixelColor(ledForCap&#091;i], CircuitPlayground.colorWheel(25 * i));\r\n\r\n\r\nelse\r\n\r\n\r\n\/\/ otherwise, clear out the light for that neopixel\r\n\r\n\r\nCircuitPlayground.setPixelColor(ledForCap&#091;i], 0, 0, 0);\r\n\r\n\r\n}\r\n\r\n\r\n\r\n\r\n\/\/ let's also play a note for one of them, as an example\r\n\r\n\r\n\/\/ we'll pick pin 3, which is labeled SCL\/A4 on the board\r\n\r\n\r\n\/\/ if the value is large enough\r\n\r\n\r\nif ( CircuitPlayground.readCap( 3 ) &gt; THRESHOLD)\r\n\r\n\r\n\/\/ play the note (only if the slide switch is on)\r\n\r\n\r\nplayNote( NOTE_G3, 250 );\r\n\r\n\r\ndelay(50);\r\n\r\n\r\n}\r\n\r\n\r\n\r\n\r\n\/\/ Play a note of the specified frequency and for the specified duration.\r\n\r\n\r\n\/\/ No tones will play if the slide switch is in the -\/off position.\r\n\r\n\r\nvoid playNote(int frequency, int duration) {\r\n\r\n\r\n\/\/ Check if the slide switch is off\r\n\r\n\r\nif (!CircuitPlayground.slideSwitch()) {\r\n\r\n\r\n\/\/ stop immediately without playing anything.\r\n\r\n\r\nreturn;\r\n\r\n\r\n} else {\r\n\r\n\r\n\/\/ Play the note for the specified duration.\r\n\r\n\r\nCircuitPlayground.playTone(frequency, duration, false);\r\n\r\n\r\n\/\/ wait for the note to play\r\n\r\n\r\ndelay(duration + duration \/ 16);\r\n\r\n\r\n}\r\n\r\n\r\n}\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Reflection For this project I decided to stick with a very traditional doorbell, just press the \u201cbutton\u201d outside and then there will be a \u201cding dong\u201d or in this case a buzzing sound. I used the code from the resources \u20187 capacitive touch sensors\u2019 but edited it to just 2 capacitive touch sensors. I used [&hellip;]<\/p>\n","protected":false},"author":2355,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-66","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/commons.mtholyoke.edu\/zcmeidgn\/wp-json\/wp\/v2\/posts\/66","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/commons.mtholyoke.edu\/zcmeidgn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/commons.mtholyoke.edu\/zcmeidgn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/commons.mtholyoke.edu\/zcmeidgn\/wp-json\/wp\/v2\/users\/2355"}],"replies":[{"embeddable":true,"href":"https:\/\/commons.mtholyoke.edu\/zcmeidgn\/wp-json\/wp\/v2\/comments?post=66"}],"version-history":[{"count":1,"href":"https:\/\/commons.mtholyoke.edu\/zcmeidgn\/wp-json\/wp\/v2\/posts\/66\/revisions"}],"predecessor-version":[{"id":67,"href":"https:\/\/commons.mtholyoke.edu\/zcmeidgn\/wp-json\/wp\/v2\/posts\/66\/revisions\/67"}],"wp:attachment":[{"href":"https:\/\/commons.mtholyoke.edu\/zcmeidgn\/wp-json\/wp\/v2\/media?parent=66"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/commons.mtholyoke.edu\/zcmeidgn\/wp-json\/wp\/v2\/categories?post=66"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/commons.mtholyoke.edu\/zcmeidgn\/wp-json\/wp\/v2\/tags?post=66"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}