For our project, we made a robotic dog that reacted to children petting its head and back. If the dog has not been pet for a while, it tilts its head and then walk forward until the child pets it. When it is pet on the head, it moves its head and wags its tail. When it is pet on the back, the dog sits down and wags its tail. Once the kid is done petting the dog’s back, the dog stands back up. We wanted to create a project that conveyed affection towards the children and that the children could relate to. Through our robot’s reactions to children’s pets, we believe we achieved such. Below is a video of the children interacting with the robot:

Most of our engagement time was either between 0 – 30 seconds or over 2 minutes. There weren’t many children who used the toy for 30 seconds – 2 minutes. Almost all of the interactions were slightly facilitated, however, as most of the children were unsure of what to do at first. In terms of reactions to our project, most children were either excited or neutral, with a few children reacting in an exploratory or curious way.

Notable interactions include:
– Several children tried to push or force the dog
– One child tried to scratch its chin
– One child asked how it works
– Two children worked together to try and keep it sitting
– One child suggested to add claws

Solidwork Files:

#include <Servo.h&gt;

#define MOT_A1_PIN 10
#define MOT_A2_PIN 9

const int SERVO1_PIN = 8;
const int SERVO2_PIN = 7;
const int SERVO3_PIN = 4;
const int SENSOR1_PIN = A1;
const int SENSOR2_PIN = A0;

const int SENSOR1_THRESH = 500;
const int SENSOR2_THRESH = 200;

const int wag_time = 10000;
const int wag_interval = 1000;
const int wag_start_angle = 90;
const int wag_left_angle = 45;
const int wag_right_angle = 135;

const int sitting_time = 20000;
const int sit_time = 10000;

const int head_time = 10000;
const int head_speed = 25;
const int head_interval = 2500;

const int left_leg_start_angle = 90;
const int left_leg_end_angle = 45;
const int right_leg_start_angle = 70;
const int right_leg_end_angle = 115;
const int leg_intervals = 5;

const int left_walk_angle = 120;
const int right_walk_angle = 40;

Servo s1;
Servo s2;
Servo s3;

int sit_count;
int wag_count;
int head_count;
int leg_interval_count;
int wait_time;
int walk_count;

bool sit_loop;
bool wag_loop;
bool head_loop;
bool head_right;
bool head_left;
bool walk_loop;
bool move_head_right;

void setup() {
  sit_count = 0;
  wag_count = 0;
  leg_interval_count = 0;
  head_count = 0;
  wait_time = 0;
  walk_count = 0;
  
  sit_loop = false;
  wag_loop = false;
  head_loop = false;
  head_right = false;
  head_left = false;
  walk_loop = false;
  move_head_right = false;
  
  s1.attach(SERVO1_PIN);
  s2.attach(SERVO2_PIN);
  s3.attach(SERVO3_PIN);
  
  s1.write(left_leg_start_angle);
  s2.write(right_leg_start_angle);
  s3.write(wag_start_angle);

  pinMode(MOT_A1_PIN, OUTPUT);
  pinMode(MOT_A2_PIN, OUTPUT);

  digitalWrite(MOT_A1_PIN, LOW);
  digitalWrite(MOT_A2_PIN, LOW);

  
}

void loop() {
  if (wait_time < 25000)
  {
    wait_time++;
  }
  
  if (analogRead(SENSOR1_PIN) <= SENSOR1_THRESH){
    sit_loop = true;
    sit_count = 0;
    wag_loop = true;
    wait_time = 0;
    walk_loop = false;
    walk_count = 0;
  }
  
  if (analogRead(SENSOR2_PIN) <= SENSOR2_THRESH){
    wag_loop = true;
    head_loop = true;
    wait_time = 0;
    walk_loop = false;
    walk_count = 0;
    if(!sit_loop)
    {
      s1.write(left_leg_start_angle);
      s2.write(right_leg_start_angle);
    }
  }

  if (wait_time &gt;= 25000 &amp;&amp; !walk_loop)
  {
    walk_loop = true;
    move_head_right = true;
  }
  
  if(sit_loop)
  {
    sit_count++;
    s1.write(left_leg_end_angle);
    s2.write(right_leg_end_angle);
    /*if(sit_count <= sitting_time)
    {
      if(sit_count % (sitting_time / leg_intervals) == 0)
      {
        leg_interval_count++;
        s1.write((left_leg_end_angle / leg_intervals) * leg_interval_count);
        s2.write((right_leg_end_angle / leg_intervals) * leg_interval_count);
      }
    }*/
    if(sit_count &gt;= sit_time)
    {
      sit_count = 0;
      sit_loop = false;
      s1.write(left_leg_start_angle);
      s2.write(right_leg_start_angle);
    }
  }
  
  if(wag_loop)
  {
    wait_time = 0;
    wag_count++;
    if(wag_count % (2 * wag_interval) == 0)
    {
      s3.write(wag_right_angle);
    }
    else if(wag_count % wag_interval == 0)
    {
      s3.write(wag_left_angle);
    }
    if(wag_count &gt;= wag_time)
    {
      wag_count = 0;
      wag_loop = false;
      s3.write(wag_start_angle);
    }
  }

  if(head_loop)
  {
    head_count++;
    if(head_count % (2 * head_interval) == 0)
    {
      head_right = true;
      head_left = false;
    }
    else if(head_count % head_interval == 0)
    {
      head_left = true;
      head_right = false;
    }
    if(head_right)
    {
      digitalWrite(MOT_A1_PIN, LOW);
      analogWrite(MOT_A2_PIN, 255);
    }
    else if(head_left)
    {
      digitalWrite(MOT_A2_PIN, LOW);
      analogWrite(MOT_A1_PIN, 255);
    }
    if(head_count &gt;= head_time)
    {
      head_count = 0;
      head_right = false;
      head_left = false;
      head_loop = false;
    }
  }
  else
  {
    digitalWrite(MOT_A1_PIN, LOW);
    digitalWrite(MOT_A2_PIN, LOW);
  }

  if (walk_loop)
  {
    walk_count++; 
    
    if(move_head_right)
    {
      digitalWrite(MOT_A1_PIN, LOW);
      analogWrite(MOT_A2_PIN, 255);
    }
    if(walk_count &gt; 500)
    {
      move_head_right = false;
    }

    if(walk_count % 5000 == 0)
    {
      s1.write(left_walk_angle);
      s2.write(right_leg_start_angle);
    }
    else if(walk_count % 2500 == 0)
    {
      s2.write(right_walk_angle);
      s1.write(left_leg_start_angle);
    }
  }
}