top of page
Search

My journey through a 6-day robotics workshop.

  • hisuijade9232
  • Apr 18
  • 8 min read

Updated: Apr 20



I love robotics, building things, engineering, and rockets. What excites me most is not just thinking about ideas, but actually turning them into something real and making them work.

The theme of my Easter holiday project this year is to develop my engineering skills. Rather than just writing code, I enjoy the whole process of building, testing, and improving—especially when things don’t work at first and I have to figure out why and make them better.

In this article, I will share what I learned during the lessons, what I built, and how I hope to grow from this experience.


Day 1:

On day 1, I used Arduino INE to program an Arduino UNO to make certain LEDs to flash at different timings. This code makes it look a little bit like a loading bar which also changes color.

Code

const int ledRed = 13;

const int ledYellow = 12;

const int ledGreen = 11;

const int ledCyan = 10;


void setup() {

pinMode (ledRed, OUTPUT);

pinMode (ledYellow, OUTPUT);

pinMode (ledGreen, OUTPUT);

pinMode (ledCyan, OUTPUT);

}

void loop() {

digitalWrite (ledRed, HIGH);

delay  (100);

digitalWrite (ledRed, LOW);

delay  (100);

digitalWrite (ledYellow, HIGH);

delay  (100);

digitalWrite (ledYellow, LOW);

delay  (100);

digitalWrite (ledGreen, HIGH);

delay  (100);

digitalWrite (ledGreen, LOW);

delay  (100);

digitalWrite (ledCyan, HIGH);

delay  (100);

digitalWrite (ledCyan, LOW);

delay  (100);

}

Day 2:

On this day, I did not use the Arduino UNO or the INE but I made two circuits.

The first one was a power supply connected to a switch, leading to a normal resistor, then a ammeter and back.

The second one was the exact same other than the fact that I used a variable resistor (a resistor which the resistance can be manually changed) instead of a normal resistor.

(Both images shown at the bottom)

Day 3:

Luckily, I did use the Arduino this day. In fact, I did 3 little projects.

The first was making a fraction of the famous Tetris theme tune, using the buzzer.

The second was using the Ultrasonic sensor and displayed it on the serial monitor.

The third was combining those together, making a buzzer which makes a different pitch of sound by the distance detected by the Ultrasonic sound.

Code 3

const int buzzer = 3;

const int trigPin = 10;

const int echoPin = 9;

long duration;

int distance;

void setup() {

  pinMode(buzzer, OUTPUT);

  pinMode(trigPin, OUTPUT);

  pinMode(echoPin, INPUT);

  Serial.begin(9600);

}

void loop() {

  digitalWrite(trigPin, LOW);

  delayMicroseconds(2);

  digitalWrite(trigPin, HIGH);

  delayMicroseconds(10);

  digitalWrite(trigPin, LOW);

  duration = pulseIn(echoPin, HIGH);

  distance = duration * 0.034 / 2;

  Serial.print("Distance: ");

  Serial.println(distance);

  int freq = distance * 20;

  tone(buzzer, freq);

}

Code 2

const int trigPin = 10;

const int echoPin = 9;

long duration;

int distance;

void setup() {

  pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output

  pinMode(echoPin, INPUT); // Sets the echoPin as an Input

  Serial.begin(9600); // Starts the serial communication

}

void loop() {

  digitalWrite(trigPin, LOW);

  delayMicroseconds(2);

  digitalWrite(trigPin, HIGH);

  delayMicroseconds(10);

  digitalWrite(trigPin, LOW);

  duration = pulseIn(echoPin, HIGH);

  distance = duration * 0.034 / 2;

  Serial.print("Distance: ");

  Serial.println(distance);

}

Code 1

const int buzzer = 3;

const int E = 330;

const int B = 247;

const int C = 262;

const int D = 294;

const int A = 220;

int noteON = 350;

int noteOFF= 20;


void setup() {

  pinMode(buzzer, OUTPUT);

}

