Edu-Right, learn about electrical electronics, space science, and science fact. We provide the Right Education and Develop technical Skills only on Edu-Right

Full width home advertisement

Science Fact

Electrical&Electronics

Space Science

Post Page Advertisement [Top]

How To Prepare Arduino Mecanum Wheels Robot

edu-right

We will learn how to build an Arduino based robot platform, DIY Arduino project which is capable of moving in any direction. This unique mobility of the robot is achieved by using special types of Wheels called Mecanum Wheels. I designed and 3D printed these wheels because they can be a bit expensive to buy they work quite well and I must say that driving this robot platform is such fun. We can wirelessly control the robot using the inner f24 lo1 radio transceiver modules or in my case. I am using my DIY RC transmitter.

components required

  • Stepper Motor – NEMA 17
  • DRV8825 Stepper Driver
  • NRF24L01 Transceiver Module
  • HC-05 Bluetooth Module
  • Li-Po battery 
  • Arduino Mega Board 
  • Transistor
  • Capacitor
I also made it possible to be controlled using a smartphone via Bluetooth communication. I made a custom injured application through which we can control the making wheels robot to move in any direction also using the slider in the app, we can control the speed of movement. The brain of this robot platform is an Arduino Mega board which controls each wheel individually each wheel is attached on a Nema 17 stepper motor and knowing the fact that stepper Motors can be precisely Trolled I added one more cool featuring the app through which we can control the robot to move automatically using the save button. We can save each position or step and then the robot can automatically run and repeat these steps with the same button. We can post the automatic operation as well as reset and delete all steps so we can store new ones.  

How to prepare this Special wheel

edu-right

The for stepper Motors are attached to this base platform and the Macon wheels are attached to the motor shaft American wheel is a wheel with rollers attached to its circumference. These rollers are positioned diagonally or at a 45-degree angle to the axis of rotation of the wheel. This makes the wheel exert force in diagonal Direction when moving forward or backward, so by rotating the wheels in certain patterns, we utilize these diagonal forces and does the robot can move in any direction. We should also note here that we need two types of making wheels often referred to as the left-handed and right-handed making wheels. The difference between them is the orientation of the rollers and they must be installed in the robot in specific locations. The rotation axis of each wheel stop roller should point to the center of the robot.  

Here's a quick demonstration of how the robot moves depending on the wheel's rotation direction. Nevertheless now, let me show you how I built this robot platform as I mentioned for making the base of the platform. I am using eight millimeters thick MDF boards using a table. So first I cut all of the pieces according to the 3D model Dimensions next using a 3 millimeters drill and 25 millimeters Forstner bit. I made the openings on the side panels for attaching the stepper Motors.  

Once I got the pieces ready. I continued with a sibling. I used wood glue and some screws for securing them. The most important thing here is to have the openings for the motors precisely made so that all of the wheels have even contact with the surface later on. you could also 3D print this base platform instead of making it with pdf Finally. I spray painted the base and its cover with white color.  

Assemble the wheels

edu-right
next is the making wheels. As I said earlier. These bills can be a bit expensive to buy so that's why I decided to design and 3D print my own. Once the wheels are made out of two parts outer and inner side which are secured together with some in four bolts and nuts. They have 10 rollers each and a shaft coupler specifically designed to fit a Nema 17 stepper motor.  I treated printed all of the parts for the American Wheels using Mike realities here 10 3D printers. There is also a link to this 3D printer. I find 3D printing time-lapses is so satisfying to watch here are few so you can enjoy too. So once I got the 3D printed Parts ready I moved on with making the shops for the rollers for that purpose. I used three-millimeter thick steel wire. The length of the shaft needs to be around 40 millimeters. So using a rotary tool I cut the wire to that length.  

I started the sibling the making Wheel by securing the two sides and the shaft coupler using for in four bolts and nuts. The length of the bolts needs to be 45 millimeters for installing the rollers first. We need to slightly insert the shaft through the holes of the inner side. Then we can insert a small entry washer insert the roller and push the shaft into the slot of the outer side of the wheel I use the single washer because it didn't have enough space to insert a second washer on the other side. I repeat this process for all 10 rollers. It's easy and kind of fun assembling these wheels. What's important here though is that the rollers need to be able to move freely? In the end, I use a few drops of easy glue in each of the inner holes to make sure that the Shaft won't get loose.  

