3D Printed Advanced Mobile Robot and Testing Platform

by jmoreno555 in Circuits > Robots

6937 Views, 74 Favorites, 0 Comments

3D Printed Advanced Mobile Robot and Testing Platform

PORTADA.png
XY PLATFORM.gif
XRay TOP.png
3D ALL.png
IMG_4428.jpg

Robotics and deep learning are converging in an extraordinary way, offering the opportunity to create intelligent mobile robots capable of navigating and adapting to diverse environments. Imagine a world where robots not only perform pre-programmed tasks but also have the ability to learn and adjust their behavior in real-time, as if they had a mind of their own. This exciting journey into advanced robotics begins with the construction of a differential mobile robot and a testing platform designed to explore new frontiers in machine learning.

Differential mobile robots are a type of robot that uses two independent wheels for movement and turning. They are versatile and suitable for a wide range of applications, from autonomous exploration in unfamiliar environments to object delivery. But how can we make such a robot a truly intelligent agent? The answer lies in deep learning.

The key to making a mobile robot autonomous and adaptable is to train it in controlled and dynamic environments. This is where the testing platform comes into play. Imagine a robotics lab equipped with simulated and real-world scenarios representing various types of terrain, from indoors to outdoors. The robot, equipped with sensors and cameras, is immersed in these environments and begins to learn to distinguish between different surfaces, obstacles, and situations.

Using deep learning algorithms, the robot processes sensory information and adjusts its behavior based on the experience gained. For example, it can learn to avoid obstacles, recognize paths, and adapt to slippery or uneven terrain. This process of self-localization and decision-making is what makes these mobile robots truly autonomous and valuable in real-world applications such as space exploration, healthcare assistance, and logistics.

Join me on this exciting journey as we explore the process of building a differential mobile robot and its testing platform. The next robotic revolution is underway, and I invite you to be a part of it.

Supplies

TOOLS:

See the TOOLS in each of the three parts

MATERIAL:

See the material in each of the three parts

ELECTRONICS:

Wemos D1 R32

ESP32 DevkitC v4

ESP32 CAM

L298N

Diodes 1N41007

VL53L0/1XV2 Laser Ranging Sensor

Description and Scope of the Project

IMG_4465.JPG

The project is divided into three main parts:

1.- Differential Robot with low cost and advanced features.

2.- Treadmill for robot and

3.- XY platform for terrain simulation.


Let's see the characteristics of each part:

Part One: The robot.

I have chosen to build a differential type robot, since it is one of the easiest systems to build. The selected motors are the famous yellow motors known as TT motors for Arduino. However, in order to obtain a robot with high-level performance, I have decided to change the motor for one that comes equipped with an optical quadrature encoder. The power system was designed specifically for this robot and consists of three 18650 Lipo batteries with its charge balancer card, its charger module and an additional system that allows wireless charging of the batteries.

An electronic card has been designed that uses the L298N integrated circuit to manage the signals from the motors and encoders. For the navigation control of the robot, the Wemos D1 R32 card has been selected because it is based on an ESP32 (a very powerful two-core microcontroller) and has the same card format as the Arduino UNO, which allows the placement of various shields. manufacturers. However, for this design, a shield has been made with an ESP32 DevkitC v4. For the front area of the robot I have decided to place a camera based on the ESP32, so a card had to be designed that had room for the camera, a pair of power LED lights and a laser distance meter.

Part Two - The Robot Treadmill:

I have designed a treadmill for this robot to allow control and navigation tests without having to go behind the robot on a test track, this way you can interact with the mobile robot on your desk.

Part Three – XY Platform:

In order to simulate various types of terrain, I have designed an XY platform composed of three servos and a novel ball joint system based on a metallic sphere magnetically coupled between the platform and the treadmill.

You can also use this platform to improve the position algorithms (Inertial Navigation) based on the robot's accelerometers.


Important: This project is part of a course that I am preparing on mobile robotics and is under constant review, therefore you will observe small differences between the design phase and the construction phase. In the case of part one (The differential mobile robot) this is already the third version, so it is already a design that has had several improvements, especially in the design part of the 3D model and improvements in the design of the Power system PCB. In the case of parts two and three (The treadmill and the XY platform) this is its first version, so the errors found in the construction phase are not yet implemented in a new version. In the final section of conclusions, I list some of the improvements that will be implemented in the following design reviews.


 With these three tools you can start testing deep learning algorithms and teach the robot to distinguish between different types of terrain. For example, you can simulate smooth terrain such as a beach or rocky terrain and in this way teach the robot to distinguish the different types of signals acquired by its sensors.

Design Recommendations - Robot Center of Gravity

To make a robot easy to maneuver we have to take into account certain design parameters, including the center of gravity.

The center of gravity is an imaginary point on an object where its mass is concentrated. In the case of a mobile robot, the center of gravity plays an important role in its stability and maneuverability. Next, I will explain how the center of gravity affects a mobile robot:

Stability: The center of gravity influences the stability of the robot. If the center of gravity is located low and close to the robot's support point, the robot will be more stable. On the other hand, if the center of gravity is high or far from the support point, the robot will be less stable and more prone to tipping over. It is crucial to design the robot so that its center of gravity is as low and close to the ground as possible to ensure greater stability.

Maneuverability: The center of gravity also affects the robot's ability to maneuver. If the center of gravity is located midway between the wheels, the robot will be able to easily rotate around its central axis. However, if the center of gravity is shifted to one side, the robot may tip over when turning sharply. The design of the robot must consider the location of the center of gravity to ensure good maneuverability.

Traction: The center of gravity also influences the traction of the robot. If the center of gravity is too far forward or too far back relative to the drive wheels, it can affect the weight distribution and traction capability of the robot. It is essential to take the center of gravity into account when designing wheel layout and drive systems to ensure optimal traction.


In summary, the center of gravity of a mobile robot affects its stability, maneuverability, and traction capacity. A low and well-located center of gravity is desirable to achieve a more stable and agile robot. Robot designers must carefully consider the location of the center of gravity when designing the structure and weight distribution of the robot to ensure optimal performance.

Design Recommendations - Battery Management System (BMS)

MonoPieza v30.png

A Battery Management System (BMS) is a system designed to monitor and control lithium-ion batteries, such as LiPo (Lithium Polymer) or 18650-type batteries, commonly used in applications like electric vehicles, portable electronic devices, and energy storage systems. The primary function of a BMS is to ensure the safe and efficient operation of batteries by performing the following tasks:

Overcharge protection: The BMS monitors the voltage of each battery cell and prevents them from charging above their safe maximum voltage, which could cause damage or safety risks.

Over-discharge protection: It prevents cells from discharging below a safe minimum voltage, which can damage the batteries and reduce their lifespan.

Cell balancing: It ensures that all individual cells in the battery have a similar charge level to maximize capacity and battery life.

Temperature monitoring: It supervises the battery temperature and takes actions to prevent overheating, which can be dangerous and harmful.

Overcurrent protection: It controls the charge and discharge current to prevent overcurrents that could damage the battery or pose safety issues.

Communication and data: Some BMS units can provide information about the battery's status, such as remaining capacity, temperature, and charge/discharge history. This is useful for monitoring and managing the battery.

In summary, a Battery Management System (BMS) for LiPo or 18650-type batteries is essential for maintaining the safety and efficiency of these batteries by ensuring they stay within safe operating limits and are used optimally.

DESIGN BASIS

MonoPieza_FRAME ROBOT_v1.3 (BMS) v16 RX.png
IMG_4419.JPG
IMG_4420.JPG
IMG_4421.JPG
IMG_4422.JPG
IMG_4423.JPG
IMG_4424.JPG

The body of the robot has been designed in a single 3D piece to maintain a firm and compact structure.

The battery system has been placed in the lower central part of the robot and the improved motors have been placed on the sides of the battery system. The free area between the castor wheel and the top of the robot has been designated to place the battery charger and the wireless battery charging system is placed below the battery system on its own 3D printed base.