void loop() {

  tone(buzzer, E);

  delay(noteON);

  noTone(buzzer);

  delay(noteOFF);

  tone(buzzer, B);

  delay(noteON/2);

  noTone(buzzer);

  delay(noteOFF/2);

  tone(buzzer, C);

  delay(noteON/2);

  noTone(buzzer);

  delay(noteOFF/2);

  tone(buzzer, D);

  delay(noteON);

  noTone(buzzer);

  delay(noteOFF);

  tone(buzzer, C);  // start buzzing

  delay(noteON/2);

  noTone(buzzer);

  delay(noteOFF/2);

  tone(buzzer, B);

  delay(noteON/2);

  noTone(buzzer);

  delay(noteOFF/2);

  tone(buzzer, A);

  delay(noteON);

  noTone(buzzer);

  delay(noteOFF);

  tone(buzzer, A);

  delay(noteON/2);

  noTone(buzzer);

  delay(noteOFF/2);

  tone(buzzer, C);  // start buzzing

  delay(noteON/2);

  noTone(buzzer);

  delay(noteOFF/2);

  tone(buzzer, E);

  delay(noteON);

  noTone(buzzer);

  delay(noteOFF);

  tone(buzzer, D);

  delay(noteON/2);

  noTone(buzzer);

  delay(noteOFF/2);

  tone(buzzer, C);  // start buzzing

  delay(noteON/2);

  noTone(buzzer);

  delay(noteOFF/2);

    tone(buzzer, B);

  delay(noteON*1.5);

  noTone(buzzer);

  delay(noteOFF*1.5);

  tone(buzzer, B);

  delay(noteON/2);

  noTone(buzzer);

  delay(noteOFF/2);

  tone(buzzer, D);

  delay(noteON);

  noTone(buzzer);

  delay(noteOFF);

  tone(buzzer, E);

  delay(noteON);

  noTone(buzzer);

  delay(noteOFF);

  tone(buzzer, C);  // start buzzing

  delay(noteON);

  noTone(buzzer);

  delay(noteOFF);

  tone(buzzer, A);

  delay(noteON);

  noTone(buzzer);

  delay(noteOFF);

  tone(buzzer, A);

  delay(noteON*2);

  noTone(buzzer);

  delay(noteOFF*2);

  delay(740);

}

Day 4:

On this day I finally was taught how to turn a DC motor with a transistor using an Arduino

Code

void setup()

{ pinMode(13, OUTPUT);

}

