Skip to content

Final Project Overall Summary

CHOCOBOT

My project CHOCOBOT consist of multiple input and output devices, the input devices are;

  • Ultrasonic sensor

  • Time of flight sensor

Output devices are;

  • Speaker

  • Servo motor

Main Idea of project

The main idea of project is to “give and take” which means if you throw something inside the dustbin attached below the dog it will give chocolate as a reward in return. Basically my project’s main intention is to teach children how to be mindful regarding the waste and to keep the surrounding neat and clean without throwing the waste openly. In addition to that, my project also gives lessons to them regarding the waste through short speeches played from the speaker and encourages them to always throw the waste inside the dustbin only.

Final project Slide

Final Project video

  • Youtube link for my final project video is attached here

FFmpeg command I used to compressed my video:

 ffmpeg -i Roshanfinal.mp4 -vcodec libx264 -crf 34 -preset veryslow -vf scale=-2:1080 -acodec libmp3lame -q:a 4 -ar 48000 -ac 2 presentation.mp4

BOM

Component Quantity Price ($) Total Price ($) Source
ESP32C3 1 $7.49 $7.49 JNWSFL
Speaker 8 ohm,0.5 watt 1 $4.4 $4.4 JNWSFL
5V usb adapter 1 $2.5 $2.5 JNWSFL
Female header pins 22 $7.99 $7.99 JNWSFL
Ultrasonic sensor 1 $3.95 $3.95 JNWSFL
3D print PLA 1 $2.1 $2.1 JNWSFL
18mm thick rubber wood 1 $5.85 $5.85 JNWSFL
DF player mini 1 $4.99 $4.99 JNWSFL
Servo motor 1 $13.99 $13.99 JNWSFL
VL5L1X 1 $4.48$ $4.48 JNWSFL
Screw terminal 7 $0.60 $0.60 JNWSFL

Total Price: $58.34/- only which is equivalent to Nu.4985.15/- only

Design and Fabrication

  • In order to make my project complete and sucessful, I had done designing of all those components which formed a complete product at the end which can actually communicate with children and teaches them to be mindful regarding the waste.

1.Main model of dog

The main model of dog was designed using blender and later on it was exported and cut in zund.

2.Chocolate dispensing assembly

The chocolate dispensing assembly consist of two components, barrel and jar with lid to open and close where we can top up chocolates when the jar gets empty. It was designed using fusion 360

3.PCB casing

After considering all the input, output devices and the components for the project, I designed the casing for the pcb using fusion 360 which is essential while carrying out the system integration of the project.

4.Speaker casing

In order to mount the speaker inside the mouth of a dog, I designed the casing of a speaker using fusion 360

5.Ultrasonic sensor mount board cum nose of a dog

As I was having difficulty in mounting the ultrasonic sensor on the dog, I thought of a solution to design the nose with holes where I can mount the ultrasonic sensor so I had designed using fusion 360

6.Casing for time of flight sensor

Since in order to place the time of flight sensor firmly on the dustbin, I had designed its casing using fusion 360

7.Dust bin

Finally, I had also designed the main dustbin for my project using fusion 360 and machined using shopbot

This is how my whole model looks like after assembling them together

This is how I integrated the whole system for my project

Electronics design and Production

For my final project I am using XIAO ESP32C3 as the microcontroller

For my input devices I am using 5v ultrasonic sensor with 15mA current drawn during operation and 5v time of flight sensor with 20mA current drawn

For my output devices I am using 5v servo motor with 0.07A current drawn and 8 Ohm speaker with 0.5 watt

System Design for my project

Schematic design of pcb for my final project

Pcb layout design for my final project

Pcb for my final project along with its casing

  • To ensure proper and rigid connections of input and output devices from the board, I had added screw terminals from back of the pcb and 3d printed the casing of pcb after designing

Programing

Here is the flow chart of how my system is going to work

Testing the all input and output devices with MCU

After I finished designing my final pcb for the final project, I did milling and soldered all the necessary components for my board and connected all the devices that are required for my final project and tested electronics equipments with the code.

Final code