Assemble the whole setup of the car

so what're the wheels are ready now? We can move on and assemble the whole robot first. We need to attach the stepper Motors to the base platform. For securing them in place. I used three bolts with a length of 12 millimeters. Next, we need to attach the wheels to the motor shaft the shaft coupler that I meet have a special spot for inserting on M3 not through which an entry bolt can pass through and so we can secure the wheel to the shaft next for securing the top cover to the base. I attach threaded rods on the two corners of the base.  

I made holes in the same position on the cover. And so I was able to easily insert and secure the cover to the base. On the backside of the base. I made 20 millimeters whole for attaching a power switch later on as well as five millimeters whole for attaching an LED.  

so now we can move on with the electronics.  
edu-right


Here's the complete circuit diagram of this project.  

Assemble the circuit

So we will control the for Nema 17 stepper Motors using the for drv8825 stepper drivers or also we could use the 4988 stepper drivers for powering the steppers and the whole robot. We will use 12 volts power supply and in my case, I will use a tree as a LiPo battery which provides around 12 volts for radio communication. We are using the inner f24 lo1 module and for Bluetooth communication. We are using the HCO 5 Bluetooth module.  

I also included a simple voltage divider that will be used for monitoring the battery voltage and analytic connection for indicating when the battery voltage will drop below 11 volts. I also included a dedicated at 5 volts voltage regulator which can provide around 3 amps of current this is optional,  Nevertheless to keep the electronics components organized and get rid of wiring Miss. I designed a custom PCB using the end of a free online circuit design software. This PCB will act as an Arduino Mega Shield because we will be able to directly connect it to the top of the Arduino Mega board. I used both the top and the bottom layer for running the connections for those Arduino pins, which I didn't use I included pin header connections so that they are available in case we want to use them for something in the future. I also included 12 volts 5 volts and ground connection pins as well as pins for selecting the stepping resolution of the drivers. Once they finish the design, I generated the Gerber file needed for manufacturing the PCB. Then I order the PCB from jail PCB. We can simply drag and drop the Gerber file and once uploaded.

If everything's all right, then we can go on and select the properties that we want for our PCB this time. I chose the PCB color to be blue to match the Arduino board color. And that's it. Now we can simply order our PCB at a reasonable price note that if it's your first order from jail PCB. the quality of the PCBs is great and everything is the same as in the design. now we can move on in a symbol the PCB I started with shouldering the smaller components first the resistors and the capacitors. I insert it and soldered male pin feathers to the PCB which will be used for connecting it to the Arduino board.  


PROCEDURE

Next, I place all-female pin headers in place and solder them as well as for the stepper Motors connections and the pins for selecting the stepping resolution. I used male pin headers this way. We can directly connect the motors to the PCB and use jumpers for selecting the stepping resolution. Then I solder the terminal blocks the trimmer and the voltage regulator and that's it. The PCB is now ready and we can move on with inserting the drivers and connecting the motors to it.  

First. I place the jumpers for selecting the stepping resolution.  

I selected 16-step resolution by connecting the ms3 pain of the driver to 5 volts then on top of the Mi place the drv8825 drivers as well as connected the inner f24 lo1 module and the HTML5 Bluetooth module at the end. We can simply attach this PCB Shield to the Arduino board.  

Next, I connected the battery to the PCB to the appropriate terminal block and place them into the base platform here. I inserted the power switch in place and connect it to the other terminal block right above the power switch. I also inserted the battery indicator LED.  

What's left now is to connect the motors to the PCB.  

We should note here that when connecting opposite Motors. We should connect their connectors opposite as well.  

This is needed later when programming the robot so that for example the forward command would move both Motors in the same direction.  

Although they are flip and one would make clockwise and the other anti-clockwise rotation at the end. I can simply insert the cover at the top and so we are done with this. Making Wheels project.  

the Arduino code setup:-  

There are two separate Audrina cause the first one is for controlling the robot using the inner f24 lo1 modules and the other is for controlling the robot using a smartphone.  

So here we are using the RF 24 library for the radio communication and the exhale step or library for controlling the stepper Motors first. We need to define the pins to which all of them are connected Define some variables needed for the program below and in the setup, a section sets the steppers maximum speed and begins the radio communication in the loop section. We start by reading the data coming from the RC transmitter code.   

