<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kseniya Kay on Medium]]></title>
        <description><![CDATA[Stories by Kseniya Kay on Medium]]></description>
        <link>https://medium.com/@kseniya_kay?source=rss-febdf9b3cb7a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*fQB6jUnPPVaDOjBtmAVe0g.png</url>
            <title>Stories by Kseniya Kay on Medium</title>
            <link>https://medium.com/@kseniya_kay?source=rss-febdf9b3cb7a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 16:10:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kseniya_kay/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Lab 8 | Capacitive Sensing with Piezo]]></title>
            <link>https://medium.com/@kseniya_kay/lab-8-capacitive-sensing-with-piezo-658332534796?source=rss-febdf9b3cb7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/658332534796</guid>
            <category><![CDATA[info-c262]]></category>
            <category><![CDATA[arduino-projects]]></category>
            <category><![CDATA[berkeleyischool]]></category>
            <dc:creator><![CDATA[Kseniya Kay]]></dc:creator>
            <pubDate>Tue, 11 Nov 2025 16:59:20 GMT</pubDate>
            <atom:updated>2025-11-11T18:26:13.760Z</atom:updated>
            <content:encoded><![CDATA[<p>Joseline Chang, Samuel Robson, Kseniya Kapytouskaya, Professor Kimiko Ryokai. INFO C262, Fall 2025</p><h3>Objective</h3><p>In this lab, we played around with the capacitive sensor exploring both its touch and proximity affordances. We created a simple capacitive sensor in class using a piece of foil and a paper clip, and later explored another conductive material— an apple :) We created an interaction with an everyday object using the capacitive sensor as a proximity input and adding a Piezo buzzer and a Servo motor to it. Thinking up the function, story, aesthetic value and the practical application of our interaction was probably the hardest part — much less so the actual implementation.</p><h3>Components</h3><p><em>1 — Arduino R4 Minima<br>1 — breadboard<br>1–10M Ω Resistor<br>1 — paperclip<br>1 — piece of foil<br>1 — Piezo buzzer<br>1 — apple<br>1 — plate coaster<br>1 — Servo motor<br>1 — loaded container<br>multiple — jumper wires</em></p><h3>Process Description</h3><p>Our team first created a capacitive sensor with a piece of foil and a paper clip following the visual instructions and the code provided by the teaching team.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iqlsiMULcLEJutjCYceDPA.png" /><figcaption>Visual instructions from the teaching team for creating a capacitive sensor</figcaption></figure><pre>// UNO R4-compatible capacitive sensing (no external library).<br>// This sketch prints a relative &quot;capacitance&quot; value to Serial.<br>const uint8_t SEND_PIN = 4;<br>const uint8_t RECV_PIN = 2;<br><br>// Safety timeout so we never hang while waiting for a transition<br>const unsigned long TIMEOUT_US = 3000; // 3 ms is plenty here<br><br>// Take multiple samples and average for smoother readings<br>const uint8_t NUM_SAMPLES = 10;<br>unsigned long measureOnce() {<br><br>// 1) Discharge the receive node<br>pinMode(RECV_PIN, OUTPUT);<br>digitalWrite(RECV_PIN, LOW);<br>delayMicroseconds(5);<br><br>// 2) Prepare to measure: make RECV an input, drive SEND high to charge through the resistor<br>pinMode(RECV_PIN, INPUT);<br>digitalWrite(SEND_PIN, HIGH);<br><br>// 3) Time how long until RECV reads HIGH (Schmitt threshold crossed)<br>unsigned long start = micros();<br>while (digitalRead(RECV_PIN) == LOW) {<br>if (micros() - start &gt; TIMEOUT_US) break; // avoid lockup<br>}<br>unsigned long duration = micros() - start;<br><br>// 4) Pull SEND low to stop charging<br>digitalWrite(SEND_PIN, LOW);<br>return duration; // higher = more capacitance (touch/nearby hand)<br>}<br>unsigned long readCapacitance(uint8_t samples) {<br>unsigned long sum = 0;<br>for (uint8_t i = 0; i &lt; samples; i++) {<br> sum += measureOnce();<br>delayMicroseconds(200);<br>}<br>return sum / samples;<br>}<br><br>void setup() {<br>pinMode(SEND_PIN, OUTPUT);<br>digitalWrite(SEND_PIN, LOW);<br>pinMode(RECV_PIN, INPUT);<br>Serial.begin(9600);<br><br> // Give USB/Serial a moment to come up<br>delay(200);<br>}<br><br>void loop() {<br>unsigned long capVal = readCapacitance(NUM_SAMPLES);<br>Serial.println(capVal);<br>delay(10);<br>}</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FLdUOJYa4G7c%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DLdUOJYa4G7c&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FLdUOJYa4G7c%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/948612c7d99d7052eebbc27381452766/href">https://medium.com/media/948612c7d99d7052eebbc27381452766/href</a></iframe><p>As the first output looked hopeful, we explored threshold detection of a capacitive sensor to make the built in LED next to pin 13 of the Arduino board turn on. Another code provided by the teaching team automatically calibrated a baseline when the program started (so we had to make sure no one was touching the sensor for the first couple of seconds). After calibration, the program compared the live sensor value to the established baseline.</p><pre>// UNO R4 Capacitive Touch (10 MΩ) — baseline + timeout-aware touch detection<br>// Wiring: 10 MΩ between D4 (SEND) and D2 (RECV); foil pad on D2<br>const uint8_t SEND_PIN = 4;<br>const uint8_t RECV_PIN = 2;<br>const unsigned long TIMEOUT_US = 8000; // long enough for 10 MΩ<br>const unsigned long SAT_MARGIN = 400; // within this of timeout = definite touch<br>const uint8_t AVG_SAMPLES = 10; // smoothing<br>const uint16_t CAL_SAMPLES = 100; // ~2 s calibration @ 15 ms each<br><br>// Auto-calibrated thresholds<br>unsigned long baseline = 0;<br>unsigned long thrOn = 0;<br>unsigned long thrOff = 0;<br>unsigned long measureOnce() {<br><br>// Discharge<br>digitalWrite(SEND_PIN, LOW);<br>pinMode(RECV_PIN, OUTPUT);<br>digitalWrite(RECV_PIN, LOW);<br>delayMicroseconds(50);<br><br>// Charge + time to digital HIGH<br>pinMode(RECV_PIN, INPUT); // no pullup<br>digitalWrite(SEND_PIN, HIGH);<br>unsigned long start = micros();<br>while (digitalRead(RECV_PIN) == LOW) {<br>if (micros() - start &gt; TIMEOUT_US) {<br>digitalWrite(SEND_PIN, LOW);<br>return TIMEOUT_US; // saturated (touch/proximity w/ large pad)<br>}<br>}<br><br>unsigned long dur = micros() - start;<br>digitalWrite(SEND_PIN, LOW);<br>return dur; // higher = more capacitance<br>}<br><br>unsigned long readAverage(uint8_t n) {<br>unsigned long sum = 0;<br>for (uint8_t i = 0; i &lt; n; i++) {<br> sum += measureOnce();<br>delayMicroseconds(250);<br>}<br>return sum / n;<br>}<br><br>void calibrate() {<br>// Hands off the sensor during calibration (~2 s)<br>unsigned long sum = 0;<br>for (uint16_t i = 0; i &lt; CAL_SAMPLES; i++) {<br> sum += measureOnce();<br>delay(15);<br>}<br> baseline = sum / CAL_SAMPLES;<br> // Margin scales with baseline; ensure a sensible minimum<br>unsigned long margin = baseline / 4; // ~25% of idle<br>if (margin &lt; 20) margin = 20;<br> // Hysteresis band<br> thrOn = baseline + margin;<br> thrOff = baseline + margin / 2;<br>}<br><br>void setup() {<br>pinMode(SEND_PIN, OUTPUT);<br>digitalWrite(SEND_PIN, LOW);<br>pinMode(RECV_PIN, INPUT);<br>pinMode(LED_BUILTIN, OUTPUT);<br>Serial.begin(9600);<br>delay(200);<br>calibrate();<br>Serial.print(&quot;baseline=&quot;); Serial.print(baseline);<br>Serial.print(&quot; thrOn=&quot;); Serial.print(thrOn);<br>Serial.print(&quot; thrOff=&quot;); Serial.println(thrOff);<br>}<br><br>bool touched = false;<br>void loop() {<br>unsigned long v = readAverage(AVG_SAMPLES);<br> // Rule 1: near-timeout = definite touch (handles your 8000 case)<br>bool nearTimeout = (v &gt;= (TIMEOUT_US - SAT_MARGIN));<br> // Rule 2: otherwise use hysteresis around baseline<br>if (!touched &amp;&amp; (nearTimeout || v &gt; thrOn)) touched = true;<br>if ( touched &amp;&amp; !nearTimeout &amp;&amp; v &lt; thrOff) touched = false;<br>digitalWrite(LED_BUILTIN, touched ? HIGH : LOW);<br> // Plot the measured value; uncomment to also plot thresholds<br>Serial.println(v);<br> // Serial.print(v); Serial.print(&#39;,&#39;);<br> // Serial.print(thrOn); Serial.print(&#39;,&#39;);<br> // Serial.print(thrOff); Serial.print(&#39;,&#39;);<br> // Serial.println(TIMEOUT_US);<br>delay(10);<br>}</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FwEl8ETG-_I4%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2FwEl8ETG-_I4%3Ffeature%3Dshare&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FwEl8ETG-_I4%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/05de41cc9d983b21e3f3ceff7a27edc6/href">https://medium.com/media/05de41cc9d983b21e3f3ceff7a27edc6/href</a></iframe><h3>Creative Interaction</h3><p>Once the threshold detection of a capacitive sensor was tested out and fully working, we replaced the foil with an apple, made sure its conductive qualities were on par, and connected a Piezo buzzer to the breadboard alarming the audience when the apple was being touched. To make the interaction more assuring, we added a Servo motor with an attached plate coaster to it, removing the apple away from the unsolicited person :) We also placed the Servo inside of a loaded container to add stability to the construction.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dm_0BlOy_RH4&amp;type=text%2Fhtml&amp;schema=youtube&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fm_0BlOy_RH4%3Ffeature%3Doembed" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e3ac914c20bf0442f9eb20628617c3fa/href">https://medium.com/media/e3ac914c20bf0442f9eb20628617c3fa/href</a></iframe><p>The next step would be to hide the interaction mechanics from the viewer’s eye by placing the breadboard and Arduino board inside of the container under the plate coaster, making a hole in the coaster and connecting the jumper wire to the bottom of the apple through the hole. This way, we would only be able to see the rotating plate with the apple on it.</p><h3>Code</h3><pre>// UNO R4 Capacitive Touch (10 MΩ) - baseline + timeout-aware touch detection<br>#include &lt;Servo.h&gt;<br>// Wiring: 10 MΩ between D4 (SEND) and D2 (RECV); foil pad on D2<br><br>const uint8_t SEND_PIN = 4;<br>const uint8_t RECV_PIN = 2;<br>const unsigned long TIMEOUT_US = 8000; // long enough for 10 MΩ<br>const unsigned long SAT_MARGIN = 400; // within this of timeout = definite touch<br>const uint8_t AVG_SAMPLES = 10; // smoothing<br>const uint16_t CAL_SAMPLES = 100; // ~2 s calibration @ 15 ms each<br>const uint8_t BUZZER_PIN = 8; // adding a buzzer pin<br><br>// --- Servo setup ---<br>const uint8_t SERVO_PIN = 9;     // control wire to D9<br>Servo myservo;<br>int currentAngle = 0;            // track angle (optional smoothing)<br>const int ANGLE_TOUCH = 180;<br>const int ANGLE_IDLE  = 0;<br><br>// Auto-calibrated thresholds<br><br>unsigned long baseline = 0;<br>unsigned long thrOn = 0;<br>unsigned long thrOff = 0;<br>unsigned long measureOnce() {<br><br> // Discharge<br><br>digitalWrite(SEND_PIN, LOW);<br>pinMode(RECV_PIN, OUTPUT);<br>digitalWrite(RECV_PIN, LOW);<br>delayMicroseconds(50);<br><br> // Charge + time to digital HIGH<br><br>pinMode(RECV_PIN, INPUT); // no pullup<br>digitalWrite(SEND_PIN, HIGH);<br>unsigned long start = micros();<br>while (digitalRead(RECV_PIN) == LOW) {<br>if (micros() - start &gt; TIMEOUT_US) {<br>digitalWrite(SEND_PIN, LOW);<br>return TIMEOUT_US; // saturated (touch/proximity w/ large pad)<br>}<br>}<br><br>unsigned long dur = micros() - start;<br>digitalWrite(SEND_PIN, LOW);<br>return dur; // higher = more capacitance<br>}<br><br>unsigned long readAverage(uint8_t n) {<br>unsigned long sum = 0;<br>for (uint8_t i = 0; i &lt; n; i++) {<br> sum += measureOnce();<br>delayMicroseconds(250);<br>}<br>return sum / n;<br>}<br><br>void calibrate() {<br> // Hands off the sensor during calibration (~2 s)<br>unsigned long sum = 0;<br>for (uint16_t i = 0; i &lt; CAL_SAMPLES; i++) {<br> sum += measureOnce();<br>delay(15);<br>}<br><br> baseline = sum / CAL_SAMPLES;<br> // Margin scales with baseline; ensure a sensible minimum<br>unsigned long margin = baseline / 4; // ~25% of idle<br>if (margin &lt; 20) margin = 20;<br> // Hysteresis band<br> thrOn = baseline + margin;<br> thrOff = baseline + margin / 2;<br>}<br><br>void setup() {<br>pinMode(SEND_PIN, OUTPUT);<br>digitalWrite(SEND_PIN, LOW);<br>pinMode(RECV_PIN, INPUT);<br>pinMode(LED_BUILTIN, OUTPUT);<br>pinMode(BUZZER_PIN, OUTPUT);<br><br>myservo.attach(SERVO_PIN);<br>myservo.write(ANGLE_IDLE);<br>currentAngle = ANGLE_IDLE;<br><br>Serial.begin(9600);<br>delay(200);<br>calibrate();<br>Serial.print(&quot;baseline=&quot;); Serial.print(baseline);<br>Serial.print(&quot; thrOn=&quot;); Serial.print(thrOn);<br>Serial.print(&quot; thrOff=&quot;); Serial.println(thrOff);<br>}<br><br>bool touched = false;<br><br>void loop() {<br>static bool prevTouched = false;         // remember previous state<br>unsigned long v = readAverage(AVG_SAMPLES);<br><br> // Rule 1: near-timeout = definite touch (handles your 8000 case)<br>bool nearTimeout = (v &gt;= (TIMEOUT_US - SAT_MARGIN));<br><br> // Rule 2: otherwise use hysteresis around baseline<br>if (!touched &amp;&amp; (nearTimeout || v &gt; thrOn)) touched = true;<br>if ( touched &amp;&amp; !nearTimeout &amp;&amp; v &lt; thrOff) touched = false;<br><br>digitalWrite(LED_BUILTIN, touched ? HIGH : LOW);<br><br>// Move servo based on touch state<br>int target = touched ? ANGLE_TOUCH : ANGLE_IDLE;<br>myservo.write(target);<br><br>// --- Buzzer feedback (edge-triggered) ---<br>if (!prevTouched &amp;&amp; touched) {<br>  // Touch detected: move servo + sound<br>  playAlarm();<br>  myservo.write(180);      // move to 180°<br>  delay(1000);             // hold for 1 second<br>  myservo.write(0);        // return to 0°<br>}<br><br>prevTouched = touched;<br><br>// stream raw value for plotting/debug<br>Serial.println(v);<br>delay(10);<br>}<br><br>// Apple bite sound<br>void playAlarm() {<br>  // Phase 1: Regular beeps (attention grabber)<br>  for (int i = 0; i &lt; 6; i++) {<br>    tone(BUZZER_PIN, 1000, 200); // mid tone<br>    delay(250);<br>    tone(BUZZER_PIN, 1500, 200); // higher tone<br>    delay(250);<br>  }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=658332534796" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lab 7| Output: Servo Motors]]></title>
            <link>https://medium.com/@kseniya_kay/lab-7-output-servo-motors-1cd9898948d6?source=rss-febdf9b3cb7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/1cd9898948d6</guid>
            <category><![CDATA[berkeleyischool]]></category>
            <category><![CDATA[info-c262]]></category>
            <dc:creator><![CDATA[Kseniya Kay]]></dc:creator>
            <pubDate>Tue, 28 Oct 2025 08:13:06 GMT</pubDate>
            <atom:updated>2025-10-28T08:33:48.668Z</atom:updated>
            <content:encoded><![CDATA[<p>Kseniya Kapytouskaya, Professor Kimiko Ryokai. INFO C262, Fall 2025</p><h3>Objective</h3><p>In this lab, we got to use the servo motor and programmed it to respond to the keyboard and the potentiometer. For our homework assignment, we were to create an actual wheelless crawler, and generate forward movement with it, optionally using the potentiometer to control the speed of the movement. Coming up with the actual moving design has been the hardest part for me.</p><h3>Components</h3><p><em>1 — Arduino R4 Minima<br>1 — breadboard<br>1 — little blue flashy thing<br>1 — potentiometer<br>1 — servo motor<br>1 — Arduino box<br>1— double-sided scotch-tape<br>multiple— cardboard pieces<br>multiple — wires</em></p><h3>Process Description</h3><p>I first connected the servo motor to the breadboard and attached one of the accessories to it to see how far the rotation goes. With the help of the following code I programmed the motor to move with the press of a number key (through Serial Monitor).</p><pre>/*<br> * Servo Control by Serial<br> * entering 1-9 on the serial monitor will move the servo<br> * motor to corresponding positions between 0 and 180 degrees<br> * <br> * brief history of edits:<br> * <br> * modified for TUI Fall 2017<br> *<br> * modified for TUI October 2007<br> *<br> * Created 18 October 2006<br> * copyleft 2006 Tod E. Kurt <br> * http://todbot.com/<br> *<br> * adapted from &quot;http://itp.nyu.edu/physcomp/Labs/Servo&quot;<br> */<br> <br>#include &lt;Servo.h&gt;<br><br>int servoPin = 7; // pin for the servo motor<br><br>Servo myservo;    // create servo object to control a servo<br>int pos;     // the position we want to move the servo to<br><br>int val;          // variable used to store data from serial port<br><br>void setup() {<br>  myservo.attach(servoPin); // attaches the servo on pin servoPin to the servo object<br>  Serial.begin(9600);<br>  Serial.println(&quot;Servo control program ready&quot;);<br>}<br><br>void loop() {<br>  while (Serial.available()) {<br>    val = Serial.read();<br>    if (val &gt;= &#39;1&#39; &amp;&amp; val &lt;= &#39;9&#39; ) {<br>      Serial.println();Serial.println();<br>      // interpret the user&#39;s input to get a number from 1 to 9<br>      val = val - &#39;0&#39;; // convert val from character variable to number variable<br>                       // (see http://forum.arduino.cc/index.php?topic=103511.0 for a forum discussing more about this)<br>      Serial.print(&quot;val = &quot;);Serial.println(val);<br>      <br>      // calculate the position that we should move the servo to<br>      pos = map(val, 1, 9, 0, 180); // (see https://www.arduino.cc/en/Reference/Map)    <br>      Serial.print(&quot;pos = &quot;);Serial.println(pos);<br><br>      // tell the servo to go to the position<br>      myservo.write(pos);<br>      // wait a few milliseconds so we don&#39;t overload the servo with too many commands all at once<br>      delay(15);<br>    }<br>  }<br><br>}</pre><p>Below is what the motor movement looked like. The duration of the rotation depended on the difference between the two consequtively pressed numbers. As such, pressing 1 after 9 and vice versa would generate the longest rotation, while pressing 4 after 5 and vice versa would barely make any difference.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F8zZlayysYU0%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2F8zZlayysYU0%3Ffeature%3Dshare&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F8zZlayysYU0%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0c109689fe5a66e7cf5ad3561ea0b9f5/href">https://medium.com/media/0c109689fe5a66e7cf5ad3561ea0b9f5/href</a></iframe><p>I then connected a potentiometer to the breadboard and used the following code to create dependency between the rotational movement of the servo motor and the potentiometer.</p><pre>/*<br> Controlling a servo position using a potentiometer (variable resistor)<br> by Michal Rinott <br><br> modified on 8 Nov 2013<br> by Scott Fitzgerald<br> http://www.arduino.cc/en/Tutorial/Knob<br>*/<br><br>#include &lt;Servo.h&gt;<br><br>Servo myservo;  // create servo object to control a servo<br><br>int potpin = 0;  // analog pin used to connect the potentiometer<br>int val;    // variable to read the value from the analog pin<br><br>void setup() {<br>  myservo.attach(7);  // attaches the servo on pin 9 to the servo object<br>}<br><br>void loop() {<br>  val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023)<br>  val = map(val, 0, 1023, 0, 180);     // scale it to use it with the servo (value between 0 and 180)<br>  myservo.write(val);                  // sets the servo position according to the scaled value<br>  delay(15);                           // waits for the servo to get there<br>}</pre><p>Below is the result I got. I couldn’t fully get rid of the rotor’s twitching when the potentiometer was cranked up to the maximum power, likely due to the voltage noise.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FS-AFDYZcfow%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=http%3A%2F%2Fwww.youtube.com%2Fshorts%2FS-AFDYZcfow%3Ffeature%3Dshare&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FS-AFDYZcfow%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a2a17dceafd1ea20a9e0ac38920b8721/href">https://medium.com/media/a2a17dceafd1ea20a9e0ac38920b8721/href</a></iframe><h3>Crawler Creation</h3><p>As many times before, I got stuck in the ideation stage a little too long, instead of rapid prototyping. Eventually, I grabbed a piece of cardboard, cut it in multiple thin pieces, stuck every two pieces with double-sided scotch tape and placed two such pieces on each side of the rotor. I then stuck the servo motor on top on the Arduino box. To make sure the crawler moved at a steady speed, I used the code provided by the teaching team but reduced the rotor delay time to 1 second.</p><pre>#include &lt;Servo.h&gt;<br><br>int servoPin = 7; // pin for the servo motor<br><br>Servo myservo;  // create servo object to control a servo<br>// twelve servo objects can be created on most boards<br><br>int pos = 0;    // variable to store the servo position<br><br>void setup() {<br>  myservo.attach(servoPin); // attaches the servo on pin servoPin to the servo object<br>}<br><br>void loop() {<br>  for (pos = 0; pos &lt;= 180; pos += 1) { // goes from 0 degrees to 180 degrees<br>    // in steps of 1 degree<br>    myservo.write(pos);              // tell servo to go to position in variable &#39;pos&#39;<br>    delay(1);                       // waits 15ms for the servo to reach the position<br>  }<br>  for (pos = 180; pos &gt;= 0; pos -= 1) { // goes from 180 degrees to 0 degrees<br>    myservo.write(pos);              // tell servo to go to position in variable &#39;pos&#39;<br>    delay(1);                       // waits 15ms for the servo to reach the position<br>  }<br>}</pre><p>The first prototype turned out alright overall but the cardboard legs would get wobbly and get in the way of linear movement.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F6gm7n0k0xLQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2F6gm7n0k0xLQ%3Ffeature%3Dshare&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F6gm7n0k0xLQ%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3817cfaa5665e113e6184e937c49628b/href">https://medium.com/media/3817cfaa5665e113e6184e937c49628b/href</a></iframe><p>To add stability to the prototype, I glued the third cardboard piece to the two cardboard legs. The crawler got a lot more stable. I experimented with weights and decided to leave the box empty as it would prompt faster movement.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2F9L1IKatze08%3Ffeature%3Dshare&amp;type=text%2Fhtml&amp;schema=youtube&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F9L1IKatze08%3Ffeature%3Doembed" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ade6151e1f368ed3db6fc352d37bf20d/href">https://medium.com/media/ade6151e1f368ed3db6fc352d37bf20d/href</a></iframe><p>After this prototype was completed, I wanted to add synchronous movement to the servo motor’s left side and created a table-looking structure out of the pieces of cardboard. Unfortunately, it did not perform as well crawling-wise, so I disregarded the idea and left the crawler in its second prototyping stage, with only one side moving it along.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1cd9898948d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lab 6 | Output: DC Motors]]></title>
            <link>https://medium.com/@kseniya_kay/lab-6-output-dc-motors-a5ee72f84504?source=rss-febdf9b3cb7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5ee72f84504</guid>
            <dc:creator><![CDATA[Kseniya Kay]]></dc:creator>
            <pubDate>Mon, 20 Oct 2025 02:06:58 GMT</pubDate>
            <atom:updated>2025-10-20T02:20:19.842Z</atom:updated>
            <content:encoded><![CDATA[<p>Kseniya Kapytouskaya, Professor Kimiko Ryokai. INFO C262, Fall 2025</p><h3>Objective</h3><p>In this lab, we played around with the DC motor exploring motion as an output, in a form of a display or tactile feedback. We created a vibration, a rotational motion and came up with the practical application of the device. Additionally, we explored an off-center weight with the motor to see what kinds of different motions this allows us to create. Optionally, we were suggested to combine it with other outputs (sound, light, etc.).</p><h3>Components</h3><p><em>1 — Arduino R4 Minima<br>1 — breadboard<br>1 — 220 Ω Resistor<br>1 — potentiometer<br>1 — DC motor<br>1 — diode (marked 1N4004)<br>1 — transistor (marked TIP120)<br>1 — battery pack<br>2 — cork plug<br>1 — pencil lead<br>multiple — wires</em></p><h3>Process Description</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D82C0ED6hhM6vVIeLoBClg.png" /></figure><p>This device assembly was a little more complicated as it engaged a few new components connected to the breadboard. After I connected a DC motor, a new diode, a transistor and a battery pack, besides the already-connected components I had used in the previous device iterations, I ran the following code (provided by the teaching team) to ensure the DC motor was rotating.</p><pre>/* DC Motor with potentiometer control<br> * Theory and Practice of Tangible User Interfaces<br> * Fall 2025<br> */<br> <br>int motorPin = 9;<br>int potPin = A0;<br><br>int potVal = 0;<br>int motorCtrlVal = 0;<br><br>void setup() {<br>  pinMode(potPin, INPUT);<br>  pinMode(motorPin, OUTPUT);<br>  Serial.begin(9600);<br>}<br><br>void loop() {<br>  potVal = analogRead(potPin);<br>  Serial.print(&quot;potVal: &quot;);Serial.println(potVal);<br>  motorCtrlVal = map(potVal, 0, 1024, 0, 255);<br>  Serial.print(&quot;motorCtrlVal: &quot;);Serial.println(motorCtrlVal);<br>  analogWrite(motorPin, motorCtrlVal);<br>}</pre><p>I then placed a piece of a cork on the top of the DC motor to see how the speed controlled by a potentiometer affects the motion — and below is the outcome I received.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FDYtfOP9q8lA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2FDYtfOP9q8lA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FDYtfOP9q8lA%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c3856569c8933dc22c12331fbbb7c99e/href">https://medium.com/media/c3856569c8933dc22c12331fbbb7c99e/href</a></iframe><p>The rotational movement made me think of multiple use applications: dentistry, a mixer, a fan, a face scrubbing device, a music box, and a carousel. Thinking of the feasibility of demonstrating either of these use applications with my device, I came up with yet another idea. I always found a pencil compass used in Maths classes a bit of a strange device — yet precise and doing the job.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*UTnYBBE-TW9cxuw6ptnxtg.png" /><figcaption>The pencil compass (for a reference)</figcaption></figure><p>I thought of automating the process of drawing circles — with the use of a DC motor, a wider cork surface, and a pencil lead. I borrowed most items from the kitchen, cutting the (salt) cork in half and extracting a piece of a pencil lead, and stuck them together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*siJP2JgcHQmNGf40QmOKCA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5zF8ToJZI3Dl2_SrnS3TRw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lu8UXx4uGIwpL1t9iI4D6w.png" /><figcaption>The tools I used to create a pencil lead holder (pencil compass alternative)</figcaption></figure><p>I ended up not making any alterations to the code, as it was doing a good job rotating the cork with the pencil lead in it. The precision of the circles I drew with the device depended on the position of the cork that would sometimes tilt one way or another. Below, you can see both the device in motion and the final outcome.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Frm4RY7BZ14s%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2Frm4RY7BZ14s%3Ffeature%3Dshare&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Frm4RY7BZ14s%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0a3df6cd39d4763fabc04d9bee4b191/href">https://medium.com/media/c0a3df6cd39d4763fabc04d9bee4b191/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F1KcGEWs9UGU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2F1KcGEWs9UGU%3Ffeature%3Dshare&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F1KcGEWs9UGU%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/4627d746cc457626ce5d60c0ccd47143/href">https://medium.com/media/4627d746cc457626ce5d60c0ccd47143/href</a></iframe><p>Frankly, the brightness of the video doesn’t do justice to the circles as it removes slightly more subtle lines from them. I am happy to demonstrate the phone video catching all the subtleties — or the device — in person!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5ee72f84504" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Becoming a Tree | Post-Human Design Workshop]]></title>
            <link>https://medium.com/@kseniya_kay/becoming-a-tree-post-human-design-workshop-3162b2daec7e?source=rss-febdf9b3cb7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3162b2daec7e</guid>
            <category><![CDATA[posthumanism]]></category>
            <category><![CDATA[info-c262]]></category>
            <category><![CDATA[japanese-maple]]></category>
            <category><![CDATA[berkeleyischool]]></category>
            <dc:creator><![CDATA[Kseniya Kay]]></dc:creator>
            <pubDate>Wed, 08 Oct 2025 01:43:25 GMT</pubDate>
            <atom:updated>2025-10-08T01:43:38.760Z</atom:updated>
            <content:encoded><![CDATA[<p>Professor Kimiko Ryokai. INFO C262, Fall 2025<br><em>Samuel Robson, Amber Young, Joseline Chang, Kseniya Kapytouskaya</em></p><p>As part of Professor Ryokai’s course INFO C262: Tangible User Interfaces, our group was invited to step outside of ourselves — and into the life of a non-human being. We were asked to enact a non-human subject and experience the world through its perspective.</p><p>Our team gravitated toward a single Japanese maple tree beside the Faculty Building. Its bright yellow leaves and low, twisting branches made it stand out — almost as if it had been placed there intentionally for visual pleasure. We approached the tree with curiosity, engaging it through our senses: we touched its bark, inhaled its scent, and paid attention to the wildlife nearby.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ZvxaRGorj7LCwMSokOnbg.png" /><figcaption>The Japanese maple tree we enacted, UC Berkeley campus</figcaption></figure><p>Our ‘human’ observations:</p><ul><li>This tree looks pretty and very different from California-native tree species, as if it was purposefully planted by humans for aesthetic purposes.</li><li>Its crown looks so dense one might use it as a solid shelter from the rain.</li><li>It starts branching out very close to the ground, almost forming a few tree trunks.</li><li>Looking at the width of the trunk, the tree is probably between 20 to 30 years old.</li><li>Its roots are breaking through the tar, as if they are constrained by the limited space underneath.</li><li>It fosters wildlife all around it: squirrels, spiders, ants, and bees to name a few.</li><li>Its bark smells somewhat dusty.</li><li>Leaves’ rustling, a nearby construction and a working AC unit were the dominating sounds this Monday morning.</li></ul><p>As we spent more time with the tree, these questions emerged:</p><ul><li>Is the tree comfortable being where it is?</li><li>Does it want to break free from the constraints of the human structures around?</li><li>Does it get bothered by the noise?</li><li>Can it connect human activity with the stress to the ecosystem?</li><li>What does it care for?</li><li>Does it communicate with other non-humans?</li></ul><p>When we were done with our ‘human’ observations, we enacted being the tree. We spread our arms and closed our eyes. Some team members took off their shoes to feel a deeper connection with the ground, some swayed the way thin trees do in the wind.</p><ul><li>The first thing we noticed was how hard it was to disconnect from our human sensory system and thinking process. It was not easy to feel as a non-human without projecting our make-believe experiences.</li><li>Some team members mentioned they felt tension about the space they were in. Some felt calm and unbothered by the surroundings. Some expressed concern over access to enough water. Some said shedding leaves must feel relieving.</li><li>Most agreed that our perception of time had changed, as if time was going by slower — or didn’t matter. Some mentioned that the tree may have an abstract, season-bound sense of time based on the shedding and regrowth.</li><li>Our team had different opinions on mobility. As a tree, we surely couldn’t move the way humans do but can other ways be considered as a proper movement? The tree could sway and move its branches in the wind, rustle its leaves and expand its root system further into the soil. Such a movement would happen slowly over time — which wouldn’t presumably matter as the tree has a vague perception of time, if any.</li><li>We discussed the tree’s relationship with humans and came to the conclusion that a mature tree is self-sustainable and therefore would not care for humans. It’s humans who depend on trees for oxygen, shelter, fruit, wood, leaves and sometimes juice (as in the birch trees). There are multiple affordances the tree may offer to humans and close to none vice versa.</li><li>Relationships with non-humans seem to be symbiotic and therefore more beneficial for the tree. As such, bees and insects pollinate the tree, while birds and spiders protect the tree from too many insects.</li></ul><h3>As a result of the non-human embodiment, we had the following realizations:</h3><ul><li>Felt awareness of slower, non-verbal forms of existence — how trees “experience” time differently.</li><li>Noticed how vulnerable non-humans are to human decisions (deforestation, uprooting, pollution etc.).</li><li>Experienced a sense of interdependence — realizing that trees literally sustain our breathing.</li><li>Developed emotional resonance with stillness and patience as a survival strategy.</li><li>Recognized that wellbeing for non-humans often means balance, not growth or dominance.</li><li>Gained appreciation for the quiet intelligence in natural systems (roots communicating, fungal networks, etc.).</li><li>Realized how trees and ecosystems “design” stability and cooperation without central control.</li><li>Saw that endurance and resilience can be more profound than speed or productivity.</li><li>Began to think of non-humans as active participants in shared environments, not background scenery.</li></ul><p>Speaking of the technologies that center non-humans, a few came up in our discussion: automatic water feeder (both for animals and plants) and animal prosthetics. We had a back-and-forth discussion on these and came to the conclusion that while well-intentioned, these technologies exist to make humans happy in the first place — be it to extend their plants’ or animals’ lives. The bottom line is, there’s barely any technology that exists for non-human-pleasing purposes.</p><p>We are hoping to bring this new feeling of interconnectedness and consideration for nature into our project (which is so far very human-centered), to design with shared agency, and to include more-than-human perspectives in our work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S7tuQ8MfRFU97sqwwnlJAA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8cxAVIBPOc1dHoYpoTCGzg.png" /><figcaption>Our field notes</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3162b2daec7e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lab 5 | Output: Piezo Speakers]]></title>
            <link>https://medium.com/@kseniya_kay/lab-5-output-piezo-speakers-62118243c9cd?source=rss-febdf9b3cb7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/62118243c9cd</guid>
            <dc:creator><![CDATA[Kseniya Kay]]></dc:creator>
            <pubDate>Tue, 07 Oct 2025 18:59:15 GMT</pubDate>
            <atom:updated>2025-10-07T19:38:29.363Z</atom:updated>
            <content:encoded><![CDATA[<p>Kseniya Kapytouskaya, Professor Kimiko Ryokai. INFO C262, Fall 2025</p><h3>Objective</h3><p>In this lab, we played around with the Piezo buzzer turning it into a theremin and a speaker. The goals of the lab were:</p><p>a) explore the capabilities of the Piezo Buzzer <br>b) design an artifact where both input ind output occur at the same place. For that, we could use any combination of the input transducers and output transducers (pot, photocell, FSR, LEDs, piezo, screen).</p><p>I chose to work with photocells, the piezo buzzer and my previous design in P5*js — to make it more interactive.</p><h3>Components</h3><p><em>1 — Arduino R4 Minima<br>1 — breadboard<br>2–220 Ω Resistor<br>1 — Piezo busser<br>2 — photocells<br>multiple — wires</em></p><h3>Process Description</h3><p>I used this <a href="https://docs.arduino.cc/built-in-examples/digital/toneMelody">tutorial</a> for the instructions on how to connect the Piezo buzzer to the breadboard, create an attachment file pitches.h to store the musical notes, and borrow a simple code from to make sure the buzzer was working. It took me a while to get the buzzer going as its wires were too loose to create a solid connection with the breadboard.</p><p>Once that worked, I connected two photocells to the breadboard and used the following code to ensure both photocells were reading the light conditions correctly.</p><pre>// Dual Photocell Test<br>// Left cell → A3<br>// Right cell → A0<br><br>int photocellPinLeft  = A3;<br>int photocellPinRight = A0;<br><br>void setup() {<br>  Serial.begin(9600);<br>  Serial.println(&quot;Photocell Test Ready&quot;);<br>}<br><br>void loop() {<br>  int leftVal  = analogRead(photocellPinLeft);<br>  int rightVal = analogRead(photocellPinRight);<br>  int avgVal   = (leftVal + rightVal) / 2;<br><br>  Serial.print(&quot;Left: &quot;);<br>  Serial.print(leftVal);<br>  Serial.print(&quot; | Right: &quot;);<br>  Serial.print(rightVal);<br>  Serial.print(&quot; | Average: &quot;);<br>  Serial.println(avgVal);<br><br>  delay(200); // adjust for smoother or faster readings<br>}</pre><p>One of the photocells was lagging and storing incorrect information, so I had to play around with the resistor position to get analogous reading from both photocells. The culprit might have been that I initially chose a gold-brown-red resistor, instead of the gold-orange-black-brown one. When both photocells were sending similar light values, I started wondering how to connect light with music on the conceptual level. I thought of the logical correlation between an alarm and daytime (time to get up) vs a lullaby and nighttime (time to go to sleep). I then thought it would be great to animate my sloth from P5*js to get it to sleep with the sound of lullaby and have it wake up with the alarm. I made a sketch of a sloth, punched holes in its pupils and placed two photocells to where its pupils were. I created a sleeping mask for it (out of the face mask I had) and placed it on top of the sketch, as per the pictures below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8L2SAajcKiv5BdiUOFBLBg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i3ZEYUA8UH59RacsNglRPQ.png" /><figcaption>My napping sloth sketch</figcaption></figure><p>I then used the following Arduino code to get an alarm and lullaby play based on the light conditions the photocells read.</p><pre>#include &quot;pitches.h&quot;<br><br>// Initializing two photocells<br>int photocellPinRight = A0;<br>int photocellPinLeft = A3;<br>int speakerPin = 8;<br><br>// Setting starting conditions<br>int photocellVal = 0;<br>bool lullabyPlayed = false;<br>bool wakePlayed = false;<br><br>void setup() {<br>  pinMode(speakerPin, OUTPUT);<br>  Serial.begin(9600);<br>}<br><br>// Initializing the loop<br>void loop() {<br>  // Setting combines light reading conditions<br>  int leftVal  = analogRead(photocellPinLeft);<br>  int rightVal = analogRead(photocellPinRight);<br>  photocellVal = (leftVal + rightVal) / 2;<br><br>  Serial.println(photocellVal);<br><br>  // Setting dark condition (play lullaby once)<br>  if (photocellVal &lt; 300 &amp;&amp; !lullabyPlayed) {<br>    playBrahmsLullaby();<br>    lullabyPlayed = true;<br>    wakePlayed = false; // reset wake when dark<br>  }<br><br>  // Setting bright condition (play wake-up once)<br>  if (photocellVal &gt; 1000 &amp;&amp; !wakePlayed) {<br>    playWakeUpChime();<br>    wakePlayed = true;<br>    lullabyPlayed = false; // reset lullaby when bright<br>  }<br>}<br><br>// Brahm&#39;s Lullaby Notes (for the darkness)<br>// -------------------------<br>void playBrahmsLullaby() {<br>  int melody[] = {<br>    NOTE_G4, NOTE_G4,<br>    NOTE_AS4, NOTE_G4, NOTE_G4,<br>    NOTE_AS4, NOTE_G4, NOTE_AS4,<br>    NOTE_DS5, NOTE_D5, NOTE_C5,<br>    NOTE_C5, NOTE_AS4, NOTE_F4, NOTE_G4,<br>    NOTE_GS4, NOTE_F4, NOTE_F4, NOTE_G4,<br>    NOTE_GS4, NOTE_F4, NOTE_GS4,<br>    NOTE_D5, NOTE_C5, NOTE_AS4, NOTE_D5,<br>    NOTE_DS5<br>  };<br><br>  int durations[] = {<br>    8, 8, <br>    -4, 8, 4,<br>    2, 8, 8,<br>    4, -4, 8,<br>    4, 4, 8, 8,<br>    4, 4, 8, 8,<br>    2, 8, 8,<br>    8, 8, 4, 4,<br>    2<br>  };<br><br>  // Setting the tempo<br>  int notes = sizeof(melody) / sizeof(melody[0]);<br>  for (int thisNote = 0; thisNote &lt; notes; thisNote++) {<br>    int duration = 2000 / abs(durations[thisNote]); <br>    tone(speakerPin, melody[thisNote], duration);<br>    int pauseBetweenNotes = duration * 1.3;<br>    delay(pauseBetweenNotes);<br>    noTone(speakerPin);<br>  }<br>}<br><br>// Wake-up alarm<br>void playWakeUpChime() {<br> Serial.println(&quot;☀️ WAKE UP! WAKE UP! ☀️&quot;);<br><br>  // Phase 1: Regular beeps (attention grabber)<br>  for (int i = 0; i &lt; 6; i++) {<br>    tone(speakerPin, 1000, 200); // mid tone<br>    delay(250);<br>    tone(speakerPin, 1500, 200); // higher tone<br>    delay(250);<br>  }<br>  // Phase 2: Faster beeps (panic mode)<br>  for (int i = 0; i &lt; 10; i++) {<br>    tone(speakerPin, 2000, 100);<br>    delay(120);<br>    tone(speakerPin, 1800, 100);<br>    delay(120);<br>  }<br>  // Phase 3: Continuous high scream<br>  tone(speakerPin, 2500, 1500); // loud sustained tone<br>  delay(1500);<br>  noTone(speakerPin);<br>  // Finish with three sharp beeps<br>  for (int i = 0; i &lt; 3; i++) {<br>    tone(speakerPin, 3000, 150);<br>    delay(300);<br>  }<br><br>  noTone(speakerPin);<br>  Serial.println(&quot;Alarm ended. The sloth is fully awake.&quot;);<br>}</pre><p>Below is what it sounded and looked like :)</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FTEj0P-BAMqU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2FTEj0P-BAMqU%3Ffeature%3Dshare&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FTEj0P-BAMqU%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/4efd1471bf8dd6ef81b2619bf075e017/href">https://medium.com/media/4efd1471bf8dd6ef81b2619bf075e017/href</a></iframe><p>After the physical part of playing appropriate tunes to certain light conditions was done, I played around with the sloth animation in P5*js. While I couldn’t get the animation perfectly follow my instructions (I couldn’t get the sloth keep its eyes open during the alarm), I made certain progress in getting the sloth to sleep with the lullaby.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FUTGsq3m_-Wc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2FUTGsq3m_-Wc%3Ffeature%3Dshare&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FUTGsq3m_-Wc%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8c4b778c3814986f4daf6970fcc6a17b/href">https://medium.com/media/8c4b778c3814986f4daf6970fcc6a17b/href</a></iframe><p>Below is the p5*js code I used to (half-) animate the sloth</p><pre>// --------------------<br>// p5.js code for Sloth + Arduino light control<br>// --------------------<br><br>let port;<br>let reader;<br>let latestData = &quot;0&quot;;<br><br>let smoothedLight = 1;   // running average of light values<br>let smoothFactor = 0.02; // 0.0–1.0 smaller = smoother, slower response<br>let smoothedPupil = 80;<br><br>function setup() {<br>  createCanvas(500, 500);<br><br>  const connectButton = createButton(&quot;Connect to Arduino&quot;);<br>  connectButton.position(10, 10);<br>  connectButton.mousePressed(initSerial);<br>}<br><br>async function initSerial() {<br>  if (!port) port = await navigator.serial.requestPort();<br>  if (!port.readable) {<br>    await port.open({ baudRate: 9600 });<br>    reader = port.readable.getReader();<br>    readSerial();<br>    console.log(&quot;Connected!&quot;);<br>  }<br>}<br><br>async function readSerial() {<br>  while (true) {<br>    const { value, done } = await reader.read();<br>    if (done) break;<br>    if (value) {<br>      let text = new TextDecoder().decode(value);<br>      latestData = text.trim();<br>    if (smoothedLight === 1) smoothedLight = lightValue;<br>    }<br>  }<br>}<br><br>/**<br> * Drawing a top eyelid as a 10% larger ellipse, trimmed by a horizontal line.<br> * x,y : eye center<br> * w,h : eye width/height<br> * t   : 0..1 (0 = fully open, 1 = fully closed)<br> * skin: [r,g,b] face color<br> */<br>function drawEyelidClipped(x, y, w, h, t, skin = [160,150,106]) {<br>  const ctx = drawingContext;<br><br>  // 10% bigger eyelid ellipse<br>  const eyelidW = w * 1.1;<br>  const eyelidH = h * 1.1;<br><br>  // Horizontal cut line goes from the top of the eye box downward by t*h<br>  const rectTopY = y - h / 2; // top of the eye’s bounding box<br>  const lineY = rectTopY + t * h; // where we trim the eyelid<br><br>  ctx.save();<br><br>  // 1) Clip to the eye ellipse<br>  ctx.beginPath();<br>  ctx.ellipse(x, y, w / 2, h / 2, 0, 0, Math.PI * 2);<br>  ctx.clip();<br><br>  // 2) Intersect with the rectangle above the moving line (so we keep only the &quot;cap&quot;)<br>  ctx.beginPath();<br>  ctx.rect(x - w, rectTopY, 2 * w, max(0, lineY - rectTopY));<br>  ctx.clip();<br><br>  // 3) Draw the eyelid ellipse; only the clipped cap will appear<br>  ctx.fillStyle = `rgb(${skin[0]},${skin[1]},${skin[2]})`;<br>  ctx.beginPath();<br>  ctx.ellipse(x, y, eyelidW / 2, eyelidH / 2, 0, 0, Math.PI * 2);<br>  ctx.fill();<br><br>  ctx.restore();<br>}<br><br>function draw() {<br>  background(0);<br><br>  const faceX = width / 2;<br>  const faceY = height / 2;<br><br>  // Read light sensor<br>  let lightValue = int(latestData);<br>  if (isNaN(lightValue)) lightValue = 0;<br><br>  // Smooth the incoming values<br>  smoothedLight = smoothedLight * (1 - smoothFactor) + lightValue * smoothFactor;<br><br>  // --- Map light to eye openness ---<br>  // Low light → eyes fully closed (1)<br>  // Bright → fully open (0)<br>  let blinkLevel;<br>  if (smoothedLight &lt; 300) blinkLevel = 1; // fully closed<br>  else if (smoothedLight &gt; 300) blinkLevel = 0; // open<br><br>  // --- Keep pupil size loosely related to light ---<br>  let targetPupil = map(smoothedLight, 0, 1023, 110, 35);<br>  smoothedPupil = smoothedPupil * 0.95 + targetPupil * 0.05;<br>  const pupilSize = smoothedPupil;<br><br>  // Colors<br>  const SKIN = [160,150,106];<br>  const BELLY = [190,180,140];<br><br>  // Body<br>  fill(...SKIN);<br>  ellipse(faceX, faceY + 285, 350, 400);<br><br>  // Belly patch<br>  fill(...BELLY);<br>  ellipse(faceX, faceY + 285, 250, 250);<br><br>  // Head<br>  fill(...SKIN);<br>  ellipse(faceX, faceY, 300, 180);<br><br>  // Eyes<br>  const eyeOffsetX = 170;<br>  const eyeY = faceY - 60;<br>  const eyeW = 140, eyeH = 110;<br><br>  // Whites<br>  fill(255);<br>  ellipse(faceX - eyeOffsetX, eyeY, eyeW, eyeH);<br>  ellipse(faceX + eyeOffsetX, eyeY, eyeW, eyeH);<br><br>  // Pupils<br>  fill(0);<br>  ellipse(faceX - eyeOffsetX, eyeY, pupilSize, pupilSize);<br>  ellipse(faceX + eyeOffsetX, eyeY, pupilSize, pupilSize);<br><br>  // Eyelids<br>  drawEyelidClipped(faceX - eyeOffsetX, eyeY, eyeW, eyeH, blinkLevel, SKIN);<br>  drawEyelidClipped(faceX + eyeOffsetX, eyeY, eyeW, eyeH, blinkLevel, SKIN);<br><br>  // Nose<br>  fill(80, 50, 40);<br>  ellipse(faceX, faceY - 30, 90, 60);<br><br>  // Mouth &amp; Teeth<br>  noFill();<br>  stroke(0);<br>  strokeWeight(3);<br>  arc(faceX, faceY + 65, 100, 10, 0, PI);<br><br>  fill(255);<br>  noStroke();<br>  rect(faceX - 30, faceY + 70, 30, 40, 5);<br>  rect(faceX + 10, faceY + 70, 20, 30, 5);<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62118243c9cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lab 4 | Sensing: Force sensors and photocells]]></title>
            <link>https://medium.com/@kseniya_kay/lab-4-sensing-force-sensors-and-photocells-dec59c6695b5?source=rss-febdf9b3cb7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/dec59c6695b5</guid>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[info-c262]]></category>
            <category><![CDATA[berkeleyischool]]></category>
            <dc:creator><![CDATA[Kseniya Kay]]></dc:creator>
            <pubDate>Fri, 03 Oct 2025 08:32:17 GMT</pubDate>
            <atom:updated>2025-10-03T08:36:13.605Z</atom:updated>
            <content:encoded><![CDATA[<p>Kseniya Kapytouskaya, Professor Kimiko Ryokai. INFO C262, Fall 2025</p><h3>Objective</h3><p>For this lab, we were to create an animation with the use of <a href="https://p5js.org/">P5*js</a> program, force sensitive resistors (FSR) and photocells measuring light brightness.</p><p>The goals of this lab were:<br>a) get comfortable playing around with both FSR and photocells that operate in the same manner as the potentiometer<br>b) explore the capabilities of the new animation tool — P5*js <br>c) connect the animation with the physical tool in a way that would make sense</p><h3>Description</h3><p>To make sure all tools were working, I connected the photocell to my breadboard as per the example from <a href="https://learn.adafruit.com/photocells/using-a-photocell">the Adafruit website</a> and ran the following code.</p><pre>const int analogInPin = A0;<br><br>void setup() {<br>  Serial.begin(9600);<br>}<br><br>void loop() {<br>  // read the sensor value from the analog input pin<br>  const int sensorValue = analogRead(analogInPin);<br><br>  Serial.println(sensorValue);<br><br>  // wait 2 milliseconds before the next loop<br>  // for the analog-to-digital converter to settle<br>  // after the last reading:<br>  delay(2);<br>}</pre><p>To ensure that the force sensitive resistor was working, I followed the instructions from <a href="https://learn.adafruit.com/force-sensitive-resistor-fsr/using-an-fsr">this page</a>. Once I got that going, I focused on the animation tool.</p><h3>Components</h3><p><em>1 — Arduino R4 Minima<br>1 — breadboard<br>2–220 Ω Resistor<br>1 — force sensitive resistor (FSR)<br>multiple — wires</em></p><h3>Process</h3><p>Creativity is not my strongest side, so I first spent a lot of time looking at the existing <a href="https://p5js.org/examples/">P5*js examples</a> and pondering which direction I would like to go. I like minimalism and simplicity, so the simple yet interactive <a href="https://p5js.org/examples/angles-and-motion-aim/">Eye Motion</a> animation caught my attention. I borrowed the code from there and added layers to come up with the ultimate picture of a sloth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/324/1*VWYX3yB4SrOYDDeEfANy1g.png" /><figcaption>Meet Sid the Sloth</figcaption></figure><p>This prototype was largely inspired by Sid the sloth from the Ice Age animation movie. Up to this day, it is still one of my favorite cartoons — it is funny, clever, and engages all generations. It also shows that the best friendships can come from the most unexpected places.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*A9WBopHP80WkjQYxOtm-qQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*lFLv3ZKNaGnXUiJOD9useQ.png" /><figcaption>Sid is ready for a daily nap</figcaption></figure><p>The animation is pretty basic but it makes me happy — when I press the FSR, Sid blinks :) I went through various iterations of the eye pupils — from their enlarging to turning into hearts, to blinking, and ended up settling with blinking as it feels more like Sid’s nature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*YLA0G47iplMmgpMQ1SK00A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*3ZsKLcl0FjFbyfGtDfKgXg.png" /><figcaption>Previous iterations</figcaption></figure><h3>Code</h3><p>Below is the code I used to create the shape and animation.</p><pre>// Initializing the system<br>let port;<br>let reader;<br>let latestData = &quot;0&quot;;<br><br>function setup() {<br>  createCanvas(500, 500);<br>  colorMode(RGB);<br><br>  const connectButton = createButton(&quot;Connect to Arduino&quot;);<br>  connectButton.position(10, 10);<br>  connectButton.mousePressed(initSerial);<br>}<br><br>async function initSerial() {<br>  if (!port) port = await navigator.serial.requestPort();<br>  if (!port.readable) {<br>    await port.open({ baudRate: 9600 });<br>    reader = port.readable.getReader();<br>    readSerial();<br>    console.log(&quot;Connected!&quot;);<br>  }<br>}<br><br>async function readSerial() {<br>  while (true) {<br>    const { value, done } = await reader.read();<br>    if (done) break;<br>    if (value) {<br>      let text = new TextDecoder().decode(value);<br>      latestData = text.trim();<br>    }<br>  }<br>}<br><br>/**<br> * Drawing a top eyelid as a 10% larger ellipse, trimmed by a horizontal line.<br> * x,y : eye center<br> * w,h : eye width/height<br> * t   : 0..1 (0 = fully open, 1 = fully closed)<br> * skin: [r,g,b] face color<br> */<br>function drawEyelidClipped(x, y, w, h, t, skin=[160,150,106]) {<br>  const ctx = drawingContext;<br><br>  // 10% bigger eyelid ellipse<br>  const eyelidW = w * 1.1;<br>  const eyelidH = h * 1.1;<br><br>  // Horizontal cut line goes from the top of the eye box downward by t*h<br>  const rectTopY = y - h/2;         // top of the eye’s bounding box<br>  const lineY    = rectTopY + t*h;   // where we trim the eyelid<br><br>  ctx.save();<br><br>  // 1) Clip to the eye ellipse<br>  ctx.beginPath();<br>  ctx.ellipse(x, y, w/2, h/2, 0, 0, Math.PI * 2);<br>  ctx.clip();<br><br>  // 2) Intersect with the rectangle above the moving line (so we keep only the &quot;cap&quot;)<br>  ctx.beginPath();<br>  ctx.rect(x - w, rectTopY, 2*w, max(0, lineY - rectTopY)); // from top down to lineY<br>  ctx.clip();<br><br>  // 3) Draw the eyelid ellipse; only the clipped cap will appear<br>  ctx.fillStyle = `rgb(${skin[0]},${skin[1]},${skin[2]})`;<br>  ctx.beginPath();<br>  ctx.ellipse(x, y, eyelidW/2, eyelidH/2, 0, 0, Math.PI * 2);<br>  ctx.fill();<br><br>  ctx.restore();<br>}<br><br>function draw() {<br>  background(0);<br><br>  const faceX = width / 2;<br>  const faceY = height / 2;<br><br>  // Read force sensor<br>  let fsrValue = int(latestData);<br>  if (isNaN(fsrValue)) fsrValue = 0;<br><br>  // Map sensor to pupil size and blink amount<br>  const pupilSize  = map(fsrValue, 0, 1023, 35, 110);<br>  const blinkLevel = constrain(map(fsrValue, 0, 1023, 0, 1), 0, 1); // 0 open -&gt; 1 closed<br><br>  // Colors<br>  const SKIN = [160,150,106];<br>  const BELLY= [190,180,140];<br><br>  // Body (drawing first) <br>  fill(...SKIN);<br>  ellipse(faceX, faceY + 285, 350, 400);<br><br>  // Belly patch<br>  fill(...BELLY);<br>  ellipse(faceX, faceY + 285, 250, 250);<br><br>  // Head <br>  fill(...SKIN);<br>  ellipse(faceX, faceY, 300, 180);<br><br>  // Eyes <br>  const eyeOffsetX = 170;<br>  const eyeY = faceY - 60;<br>  const eyeW = 140, eyeH = 110;<br><br>  // Whites<br>  fill(255);<br>  ellipse(faceX - eyeOffsetX, eyeY, eyeW, eyeH);<br>  ellipse(faceX + eyeOffsetX, eyeY, eyeW, eyeH);<br><br>  // Pupils<br>  fill(0);<br>  ellipse(faceX - eyeOffsetX, eyeY, pupilSize, pupilSize);<br>  ellipse(faceX + eyeOffsetX, eyeY, pupilSize, pupilSize);<br><br>  // Eyelids (true clipped caps; draw AFTER pupils, BEFORE mouth/teeth)<br>  drawEyelidClipped(faceX - eyeOffsetX, eyeY, eyeW, eyeH, blinkLevel, SKIN);<br>  drawEyelidClipped(faceX + eyeOffsetX, eyeY, eyeW, eyeH, blinkLevel, SKIN);<br><br>  // Nose (on top)<br>  fill(80, 50, 40);<br>  ellipse(faceX, faceY-30, 90, 60);<br><br>  // Mouth &amp; Teeth (drawing last so nothing covers them)<br>  noFill();<br>  stroke(0);<br>  strokeWeight(3);<br>  arc(faceX, faceY + 65, 100, 10, 0, PI);<br><br>  fill(255);<br>  noStroke();<br>  rect(faceX - 30, faceY + 70, 30, 40, 5);<br>  rect(faceX + 10, faceY + 70, 20, 30, 5);<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*1QzuKUAFA1eP1IKn8TfdkQ.gif" /></figure><p>Submitting this a little late but will be happy to receive any feedback!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dec59c6695b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lab 3 | Sensing: Potentiometer]]></title>
            <link>https://medium.com/@kseniya_kay/lab-3-sensing-potentiometer-8a84100c9c5a?source=rss-febdf9b3cb7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a84100c9c5a</guid>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[berkeleyischool]]></category>
            <dc:creator><![CDATA[Kseniya Kay]]></dc:creator>
            <pubDate>Mon, 22 Sep 2025 02:58:22 GMT</pubDate>
            <atom:updated>2025-09-22T05:08:47.902Z</atom:updated>
            <content:encoded><![CDATA[<p>Kseniya Kapytouskaya, Professor Kimiko Ryokai. INFO C262, Fall 2025</p><h3>Objective</h3><p>For this lab, we were to program 2–3 potentiometers to control for the brightness of the LED lights and/or their frequency of blinking. I chose to work with 2 potentiometers, where one potentiometer would control the brightness of the LEDs and the other would control the blinking.</p><p>The goals of this lab were:<br>a) to understand the working mechanism behind volume knobs of audio devices (like a radio), or light knobs that dim the light, and<br>b) to combine and modify given code excerpts to control for two conditions (brightness and frequency of a signal).</p><h3>Description</h3><p>During the class lab, I soldered 3 wires to each potentiometer, placing the yellow wire in the middle. I connected the yellow wire to the Arduino’s A0 pin, the red one to the 5V pin, and the black one to a GND pin. I then sequentially tested both devices with the code below to make sure my potentiometers were working.</p><pre>const int analogPin = A0;<br><br>void setup() {<br>  Serial.begin(9600);<br>}<br><br>void loop() {<br>  int val = analogRead(analogPin);<br>  Serial.println(val);<br>}</pre><p>I permanently keep 3 resistors, 3 LED lights and connecting wires in the breadboard to save time on re-attaching them each week. Therefore, my kit was working as soon as I attached the first potentiometer to it. To connect the second potentiometer, I removed the red wire and the black wire from Arduino’ 5V pin and GND pin, and attached them to the breadboard’s red bus and blue bus accordingly. I inserted the second potentiometer’s yellow wire into Arduino’s A5 pin, the red wire into the breadboard’s blue bus, and the black wire into the breadboard’s red bus. I then used additional wires to connect the breadboard’s red bus with Arduino’ 5V pin and the breadboard’s blue bus with Arduino’ GND pin.</p><h3>Components</h3><p><em>1 — Arduino R4 Minima<br>1 — breadboard<br>3–220 Ω Resistor<br>3 — red, green, and blue LEDs<br>2 — soldered potentiometers<br>multiple — wires</em></p><h3>Code</h3><p>I found modifying the code and checking its output the most entertaining part of the assignment. Initially, I used an example code from the <a href="https://docs.arduino.cc/built-in-examples/analog/AnalogInput/">Arduino website</a> to test one LED’s blinking. Seeing that work made me want to test it on all 3 LED’s. To do that, I made the following adjustments to the code.</p><pre><br>int sensorPin = A0;   // select the input pin for the potentiometer<br><br>int rledPin = 10;      // select the pin for the LED<br>int gledPin = 9;      // select the pin for the LED<br>int bledPin = 12;      // select the pin for the LED<br><br>int sensorValue = 0;  // variable to store the value coming from the sensor<br><br>void setup() {<br>  // declare the ledPin as an OUTPUT:<br>  pinMode(rledPin, OUTPUT);<br>  pinMode(gledPin, OUTPUT);<br>  pinMode(bledPin, OUTPUT);<br>}<br><br>void loop() {<br>  // read the value from the sensor:<br>  sensorValue = analogRead(sensorPin);<br><br>  // turn the RED ledPin on<br>  digitalWrite(rledPin, HIGH);<br>  // stop the program for &lt;sensorValue&gt; milliseconds:<br>  delay(sensorValue);<br>  // turn the RED ledPin off:<br>  digitalWrite(rledPin, LOW);<br>  // stop the program for &lt;sensorValue&gt; milliseconds:<br>  delay(sensorValue);<br><br>    // turn the GREEN ledPin on<br>  digitalWrite(gledPin, HIGH);<br>  // stop the program for &lt;sensorValue&gt; milliseconds:<br>  delay(sensorValue);<br>  // turn the GREEN ledPin off:<br>  digitalWrite(gledPin, LOW);<br>  // stop the program for &lt;sensorValue&gt; milliseconds:<br>  delay(sensorValue);<br><br>    // turn the BLUE ledPin on<br>  digitalWrite(bledPin, HIGH);<br>  // stop the program for &lt;sensorValue&gt; milliseconds:<br>  delay(sensorValue);<br>  // turn the BLUE ledPin off:<br>  digitalWrite(bledPin, LOW);<br>  // stop the program for &lt;sensorValue&gt; milliseconds:<br>  delay(sensorValue);<br>}</pre><p>After having all 3 LEDs successfully blink with the frequency regulated by one potentiometer, I tested another potentiometer for its ability to control one LED’s brightness. For that, I borrowed the code example from <a href="https://owenmundy.com/blog/2010/05/fading-an-led-with-pwm-and-a-potentiometer/">the following website</a> (lines 1–23).</p><p>Combining both codes was the biggest challenge for me, as one bit of code (regulating the blinking frequency) seemed to keep overwriting the other (regulating the brightness). After multiple tries, I managed to merge both codes into the following bit.</p><pre>/* Merged code output<br>—————————————————————*/<br> <br>int brightnessPin = A5;    // The input pin that regulates brightness<br>int brightnessValue = 0;  // value read from the pin<br><br>int sensorPin = A0;   // The input pin that regulates blinking frequency<br>int sensorValue = 0;  // variable to store the value coming from the sensor<br><br>int rledPin = 10;      // select the red pin for the LED<br>int gledPin = 9;      // select the green pin for the LED<br>int bledPin = 12;      // select the blue pin for the LED<br> <br>void setup() {<br>  // declare the ledPin as an OUTPUT:<br>  pinMode(rledPin, OUTPUT);<br>  pinMode(gledPin, OUTPUT);<br>  pinMode(bledPin, OUTPUT);<br>}<br> <br>void loop() {<br>  // read the value from the sensor:<br>  sensorValue = analogRead(sensorPin);<br>  brightnessValue = analogRead(brightnessPin); // read the pot value<br><br>  // turn the RED ledPin on<br>  analogWrite(rledPin, brightnessValue/4);  // PWM the LED with the pin value (divided by 4 to fit in a byte)<br>  delay(sensorValue);           // wait<br>  <br>  analogWrite(rledPin, 0);      // LED off<br>  delay(sensorValue);           // wait<br><br>  // turn the GREEN ledPin on<br>  analogWrite(gledPin, brightnessValue/4);  // PWM the LED with the pin value (divided by 4 to fit in a byte)<br>  delay(sensorValue);           // wait<br>  <br>  analogWrite(gledPin, 0);      // LED off<br>  delay(sensorValue);           // wait<br><br>    // turn the BLUE ledPin on<br>  analogWrite(bledPin, brightnessValue/4);  // PWM the LED with the pin value (divided by 4 to fit in a byte)<br>  delay(sensorValue);           // wait<br>  <br>  analogWrite(bledPin, 0);      // LED off<br>  delay(sensorValue);           // wait<br>}</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FBr3sv4xVlEg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2FBr3sv4xVlEg%3Ffeature%3Dshare&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FBr3sv4xVlEg%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8285c3d9d5f37ccfe4965d6067ef9f10/href">https://medium.com/media/8285c3d9d5f37ccfe4965d6067ef9f10/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a84100c9c5a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lab 2 | Digital I/O + Arduino]]></title>
            <link>https://medium.com/@kseniya_kay/lab-2-digital-i-o-arduino-b4ee9d96afc7?source=rss-febdf9b3cb7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4ee9d96afc7</guid>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[berkeleyischool]]></category>
            <category><![CDATA[info-c262]]></category>
            <category><![CDATA[led-lighting]]></category>
            <dc:creator><![CDATA[Kseniya Kay]]></dc:creator>
            <pubDate>Thu, 18 Sep 2025 08:31:48 GMT</pubDate>
            <atom:updated>2025-09-22T05:09:08.945Z</atom:updated>
            <content:encoded><![CDATA[<p>Kseniya Kapytouskaya, Professor Kimiko Ryokai. INFO C262, Fall 2025</p><h3>Objective</h3><p>In this lab, we worked on creating a diffuser for our LED lights scattering and practiced using Arduino with an added layer of complexity. The end goals were:</p><p>a) designing a light diffuser and getting creative in the process<br>b) tweaking the code provided by the teaching team to change colors with multiple key presses<br>c) coming up with an inspirational concept informing our diffuser design <br>d) optional but encouraged — creating a code for the diffuser narrative</p><h3>How It Started</h3><p>For the diffuser, I decided to use polyester fibers for their diffusing ability and a small glass bowl for a (combined) texture variation. Put together, they created a mushroom cap shape (or a jellyfish). Code-wise, I was a little stuck with programming but was able to move on with a bit of external help. Components-wise, I used:</p><blockquote>1 — Arduino R4 Minima<br>1 — breadboard<br>3 — 220 Ω Resistor<br>3 — red, green, and blue LEDs<br>1 — set of polyester fibers<br>1 — small glass bowl<br>7 — wires</blockquote><pre>// Assigning pins to respective LED lights <br>int bluePin   = 13;<br>int greenPin = 11;<br>int redPin  = 12;<br><br>// Introducing keys &quot;r/g/b&quot; for future use of a keyboard as an input<br>int rCount = 0;<br>int gCount = 0;<br>int bCount = 0;<br><br>// Configurating the LED pins as outputs (not inputs)<br>void setup() {<br>  pinMode(redPin,   OUTPUT);<br>  pinMode(greenPin, OUTPUT);<br>  pinMode(bluePin,  OUTPUT);<br><br>  // Starting USB serial so we can read keys and print status<br>  Serial.begin(9600);<br>  // Setting the starting point to no light reflection (all LED lights off)<br>  analogWrite(redPin,   0);<br>  analogWrite(greenPin, 0);<br>  analogWrite(bluePin,  0);<br><br>  // Setting message display for the monitor output<br>  Serial.println(&quot;Type r/g/b to increase brightness (wrap 0..10). &#39;x&#39; reset, &#39;s&#39; status.&quot;);<br>}<br><br>void loop() {<br>  // Initiating the loop + having the system check for any key input<br>  if (Serial.available() &gt; 0) {<br>    char c = Serial.read();<br><br>    // Setting conditions for key &quot;r&quot; as a respective command for 10% red ligth increase per one key input<br>    if (c == &#39;r&#39;) {<br>      rCount = (rCount + 1) % 11;                  // 0..10 wrap<br>      int val = map(rCount, 0, 10, 0, 255);<br>      analogWrite(redPin, val);<br>      Serial.print(&quot;Red = &quot;); Serial.println(val);<br><br>      // Setting conditions for key &quot;g&quot; as a respective command for 10% green ligth increase per one key input<br>    } else if (c == &#39;g&#39;) {<br>      gCount = (gCount + 1) % 11;<br>      int val = map(gCount, 0, 10, 0, 255);<br>      analogWrite(greenPin, val);<br>      Serial.print(&quot;Green = &quot;); Serial.println(val);<br><br>      // Setting conditions for key &quot;b&quot; as a respective command for 10% blue ligth increase per one key input<br>    } else if (c == &#39;b&#39;) {<br>      bCount = (bCount + 1) % 11;<br>      int val = map(bCount, 0, 10, 0, 255);<br>      analogWrite(bluePin, val);<br>      Serial.print(&quot;Blue = &quot;); Serial.println(val);<br><br>      // Setting conditions for key &quot;x&quot; as a respective command for an overall light switch-off and counter reset<br>    } else if (c == &#39;x&#39;) {                         // reset all to 0<br>      rCount = gCount = bCount = 0;<br>      analogWrite(redPin,   0);<br>      analogWrite(greenPin, 0);<br>      analogWrite(bluePin,  0);<br>      Serial.println(&quot;Reset all to 0&quot;);<br><br>      // Setting conditions for key &quot;s&quot; as a respective command for a status display<br>    } else if (c == &#39;s&#39;) {                         // print status<br>      Serial.print(&quot;Counts R/G/B = &quot;);<br>      Serial.print(rCount); Serial.print(&quot;/&quot;);<br>      Serial.print(gCount); Serial.print(&quot;/&quot;);<br>      Serial.print(bCount); Serial.print(&quot; | Levels = &quot;);<br>      Serial.print(map(rCount, 0, 10, 0, 255)); Serial.print(&quot;/&quot;);<br>      Serial.print(map(gCount, 0, 10, 0, 255)); Serial.print(&quot;/&quot;);<br>      Serial.println(map(bCount, 0, 10, 0, 255));<br>    }<br>  }<br><br>  delay(10);  // tiny breather for serial buffer<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*cmdaeos3u-prwln_SM_6fQ.gif" /></figure><h3>How It’s Going</h3><p>Coming up with an inspirational concept informing my diffuser design was a lot harder than I thought. I naturally get inspired by nature, so anything sea- or forest-related would work for a project. Narrowing down among the multitude of options with resource constraints proved to be harder. I ended up settling with the mushroom-style night lamp changing its lights based on the action-based input. As such, ‘sleep’ sets the lamp to a mix of red and yellow colors with steady calm pulsing. ‘Read” sets the light to bright white. ‘Party’ kicks in full-on party mode. And my favorite — ‘marvel’ — shows blueish night sky with occasional star twinkling.</p><p>The components I used are:</p><blockquote>1 — Arduino R4 Minima<br>1 — breadboard<br>3–220 Ω Resistor<br>3 — red, green, and blue LEDs<br>1 — set of polyester fibers<br>1 — plastic peanut<br>1 — small glass bowl<br>4 — pieces of paper <br>1 — candle<br>7 — wires</blockquote><pre>// Assigning pins to respective LED lights<br>const int redPin = 12, greenPin = 11, bluePin = 13;<br><br>// putting helper in place so it’s known everywhere<br>void setColor(int r, int g, int b) {<br>  r = constrain(r,0,255);<br>  g = constrain(g,0,255);<br>  b = constrain(b,0,255);<br>  analogWrite(redPin, r);<br>  analogWrite(greenPin, g);<br>  analogWrite(bluePin, b);<br>}<br>// Setting the default lamp mode to &#39;sleep&#39;<br>String mode = &quot;sleep&quot;;  // default<br><br>// Configurating the LED pins as outputs (not inputs)<br>void setup() {<br>  pinMode(redPin, OUTPUT);<br>  pinMode(greenPin, OUTPUT);<br>  pinMode(bluePin, OUTPUT);<br>  Serial.begin(9600);<br>  Serial.println(&quot;Type: sleep | read | party&quot;);<br>}<br><br>// Initiating the loop + having the system check for any key input<br>void loop() {<br>  if (Serial.available()) {<br>    mode = Serial.readStringUntil(&#39;\n&#39;);<br>    mode.trim();<br>    Serial.print(&quot;Mode set to: &quot;); Serial.println(mode);<br>  }<br><br>// Setting the modes<br>  if (mode == &quot;sleep&quot;) {<br>    // Amber breathing<br>    for (int i=0; i&lt;255; i++) {<br>      setColor(i/4, i/4, 0);  // warm amber<br>      delay(20);<br>    }<br>    for (int i=255; i&gt;0; i--) {<br>      setColor(i/4, i/4, 0);<br>      delay(20);<br>    }<br>  } else if (mode == &quot;read&quot;) {<br>    setColor(255, 255, 255);  // bright white<br>    delay(100);<br>  } else if (mode == &quot;party&quot;) {<br>      // Mix rainbow cycling and strobe<br>      for (int i=0; i&lt;3; i++) {<br>      // Rainbow sweep<br>      for (int c=0; c&lt;255; c+=5) {<br>        setColor(c, 255-c, (c*3)%255);<br>        delay(15);<br>        }<br>      // White strobe burst<br>      for (int j=0; j&lt;5; j++) {<br>      setColor(255,255,255); delay(80);<br>      setColor(0,0,0);       delay(80);<br>      }<br>    }<br>  } else if (mode == &quot;marvel&quot;) {<br>    // ---- Night sky: dim blue base + random twinkles + rare meteor ----<br>    const uint8_t skyLevel = 24;    // base blue brightness (16..40 looks nice)<br><br>    // Run a short segment so the loop comes back often to check Serial<br>    for (int frame=0; frame&lt;200; frame++) {<br>      // Base sky: cool blue with a touch of green to desaturate<br>      setColor(0, skyLevel/6, skyLevel);<br>      delay(10);<br><br>      // Random twinkle (~0.5% chance per frame)<br>      if (random(0,1000) &lt; 5) {<br>        // brief white sparkle (fade in/out ~300 ms total)<br>        for (int i=0; i&lt;=255; i+=32) {<br>          setColor(i, i, i + skyLevel);  // white over base<br>          delay(8);<br>        }<br>        for (int i=255; i&gt;=0; i-=32) {<br>          setColor(i, i, i + skyLevel);<br>          delay(8);<br>        }<br>      } <br>      // Rare meteor (~0.05% chance per frame)<br>      if (random(0,2000) &lt; 1) {<br>        // cool cyan-white flash (~700 ms total)<br>        for (int i=0; i&lt;=255; i+=17) {<br>          int r = i/3, g = (i*4)/5, b = i; // cooler than pure white<br>          setColor(r,g,b);<br>          delay(8);<br>        }<br>        for (int i=255; i&gt;=0; i-=17) {<br>          int r = i/3, g = (i*4)/5, b = i;<br>          setColor(r,g,b);<br>          delay(8);<br>        }<br>      }<br>    }<br><br>  } else {<br>    // Unknown mode → lights off briefly<br>    setColor(0,0,0);<br>    delay(50);<br>  }<br>}</pre><p>The design itself turned out pretty LoFi. Even so, I still like seeing the unusual texture of the polyester fibers under the glass cap.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O_U-qokfD79RbbpTRJuslw.png" /></figure><p>Below is one settings in action. More couldn&#39;t get uploaded due to the size limitations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*fXQnTG2S0fjiQxP92grLGg.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4ee9d96afc7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lab 1 | Physical Computing]]></title>
            <link>https://medium.com/@kseniya_kay/info-c262-lab-1-physical-computing-4450354f9b60?source=rss-febdf9b3cb7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/4450354f9b60</guid>
            <category><![CDATA[info-c262]]></category>
            <category><![CDATA[berkeleyischool]]></category>
            <category><![CDATA[arduino-uno]]></category>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[arduino-projects]]></category>
            <dc:creator><![CDATA[Kseniya Kay]]></dc:creator>
            <pubDate>Wed, 10 Sep 2025 08:52:48 GMT</pubDate>
            <atom:updated>2025-09-22T05:09:31.278Z</atom:updated>
            <content:encoded><![CDATA[<p>Kseniya Kapytouskaya, Professor Kimiko Ryokai. INFO C262, Fall 2025</p><h3>Objective</h3><p>The goal of the first lab was to get familiar with Arduino — both a microcontroller and the software. We primarily worked with a breadboard, LED lights, wires and a resistor.</p><h3>Description</h3><p>At first, I connected pin 13 of the microcontroller and the breadboard with a wire. I inserted one side of a resistor in the same row as the wire. After, I picked a blue LED light and placed its short leg (anode) in the same row as the resistor’s other side. I used another wire to connect the LED light’s cathode (long leg) with the microcontroller.</p><p>I modified the original code from the example to have the light go on for 3 seconds and go off for 3 seconds.</p><h3>Code</h3><pre>// the setup function runs once when you press reset or power the board<br>void setup() {<br>  // initialize digital pin LED_BUILTIN as an output.<br>  pinMode(LED_BUILTIN, OUTPUT);<br>}<br><br>// the loop function runs over and over again forever<br>void loop() {<br>  digitalWrite(LED_BUILTIN, HIGH);  // turn the LED on (HIGH is the voltage level)<br>  delay(3000);                      // wait for a second<br>  digitalWrite(LED_BUILTIN, LOW);   // turn the LED off by making the voltage LOW<br>  delay(3000);                      // wait for a second<br>}</pre><h3>Components</h3><blockquote>1 Arduino</blockquote><blockquote>1 LED</blockquote><blockquote>1 Resistor (220Ω)</blockquote><blockquote>2 Wires</blockquote><blockquote>1 Breadboard</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LeSqKKKHLY-MLeHLe5PfGw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zFWKgfAVmwY56PsPRkk56w.png" /></figure><h3>Further exploration</h3><p>Having succeeded with the basic prototype, I wanted to explore if I could have all three LED lights blink one after another. I used the initial setup to build on top of it. I inserted a red LED light with its anode in the same row as the blue light’s cathode, and a green light’s anode in the same row as the red light’s cathode. Lastly, I connected the rows of both red and green lights’ cathodes with wires into the microcontroller’s pins 11 and 10 accordingly.</p><h3>Code</h3><p>I borrowed Connie’s code from <a href="https://medium.com/@connieqgu/lab-1-physical-computing-sample-144b450f2151">her Medium post</a> and added a bit activating the third light. I also played with the variation of seconds, leaving them all eventually at 3.</p><pre>void setup() {<br><br>// put your setup code here, to run once:<br>pinMode(13, OUTPUT);<br>pinMode(11, OUTPUT);<br>pinMode(10, OUTPUT);<br>}<br><br>void loop() {<br>// put your main code here, to run repeatedly:<br><br>digitalWrite(13, HIGH);<br>delay(3000);<br>digitalWrite(13, LOW);<br>digitalWrite(11, HIGH);<br>delay(3000);<br>digitalWrite(11, LOW);<br>digitalWrite(10, HIGH);<br>delay(3000);<br>digitalWrite(10, LOW);<br>delay(3000);<br>}</pre><h3>Components</h3><blockquote>1 Arduino</blockquote><blockquote>3 LED lights</blockquote><blockquote>1 Resistor (220Ω)</blockquote><blockquote>4 Wires</blockquote><blockquote>1 Breadboard</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n69q6Fd_XgbHoFiCz7yDQw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LVw3HmJO8BPFlL1hp-nQ1w.png" /></figure><h3>Reflections</h3><p>While each light went on and off for 3 seconds, they didn’t follow the order, and blue would go on at the same time as green. I tried to relocate the lights around the breadboard, cross-checked their anodes’ and cathodes’ placement and tried various time combinations in the code; however, I couldn’t change the outcome.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4450354f9b60" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kseniya | Intro]]></title>
            <link>https://medium.com/@kseniya_kay/kseniya-intro-d96cf8aaf14d?source=rss-febdf9b3cb7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d96cf8aaf14d</guid>
            <category><![CDATA[hobby]]></category>
            <category><![CDATA[introduction]]></category>
            <category><![CDATA[projects]]></category>
            <dc:creator><![CDATA[Kseniya Kay]]></dc:creator>
            <pubDate>Sat, 06 Sep 2025 23:29:43 GMT</pubDate>
            <atom:updated>2025-09-07T00:43:32.784Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey there :) My name is Kseniya, and I am a Master’s student in Development Engineering at UC Berkeley graduating in December ‘25.</p><p>My professional experiences span from being a lawyer in Belarus to a user research project manager in China, to now a climate-curious and tech-curious grad student at UC Berkeley. During my time in grad school, I worked with a non-profit redesigning a school food supply chain around a farm-to-table model where I co-created an internal operations dashboard. I conducted an environmental life cycle assessment comparing electric and conventional vehicles across various regions — just to discover that electrification alone won’t help in solving the climate crisis unless we decarbonize the grid. For my capstone project this fall, I’ll be working on a methane remote sensor, collaborating with both hardware and software teams on its design and user applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u0B_eEU4ZK4oezz2GDg_pQ.png" /><figcaption>With my team working on an internal operations dashboard for a non-profit (5 of us on the right)</figcaption></figure><p>The physical object I’ve recently been fascinated with is a wooden dragonfly that I brought back from a trip to Moganshan, China. Its low center of gravity allows it to balance on the very tip of its head, creating a kinetic illusion that challenges your perception of physical reality. It now lives on my desk and serves a meditative role, helping me unwind without defaulting to fully digital alternatives, like Instagram scrolling.</p><figure><img alt="The wooden dragonfly from Moganshan, China" src="https://cdn-images-1.medium.com/max/1024/1*FaQh0Z0eZEGLTrM_OkeBLA.png" /><figcaption>The wooden dragonfly from Moganshan, China</figcaption></figure><p>Originally from a flat, landlocked country, I love everything sea- and mountain-related. On my happiest days, you can find me swimming, surfing, snorkeling, scuba diving, hiking, chilling at the beach and indulging in seafood. It’s this affinity for nature that drives me to build systems that help protect it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gaFWlTEnZoQ6hVOzvGyqBg.png" /><figcaption>Possibly the world’s largest telescope in Guizhou, China</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d96cf8aaf14d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>