Mechatronics

Throughout this book we analyse forces, motion, stress and deformation with pen, paper and code. Sooner or later every mechanical engineer faces the next question: how do we make something move on command and sense what it is doing? Answering that question requires a working knowledge of electronics, sensors, actuators and embedded programming. The field where mechanical engineering meets electrical engineering and software is called mechatronics, and this part introduces the subset of it that a mechanical engineer needs in order to prototype electromechanical systems.

The scope is deliberately practical. We want to drive DC motors (brushed and brushless), stepper motors and solenoids. We want to read data from load cells, temperature sensors, rotary encoders (magnetic or optical), accelerometers and gyroscopes. We want to power these devices from batteries, design simple circuits using Ohm’s law and voltage dividers, and understand resistance and capacitance well enough to avoid the most common pitfalls. We want to program microcontrollers such as the Arduino and the ESP32, communicate over SPI, I2C and UART on the wire, and over WiFi, ESP-NOW, Bluetooth and Zigbee/Matter through the air. We want to build circuits on breadboards, then make them permanent with crimping tools and a soldering iron.

This is not a course in electrical engineering. We do not derive Maxwell’s equations or design op-amp filters. What we do is learn enough to close the loop between a mechanical design and the real world, so that a prototype can sense its environment and act on it.

The motivation comes from projects our students have carried out in recent years. One group built a desktop-sized six-axis industrial robot driven by stepper motors, using AS5600 magnetic encoders on every joint so the controller always knows where the arm is. Another group constructed self-balancing robots with brushless DC motors, MPU6050 inertial measurement units and AS5048A magnetic encoders for wheel feedback. A third group designed a dynamometer to characterize stepper motor performance: a disc brake applied a controlled load via a stepper-driven brake pad, an AS5600 encoder measured shaft speed, and an HX711 amplifier with a 5 kg load cell recorded the braking force. All three projects required exactly the skills covered in this part.

The broader landscape is equally motivating. RC cars, drones, 3D printers, CNC machines and dynamometers all sit at the intersection of mechanical design, electronics and software. Understanding the fundamentals presented here opens the door to all of them.