So depending on the received data, for example, if the left joystick is moved forward its value will be greater than 160 and in such a case, we will call the move forward custom function if we take a look at this function, we can see that all it does it sets the speed of the motor to positive for moving backward. The speed is set to negative.  

So for moving in all directions, we just need to set the rotation. Of the wheels appropriately as explained in the beginning for executing these commands in the loop section. We need to call the Run speed function for all steppers in the loop section. We also read the analog input from the voltage divider coming from the battery and according to this value. We will know when the battery voltage will drop under 11 volts and so we will turn on the indicator led the other code for controlling the robot using the Android application is very similar and works the same way here instead of the radio module. We need to define the Bluetooth module and initialize its communication in the setup section.  

So again first we read the incoming data from the smartphone or the Android app and according to it. We tell the robot in which direction to move if we take a look at the injury tab, we can see that it simply sends numbers from 0 to 15 through the Bluetooth when the buttons are pressed.  

The app is made using the MIT App Inventor online application and you can find more details about Out it in my particular tutorial for it. Download it and then open the zip file then you get your app and install that click here


Source code for Arduino


#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <AccelStepper.h>
RF24 radio(48, 49);   // nRF24L01 (CE, CSN)
const byte address[6] = "00001";
unsigned long lastReceiveTime = 0;
unsigned long currentTime = 0;
// Define the stepper motors and the pins the will use
AccelStepper LeftBackWheel(1, 42, 43);   // (Type:driver, STEP, DIR) - Stepper1
AccelStepper LeftFrontWheel(1, 40, 41);  // Stepper2
AccelStepper RightBackWheel(1, 44, 45);  // Stepper3
AccelStepper RightFrontWheel(1, 46, 47); // Stepper4
int wheelSpeed = 1500;
// Max size of this struct is 32 bytes - NRF24L01 buffer limit
struct Data_Package {
  byte j1PotX;
  byte j1PotY;
  byte j1Button;
  byte j2PotX;
  byte j2PotY;
  byte j2Button;
  byte pot1;
  byte pot2;
  byte tSwitch1;
  byte tSwitch2;
  byte button1;
  byte button2;
  byte button3;
  byte button4;
};
Data_Package data; //Create a variable with the above structure
void setup() {
  // Set initial seed values for the steppers
  LeftFrontWheel.setMaxSpeed(3000);
  LeftBackWheel.setMaxSpeed(3000);
  RightFrontWheel.setMaxSpeed(3000);
  RightBackWheel.setMaxSpeed(3000);
  radio.begin();
  radio.openReadingPipe(0, address);
  radio.setAutoAck(false);
  radio.setDataRate(RF24_250KBPS);
  radio.setPALevel(RF24_PA_LOW);
  radio.startListening(); //  Set the module as receiver
  Serial.begin(115200);
}
void loop() {
  // Check whether we keep receving data, or we have a connection between the two modules
  currentTime = millis();
  if ( currentTime - lastReceiveTime > 1000 ) { // If current time is more then 1 second since we have recived the last data, that means we have lost connection
    resetData(); // If connection is lost, reset the data. It prevents unwanted behavior, for example, if a drone jas a throttle up, if we lose connection it can keep flying away if we don't reset the function
  }
  // Check whether there is data to be received
  if (radio.available()) {
    radio.read(&data, sizeof(Data_Package)); // Read the whole data and store it into the 'data' structure
    lastReceiveTime = millis(); // At this moment we have received the data
  }
  // Set speed - left potentiometer
  wheelSpeed = map(data.pot1, 0, 255, 100, 3000);

  if (data.j1PotX > 150) {
    moveSidewaysLeft();
  }
  else if (data.j1PotX < 100) {
    moveSidewaysRight();
  }
  else if (data.j1PotY > 160) {
    moveForward();
  }
  else if (data.j1PotY < 100) {
    moveBackward();
  }
  else if (data.j2PotX < 100 & data.j2PotY > 160) {
    moveRightForward();
  }
  else if (data.j2PotX > 160 & data.j2PotY > 160) {
    moveLeftForward();
  }
  else if (data.j2PotX < 100 & data.j2PotY < 100) {
    moveRightBackward();
  }
  else if (data.j2PotX > 160 & data.j2PotY < 100) {
    moveLeftBackward();
  }
  else if (data.j2PotX < 100) {
    rotateRight();
  }
  else if (data.j2PotX > 150) {
    rotateLeft();
  }
  else {
    stopMoving();
  }
  // Execute the steps
  LeftFrontWheel.runSpeed();
  LeftBackWheel.runSpeed();
  RightFrontWheel.runSpeed();
  RightBackWheel.runSpeed();

  // Monitor the battery voltage
  int sensorValue = analogRead(A0);
  float voltage = sensorValue * (5.0 / 1023.00) * 3; // Convert the reading values from 5v to suitable 12V i
  // If voltage is below 11V turn on the LED
  if (voltage < 11) {
    digitalWrite(led, HIGH);
  }
  else {
    digitalWrite(led, LOW);
  }
}
void moveForward() {
  LeftFrontWheel.setSpeed(wheelSpeed);
  LeftBackWheel.setSpeed(wheelSpeed);
  RightFrontWheel.setSpeed(wheelSpeed);
  RightBackWheel.setSpeed(wheelSpeed);
}
void moveBackward() {
  LeftFrontWheel.setSpeed(-wheelSpeed);
  LeftBackWheel.setSpeed(-wheelSpeed);
  RightFrontWheel.setSpeed(-wheelSpeed);
  RightBackWheel.setSpeed(-wheelSpeed);
}
void moveSidewaysRight() {
  LeftFrontWheel.setSpeed(wheelSpeed);
  LeftBackWheel.setSpeed(-wheelSpeed);
  RightFrontWheel.setSpeed(-wheelSpeed);
  RightBackWheel.setSpeed(wheelSpeed);
}
void moveSidewaysLeft() {
  LeftFrontWheel.setSpeed(-wheelSpeed);
  LeftBackWheel.setSpeed(wheelSpeed);
  RightFrontWheel.setSpeed(wheelSpeed);
  RightBackWheel.setSpeed(-wheelSpeed);
}
void rotateLeft() {
  LeftFrontWheel.setSpeed(-wheelSpeed);
  LeftBackWheel.setSpeed(-wheelSpeed);
  RightFrontWheel.setSpeed(wheelSpeed);
  RightBackWheel.setSpeed(wheelSpeed);
}
void rotateRight() {
  LeftFrontWheel.setSpeed(wheelSpeed);
  LeftBackWheel.setSpeed(wheelSpeed);
  RightFrontWheel.setSpeed(-wheelSpeed);
  RightBackWheel.setSpeed(-wheelSpeed);
}
void moveRightForward() {
  LeftFrontWheel.setSpeed(wheelSpeed);
  LeftBackWheel.setSpeed(0);
  RightFrontWheel.setSpeed(0);
  RightBackWheel.setSpeed(wheelSpeed);
}
void moveRightBackward() {
  LeftFrontWheel.setSpeed(0);
  LeftBackWheel.setSpeed(-wheelSpeed);
  RightFrontWheel.setSpeed(-wheelSpeed);
  RightBackWheel.setSpeed(0);
}
void moveLeftForward() {
  LeftFrontWheel.setSpeed(0);
  LeftBackWheel.setSpeed(wheelSpeed);
  RightFrontWheel.setSpeed(wheelSpeed);
  RightBackWheel.setSpeed(0);
}
void moveLeftBackward() {
  LeftFrontWheel.setSpeed(-wheelSpeed);
  LeftBackWheel.setSpeed(0);
  RightFrontWheel.setSpeed(0);
  RightBackWheel.setSpeed(-wheelSpeed);
}
void stopMoving() {
  LeftFrontWheel.setSpeed(0);
  LeftBackWheel.setSpeed(0);
  RightFrontWheel.setSpeed(0);
  RightBackWheel.setSpeed(0);
}
void resetData() {
  // Reset the values when there is no radio connection - Set initial default values
  data.j1PotX = 127;
  data.j1PotY = 127;
  data.j2PotX = 127;
  data.j2PotY = 127;
  data.j1Button = 1;
  data.j2Button = 1;
  data.pot1 = 1;
  data.pot2 = 1;
  data.tSwitch1 = 1;
  data.tSwitch2 = 1;
  data.button1 = 1;
  data.button2 = 1;
  data.button3 = 1;
  data.button4 = 1;
}



For Better Understand watch this video 

This idea is collected from Here

No comments:

Post a Comment

Thank You!!

Bottom Ad [Post Page]

| Designed by Colorlib