Introduction to Mechatronics

by punnia2023 in Circuits > Arduino

79 Views, 1 Favorites, 0 Comments

Introduction to Mechatronics

IMG_5404.jpeg

Learning the basic of mechatronics.

Projects in arduino, ESP32

Using Tinkercad, Thingspeak, kicad , Dabble

Supplies

IMG_5405.jpeg

Arduino Uno

Ultrasonic sensor

ESP32

MG996R Metal Gear Servo

Jumper cables

L298N Motor Driver/L293D

Chassis of robotic car

3 Batter y pack ( 12V/9V )

7805ic

IMG_5406.jpeg

Project Title:


  1. Final Project - Binny: Smart Robot Dustbin



Why This Project:

  1. Cafeterias and public dining areas often have trash left on tables or floors due to people not wanting to walk to trash bins.
  2. This causes hygiene issues and ruins the dining experience.
  3. The project gamifies waste disposal by making the dustbin interactive and mobile, allowing users to summon and control it via their smartphones.
  4. Goal: Encourage better waste management habits through a fun, user-friendly approach.


Observations:

  1. Trash is often left on tables and the floor, even with dustbins available, highlighting the need for a smarter waste solution.

IMG_5407.jpeg



Key Features:


  1. Automatic Lid Operation:
  2. Lid opens/closes automatically using a servo motor.
  3. Ultrasonic sensor detects nearby trash to trigger lid opening for hands-free use.
  4. Mobile App Control:
  5. Dustbin mounted on wheels powered by DC motors.
  6. Movement (forward, backward, left, right) is controlled via a Bluetooth-connected app.


Additional Features (Planned):


  1. Battery life monitoring
  2. Weight measurement of trash
  3. Cleaning mechanism
  4. Seamless connection to one device at a time


Part 1: Opening & Closing of Dustbin Lid


  1. Tested sensors and servo using Arduino Uno.
  2. Initial servo was too weak to lift the lid; upgraded to a MG996R Metal Gear Servo

IMG_5408.jpeg

Final Connection Plan for the Lid:


  1. Verified that the servo and ultrasonic sensor connections worked.
  2. Attached a 5.28 cm ABS plastic lever to the servo motor to lift the lid.
  3. Made holes in the lid to mount the ultrasonic sensor.
  4. Sensor fixed securely on the lid.


Testing & Refinement:

  1. Initial Issue: Code was reversed—bin stayed open by default and closed when detecting objects.
  2. Solution: Fixed the logic, added extra seconds for the lid to remain open, and increased sensor detection range.


IMG_5409.jpeg

Final Working of Part 1:

  1. Successfully demonstrated the automatic lid opening and closing system using an ultrasonic sensor and servo motor.
  2. The trash bin now opens hands-free when an object is detected.


Part 2: Moving the Dustbin and App Control


  1. Designed a custom ABS plastic chassis (2 mm thick) using a DXF file and laser cutting to hold the dustbin.
  2. Integrated components:
  3. ESP32 (for wireless control and app integration)
  4. L298N / L293D Motor Driver
  5. 3 Battery Packs (12V/9V)
  6. 7805 Voltage Regulator IC
  7. Assembled the robotic car chassis with wheels and motors to enable dustbin mobility.

IMG_5410.jpeg

Using L293D Motor Driver:

  1. Attempted to use L293D driver for motors.
  2. Motors ran only briefly before stopping.
  3. Likely causes:
  4. Limited to 600 mA continuous current per channel (not enough for load).
  5. Voltage drop across transistors.
  6. Inefficient for heavier/high-current motors, leading to stalling.
  7. Decision: Switch to L298N for better performance.


Using L298N Motor Driver:


  1. Tried several fixes:
  2. Connected ESP32 ground to motor driver ground.
  3. Added 7805 voltage regulator IC, but it overheated.
  4. Reduced battery voltage to ~8V, but 7805 still overheated.
  5. Powered ESP32 directly from laptop USB to isolate issues.
  6. Found motor driver pin placement affected motor operation.


  1. Why L298N was better:
  2. Handles up to 2A per channel, stronger than L293D.
  3. Uses Darlington transistor arrays for better robustness.
  4. Separate motor (12V) and logic (5V) power pins improve stability.
  5. Widely documented for ESP32-based robotics.


IMG_5411.jpeg

Code for Running Motors with ESP32 (Bluetooth Serial):


  1. ESP32 set up as a Bluetooth device named My_BT_Car.
  2. Accepts single-character commands via Bluetooth to control movement:
  3. F = Forward
  4. B = Backward
  5. L = Left pivot
  6. R = Right pivot
  7. S/others = Stop

  8. Controls two DC motors via L298N/L293D motor driver.
  9. Motor direction managed through digital pins; PWM channels handle speed control.


Code for Running Motors with ESP32 (Dabble App):


  1. Designed for external app-based control (joysticks, button states, speed values).
  2. Uses structured data instead of simple one-letter commands.
  3. Connections:
  4. Motor driver ENA = GPIO 22, IN1 = GPIO 16, IN2 = GPIO 17
  5. ENB = GPIO 23, IN3 = GPIO 18, IN4 = GPIO 19

  6. App-driven approach provides more flexibility and easier control over direction and speed.

IMG_5412.jpeg

App for Robot (MIT App Inventor):


  1. A simple mobile app built on MIT App Inventor for single-user control.
  2. Provides directional buttons (Forward, Backward, Left, Right).
  3. Connects to the dustbin via Bluetooth.


Website for Robot (Multi-User Access):

  1. Allows multiple users to connect to the dustbin via a web app.
  2. Key Features:
  3. Connect via Bluetooth, control page with directional buttons & 1-minute session timer.
  4. Automatic disconnection after the session, making it ready for the next user.
  5. Optional dark mode toggle.
  6. Demo mode for testing (not in final version).
  7. Emphasis on proper backend code integration for stability.


Real-Life Implementation Phases:

  1. Prototype:
  2. Automatic dustbin lid, robot bin controlled via phone.
  3. Validated mechanical movement & basic control.
  4. Multi-User Interaction:
  5. QR code access for shared control.
  6. Single-user sessions, auto-disconnect after inactivity.
  7. Notifications for user actions and gamification messages.
  8. Practical Model:
  9. Rechargeable Li-ion battery with USB-C docking.
  10. Motors for carrying 3–5 kg trash.
  11. Easy inner bin removal for staff cleaning.