The front part of the robot has been designated as a free area to be able to place various sensors and even grippers. For this preliminary design it has been decided to place an ESP32 camera equipped with two power LEDs on each side and an VL53LO/1XV2 laser distance sensor in this front area.

On the upper part of the robot, the motor drive card, the Wemos D1 R32 card and its shield with an ESP32 DevkitC v4 have been placed.

The WEMOS D1 R32 is intended to be used to manage low level navigation algorithms: Motor Control and encoder reading.

The ESP32 CAM is designed to manage the vision algorithms, provide real-time video transmission and provide the Robot's WiFi network to allow remote connections.

The ESP32 DevkitC v4 is designed to execute the user's algorithms.

The connection between these three ESP32 will be using serial ports and parser algorithms to send commands between them.

Design Recommendations - BEFORE STARTING 3D PRINTING

Screenshot 2023-10-31 124357.png

Efficient 3D Design: Use 3D design software like SolidWorks, Fusion 360, Tinkercad, or Blender to create your model. Ensure you are familiar with the chosen tool.

Design the structure to require the least amount of supports during printing. This will make printing easier and reduce the time and material needed.

Print Orientation: Plan the orientation of the part on the 3D printer to minimize the need for supports. Often, a flat orientation is the best choice.

Avoid sharp angles or excessively long overhangs as they might require supports or be prone to deformation.

Printing Material: Choose a suitable material for your application. PLA is common for prototypes, but if you need more strength, consider ABS, PETG, or Nylon. For specialized applications, you might consider materials like TPU for flexibility or resin for high resolution.

Wall Thickness and Infill: Adjust the wall thickness and infill of your design according to your needs. Parts that need to be stronger can have thicker walls and more infill, while less critical parts can be lighter.

Easy Assembly: Design parts that are easy to assemble without the need for additional tools. Consider using clips, bolts and nuts, or slot and tab systems to keep parts together.

Consider Tolerances: Take into account tolerances to ensure that the printed parts fit together properly. 3D printers can have some variability in the dimensions of printed parts.

Modular Structure: Divide the structure into smaller modules that can be printed separately and then assembled. This makes printing, troubleshooting, and part replacement easier.

Iterative Testing: Prototype and test with 3D-printed parts before printing the complete structure. This allows you to make adjustments and improvements to the design without wasting time and material.

Documentation: Document your design in detail. Provide clear assembly instructions, a parts list, and any additional information that might be useful for others looking to build the same robot.

Consider Functionality: Ensure that the structure can accommodate all necessary components, such as motors, wheels, sensors, and circuit boards.

Strategic Reinforcements: If needed, you can add reinforcements in critical areas of the structure to increase strength and durability.

Optimize for Weight: If mobility is a significant factor, look for ways to optimize the weight of the structure without compromising strength.

Respect Copyrights: If you are using pre-existing designs or third-party components, make sure to respect copyrights and relevant licenses.


Keep in mind that designing a Robot can be a complex project, so careful planning and iteration are essential.

3D PRINTING: Robot

3d2.png
IMG_2689.JPG
3d1.png
3d3.png

The following files contain the parts that we need to print that are part of the ROBOT:

3D PRINTING: Treadmill

3dr2.png
IMG_2457.jpg
3dr1.png
3dr3.png

The following files contain the parts that we need to print that are part of the TREADMILL:

3D PRINTING: XY Platform

3dxy1.png
IMG_2459.jpg
3dxy2.png

The following files contain the parts that we need to print that are part of the XY PLATFORM:

3D PRINTING: Post Processing

IMG_2727.JPG

Once the 3D printer has finished its work, it is often necessary to work on the part itself: this is where post-processing comes in. Post-processing includes several steps on the cleaning of the parts. The goal is to remove all excess material.

The post processing steps are:

  • Support Removal
  • Sanding
  • Joining
  • Priming & Painting

Tools that we are going to use in this step:

  • Dremel
  • Dremel 432 Sanding Band
  • Dremel 932 Aluminum Oxide Grinding Stone
  • Dremel 9901 Tungsten Carbide Carving Bit
  • Retracting-Blade Utility Knives
  • Straight Rectangular File for Coarse Finish, 8" Long x 1/2" Wide
  • Sanding Sheet with Paper Abrasive Backing, for Smooth Finish, 220 Grit
  • Drill Bits: 1/8", 5/32", 13/64", 7/32", 4mm, 8mm


POST PROCESSING: Robot

IMG_2727.JPG
IMG_2737.JPG
IMG_2768.JPG
IMG_2787.JPG
IMG_2800.JPG
IMG_2990.JPG

Use a Straight Rectangular File for Coarse Finish, 8" Long x 1/2" Wide to remove excess plastic.

Use a 1/8" drill bit to drill the holes for the M3 screws to go through.

Using the Dremel 9901 Tungsten Carbide Carving Bit, adjust the holes for the antenna and switch inputs.

POST PROCESSING: Treadmill

IMG_2841.JPG
IMG_2852.JPG
IMG_2861.JPG
IMG_2906.JPG
IMG_2907.JPG
IMG_2919.JPG
IMG_2938.JPG
IMG_2947.JPG
IMG_3034.JPG
IMG_3047.JPG
IMG_3585.JPG
IMG_3612.JPG
IMG_3603.JPG

To adjust the hole so that the screws fit perfectly, first run the 1/8" drill bit to allow the M3 screw to pass freely, then use an 7/32" drill bit and use a piece of PVC pipe as a stop to prevent the drill bit from going straight and piercing the entire piece of plastic. The length of this piece depends on the length of the drill bit you are using and the goal is only to make a hole about 5 mm deep, enough for the head of the Allen screw to enter the piece and remain hidden.

Using an 13/64" drill bit, clean the plug holes.

To clean the steel bar guides use a 1/8" drill bit.

Use a Dremel 432 Sanding Band to clean the PVC pipe supports.

Use a Sanding Sheet with Paper Abrasive Backing, for Smooth Finish, 220 Grit, to flatten surfaces.

POST PROCESSING: XY PLATFORM

IMG_3007.JPG
IMG_3050.JPG
IMG_3098.JPG
IMG_3107.JPG
IMG_3117.JPG
IMG_3644.JPG
IMG_3676.JPG

Use a 5/32" drill bit through a PVC spacer tube to clear the insert holes.

Use a 1/8" drill bit to clean the screw holes in the PVC support pieces.

Use an 8mm drill bit to clean the hole where the steel bar goes. To clean the bottom of the piece, clean using only the 8 mm drill bit and manually, with the help of tweezers, rotate the drill bit to remove excess plastic.

To clean the steel bar guides use a 1/8" drill bit.

PAINTING ROBOT

IMG_3231.JPG
IMG_3209.JPG
IMG_3215.JPG
IMG_3228.JPG
IMG_3230.JPG

If necessary, paint the model with spray paint.

Before Starting to Assemble: ROD CUTTING

IMG_3265.JPG
IMG_3233.JPG
IMG_3256.JPG
IMG_3267.JPG
IMG_3132.JPG
IMG_3266.JPG
IMG_3127.JPG
IMG_3131.JPG
IMG_3168.JPG
IMG_3177.JPG
IMG_3203.JPG
IMG_3178.JPG
Dismdvd.jpg
IMG_3268.JPG
IMG_3269.JPG

TOOLS:

Electric Angle Grinders

Angle Grinder Cutoff Wheel for Stainless Steel, Flush-Cut, 4-1/2" Diameter, 0.045" Thick

MATERIAL:

Multipurpose 304/304L Stainless Steel Rod, 1/8" Diameter

Multipurpose 304/304L Stainless Steel Rod, 8mm Diameter

STEPS:

We need to prepare the following steel bars:

3 bars 8mm in diameter by 120 mm in length.

12 bars 1/8" in diameter by 50 mm in length.