void loop() {

digitalWrite(13, HIGH);

delay(1000);

digitalWrite(13, LOW);

delay(1000);

Day 5:

This day was filled with boards containing Arduino-s and transistors.

Firstly, I made a motor spin omnidirectional and with different speeds.

The funnest part yet, I made a car with no consciousness.


Code 3

int motor = 9;

int analogPin = 3;

int val;

void setup() {
  pinMode(8, OUTPUT); //2
  pinMode(9, OUTPUT); //4
  pinMode(10, OUTPUT); //1
  pinMode(11, OUTPUT); //3
  pinMode(5, OUTPUT); //Left Motor
  pinMode(6, OUTPUT); //Right Motor
}

void loop() {
  //val = analogRead(analogPin);
  //analogWrite(motor,val/4);
  
  analogWrite(5, 255);
  analogWrite(6, 255);
  //Forwards
  digitalWrite(8,HIGH);
  digitalWrite(9,LOW);
  digitalWrite(10,LOW);
  digitalWrite(11,HIGH);
    //End of Forwards
  delay(1000);
    //Backwards
  digitalWrite(8,LOW);
  digitalWrite(9,HIGH);
  digitalWrite(10,HIGH);
  digitalWrite(11,LOW);
  //End of Backwards
  delay(1000);
}

Code 2

void setup() {

  pinMode(8, OUTPUT); //2

  pinMode(9, OUTPUT); //4

}

void loop() {

  //Forwards

  digitalWrite(8,HIGH);

  digitalWrite(9,LOW);

    //End of Forwards

  delay(1000);

    //Backwards

  digitalWrite(8,LOW);

  digitalWrite(9,HIGH);

  //End of Backwards

  delay(1000);

}

Code 1

int potPin = A0;

int motorPin = 9;

int potValue = 0;

int pwmValue = 0;


void setup() {

pinMode(motorPin, OUTPUT);

}

void loop() {

potValue = analogRead(potPin);

pwmValue = map(potValue, 0, 1023, 0, 255);

analogWrite(motorPin, pwmValue);

}

Day 6:

At last, the final day. On this day, I did many things. Firstly, I learnt about open and closed loops. Then, I tested 3 ultrasound sensors and attached all on the Day 5 car.

Yes, you guessed it, then I did code refactoring and let it run. It was awesome.

Code

int motor = 9;
int analogPin = 3;
int val;
const int trigPinF = 12;
const int echoPinF = 13;
const int trigPinL = 2;
const int echoPinL = 3;
const int trigPinR = 7;
const int echoPinR = 4;
long durationF;
int distanceF;
long durationL;
int distanceL;
long durationR;
int distanceR;

void setup() {
  pinMode(8, OUTPUT); //2 (Left)
  pinMode(9, OUTPUT); //4 (left)
  pinMode(10, OUTPUT); //1 (right)
  pinMode(11, OUTPUT); //3 (right)
  pinMode(5, OUTPUT); //Left Motor
  pinMode(6, OUTPUT); //Right Motor
  pinMode(trigPinF, OUTPUT);
  pinMode(echoPinF, INPUT);
  pinMode(trigPinL, OUTPUT);
  pinMode(echoPinL, INPUT);
  pinMode(trigPinR, OUTPUT);
  pinMode(echoPinR, INPUT);
  Serial.begin(9600);
}

void loop() {

  digitalWrite(trigPinF, LOW);
  delayMicroseconds(2);
  // Sets the trigPin on HIGH state for 10 micro seconds
  digitalWrite(trigPinF, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPinF, LOW);
  // Reads the echoPin, returns the sound wave travel time in microseconds
  durationF = pulseIn(echoPinF, HIGH);
  // Calculating the distance
  distanceF = durationF * 0.034 / 2;

  digitalWrite(trigPinR, LOW);
  delayMicroseconds(2);
  // Sets the trigPin on HIGH state for 10 micro seconds
  digitalWrite(trigPinR, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPinR, LOW);
  // Reads the echoPin, returns the sound wave travel time in microseconds
  durationR = pulseIn(echoPinR, HIGH);
  // Calculating the distance
  distanceR = durationR * 0.034 / 2;

  digitalWrite(trigPinL, LOW);
  delayMicroseconds(2);
  // Sets the trigPin on HIGH state for 10 micro seconds
  digitalWrite(trigPinL, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPinL, LOW);
  // Reads the echoPin, returns the sound wave travel time in microseconds
  durationL = pulseIn(echoPinL, HIGH);
  // Calculating the distance
  distanceL = durationL * 0.034 / 2;

  if (distanceF < 15){
    digitalWrite(8,LOW);
    digitalWrite(9,HIGH);
    digitalWrite(10,HIGH);
    digitalWrite(11,LOW);
    delay (500);
    digitalWrite(8,HIGH);
    digitalWrite(9,LOW);
    digitalWrite(10,LOW);
    digitalWrite(11,LOW);
    delay (500);
  }

  if (distanceL < 20){
    digitalWrite(8,HIGH);
    digitalWrite(9,LOW);
    digitalWrite(10,HIGH); 

    digitalWrite(11,LOW);
    delay (500);
  }

  if (distanceR < 20){
    digitalWrite(8,LOW);
    digitalWrite(9,HIGH);
    digitalWrite(10,LOW);
    digitalWrite(11,HIGH);
    delay (500);
  }

  analogWrite(5, 150);
  analogWrite(6, 150);
  //Forwards
  digitalWrite(8,HIGH);
  digitalWrite(9,LOW);
  digitalWrite(10,LOW);
  digitalWrite(11,HIGH);
    //End of Forwards

  Serial.print("   DistanceR: ");
  Serial.println(distanceR);
}

Through this experience, I realised that engineering is not just about getting things right the first time, but about testing, failing, and improving. I want to continue building more complex projects in the future and develop my skills further.

 
 
 

Comments


bottom of page