Robots on arduino uno. Ready-made Arduino robots. Ready-made robot or frame for a robot

Hi all. This article is a short story about how do robot their hands. Why a story, you ask? This is due to the fact that for the manufacture of such crafts it is necessary to use a significant amount of knowledge, which is very difficult to present in one article. We'll walk through the build process, take a peek at the code, and ultimately bring a Silicon Valley creation to life. I advise you to watch the video to get an idea of ​​what you should end up with.

Before moving on, please note the following: during manufacturing crafts a laser cutter was used. From laser cutter You can refuse if you have enough experience working with your hands. Precision is the key to completing the project successfully!

Step 1: How does it work?

The robot has 4 legs, with 3 servos on each of them, which allow it to move its limbs in 3 degrees of freedom. He moves with a “crawling gait.” It may be slow, but it is one of the smoothest.

First, you need to teach the robot to move forward, backward, left and right, then add an ultrasonic sensor, which will help detect obstacles/obstacles, and then a Bluetooth module, thanks to which control of the robot will reach a new level.

Step 2: Necessary Parts

Skeleton made of plexiglass 2 mm thick.

The electronic part of the homemade product will consist of:

  • 12 servos;
  • arduino nano (can be replaced with any other arduino board);

  • Shield for controlling servos;
  • power supply (in the project a 5V 4A power supply was used);

  • ultrasonic sensor;
  • hc 05 bluetooth module;

In order to make a shield you will need:

  • circuit board (preferably with common lines (buses) of power and ground);
  • inter-board pin connectors - 30 pcs;
  • sockets per board – 36 pcs;

  • wires.

Tools:

  • Laser cutter (or skilled hands);
  • Super glue;
  • Hot melt adhesive.

Step 3: Skeleton

Let's use a graphics program to draw the components of the skeleton.

After this, at any affordable way cut out 30 parts of the future robot.

Step 4: Assembly

After cutting, remove the protective paper covering from the plexiglass.

Next we start assembling the legs. Fastening elements built into parts of the skeleton. All that remains to be done is to connect the parts together. The connection is quite tight, but for greater reliability you can apply a drop of superglue to the fasteners.

Then you need to modify the servos (glue a screw opposite the servo shafts).

With this modification we will make the robot more stable. Only 8 servos need to be modified; the remaining 4 will be attached directly to the body.

We attach the legs to the connecting element (a curved part), and this, in turn, to the servo drive on the body.

Step 5: Making the shield

Making the board is quite simple if you follow the photographs presented in the step.

Step 6: Electronics

Let's attach the servo drive pins to the arduino board. The conclusions should be connected to correct sequence, otherwise nothing will work!

Step 7: Programming

It's time to bring Frankenstein to life. First, let's load the legs_init program and make sure that the robot is in the position as in the picture. Next, we'll load quattro_test to check if the robot responds to basic movements, such as moving forward, backward, left and right.

IMPORTANT: You need to add an additional library to the arduino IDE. The link to the library is provided below:

The robot must take 5 steps forward, 5 steps back, turn left 90 degrees, turn right 90 degrees. If Frankenstein does everything right, we're moving in the right direction.

P. S: Place the robot on the cup, like on a stand, so that you don’t have to put it at the starting point every time. Once the tests have shown that the robot is working normally, we can continue testing by placing it on the ground/floor.

Step 8: Inverse Kinematics

Inverse kinematics is what actually drives the robot (if you are not interested in the math side of this project and are in a hurry to finish the project, you can skip this step, but knowing what drives the robot will always be useful).

In simple words, inverse kinematics or abbreviated as IR - “part” trigonometric equations, which determine the position of the sharp end of the leg, the angle of each servo, etc., which ultimately determine a couple of preliminary settings. For example, the length of each step of the robot or the height at which the body will be located during movement/rest. Using these predefined parameters, the system will extract the amount by which each servo should be moved in order to control the robot using the given commands.

Our dear readers, we are opening a series of articles dedicated to creating a robot based on Arduino. It is assumed that the reader is a beginner and has only basic knowledge of the subject. We will try to present everything as detailed and clear as possible.

So, an introduction to the problem:

Let's start with the concept: we want a robot that can independently move around the room, while avoiding all obstacles encountered along the way. The task was set.

Now let's figure out what we need:

  1. Platform (body). There are options here: do everything yourself, buy parts and assemble them, or buy ready-made ones. Choose what you want