Mark each rod with the necessary distance and make the cuts with the grinder.

Grind the cuts to avoid burrs.

In the case of the roller shafts, I used the steel bars that come in the read head of a floppy disk drive. Otherwise you have to cut four pieces of 1/8" x 90 mm in length.

Before Starting to Assemble: MOTOR UPGRADE

IMG_4358.JPG
Encoder.gif
IMG_4361.JPG
IMG_4362.JPG
IMG_4363.JPG
IMG_4364.JPG

To improve the TT motor, we are going to replace the motor with a motor MABUCHI with an optical encoder installed.

Motor Specifications:

1.- Brand: MABUCHI MOTOR

2.- Model: FC-130SA-09490

3.- Motor size: 15mm*20mm

4.- Motor length: 25.4mm

5.- Output shaft diameter: 2.0mm

6.- Output shaft length: front shaft 17.5mm/rear shaft 8.35mm

7.- Weight: 20g

8.- Test data:

Voltage:5.0V Speed:3050RPM Current:0.02A

Voltage:6.0V Speed:3750RPM Current:0.02A

Voltage:9.0V Speed:5800RPM Current:0.02A

Voltage:12.0V Speed:8050RPM Current:0.02A

Voltage:18.0V Speed:12000RPM Current:0.02A

Encoder Specifications:

The motor comes equipped with a 334 PPR (pulses per revolution) optical quadrature encoder disk. It can be operated with 3.3 and 5 VDC and its output is phase A and B signals separated by 90 degrees. The motor terminals are soldered on the decoder board itself. To make the wiring connections it has a 1 mm six-way flat cable connector. The connector signals are as follows:

Pin 1: Phase A

Pin 2: Phase B

Pin 3: Vcc (3.3 - 5 VDC)

Pin 4: GND

Pin 5: Motor +

Pin 6: Motor -


This motor comes equipped with a quadrature encoder. But, what is a quadrature encoder?

From the DYNAPAR site:

A quadrature encoder is an incremental encoder with two out-of-phase output channels used in many general automation applications where sensing the direction of movement is required. Each channel provides a specific number of equally spaced pulses per revolution (PPR), and the direction of motion is detected by the phase relationship of one channel leading or trailing the other channel.
How does a Quadrature Encoder work?
Inside a quadrature encoder, the code disk contains two tracks, usually denoted Channel A and Channel B. These tracks or channels are coded ninety electrical degrees out of phase, as indicated in the image below, and this is the key design element that will provide the quadrature encoder its functionality. In applications requiring direction sensing, a controller can determine the direction of movement based on the phase relationship between Channels A and B.

As illustrated in the gif above, when the encoder is rotating in a clockwise direction, its signal will show Channel A leading Channel B, and the reverse will happen when the quadrature encoder rotates counterclockwise.

How and when to use a Quadrature Encoder
Quadrature encoders are used in bidirectional position sensing and length measuring applications. However, in some unidirectional start-stop applications, it is important to have bidirectional information (Channel A & B) even if the reverse rotation of the shaft is not anticipated. An error in count could occur with a single-channel encoder due to machine vibration inherent in the system. For example, an error in count may occur with a single-channel encoder in a start/stop application if it mechanically stops rotating when the output waveform is in transition. As subsequent mechanical shaft vibration forces the output back and forth across the edge, the counter will up-count with each transition, even though the system is virtually stopped. By utilizing a quadrature encoder, the counter monitors the transition in its relationship to the state of the opposite channel and can generate reliable position information.


Before Starting to Assemble: MOTOR CHANGE

IMG_4353.JPG
IMG_4365.JPG
IMG_4418.JPG
IMG_4402.JPG
IMG_4404.JPG
IMG_4354.JPG
IMG_4355.JPG
IMG_4372.JPG
IMG_4392.JPG
IMG_4400.JPG
IMG_4401.JPG

TOOLS:

Dremel with metal cutting disk

MATERIAL:

Motor MABUCHI with optical encoder x 2

TT Motor Gearbox x 2

FPC Ribbon Flexible Flat Cable Pitch 1.0MM 100MM B-Type 6P x 2


STEPS:

BEFORE YOU BEGIN: The MABUCHI motor with encoder is delicate, if you are not careful the optical disc can be damaged.


1.- Remove the flexible clip that holds the TT motor.

2.- Remove the motor.

3.- Carefully remove the 8-tooth gear.

4.- Place the motors together and mark the height of the TT motor shaft on the MABUCUI motor.

5.- CAREFULLY hold the MABUCHI motor and with the Dremel cut the excess part of the helical gear.

6.- Insert the 8-tooth gear into the new motor.

7.- Carefully insert the new motor into the yellow gear box, it may be necessary to rotate the shaft to engage the gears.

8.- Place the 6-pin flexible flat cable in the encoder socket.

READY, you have updated the TT Motor.

GEARBOX ANALYSIS

RELATIONS.png
IMG_4417.JPG
gearbox.gif

After doing some initial tests with the new motor, I observed that the gear box ratio of 1/48 did not coincide with the pulses sent by the encoder. This meant two things: Either I had problems reading the pulses, or the gearbox ratio was not correct. Since the error was constant during different tests, it meant that the problem came from the gearbox, so I had to verify the exact relationship.

After some research I found this information, which allowed me to verify the gearbox ratio:

From the MAE 3 site:

The Power Transmission often includes a Gear Ratio or Mechanical Advantage. A Gear Ratio can increase the output torque or output speed of a mechanism, but not both. A classical example is the gears on a bicycle. One can use a low gear that allows one to pedal easily up hill, but with a lower bicycle speed. Conversely a high gear provides a higher bicycle speed, but more torque is required to turn the crank arm of the pedal. This tradeoff is fundamentally due to the law of energy conservation and is the key concept of Mechanical Advantage. With a given power source you can either achieve high velocity output or high force/torque output but not both.
Mechanical Advantage refers to an increase in torque or force that a mechanism achieves through a power transmission element. For rotary devices the term Gear Ratio is used to define the Mechanical Advantage. The term Mechanical Advantage is used to describe components that include translation. The analysis below shows how one calculates the Gear Ratio and Mechanical Advantage of a Power Transmission component.
...
Summary 
The fundamental equations for a gear pair are:
τin ωin = τout ωout (power equality)
ωout / ωin = rin / rout (velocity relationship in terms of radiuses)
ωout / ωin = nin / nout (velocity relationship in terms of number of teeth)
τout / τin = rout / rin (torque relationship in terms of radiuses)
τout / τin = nout / nin (torque relationship in terms of number of teeth)

The Gear Ratio is defined as the input speed relative to the output speed. It is typically written as:
Gear Ratio = ωin : ωout


Arranging the equation in bold, we have:

nin x ωin = nout x ωout

We are going to start the calculation from the wheel to the motor and we are going to use 1 revolution as the input speed:

The input gear (nin) has 30 teeth and the output gear (nout) has 14 teeth:

30 x 1 rev = 14 x ωout

ωout = 30 x 1 rev / 14

ωout = 2.142857 rev

This is the speed of the 14/28 compound gear.

The following calculation is between the 14/28 and 16/36 compound gears:

28 x 2.142857 rev = 16 x ωout

ωout = 28 x 2.142857 rev / 16

ωout = 3.75 rev

This is the speed of the 16/36 compound gear.

The following calculation is between the 16/36 and 9/26 compound gears:

36 x 3.75 rev = 9 x ωout

ωout = 36 x 3.75 rev / 9

ωout = 15 rev

This is the speed of the 9/26 compound gear.

The last calculation is between the 9/26 compound gear and the motor gear:

26 x 15 rev = 8 x ωout

ωout = 26 x 15 rev / 8

ωout = 48.75 rev

48.75 rev is the motor speed when we have a wheel speed of 1 rev.


The gearbox ratio is 1/48.75


With the new motor with its encoder that we have installed and using a quadrature encoder reading, we have that for one revolution of the wheel we have:


1 rev x 48.75 x 334 PPR x 4 =

65,130 PULSES PER REVOLUTION !


If we had not performed the gear ratio calculation and had taken the 1/48 ratio that is normally specified when we buy this type of motor, we would have:


1 rev x 48 x 334 PPR x 4 = 64,128 pulses per revolution...1002 pulses lost per revolution


Enough calculations, we already have what we need, it's time to continue assembling the robot.


Before Starting to Assemble: Prepare PCB

ESP32_SHIELD_BOTH.png
1.png
2.png
3.png
4.png
5.png
6.png
7.png
8.png
9.png
10.png
11.png
12.png
13.png
14.png
15.png
16.png
17.png
18.png

The robot is made up of four PCBs specifically designed to increase the performance of the robot while maintaining a low cost. The designed PCBs are:

1.- PCB of the Energy system.

2.- Motor Driver and Encoders PCB.

3.- ESP32 Shield PCB and

4.- ESP32 Camera & Leds PCB


The printed circuit design software that I use is EasyEDA and in this link you can follow a tutorial on its use.


In the following LINK you can download the Gerber files necessary for each of the four PCBs required for the robot.

I used the services of JLCPCB, for the manufacture of the PCBs.


The steps to follow so you can obtain these cards are:

1.- Download the Gerber file from my GitHub site

2.- Go to the JLCPCB site and if you do not have an account, create one.

3.- Enter the site and at the top right of the page click on the "Order now" link

4.- Click on the "Add gerber file" button

5.- Select the *.zip file that you downloaded and once the upload is complete, you can select, for example, to change the color of the PCB.

6.- Click on the "SAVE TO CART" button

7.- Go to "View Car" and proceed with the payment.

READY...let's wait for the courier to bring us the PCB

ROBOT: Wiring Energy System

ES2.png
ES1.png
ES3.png

For this project, the electrical power system is designed for a differential mobile robot and relies on a charger for LiPo 18650 batteries. The charger features a USB Type-C input and is designed to manage three LiPo 18650 batteries. Additionally, an external wireless charging system has been integrated, supplying 5V / 2A.

The charging process revolves around a dedicated Battery Management System (BMS) for the three LiPo batteries. This BMS oversees and controls critical aspects such as protection against overcharge, over-discharge, cell balancing, temperature monitoring, and protection against excessive currents. The wireless charger connects to the USB charger, enabling the efficient and secure recharging of the batteries.

This design offers flexibility by allowing charging through the USB Type-C port or via the wireless system, facilitating adaptability to various power sources. The combination of wired and wireless technologies ensures a reliable power supply for the optimal operation of the differential mobile robot in various applications.

Energy System - PCB Design

3D_PCB1_2023-10-26_1.png
BMS.gif
3D_PCB_MBS_1_18650.png
BATTERY SYSTEM v3.png
3D_PCB_MBS_2_18650.png
BATTERY SYSTEM v3_top.png
BATTERY SYSTEM v3_front.png
BATTERY SYSTEM v3_bottom.png
scketch.png
pcb layout.png
TOP_BMS.png
BOTTOM_BMS.png

The design of the PCB of the power system considered maintaining a low center of gravity of the robot, as well as a reduced space, so the batteries were placed in an arrangement in which the space of both the batteries and the BMS card was optimized. . The PCB includes space to mount a pair of pressure resistors that allows us to monitor the voltage of the battery pack. These resistors are selected to reduce the maximum charging voltage of the three Lipo batteries from 12.6 V to 3.3 Volts, which is the maximum voltage that can be read through the analog input of an ESP32.

PCB ASSEMBLY - Energy System

IMG_4129.JPG
IMG_4204.JPG
IMG_4244.JPG
IMG_4248.JPG
IMG_4250.JPG
IMG_4251.JPG
IMG_4254.JPG
IMG_4255.JPG
IMG_4256.JPG
IMG_4257.JPG
IMG_4258.JPG
IMG_4259.JPG
IMG_4267.JPG
IMG_4270.JPG
IMG_4271.JPG
IMG_4272.JPG
IMG_4273.JPG
IMG_4274.JPG
IMG_4275.JPG
IMG_4276.JPG
IMG_4277.JPG
IMG_4278.JPG
IMG_4279.JPG
IMG_4280.JPG
IMG_4281.JPG
IMG_4282.JPG
IMG_4283.JPG
IMG_4284.JPG
IMG_4285.JPG
IMG_4286.JPG
IMG_4287.JPG
IMG_4288.JPG
IMG_4289.JPG
IMG_4290.JPG
IMG_4291.JPG
IMG_4292.JPG
IMG_4298.JPG
IMG_4299.JPG

TOOLS:

Soldering iron, tweezers, MotoTool, Screwdriver

MATERIAL:

BEFORE BEGINNING TO WELD THE COMPONENTS:

1.- Connect a 5 VDC input type C eliminator to the battery charger and measure the output voltage with a multimeter, which should be 12.6 V.

2.- Connect a 5VDC/2A eliminator to the wireless charger transmitter. Place the receiving antenna about 3 mm away from the transmitting antenna and measure the output voltage of the receiving module: it should be 5VDC.

3.- Measure the voltage of each Lipo battery: it should be between 2.7 and 4.2 VDC

4.- Place the spacers in place and glue them to the robot with silicone.

ASSEMBLY STEPS

WIRELESS MODULE:

1.- Place female terminal pins on the output cables of the wireless module.

2.- Place the wireless antenna and its module on the 3D printing base and secure them with adhesive tape.

CHARGER MODULE:

1.- Solder a Black cable with a male terminal to the GND terminal of the charger module (Next to the USB C connector)

2.- Solder a Red cable with a male terminal to the VIN terminal of the charger module (Next to the USB C connector)

3.- Solder a section of about 6 cm of black AWG 20 cable to the GND terminal of the charger module (Reference: End opposite the USB connector)

4.- Solder a section of about 6 cm of red AWG 20 cable to the BAT terminal of the charger module

CUSTOM PCB:

1.- Solder the connection terminal and with the mototool file the solder so that it is flush with the plate and allows the base of the batteries to be soldered.

2.- Solder the base of two batteries. Be careful to observe the polarity of the base.

3.- Solder a piece of desoldering wire (We need a flexible cable) to the PCB pad indicated with B-

4.- Solder a section of about 5 cm of black AWG 20 cable to pad J1 P- (BMS)

5.- Solder a section of about 5 cm of red AWG 20 cable to the J1 P+ pad (BMS)

6.- Solder the BMS module to the PCB

7.- Solder the black wire (J1 P-) to the P- terminal of the BMS module

8.- Solder the red wire (J1 P+) to the P+ terminal of the BMS module

9.- Solder two sections of about 10 cm of red AWG 20 cable to the J3 pads (TO SWITCH)

10.- Solder the base of a battery to the PCB.

TEMPORARILY PLACE the components on the robot body to measure the length of the cables. Once measured and cut, proceed with:

11.- Solder the black output cable of the charger module to the pad J2 P- (CHARGER)

12.- Solder the red output cable of the charger module to the J2 P+ (CHARGER) pad

REMOVE THE POWER MODULE FROM THE ROBOT It will be installed later.

PCB DESIGN - Motor Shield

3D_PCB1_1_2023-10-26_1.png
3D_PCB1_TOP.png
Schematics.png
TOP.png
BOTTOM.png

The motor PCB has been designed around the L298N motor driver found on the market, however certain modifications have been made that allow better control of the motor. Among these modifications are the ability to use current measurement resistors and thus send this signal to the microcontroller in charge of the navigation routines. Also, unlike the commercial version, the PWM signals have been provided in differential format for each motor. This allows you to use the dedicated PWM hardware of an ESP32 to control the motor, instead of doing it through code.

