Fusion Robotics Assignment— Kitchen Timer

This assignment is the last of 3 intro assignments to Fusion, making sure we somewhat know how to make a robot that will move things. The requirements for this project aren’t that complex:

  • Circuit Building – planning and building a circuit that allows an arduino board to interact with other components
  • Arduino Programming – writing code that will make our device move something.

Now I originally had in mind to make a “trumpet” robot where I could adjust the harmonic series and the valves but I realised it didn’t move anything so I had to scrap it. I also cook very regularly but I mostly use my phone to set timers for things like pasta, baking, etc, which can be a little slow to take my phone out of my pocket while I’m cooking and fiddle around with the app, so I thought this would be something useful to make that also happened to meet the requirements.

Here’s the image of what I’m more or less going for. I knew a tiny bit about robotics so I knew which parts I had to use. I would use a push button to start the timer, a potentiometer to act as a dial, a piezo buzzer to act as the alarm, and a servo to display the time. I ended up asking ChatGPT to tell me where to hook everything up to, because that was something I wasn’t completely sure about.

Here is a circuit schematic of the project. I briefly went through the parts of the circuit earlier but for ease of view the whole schematic is here. Before I click the button to start the timer, I adjust the potentiometer that will set the duration of the timer, and after that I will push the button. While the timer is ticking the servo will adjust its rotation to display the time. Once the time is over the piezo buzzer will sound for a brief moment and we can start another timer. Looking in hindsight this schematic is a little bit different from the prototype but I can’t really predict that so this will have to do.

Circuit Schematic
BOM for reference

Code Explanation

I don’t have much experience with C++ so I had ChatGPT help me generate some code:

#include <Servo.h>

Servo timerServo;

int buttonPin = 2;
int potPin = A0;
int piezoPin = 10;
int servoPin = 9;

bool running = false;
unsigned long startTime = 0;
unsigned long timerDuration = 0;

void setup() {
  timerServo.attach(servoPin);
  pinMode(buttonPin, INPUT);
  pinMode(piezoPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int buttonState = digitalRead(buttonPin);

  // Set timer using potentiometer
  if (!running) {
    int potValue = analogRead(potPin);
    timerDuration = map(potValue, 0, 1023, 1000, 30000); // 1-10m timer
    int servoAngle = map(potValue, 0, 1023, 0, 180);
    timerServo.write(servoAngle);
  }

  // Start timer when button is pressed
  if (buttonState == HIGH && !running) {
    running = true;
    startTime = millis();
  }

  // Run timer
  if (running) {
    unsigned long elapsed = millis() - startTime;

    if (elapsed < timerDuration) {
      int angle = map(elapsed, 0, timerDuration, 180, 0);
      timerServo.write(angle);
    } else {
      running = false;
      tone(piezoPin, 1000, 1000); // Beep at end
    }
  }
}  

I later looked at the code myself just so I could understand what it was doing for my own interest but it worked fine. I’ll briefly go over it here; the first section lets me control the servo and declares where all the parts are. The next part sets up the hardware and variables for the timer, and then the void loop part is the main loop of the code, and if the timer isn’t running currently it just maps the value of the potentiometer(0-1023) to somewhere between 1-30s(adjustable but chose a smaller window for demonstration) and tells the servo to move according to the time. Once the button is pressed the the running variable is set to true and the timer starts. While it is running it calculated the passed time and adjusts the servo, and once the time is over running is set to false which lets the timer run again and the buzzer sounds an alarm telling me the timer’s over.

AI related stuff

I decided to use ChatGPT for most of my AI work just because it was the most accessible to me. I don’t think it would’ve made much of a difference if I used some other AI but it’s just preference. I mostly used it for the coding and figuring out the physical prototype.

Links(prototypes & AI transcript)


Comments

3 Responses to “Fusion Robotics Assignment— Kitchen Timer”

  1. mcrompton Avatar
    mcrompton

    OK, Trison. This looks pretty good but it seems that AI did all the heavy lifting. If you are new to this, it would make sense that you will need more help creating your device, but I don’t see much evidence that you actually understand how it works. Remember, we want to use AI to go deeper while accelerating our progress. You have some explanation, but I wonder how much of that is also taken from AI. How did you create your circuit diagram? I note that Arduino is mis-spelled in a few places in that diagram. Is that your typo? The video shows the device behaving in an unexpected manner. What happened there? Why? Let’s get into a little more detail in your demonstration and explanation.

    1. The circuit schematic in tinkercad is just a button on the top of the screen that converts your current circuit to a diagram. The “UARDUINO” is Tinkercad’s native naming for arduino uno. The reason the explanation is so short is just because the device is just really simple. I set the min and max time in the code, and adjust the potentiometer to choose my time between the min and max times, and once I want to start the device I push the button, and the servo rotates, and if the housing is there it will correspond to a certain time. Once the time is up the buzzer sounds, and the servo is back to its resting position. The device looks a bit weird just because I needed to do some polishing that I didn’t have time for(making a housing for the actual servo to live in). I also set the max time down by a lot just for ease of demonstration. The image at the start of the blog has time up to an hour which for our use case is inconvenient to record a servo spinning for an hour.

      1. mcrompton Avatar
        mcrompton

        OK. We’ll go with this. It would be good to see if you can find another opportunity this year to apply some sort of Arduino circuit to a project to deepen your understanding of the concepts here.

Leave a Reply to mcrompton Cancel reply

Your email address will not be published. Required fields are marked *