The kit usually includes a platform and one motor for two driving wheels (caterpillar) and a compartment for batteries. There are options all-wheel drive- a motor for 4 wheels. For beginners, we recommend taking tank-type platforms

Two driving wheels and a third support wheel.

  1. Next, we need a rangefinder. Sonar (aka rangefinder, aka Ultrasonic module) As a rangefinder, the choice was initially between ultrasonic and infrared. Since the ultrasonic characteristics are significantly better (maximum range is about 4-5 meters, versus 30-60 cm), and the price is about the same, the choice fell on Ultrasonic. The most common model is HC-SR04.

  1. Motor Driver.

What should I do? The first thing that comes to mind is to put a transistor at the output of the microcontroller and power the motors from it. This is of course good, but it won’t work if we want to turn the engine in the other direction... But the H-bridge, which is a little more complex circuit than a pair of transistors. But in this case there are plenty of them in the form of ready-made integrated circuits, so I think there is no need to reinvent the wheel - we’ll buy a ready-made one. In addition, the price is 2-3 dollars... Let's move on. For these purposes, we will buy an L293D chip, or, even better, a Motor Shield based on it.

Motor shield on L298N chip

  1. Sound generation - piezo emitter

The most simple option sound generation is the use of a piezo emitter.

Piezoceramic emitters (piezo emitters) are electroacoustic sound reproduction devices that use the piezoelectric effect. (the effect of polarization of a dielectric under the influence of mechanical stresses (direct piezoelectric effect). There is also an inverse piezoelectric effect - the occurrence of mechanical deformations under the influence of an electric field.

Direct piezoelectric effect: in piezo lighters, to obtain high voltage on the arrester;

Reverse piezoelectric effect: in piezo emitters (effective at high frequencies and have small dimensions);)

Piezo emitters are widely used in various electronic devices- alarm clocks, telephones, electronic toys, household appliances. A piezoceramic emitter consists of a metal plate on which a layer of piezoelectric ceramics is applied, which has a conductive coating on the outside. The plate and the spray are two contacts. The piezo emitter can also be used as a piezoelectric microphone or sensor.

That's all we need at first. First, let's look at how to assemble and make these parts work individually in separate lessons.

Lesson 2. Working with an ultrasonic distance measuring sensor (range finder)

Lesson 3. Arduino and Motor Shield based on L298N

Lesson 4. Sound reproduction - piezo emitter

Lesson 5. Assembling the robot and debugging the program

Good day! In front of you, dear ones, is an art robot that can paint various spherical or ovoid objects ranging in size from 4 to 9 cm.

To make it you will need a 3D printer, a set of standard tools + Arduino.

Note: Do not give up on projects that use a 3D printer. If you wish, you can always find a place or way where you can order printing of the parts necessary for the project.

Step 1: A little about the robot