Another modification was to place a six-way FPC flat cable connector for each motor, in this way the signals from the motors and encoders are in a single connector, facilitating the assembly of the robot and simplifying the excess of cables. Communication with the SHIELD of the microcontroller is carried out through a 16-way flat cable connector. Otherwise the rest of the components are the same as the commercial version.

For a description of the operation of this motor controller card see this link

The arrangement of the signals on the FPC FFC 1mm 16 Pin Straight DIP Cable Connector is as follows:

  • Pin 1: Phase A Motor 1
  • Pin 2: PWM A Motor 1
  • Pin 3: Phase B Motor 1
  • Pin 4: Sense Motor 1
  • Pin 5: Enable Motor 1
  • Pin 6: PWM B Motor 1
  • Pin 7: GND
  • Pin 8: +5 V
  • Pin 9: 3.3 V
  • Pin 10: GND
  • Pin 11: PWM a Motor 2
  • Pin 12: Enable Motor 2
  • Pin 13: Phase A Motor 2
  • Pin 14: PWM B Motor 2
  • Pin 15: Phase B Motor 2
  • Pin 16: Sense Motor 2

The arrangement of the signals from Motor 1 on the FPC FFC 1mm 6 Pin Straight DIP Cable Connector is as follows:

  • Pin 1: Phase A Motor 1
  • Pin 2: Phase B Motor 1
  • Pin 3: 3.3 V
  • Pin 4: GND
  • Pin 5: Motor 1 +
  • Pin 6: Motor 1 -

The arrangement of the signals from Motor 2 on the FPC FFC 1mm 6 Pin Straight DIP Cable Connector is as follows:

  • Pin 1: Phase A Motor 2
  • Pin 2: Phase B Motor 2
  • Pin 3: 3.3 V
  • Pin 4: GND
  • Pin 5: Motor 2 +
  • Pin 6: Motor 2 -

PCB ASSEMBLY - Motor

IMG_4325.JPG
IMG_4326.JPG

TOOLS:

Soldering iron

MATERIAL:

  • FPC FFC 1mm 16 Pin Straight DIP Cable Connector x1
  • FPC FFC 1mm 6 Pin Straight DIP Cable Connector x2
  • Diode 1N4007 x8
  • Electrolitic Capacitor 22ouF / 65V x1
  • Capacitor 100nF x1
  • L298N Motor Driver IC x1
  • Heat Sink for L298 IC x1
  • 2 pin small terminal x1
  • Custom PCB (obtained in step 16)

STEPS:

Start by soldering the smaller components such as diodes, continue with the connectors, being careful to observe their orientation. A drawing of its placement is marked on the PCB. Later, solder the 2 pin small terminal, the capacitors and lastly, solder the L298N circuit with its heat sink.

PCB DESIGN - ESP32 SHIELD

3D_PCB5_2023-10-26.png
ESP32_SHIELD_TOP.png
Schematics.png
ESP32_SHIELD_BOTH.png
ESP32_SHIELD_BOTTOM.png
ESP32_SHIELD_TOP2.png

The design of this PCB has two main objectives. The first is to provide an interface between the Wemos D1 R32 board, and the Motor Shield. The second objective is to provide a control board expansion for an ESP32 DevkitC v4 that is intended to run the user's programs. Communication between the WEMOS board and the ESP32 Devkit is carried out through a pair of jumpers that connect the TX and RX serial communication lines.

The pin assignment of the WEMOS board on this SHIELD is as follows:

Motor and encoder control pins:

  • pwmA_M1: pin 17
  • pwmB_M1: pin 26
  • enable_M1: pin 14
  • sense_M1: pin 25
  • PhaseA_M1: pin 27
  • PhaseB_M1: pin 16
  • pwmA_M2: pin 4
  • pwmB_M2: pin 2
  • enable_M2: pin 12
  • sense_M2: pin 36
  • PhaseA_M2: pin 34
  • PhaseB_M2: pin 35

Free pins for the user (through a 2x5 jumper):

SDA, SDL, GND, 5V, IO39, IO18, IO19, IO23, IO5, IO13

The arrangement of the signals on the FPC FFC 1mm 16 Pin Straight DIP Cable Connector is as follows:

  • Pin 1: Phase A Motor 1
  • Pin 2: PWM A Motor 1
  • Pin 3: Phase B Motor 1
  • Pin 4: Sense Motor 1
  • Pin 5: Enable Motor 1
  • Pin 6: PWM B Motor 1
  • Pin 7: GND
  • Pin 8: +5 V
  • Pin 9: 3.3 V
  • Pin 10: GND
  • Pin 11: PWM A Motor 2
  • Pin 12: Enable Motor 2
  • Pin 13: Phase A Motor 2
  • Pin 14: PWM B Motor 2
  • Pin 15: Phase B Motor 2
  • Pin 16: Sense Motor 2

PCB ASSEMBLY - ESP32 SHIELD

IMG_4327.JPG
IMG_4328.JPG
IMG_4329.JPG

TOOLS:

Soldering iron

MATERIAL:

1x19 Single Row Male 2.54 Breakable Pin Header PCB JST Connector x2

1x19 Single Row Female 2.54 Breakable Pin Header PCB JST Connector x2

1x10 Single Row Male 2.54 Breakable Pin Header PCB JST Connector x1

1x8 Single Row Male 2.54 Breakable Pin Header PCB JST Connector x2

1x6 Single Row Male 2.54 Breakable Pin Header PCB JST Connector x1

1x2 Single Row Male 2.54 Breakable Pin Header PCB JST Connector x2

2x54 Pin 2.54mm Dual Row Right Angle PCB Male Pin Header Strip Connector x1

STEPS:

To ensure that the female bases are well aligned, before soldering them to the PCB, place the ESP32 DevkitC on them and proceed to solder them to the PCB, this way the bases will be perfectly aligned. Once the female terminals are soldered, remove the ESP32 and continue soldering the rest of the male terminals.


PCB DESIGN - ESP32 CAM & LIGHTS

3D_PCB1_2023-10-26.png
Screenshot 2023-10-26 121529.png
Screenshot 2023-10-26 121708.png
Screenshot 2023-10-26 121547.png

The ESP32 CAM PCB was designed taking into account the front part of the robot, which has an entire section to mount an endless number of sensors and mechanical components, such as grippers. The camera was placed in the central part of the PCB and power LEDs have been placed on each side, each with its connector to connect them independently. A support has been placed at the bottom of the right side to mount an VL53LO/1XV2 laser distance sensor. The only signals from the camera that have been sent to the output connector are the voltage signals and the serial communication pins: TX and RX.

PCS ASSEMBLY - ESP32 CAM & LIGHTS

IMG_4337.JPG
IMG_4336.JPG
IMG_4339.JPG
IMG_4338.JPG

TOOLS:

Soldering iron

MATERIAL:

ESP32 CAM

Blue Power Led 5W x2

Lens for Power Led x2

VL53LO/1XV2 laser distance sensor x1

1x8 Single Row Female 2.54 Breakable Pin Header PCB JST Connector x2

1x6 Single Row Female 2.54 Breakable Pin Header PCB JST Connector x2

1x6 Pin 2.54mm Single Row Right Angle PCB Male Pin Header Strip Connector x1

1x4 Pin 2.54mm Single Row Right Angle PCB Male Pin Header Strip Connector x1

1x2 Pin 2.54mm Single Row Right Angle PCB Male Pin Header Strip Connector x2

STEPS:

To ensure that the female bases are well aligned, before soldering them to the PCB, place the ESP32 CAM on them and proceed to solder them to the PCB, this way the bases will be perfectly aligned. Once the female terminals are soldered, remove the ESP32 CAM. Next, do the same with the female terminals of the laser distance sensor (To ensure that the sensor is well aligned, it is necessary to also place the hexagonal spacers, so that when soldering the terminals the spacers are also aligned). Remove the laser sensor and continue soldering the rest of the male terminals.

PART ONE: Robot

MonoPieza_FRAME ROBOT_v1.3 (BMS) v16 RX.png

