17.4 Implementation

17.4 Implementation

Software Development

The Arduino code integrates and controls a coordinated electromechanical system consisting of a DC motor, a stepper motor, and four electromagnets. The DC motor is responsible for driving a four-bar linkage mechanism, while the stepper motor is used to rotate the main chassis of the device. Additionally, four electromagnets are employed to selectively lock and release the linkages during different phases of motion—remaining engaged during the straight-line actuation phase and disengaged during the arced return path.

The code begins by initializing pin assignments for all components. The DC motor is connected via three key pins: a PWM pin (pin 3) to control speed, a brake pin (pin 9), and a direction pin (pin 12). The motorforward function allows the DC motor to drive the linkage, while the motorstop function brings the motor to a halt. The stepper motor, wired to pins 5, 6, 10, and 11, is controlled using the Stepper.h library and programmed to rotate in discrete steps to realign the chassis by ±30 steps (1.8°/step). A helper function, steppermotorlock, energizes the coils to hold the stepper in a fixed position when needed, so that when the arms are moving the chassis does not pivot.

The electromagnets are wired to digital pins 2, 4, 7, and 8 and are activated or deactivated based on the motion phase. The control logic relies on the joystick connected to analog pins A1 (VRX) and A0 (VRY). The code defines threshold ranges and dead zones to detect intentional directional input from the joystick without false triggers. When the joystick is pushed to the “left” or “right” and held for a minimum of two seconds, the stepper motor rotates the chassis, and the electromagnets toggle to simulate a full cycle of mechanical motion. Specifically, they are turned off during the arced motion and turned on during the straight-line path. When the joystick is pushed “up,” the DC motor is engaged to drive the linkages forward while a specific pair of electromagnets is activated to constrain the path. If the joystick is centered (within the deadzone), the system enters an idle state where the motor is stopped, and all electromagnets are turned on to lock the mechanism.

Overall, this code provides directional control over the electromechanical system, combining rotational repositioning, linear actuation, and electromagnetic locking in response to intuitive joystick input. The precise pin mappings, delay logic, and step coordination ensure accurate and synchronized behavior across all components.

Electronics & Circuitry

Our electronics system was centered around an Arduino Uno, which controlled the timing and motion of the climbing and turning mechanisms, as well as the activation of the electromagnets. A 10 RPM 12V geared DC motor, driven by an L298N motor driver, powered the four arms through a crank and belt system. The motor was controlled using PWM, brake, and DIR pins. For chassis rotation, we used a NEMA 17 stepper motor, driven by two L298N motor drivers to prevent overheating while delivering sufficient current.

image-20250502-215849.png
Figure 4.1. 12V DC motor.
image-20250502-220008.png
Figure 4.2. NEMA 17 stepper motor.

The L298N drivers were also used to drive the 5V electromagnets, with all control signals connected to digital outputs on the Arduino Uno. The electromagnets were connected to the motor driver, which enabled high and low outputs from the Arduino to toggle their "on" and "off" states as needed.

image-20250502-220051.png
Figure 4.3. L298N motor driver.
image-20250502-220245.png
Figure 4.4. 5V electromagnets with 5kg holding force.

We used a motor shield to simplify the system by interfacing directly with the Arduino Uno and saving chassis space by acting as a motor driver. A 12V power supply provided the necessary voltage for the motors, while the LM2596 adjustable voltage regulator stepped this down to 5V for the electromagnets and joystick. However, during testing, the electromagnets were only receiving 3.8V, so we adjusted the LM2596 output to 7.5V, which resulted in a true 5V at the magnets. Since the joystick could only handle 5V input, we used a 7805 voltage regulator to safely convert 12V to 5V for joystick use. Additionally, we added capacitors at the input and output of the 7805 voltage regulator to ensure a stable input/output voltage with minimum fluctuations.

image-20250502-220322.png
Figure 4.5. LM2596 adjustable voltage regulator.
image-20250502-220512.png
Figure 4.6. 7805 voltage regulator.

The joystick controlled motion initiation, with the “up” direction starting the climbing phase and “left” and “right” controlling turning. The VRY and VRX pins were connected to A0 and A1 on the Arduino, respectively.

image-20250502-220554.png
Figure 4.7. Joystick module for Arduino.

Fabrication & Assembly

Fabrication and assembly of our robot involved a combination of laser cutting, mechanical fastening, and soldering. We used 6mm acrylic sheets for both rapid prototyping and the final design, fabricating components such as bearing and axle fit test pieces, the main chassis, bottom arm, support links, spacers, and the links for the four-bar mechanisms. Soldering was performed to ensure strong electrical connections between the DC motor, electromagnets, power supply, joystick, and their respective wiring. Spacers were added between links in the four-bar arms to keep the electromagnets level with the climbing surface, while low-friction washers reduced resistance at the joints.

image-20250502-220636.png
Figure 4.8. Laser cut spacers to make electromagnets flush with steel plate.

M3 bolts were used to assemble the linkages, acting as pivot joints, and were secured with lock nuts to prevent loosening during motion. Set screws were used to firmly secure the pulleys to the axles.

To address belt slippage, we created makeshift tensioners using M4 bolts housed in low-friction sleeves to prevent damage to the belt teeth—this required drilling additional holes in both the chassis and bottom arm. Since three belts shared a single pulley on the bottom arm, careful attention was given to the order of belt placement to maintain proper function. To synchronize the motion and timing of each pair of four-bar mechanisms, one side was configured with an “open” belt layout while the other used a “crossed” configuration.

C8D5920C-860A-4732-9954-807DC72E0B51 copy.jpeg
Figure 4.9. Open and crossed configurations of belts.

Two separate axles needed to be collinear to ensure uniform and synchronized motion—one axle for driving the crank mechanisms and another for rotating the chassis. This was achieved by rigidly fixing the turning pulley to the bottom arm, which housed a fixed plate with a bearing. The bearing provided support for the main crankshaft, ensuring it remained aligned along the same axis as the turning mechanism. This collinear arrangement was critical for preventing binding and maintaining consistent motion between the climbing and turning functions.

Figure 4.10. Collinear axles.