Art robot - two-axis homemade, which can pattern on most spherical surfaces. The robot is customized for a certain type of object (ping pong balls, Christmas decorations, light bulbs and eggs (duck, goose, chicken...).

High-precision stepper motors with high torque are used to rotate the spherical object and move the manipulator, and a quiet and reliable SG90 servo drive is used to lift the handle mechanism.

Step 2: Necessary Parts

In order to do DIY crafts we need:

  • 2x bearings 623;
  • Hairpin with a diameter of 3 mm and a length of 80-90 mm;
  • 1x spring (length 10 mm and diameter 4.5 mm);
  • 2x NEMA 17 stepper motors (torque 4.4 kg/cm);
  • Motor cables (length 14 + 70 cm);
  • USB cable;
  • 1x servo SG90;
  • Arduino Leonardo;
  • shield JJRobots;

  • 2xA4988 drivers for stepper motors;
  • Power supply 12V/2A;
  • 11x M3 6mm screws;
  • 4x M3 16mm screws;
  • 4x M3 nuts;
  • 2x 20mm suction cups;
  • 1x wing nut M3;
  • 1x marker;

Step 3: General outline

You can use this diagram as a “cheat sheet”.

Step 4: Let's get started!

The robot moves a manipulator with a marker attached to it, which is driven by a stepper motor. Another stepper motor is responsible for rotating the object on which the drawing is applied (egg, ball...). Two suction cups are used to hold the item in place: one attached to the stepper motor and the other on opposite side subject. A small spring will press against the suction cup, helping it hold the object. The SG90 servo drive is used to raise/lower the marker.

Step 5: Manipulator

Place the nut in the hole prepared for it and tighten the 16 mm screw. Let's do the same for the item holder (on the right in the image above). When creating the hinge for the manipulator, 2 16 mm screws were used. This hinge should rotate freely after tightening the screws.

Step 6: Suckers

Place one of the suction cups inside the hole in the item holder.

Step 7: Mounting the Stepper Motors

We attach both stepper motors to the main frame using 8 screws.

Step 8: Rotation Axis

Let's place all the elements as shown in the image above.

  • Sucker;
  • Screw;
  • Top part;
  • Spring;
  • Bearing 623 (must be built into the left cup);
  • Left cup;
  • Free space for the main frame;
  • Right cup;
  • Bearing 623;
  • Spacer ring;
  • Wing nut (M3).

Step 9: Putting everything in its place

Let's insert the assembled manipulator onto the axis of the stepper motor.

Let's install the left support on the axis of the stepper motor.

The marker and egg are set as an example (no need to place them now).

NOTE: The servo will require adjustments. You will need to re-set its angle during the calibration process.

Step 10: Electronics

Let's secure the electronics to the back of the main frame using screws (2 will be enough).

Let's connect the cables.

If you reverse the polarities when connecting stepper motors, they will simply rotate in the opposite direction, but with a servo drive the situation will not be so harmless! Therefore, double check the polarity before connecting!

Step 11: Programming the Arduino Leonardo

Let's program the Arduino Leonardo using the Arduino IDE (v 1.8.1).

  • Download Arduino IDE (v 1.8.1) and install the program;
  • Let's launch software. Select the Arduino Leonardo board and the corresponding COM PORT in the “tools->board” menu;
  • Let's open and download the Sphere-O-Bot code. Let's unpack all the files inside one folder and call it “Ejjduino_ARDUINO”.

Step 12: The art robot is ready to create works of art

Step 13: Control the Robot

Software Inkscape. Let's download and install the Inkscape software (I recommend stable version 0.91).

Download and install the EggBot Control extension (version 2.4.0 has been fully tested).

The EggBot Control extension for Inkscape is the tool you need to use when testing and calibrating your EggBot and transferring your design onto the egg. First you need to launch Inkscape. After launching Inkscape, the “Extensions” menu will appear, and in it you need to select the “Eggbot” submenu. If you don't see the Eggbot submenu, then you haven't installed the extensions correctly. Perform a backup and carefully follow the instructions for installing extensions.

That's all, thanks for your attention!)

In today's article I will tell you how to make a robot that avoids obstacles based on an Arduino microcontroller with your own hands.



To make a robot at home, you will need the microcontroller board itself and an ultrasonic sensor. If the sensor detects an obstacle, the servo will allow it to go around the obstacle. By scanning the space to the right and left, the robot will choose the most preferable path to avoid the obstacle.

Codebender is a browser-based IDE, the easiest way to program your robot from the browser. You need to click on the “Run on Arduino” button and that’s it, it couldn’t be simpler.

Insert the battery into the compartment and press the function button once and the robot will start moving forward. To stop the movement, press the button again.

/* Arduino Obstacle Avoiding Robot with a servo motor and an ultrasonic sensor HC-SR04 LED and buzzer */ //Libraries #include #include "Ultrasonic.h" //Constants const int button = 2; //Button pin to pin 2 const int led = 3; //LED pin (via resistor) to pin 3 const int buzzer = 4; //Tweeter pin to pin 4 const int motorA1= 6; //positive (+) pin of motor A to pin 6 (PWM) (from module L298!) const int motorA2= 9; //negative pin (-) of motor A to pin 9 (PWM) const int motorB1=10; // positive (+) pin of motor B to pin 10 (PWM) const int motorB2=11; // negative pin (-) of motor B to pin 11 (PWM) Ultrasonic ultrasonic(A4 ,A5); //Create an object ultrasonic(trig pin,echo pin) Servo myservo; //Create a Servo object to control the servos //Variables int distance; //Variable for storing the distance to the object int checkRight; int checkLeft; int function=0; //Variable for storing the robot function: "1" - movement or "0" - stopped. Stopped by default int buttonState=0; //Variable to store the button state. Default "0" int pos=90; //variable to store the servo position. By default 90 degrees - the sensor will look forward int flag=0; //useful flag for storing the state of the button when the button is released void setup() ( myservo.attach(5); //The servo pin is connected to pin 5 myservo.write(pos); // tells the servo to go to the position in the variable " pos" pinMode(button, INPUT_PULLUP); pinMode(led, OUTPUT); pinMode(buzzer, OUTPUT); pinMode(motorA1,OUTPUT); pinMode(motorA2,OUTPUT); pinMode(motorB1, OUTPUT); pinMode(motorB2, OUTPUT) ; ) void loop() ( //Checking the button state buttonState = digitalRead(button); unsigned long currentMillis = millis(); //count... //Changes the main function (stopped/moving) when the button is pressed if (buttonState = = LOW) (//If the button is pressed once... delay(500); if (flag == 0)( function = 1; flag=1; //change the flag variable) else if (flag == 1)( / /If the button is pressed twice function = 0; flag=0; //change the flag variable again ) ) if (function == 0)( //If the button is released or pressed twice, then: myservo.write(90); //set for servo 90 degrees – the sensor will look forward stop(); //the robot remains motionless noTone(buzzer); //the beeper is turned off digitalWrite(led, HIGH);// and the diode is on ) else if (function == 1)(//If the button is pressed, then: //Read the distance... distance = ultrasonic.Ranging(CM); //Tip: Use "CM" for centimeters and "INC" for inches //Check for objects. .. if (distance > 10)( forward(); //Everything is clear, let's move forward! noTone(buzzer); digitalWrite(led,LOW); ) else if (distance<=10){ stop(); //Обнаружен объект! Останавливаемся и проверяем слева и справа лучший способ обхода! tone(buzzer,500); // издаём звук digitalWrite(led,HIGH); // включаем светодиод //Начинаем сканировать... for(pos = 0; pos =0; pos-=1){ //идём от 180 градусов к 0 myservo.write(pos); // говорим серво пройти на позицию в переменной "pos" delay(10); // ждём 10 мс, пока сервопривод достигнет нужной позиции } checkRight= ultrasonic.Ranging(CM); myservo.write(90); // Датчик снова смотрит вперёд //Принимаем решение – двигаться влево или вправо? if (checkLeft checkRight){ right(); delay(400); // задержка, меняем значение при необходимости, чтобы заставить робота повернуться. } else if (checkLeft <=10 && checkRight <=10){ backward(); //Дорога перекрыта... возвращаемся и идём налево;) left(); } } } } void forward(){ digitalWrite(motorA1, HIGH); digitalWrite(motorA2, LOW); digitalWrite(motorB1, HIGH); digitalWrite(motorB2, LOW); } void backward(){ digitalWrite(motorA1, LOW); digitalWrite(motorA2, HIGH); digitalWrite(motorB1, LOW); digitalWrite(motorB2, HIGH); } void left(){ digitalWrite(motorA1, HIGH); digitalWrite(motorA2, LOW); digitalWrite(motorB1, LOW); digitalWrite(motorB2, HIGH); } void right(){ digitalWrite(motorA1, LOW); digitalWrite(motorA2, HIGH); digitalWrite(motorB1, HIGH); digitalWrite(motorB2, LOW); } void stop(){ digitalWrite(motorA1, LOW); digitalWrite(motorA2, LOW); digitalWrite(motorB1, LOW); digitalWrite(motorB2, LOW); }

By clicking the "Edit" button, you can edit the sketch to suit your needs.

For example, by changing the value “10” of the measured distance to an obstacle in cm, you will decrease or increase the distance that the robot Arduino will scan in search of an obstacle.

If the robot does not move, it can change the contacts of the electric motors (motorA1 and motorA2 or motorB1 and motorB2).

Step 7: Completed Robot

Your homemade obstacle avoiding robot based on an Arduino microcontroller is ready.



 
Articles By topic:
How and how much to bake beef
Baking meat in the oven is popular among housewives. If all the rules are followed, the finished dish is served hot and cold, and slices are made for sandwiches. Beef in the oven will become a dish of the day if you pay attention to preparing the meat for baking. If you don't take into account
Why do the testicles itch and what can you do to get rid of the discomfort?
Many men are interested in why their balls begin to itch and how to eliminate this cause. Some believe that this is due to uncomfortable underwear, while others think that it is due to irregular hygiene. One way or another, this problem needs to be solved.
Why do eggs itch?
Minced meat for beef and pork cutlets: recipe with photo
Until recently, I prepared cutlets only from homemade minced meat.  But just the other day I tried to cook them from a piece of beef tenderloin, and to be honest, I really liked them and my whole family liked them.  In order to get cutlets
Schemes for launching spacecraft Orbits of artificial Earth satellites