ROBOT: Heat-Set Inserts

ROBOT: Heat-Set Inserts

IMG_3755.JPG
IMG_3766.JPG
IMG_3788.JPG
IMG_3791.JPG

TOOLS:

Heat Insertion Tool For Plastic 3D Printer Soldering Iron

MATERIAL:

Heat-Set Inserts for Plastic, Brass, M3 x 5 mm, 4 mm Installed Length x 8 (for electronics)

Heat-Set Inserts for Plastic, Brass, M3 x 4.5 mm, 4 mm Installed Length x 4 (for Energy PCB)

Heat-Set Inserts for Plastic, Brass, M3 x 4.2 mm, 5 mm Installed Length x 4 (for castor wheel)

Heat-Set Inserts for Plastic, Brass, M3 x 4.2 mm, 7 mm Installed Length x 4 (for Camera PCB)

Heat-Set Inserts for Plastic, Brass, M3 x 4.2 mm, 7 mm Installed Length x 2 (for Wirelees Charger )

STEPS:

Carefully using the insertion tool, install the insertion nuts as shown in the video above.

INSTALLATION OF MOTORS AND WHEELS

INSTALLATION OF MOTORS AND WHEELS

IMG_4300.JPG
IMG_4301.JPG
IMG_4302.JPG
IMG_4303.JPG
IMG_4304.JPG
IMG_4305.JPG
IMG_4306.JPG
IMG_4307.JPG

MATERIAL:

M3 x 30 mm screw with nuts x4

Motor TT Upgrated x2

65 mm diam. wheels for motor TT x2

6 pin 1 mm x 100 mm lenght flat cable x2

STEPS:

  1. Carefully place the 6-way ribbon cable into the motor's FPC connector.
  2. Place the motor in place by CAREFULLY feeding the ribbon cable through the cable hole on the 3D model.
  3. Secure the motor with two M3 x 30mm screws.

INSTALLATION OF THE ELECTRICAL SYSTEM

INSTALLATION OF THE ELECTRICAL SYSTEM

IMG_4308.JPG
IMG_4309.JPG
IMG_4310.JPG

1.- Place the batteries in place and put the power module back into the robot and secure it with four M3 x 25 mm screws.

2.- Solder the cables to the switch and place them in place.

P3.- With the multimeter verify that both the charger module and the wireless charging module work satisfactorily.

CASTOR WHEEL INSTALLATION

CASTOR WHEEL INSTALLATION

IMG_4311.JPG
IMG_4312.JPG

MATERIAL:

Castor Wheel

M3 x 5 Screw

STEPS:

  1. Place the CASTOR wheel in place, being careful with the power system cables.
  2. Secure the CASTOR wheel with four M3 x 5 screws

ANTENNA INSTALLATION

ANTENNA INSTALLATION

IMG_4313.JPG
IMG_4316.JPG
IMG_4317.JPG
IMG_4324.JPG
  1. Carefully place the antenna connector through the hole in the 3D model. Be careful with the antenna cable as the space is tight and may be damaged when installing.
  2. Secure the connector with its nut,
  3. Screw the antenna into its connector.
  4. The end of the antenna cable will be connected after installing the camera PCB.

WIRELESS CHARGER INSTALLATION

WIRELESS CHARGER INSTALLATION

IMG_4318.JPG
IMG_4319.JPG
IMG_4320.JPG
  1. Connect the pins of the wireless charger to the female connectors of the charger module.
  2. Place the base of the wireless charging system in place and secure it using M3 X 8 mm screws.

ESP32 CAM INSTALLATION

ESP32 CAM INSTALLATION

IMG_4345.JPG
IMG_4341.JPG
IMG_4340.JPG
IMG_4346.JPG
  1. Place DUPONT jumpers on each of the terminals and pass the cables through the hole in the 3D model.
  2. Fasten the PCB to the 3D model using 4 M3 x 5mm screws

INSTALLATION OF ELECTRONIC CARDS

INSTALLATION OF ELECTRONIC CARDS

IMG_4350.JPG
IMG_4351.JPG
IMG_4352.JPG

Place the motor control board and the WMOS D1 R32 board on the robot and secure them with M3 x 5 mm screws.

Place the SHIELD ESP32 on the WEMOS D1 R32 board.

Carefully place the 16-way ribbon cable between the SHIELD ESP32 board and the motor controller board.

Carefully place the motor ribbon cables into their respective connectors on the motor controller board.



PART TWO - Robot Treadmill

TREADMILL: Cutting Bike Handlebar Grips

IMG_3389.JPG
IMG_3398.JPG
IMG_3414.JPG
IMG_3455.JPG
IMG_3445.JPG
IMG_3438.JPG
IMG_3428.JPG
IMG_3434.JPG
IMG_3404.JPG
IMG_3410.JPG

TOOLS:

Pipe Cutter

Retracting-Blade Utility Knives

MATERIAL:

Cutting Bike Handlebar Grips

1/2" PVC Pipe C-40

STEPS:

Using a utility knife, cut the bicycle handlebars grips into 4 sections of 5 cm.

To make cutting easier, you can insert the bicycle handlebar grips into a section of 1/2" PVC pipe and using the PVC pipe cutter, help yourself cut the sections.

TREADMILL: PVC Cutting

IMG_3286.JPG
IMG_3302.JPG
IMG_3270.JPG
IMG_3311.JPG
IMG_3321.JPG
IMG_3304.JPG
IMG_3494.JPG
IMG_3499.JPG
IMG_3513.JPG
IMG_3520.JPG

TOOLS:

Pipe Cutter

MATERIAL:

1/2" PVC Pipe C-40

STEPS:

4 PVC sections of 6 cm and 2 PVC sections of 26.5 cm are required.

Mark these measurements on the PVC pipe and use the pipe cutter to make these cuts.

TREADMILL: PVC Painting

IMG_3557.JPG
IMG_3357.JPG
IMG_3538.JPG
IMG_3550.JPG
IMG_3336.JPG
IMG_3326.JPG
IMG_3327.JPG
IMG_3340.JPG
IMG_3346.JPG
IMG_3555.JPG
IMG_3556.JPG

Clean the PVC pipe and then apply safety yellow spray paint.

TREADMILL: Roller Assembly

TREADMILL: Roller Assembly

IMG_3361.JPG
IMG_3369.JPG
IMG_3372.JPG
IMG_3373.JPG
IMG_3458.JPG
IMG_3459.JPG
IMG_3460.JPG
IMG_3463.JPG
IMG_3470.JPG
IMG_3480.JPG
IMG_3484.JPG
IMG_3485.JPG
IMG_3486.JPG

MATERIAL:

6063 Aluminum Low-Profile Binding Barrels and Screws, 8-32 Thread Size, for 1/2"-3/4" Material Thickness x8

Rod Bar for CD Disk Drive x4

PVC Pipe C40 12mm diam. x 50 mm long x4 (from Step 57)

Bike Handlebar Grips x4 (from Step 56)

3D PRINTER PARTS:

PLUG x8

TOP_IN_RIGHT

TOP_IN_LEFT

TOP_OUT_RIGHT

TOP_OUT_LEFT

STEPS:

  1. Place the aluminum barrels into the 3D printing plugs.
  2. Insert the sections of the bicycle handlebars grips over the sections of PVC pipe.
  3. Insert the plugs into the ends of the PVC pipe.
  4. Insert the 90mm steel shafts into the PVC rollers.


TREADMILL: Aluminium Barrels & Hot Inserts

TREADMILL: Aluminium Barrels & Hot Inserts

IMG_3375.JPG
IMG_3738.JPG
IMG_3380.JPG
IMG_3487.JPG
IMG_3386.JPG
IMG_3488.JPG
IMG_3712.JPG
IMG_3718.JPG
IMG_3735.JPG
IMG_3736.JPG
IMG_3737.JPG
IMG_3739.JPG


TOOLS:

Heat Insertion Tool For Plastic 3D Printer Soldering Iron