After I finished connecting all the input and output devices together with my final pcb, then I used the code attached below to do programing for my final project

      #include <DFRobotDFPlayerMini.h>
      #include <SoftwareSerial.h>
      #include <Servo.h>
      #include <Wire.h>
      #include <VL53L1X.h>

      SoftwareSerial mySerial(D9, D10); // DFPlayer RX/TX
      DFRobotDFPlayerMini myDFPlayer;
      VL53L1X sensor;

      const int trigPin1 = D1;  // Ultrasonic 1 (front)
      const int echoPin1 = D2;

      const int servoPin = D8;

      Servo dispenserServo;
      const int closedAngle = 0;
      const int openAngle = 180;

      bool audio1Played = false;
      bool audio2Played = false;

      int prevDistance = 300;
      int distance, currentLevel;

      void setup() {
      Serial.begin(115200);
      mySerial.begin(9600);

      pinMode(trigPin1, OUTPUT); pinMode(echoPin1, INPUT);

      dispenserServo.attach(servoPin, 500, 2400);
      dispenserServo.write(closedAngle);

      Wire.begin();
      Wire.setClock(400000); // Set I2C clock speed to 400kHz

      sensor.setTimeout(500);
      if (!sensor.init()) {
      Serial.println("Failed to detect and initialize sensor!");
      while (1);
      }


      sensor.setDistanceMode(VL53L1X::Long);  // Set sensor to long distance mode
      sensor.setMeasurementTimingBudget(50000);  // Set timing budget (50ms)
      sensor.startContinuous(50);  // Start continuous measurements every 50ms

      Serial.println(F("Initializing DFPlayer..."));
      if (!myDFPlayer.begin(mySerial)) {
      Serial.println(F("DFPlayer Mini not responding! Call Roshan, Something is Off ..."));
      while (true);
      }

      myDFPlayer.volume(35);

      Serial.println("✅ System ready.");

      readCurrentLevel();
      }

      void readCurrentLevel(){
      sensor.read();  // Get new sensor reading
      currentLevel = sensor.ranging_data.range_mm;  // Store measured distance
      Serial.print("Current Waste Level: ");
      Serial.println(currentLevel);
      }
      void loop() {
      float PeopleDist = getPeopleDistance();

      Serial.print("People: ");
      Serial.println(PeopleDist);

      // sensor.read();  // Get new sensor reading
      // distance = sensor.ranging_data.range_mm;  // Store measured distance
      // Serial.print("Distance: ");
      // Serial.println(distance);

      // delay(1000);

      // 🚫 If user walks away, reset all
      if (PeopleDist > 10.0) {
      Serial.println("No One");
      audio1Played = false;
      return;
      }

      else{
      sensor.read();  // Get new sensor reading
      distance = sensor.ranging_data.range_mm;  // Store measured distance
      Serial.print("Distance: ");
      Serial.println(distance);
      }

      // 1️⃣ Step 1: Play "Tickle me" once
      if (PeopleDist <= 10.0 && !audio1Played) {
      myDFPlayer.play(5);  // play first audio
      Serial.println("👋 Audio 1: Welcome with Barking Note !");
      audio1Played = true;
      delay(5000);  //adjust based on audio length
      myDFPlayer.stop();      // This stops the current audio
      }

      Serial.println("END 3");
      // 2️⃣ Step 2: 
      if (audio1Played && distance < currentLevel - 5) {
      currentLevel = distance;
      Serial.println("🕺 Audio 2: Thank you for Dumping waste - Reward at the End !");
      myDFPlayer.play(4);
      delay(8000);  // Give time for audio
      // myDFPlayer.stop();      // This stops the current audio
      Serial.println("🕺 Audio 3: Information on Waste !");
      int x = random(3, 6);
      Serial.println(x);
      myDFPlayer.play(3);  // "I see you!"
      delay(15000);  // Give time for audio
      myDFPlayer.stop();      // This stops the current audio

      dispenseChocolate();
      // delay(2000);
      Serial.println("🕺 Audio 4: Ending with Applause !");
      myDFPlayer.play(6);  //Clapping
      delay(6000);  // Give time for audio                 
      myDFPlayer.stop();      // This stops the current audio

      audio1Played = false;
      }
      // delay(10);
      }

      float getPeopleDistance() {
      return measureDistance(trigPin1, echoPin1);
      }

      float measureDistance(int trig, int echo) {
      digitalWrite(trig, LOW);
      delayMicroseconds(2);
      digitalWrite(trig, HIGH);
      delayMicroseconds(10);
      digitalWrite(trig, LOW);

      long duration = pulseIn(echo, HIGH, 30000);
      if (duration == 0) return -1;
      return duration * 0.034 / 2.0;
      }

      void dispenseChocolate() {
      dispenserServo.write(openAngle);
      delay(800);
      dispenserServo.write(closedAngle);
      Serial.println("✅ Chocolate dispensed.");
      }

System Integration

Here is the link to my system Integration

Answer and Planning

Here is the link to my week 17 assignment (Application and Implications/project Development) which covers up all the questions, answers and planning for the project

CC license

  • Creative Commons licenses give everyone a way to grant the public permission to use their creative work under copyright law. To learn more go to the Creative Common’s websites for Licenses, and read through the given options.

From the different type of CC Licenses I opted for ATTRIBUTION-NONCOMMERCIAL-SHAREALIKE

I chose this license because I want my work to be copy and redistribute the material in any medium or format, remix, transform, and build upon the material with following terms: ShareAlike, appropriate credit must be given and not allowed to use the material for commercial purposes.

ATTRIBUTION-NONCOMMERCIAL-SHAREALIKE Deed:

You are free to:

Share- Copy abd redistribute the material in any medium or format

Adapt- remix, transform, and build upon the material

The licensor cannot revoke these freedoms as long as you follow the license terms

**Under the following terms:

Here is the Legal Code of CC BY-NC-SA

  • Here is the linkwhere I have explanied about dissemination plan of my final project

Design files