Concept

The two of us were interested in exploring a rivalry between two devices that respond to very deliberate stimulus and communicate that stimulus between each other. We were drawn to the idea of creating small expressive creatures that beg for the users attention and compete with each other almost as siblings do. We were also interested in creating a sort of ‘counter’ that is communicated back and forth through the MQTT connection in order to keep track of which Desk Pet is in the lead and which is losing.

We see the narrative as two connected desk pets that both seek to gain more attention from their users than the other. They communicate to the user and to each other through idle movement, boasting when they receive more attention, and begging when they are receiving less than their other pair.

Process

Our initial ideas for how to express a rivalry between two Desk Pets was through the stretching and folding of fabric. In order to determine the best type of fabric to use and the best type of connection to the servos, we did a few material studies.

The two of us quickly found that muslin and wooden sticks were too stiff to generate our desired effects. From there, we moved on to fabrics that stretched more.

Along with the fabric tests, we also considered different mounting options for the servos. We began rather ambitious, expecting the use of 4 servos per person. By the end, we were able to cut the servos down to 2 per person, but maintain 4 points of contact by doubling up on each servo.

Once we had the method of movement and the best type of fabric and connection figured out, we were driven to finding a better form for out Desk Pet. The flat fabric was ideal for stretching, but it lacked depth and character. This inspired the new form of the Desk Pet that also included a more expressive face.

This new form inspired our idea for where to place the touch sensor. Making the head itself the sensor proved to be too difficult, but it shone a light on the option of making the touch sensor something detached that still rests atop the head- a hat! We stuck a touch sensor between the fabric attached to the hat to pit it between the form and the fabric and connected it accordingly to allow for the Desk Pet to respond to touch stimulus.

We created three different states for our Desk Friends.

Jealous begging and happy movements:

Lonely movements:

Execution

Our final Desk Pet looks like this:

Code

# Kinetic Fabrics S21
# Kanvi and Yael

# -----------------------------------------
# Import the standard Python time functions.
import time

# Import the low-level hardware libraries.
import board
import digitalio
import analogio

import pwmio
from adafruit_circuitplayground import cp
from adafruit_motor import servo

import supervisor
import sys

analogin = analogio.AnalogIn(board.A2)

# Create a PWMOut object on pad SDA A5 to generate control signals.
pwm1 = pwmio.PWMOut(board.A5, duty_cycle=0, frequency=50)

# Create a PWMOut object on pad A3 to generate control signals.
pwm2 = pwmio.PWMOut(board.A3, duty_cycle=0, frequency=50)

# Create a Servo object which controls a hobby servo using the PWMOut.
servo1 = servo.Servo(pwm1, min_pulse=1000, max_pulse=2000)

# Create a Servo object which controls a hobby servo using the PWMOut.
servo2 = servo.Servo(pwm2, min_pulse=1000, max_pulse=2000)

# adjust these for indivudal projects
HAPPY_START = 0
HAPPY_STOP = 30
HAPPY_SERVO2_OFFSET = 60

BEG_START = 90
BEG_STOP = 10

#########################################


def getVoltage(pin):  # helper
    return (pin.value * 3.3) / 1023


def happy(level):
    for i in range(10):
        for angle in range(HAPPY_START, HAPPY_STOP, 1):
            servo1.angle = angle
            servo2.angle = angle + HAPPY_SERVO2_OFFSET
            time.sleep(0.1 / level)

        for angle in range(HAPPY_STOP, HAPPY_START, -1):
            servo1.angle = angle
            servo2.angle = angle + HAPPY_SERVO2_OFFSET
            time.sleep(0.1 / level)


def beg():
    for i in range(10):
        for angle in range(HAPPY_START, HAPPY_STOP, 1):
            servo1.angle = angle
            time.sleep(0.1)

        for angle in range(HAPPY_START, HAPPY_STOP, 1):
            servo2.angle = angle + HAPPY_SERVO2_OFFSET
            time.sleep(0.1)

        for angle in range(HAPPY_STOP, HAPPY_START, -1):
            servo1.angle = angle
            time.sleep(0.1)

        for angle in range(HAPPY_STOP, HAPPY_START, -1):
            servo2.angle = angle + HAPPY_SERVO2_OFFSET
            time.sleep(0.1)


def neglect():
    for i in range(2):
        for angle in range(BEG_START, BEG_STOP, -1):
            servo2.angle = angle
            time.sleep(0.02)

        for angle in range(BEG_STOP, BEG_START, 1):
            servo2.angle = angle
            time.sleep(0.02)

        for angle in range(BEG_STOP, BEG_START, 1):
            servo1.angle = angle
            time.sleep(0.02)

        for angle in range(BEG_START, BEG_STOP, -1):
            servo1.angle = angle
            time.sleep(0.02)


petCount = 0
lonely = 0

while True:
    if supervisor.runtime.serial_bytes_available:
        line = sys.stdin.readline()
        print("hi")
        if line == "beg lots":
            reading = getVoltage(analogin)
            # print("Analog Voltage: %f" % reading)
            while reading < 10:
                beg()
            happy(16)

    reading = getVoltage(analogin)
    #print("Analog Voltage: %f" % reading)

    if reading &gt; 10:
        petCount += 1
    else:
        lonely += 1

    if petCount == 16:
        print("beg lots")
        happy(petCount)
        petCount = 0
        lonely = 0

    if lonely &gt; 50:
        neglect()
        lonely = 0

    time.sleep(0.2)

Conclusion and Reflection

This project was so much fun! We had a lot of fun building these Desk Pets and their accompanying code. The material and servo studies at the beginning were extremely helpful in informing our final outcome and we expect these studies to continue to inform our design decisions in future projects to come. The combination of several servos and various levels of input were also challenging to implement at first but very worthwhile by the end of the project.

There is so much more that the two of us would love to develop had we more time to continue working on these Desk Pets. Our initial concepts included multiple stimulus inputs including light and sound along with touch. We both feel that had we more time, the project would be much more compelling with those additional inputs to create different outputs that aren’t in the current project. In our initial concept, we also discussed having a visual ‘counter’ that displayed how ahead or behind the users Desk Pet was with attention received. We chose to leave it out in this iteration due to not having a good way of connecting the circuit playground to the constructed Desk Pet. We felt that by having the counter elsewhere on the table, flashing bright lights at the user, it would be too distracting and take away from the interesting folding and stretching of the fabric.