MATERIAL:

Heat-Set Inserts for Plastic, Brass, M3 x 4.2 mm, 7 mm Installed Length x 16

6063 Aluminum Low-Profile Binding Barrels and Screws, 8-32 Thread Size, for 1/2"-3/4" Material Thickness x8

STEPS:

  1. Carefully using the insertion tool, install the insertion nuts as shown in the video above.
  2. Place the aluminum barrels on the PVC pipe supports.


TREADMILL: Roller Support Assembly

TREADMILL: Roller Support Assembly

IMG_4034.JPG
IMG_4013.JPG
IMG_4014.JPG
IMG_4015.JPG
IMG_4016.JPG
IMG_4017.JPG
IMG_4018.JPG
IMG_4019.JPG
IMG_4024.jpg
IMG_4030.JPG
IMG_4031.JPG
IMG_4032.JPG
IMG_4071.JPG
IMG_4073.JPG

TOOLS:

M3 Allen wrench

MATERIAL:

Alloy Steel Socket Head Screw, Black-Oxide, M3 x 0.5 mm Thread, 16 mm Long x16

3D PRINTER PARTS:

BOT_OUT_CASTOR

BOT_OUT_RIGHT

BOT_OUT_LEFT

STEPS:

Follow the assembly instructions indicated in the video above.

TESTING ROBOT: Move Motors & Read Encoders

Use the following program to read the speed of the robot's encoders in RPM's, as well as perform the movement of the motors:

// Encoder Test Program (RPMs)
const int    encoderPinAM1 = 27; // Phase A MOTOR 1.
const int    encoderPinBM1 = 16; // Phase B MOTOR 1.
const int    encoderPinAM2 = 34; // Phase A MOTOR 2.
const int    encoderPinBM2 = 35; // Phase B MOTOR 2.

volatile int  encoderCountM1    = 0;
volatile int  encoderCountM2    = 0;
volatile int  RPMsM1    = 0;
volatile int  RPMsM2    = 0;
volatile byte ant  = 0;
volatile byte act  = 0;

unsigned long lastTime = 0;  //
unsigned long sampleTime = 100;  // milisegundos sampletime


const int    pwmA_M1 = 17;
const int    pwmB_M1 = 26;
const int    enable_M1 = 14;
const int    sense_M1 = 25;
int senseM1value = 0;

const int    pwmA_M2 = 4;
const int    pwmB_M2 = 2;
const int    enable_M2 = 12;
const int    sense_M2 = 36;
int senseM2value = 0;

const int freq = 5000;
const int ledChannel = 0;
const int resolution = 8;

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

  pinMode(pwmA_M1, OUTPUT);
  pinMode(pwmB_M1, OUTPUT);
  pinMode(enable_M1, OUTPUT);
  pinMode(pwmA_M2, OUTPUT);
  pinMode(pwmB_M2, OUTPUT);
  pinMode(enable_M2, OUTPUT);

  digitalWrite(pwmA_M1,HIGH);
  digitalWrite(pwmB_M1,LOW);

  digitalWrite(pwmA_M2,LOW);
  digitalWrite(pwmB_M2,HIGH);

  digitalWrite(enable_M1,HIGH);
  digitalWrite(enable_M2,HIGH);

  pinMode(encoderPinAM1, INPUT);
  pinMode(encoderPinBM1, INPUT);
  pinMode(encoderPinAM2, INPUT);
  pinMode(encoderPinBM2, INPUT);
  attachInterrupt(digitalPinToInterrupt(encoderPinAM1), encoderAM1, CHANGE);
  attachInterrupt(digitalPinToInterrupt(encoderPinBM1), encoderBM1, CHANGE);
  attachInterrupt(digitalPinToInterrupt(encoderPinAM2), encoderAM2, CHANGE);
  attachInterrupt(digitalPinToInterrupt(encoderPinBM2), encoderBM2, CHANGE);

}

void loop() {
  if (millis() - lastTime >= sampleTime)
  {  
      fRPMs();
      Serial.print("RPMs M1: ");Serial.println(RPMsM1);
      Serial.print("RPMs M2: ");Serial.println(RPMsM2);
   }

  delay(500);
 
}

// Encoder precisión cuádruple.
void encoderAM1(void)
{
  if (digitalRead(encoderPinAM1) == digitalRead(encoderPinBM1)) {
    encoderCountM1++;
  } else {
    encoderCountM1--;
  }

}
void encoderBM1(void)
{
  if (digitalRead(encoderPinAM1) == digitalRead(encoderPinBM1)) {
    encoderCountM1--;
  } else {
    encoderCountM1++;
  }
}

void encoderAM2(void)
{
  if (digitalRead(encoderPinAM2) == digitalRead(encoderPinBM2)) {
    encoderCountM2++;
  } else {
    encoderCountM2--;
  }

}
void encoderBM2(void)
{
  if (digitalRead(encoderPinAM2) == digitalRead(encoderPinBM2)) {
    encoderCountM2--;
  } else {
    encoderCountM2++;
  }
}

void fRPMs(void)
{

    RPMsM1 = (encoderCountM1*60.0*1000.0)/((millis()-lastTime)*65130);
    RPMsM2 = (encoderCountM2*60.0*1000.0)/((millis()-lastTime)*65130);
    lastTime = millis();
    encoderCountM1 = 0;
    encoderCountM2 = 0;
}

ROBOT + TREADMILL

3 Point Kinematic Platform

3D DETAIL BALL JOINT.png

The coupling between the treadmill and the XY platform is carried out through three contact points, which use a novel magnetic ball joint system. This system was designed to obtain a low-cost and easy-to-build XY-axis mobile platform. This coupling is achieved by means of a 15 mm diameter steel sphere, which is attached by magnetic means to the support points of the treadmill and the XY platform. These supports are made up of a pair of 1/8” diameter stainless steel bars. These bars run parallel, forming a rail where the metal sphere slides freely and are placed perpendicularly to allow free movement in the horizontal XY axes. To keep the sphere in place, each holder has a set of 20mm x 10mm x 2mm neodymium magnets. 4 magnets have been placed on each platform support (bottom of the joint) and 3 magnets have been placed on each treadmill support (top of the joint). This gives a total of 7 magnets per ball joint: four lower and three upper, this difference in the number of magnets is intended to generate a greater magnetic field in the supports of the platform and a smaller field in the supports of the treadmill, in this way When the treadmill is removed, the steel spheres remain attached to the XY platform supports due to their higher magnetic field. In addition, this number of seven magnets per ball joint forms a field strong enough to keep the ball head centered and prevent displacement due to the force of gravity when the platform is moving.

PART THREE - XY PLATFORM

XY PLATFORM: Wiring

dIAGRAMA.png

XY PLATFORM: PVC Cutting

Measure PVC XY.png
IMG_4041.JPG
IMG_4042.JPG
IMG_4043.JPG
IMG_4044.JPG
IMG_4045.JPG

XY PLATFORM: PVC Painting

IMG_4054.JPG
IMG_4065.JPG
IMG_4086.JPG
IMG_4090.JPG
IMG_4097.JPG

XY PLATFORM: Hot Inserts

IMG_3699.JPG
IMG_3711.JPG
IMG_3742.JPG
IMG_3745.JPG
IMG_3754.JPG
IMG_3792.JPG
IMG_3794.JPG

TOOLS:

Heat Insertion Tool For Plastic 3D Printer Soldering Iron

MATERIAL:

Heat-Set Inserts for Plastic, Brass, M3 x 4.2 mm, 7 mm Installed Length x 18

STEPS:

Carefully using the insertion tool, install the insertion nuts as shown in the video above.

XY PLATFORM: Servo Assamble

XY PLATFORM: Servo Assamble

IMG_3796.JPG
IMG_3803.JPG
IMG_3819.JPG
IMG_3821.JPG
IMG_3822.JPG
IMG_3825.JPG
IMG_3928.JPG
IMG_3929.JPG
IMG_3936.JPG
IMG_3947.JPG
IMG_3956.jpg
IMG_3963.JPG

TOOLS:

Spring Clamps Heavy Duty x3

5 Minute Set Epoxy Syringe - Clear

small cross screwdriver

MATERIAL:

Servo SG-5010 Tower Pro x3

3D PRINTER PARTS:

3D PRINTED MAIN SUPPORT RIGHT

3D PRINTED MAIN SUPPORT LEFT

3D PRINTED MAIN SUPPORT CASTOR

CAM x3

STEPS:

  1. With pliers cut 3 of the 4 arms of the servo.
  2. Using quick drying epoxy glue glue the servo arm to the cam.
  3. To hold the arm in place while the glue hardens, use a spring clamp,
  4. Place the servo on the 3D print stand and secure it with its 4 screws.
  5. IMPORTANT: Temporarily connect the servo to ESP8266 and run the attached program to position the servo at 90 degrees.
  6. With the servo positioned at 90 degrees place the cam in place and secure it with its screw.


#include <Servo.h>
Servo myservo1;  // create servo object to control a servo
Servo myservo2;
Servo myservo3;
#define Servo1 14
#define Servo2 12
#define Servo3 13

int valueServo = 0;


void setup() {
  pinMode(Servo1, OUTPUT);
  pinMode(Servo2, OUTPUT);
  pinMode(Servo3, OUTPUT);
  myservo2.attach(12);
  myservo3.attach(13);
  myservo1.attach(14);
  Serial.begin(115200);
  Serial.print("PUT SERVOS TO 90 DEGREES");
  myservo1.write(90);
    myservo2.write(90);
      myservo3.write(90);


}

void loop() {

}

XY PLATFORM: Ball Support

XY PLATFORM: Ball Support

IMG_3918.JPG
IMG_3826.jpg
IMG_3827.JPG
IMG_3828.JPG
IMG_3830.JPG
IMG_3858.JPG
IMG_3861.JPG
IMG_3869.JPG
IMG_3870.JPG
IMG_3871.jpg
IMG_3872.JPG
IMG_3878.JPG
IMG_3888.JPG
IMG_3893.JPG
IMG_3896.JPG
IMG_3906.jpg
IMG_3924.JPG
IMG_3925.JPG
IMG_3926.JPG
IMG_3927.JPG

TOOLS:

M4 Allen wrench

MATERIAL:

Strong Neodymium Bar Magnets - 20x10x2 mm x12

SCS8UU Linear Ball Bearing Slide Block Units, 8mm Bore Diam. x3

15 mm diam. steel ball x3

M4x12mm Stainless Steel Hex Socket Head Cap Screws Bolts x12

3D PRINTER PARTS:

3D Support for Linear Bearing RIGHT

3D Support for Linear Bearing LEFT

3D Support for Linear Bearing CASTOR

BALL_SUPPORT x3

STEPS:

  1. Mark the orientation of the magnets.
  2. Place the magnets in place and apply epoxy glue to secure them.
  3. Place the steel bars on the BALL SUPPORT.
  4. Secure the BALL SUPPORT to the Support for Linear Bearing using two M3 x 10 allen screws.
  5. Place the linear bearing into the Support for Linear Bearing and secure with four M4 x 12 screws.
  6. Place the ball on the BALL SUPPORT.


XY PLATFORM: Ball Joint Assembly

XY PLATFORM: Ball Joint Assembly

Servo to linear 3 v31.png
IMG_3964.JPG
IMG_3966.JPG
IMG_3970.JPG
IMG_3965.JPG
IMG_3977.JPG

XY PLATFORM: Put All Together

XY PLATFORM: Put All Together

IMG_4110.JPG
IMG_4098.JPG
IMG_4099.JPG
IMG_4100.JPG
IMG_4101.JPG
IMG_4102.JPG
IMG_4103.JPG
IMG_4104.JPG
IMG_4105.JPG
IMG_4106.JPG
IMG_4107.JPG
IMG_4108.JPG
IMG_4109.JPG

XY PLATFORM: Test Code

BASES SERVOS XY electronic box v2 2.png

Download the Sweep_s2_S3.ino file and download to 8266 Module to test the Servos 1 & 3...

Downloads

ROBOT + TREADMILL + XY PLATFORM

IMG_4496.JPG
ROBOT MOVIL CON BASE DE PRUEBAS FRONT.png
IMG_4495.JPG
IMG_4438.JPG
IMG_4429.JPG
IMG_4436.JPG
IMG_4435.JPG
IMG_4434.JPG
IMG_4432.JPG
IMG_4428.JPG
IMG_4439.JPG

SOFTWARE

simulation.png

The software is under development and is not part of the scope of this instructable, however I consider it interesting to show the path I am following to control the XY platform, since it seems to me to be a very attractive way to link the simulation with the real robot.

I am using BLENDER for simulation and terrain preparation. The communication between BLENDER and the ROBOT and the XY PLATFORM uses python, in particular the following libraries:

BLENDIXSERIAL

From the arduinomagix site:

blendixserial is a Blender add-on that allows you to control the movement of 3D objects in Blender via Simple UART (Serial Communication). It provides a user interface panel in the Blender 3D View where you can connect/disconnect from a serial port, start/stop object movement, and control the movement of multiple objects in the scene. When you start the movement, the add-on continuously reads data from the serial port and updates the positions of the selected objects based on the received data. The movement is applied to the specified axes (X, Y, Z) for each object and property. For example, if you choose to control the location of an object along the X-axis and the rotation along the Y-axis, the add-on will interpret the received data and update the object's position and rotation accordingly. You can select a text object within the scene that will display the current movement values for each controlled object. The add-on will update the text object with the updated position, rotation, or scale values as the objects move.


MARIONETE

MarIOnette is a Blender plugin for controlling Arduino-based microcontrollers over Serial.

At this moment I am taking these two libraries to form one specially designed for the XY platform, which takes into account the communication speeds of the serial port and the amount and type of data transmitted.


BLENDER Rig Car & Rigid Body Physics links:

Create a RC Car in Blender

Create a Car Rig with Rigid Body Physics in Blender | Car Rigging Tutorial

Fusion 360

Screenshot 2023-11-02 005544.png
F36-_3.png
MonoPieza_FRAME ROBOT_v1.3 (BMS) v16 CG TOP.png
Screenshot 2023-11-02 010501.png
F360_2.png
Screenshot 2023-11-02 010625.png
Screenshot 2023-11-02 190359.png
BASES SERVOS XY v19 2.png
F360_1.png
Screenshot 2023-11-02 002755.png
BASE RODILLOS v1.0 v15 TOP.png
BASE RODILLOS v1.0 v15.png
BMS.gif

The Design of the Robot, the Treadmill and the XY platform were made with Fusion 360.

CONCLUSION

We have finished building this set of robotic tools that can help us learn how to train our robots using new deep learning and artificial intelligence techniques.

This project is constantly being updated and the following improvements are planned:

ROBOT:

Make a new version of the motor controller card using a motor driver such as the DRV8833.

Make a new SHIELD ESP32 that includes an accelerometer () and an OLED display ().

Try TT Motors with 1/100 and 1/200 ratios, as well as motors with metal gears.

Make an additional SHIELD for the ESP32 Camera, for when it is necessary to use the front part of the robot for other accessories (such as a gripper.)

TREADMILL:

Place optical encoders on the rollers to measure the speed of the robot.

XY PLATFORM:

Improve the XY joint system.

Make the platform support more robust.

Improve the supports of the linear guides to make the movement more precise.

SOFTWARE:

Create an Add on for Blender that allows serial communication between the platform and the robot, optimizing serial transmission to avoid delays in simulations.


Personally, it is a project that has allowed me to learn and put into practice many ideas and I hope that some part of this entire project can be of use to you.


Greetings from Mexico.

Jorge Moreno