Repair Design Furniture

Do-it-yourself segway on arduino. Gyroscooter: a device, what it consists of, the scheme and design of a mini-segway. Segway electronic filling

Hi all brains! In my new brain project, I will create a self-balancing vehicle or "Segway" with my own hands. This project requires basic knowledge of electronics and the ability to work manually. All mechanical components can be purchased online or at your local store.

SEGWAY consists of a platform on which they stand in a vertical position, and two side electric motors driven by batteries. The control controller algorithm ensures a stable position. The movement of the Segway is controlled by the driver by tilting his torso, and a handle to select the direction of movement left / right. Therefore, you will need additional components such as a controller, a motor driver, and an acceleration sensor/gyroscope. The mechanical structure is made of wood as it is light in weight, electrically insulated and easy to machine. Now let's start making a Segway!

Step 1: Main characteristics of the project

In this project, it is required to manufacture a device with the following characteristics:

— Sufficient power and stability for driving on the street, and even on a gravel path;
- 1 hour of continuous work
– Total cost up to 500€ euros
- Possibility of wireless control
- Write data to SD card to detect breakdowns

Step 2: System Design

The tilt sensor is mounted horizontally along the x-axis and vertically along the y-axis.

Step 5: Testing and tuning

Please note that the motors must have sufficient power. Check the device in a wide and safe area to avoid injury or damage. It is recommended to wear protective shields and a helmet.

Follow the step by step procedure. Get Started with Programming Arduino microcontroller(download ), then check the communication with the sensors and the control bridge.

The Arduino Terminal can be used to debug code and test functionality. For example, the gain of the PID controller needs to be tuned because it depends on the mechanical and electrical parameters of the motor.

Gain is adjusted according to this procedure:
1. The Kp parameter is for balancing. Increase Kp until the balance becomes unstable, Ki and Kp remain 0. Lower Kp slightly to get a steady state.
2. The Ki parameter is for acceleration/deceleration when tilting. Increase Ki to get proper acceleration to avoid falling when leaning forward, Kp stays at 0. Balance should now be stable.
3. The parameter Kd is used to compensate for switching on and return to a stable position.

In the Terminal program, you can execute various "?" commands.
? - Help with team selection
p,i,d [integer] — Set/Get PID gain, value from 0 to 255
r [integer value] – forced increase in motor speed, value from -127 to 127
v - software version
With the "p" command you access the Kp parameter. The "p 10" command allows you to set Kp to a value of 10.

After power is applied to the Arduino, the sensors are initialized and enter the standby state. When the push button is pressed, a control signal is transmitted to the SEGWAY controller, which is in a vertical position, which is ready to activate the motors to move forward or backward, depending on the initial position. From this point on, the button must be kept pressed constantly, otherwise the motors will turn off and the controller will go into a standby state. After reaching the vertical position, the controller waits for the “Driver in Place” load limit switch signal, which is usually pressed with the foot when the driver is on the platform. After that, the balancing algorithm starts and the motors are activated forward or backward in order to remain in an upright position. Leaning forward creates translational motion forward and vice versa. Being in an inclined position leads to an acceleration of movement. Leaning in the opposite direction results in slower speed. Use the handle to move left and right.

Step 6: Demo

Watch the video of the finished device below and thank you for your attention!


This article will consider the creation of a self-balancing vehicle, or simply a Segway. Almost all materials for creating this device easy to get.

The device itself is a platform on which the driver stands. By tilting the torso, two electric motors are controlled through a chain of circuits and microcontrollers responsible for balancing.

Materials:


-XBee wireless control module.
- Arduino microcontroller
-batteries
- InvenSense MPU-6050 sensor on the “GY-521” module,
- wooden blocks
-button
-two wheels
and other things indicated in the article and in the photographs.

Step one: Determine the required characteristics and design the system.

When creating this device, the author tried to make it fit into such parameters as:
- flotation and power needed to move freely even on gravel
-batteries of sufficient capacity to provide at least one hour of continuous operation of the device
- provide the possibility of wireless control, as well as fixing data on the operation of the device on an SD card for troubleshooting and troubleshooting.

In addition, it is desirable that the cost of creating such a device be less than ordering the original off-road hoverboard.

According to the diagram below, you can see the electrical circuit diagram of a self-balancing vehicle.


The following image shows the drive system of the scooter.


The choice of a microcontroller to control Segway systems is diverse, the author Arduino system most preferred because of its price ranges. Suitable controllers such as Arduino Uno, Arduino Nano, or you can take the ATmega 328 to use as a separate chip.

To power a dual bridge motor control circuit, a supply voltage of 24 V is required, this voltage can be easily achieved by connecting 12 V car batteries in series.

The system is designed so that power is supplied to the motors only while the start button is pressed, so for a quick stop, just release it. In this case, the Arduino platform must maintain serial communication with both the bridge control circuit of the motors and with the wireless control module.

Tilt parameters are measured using the InvenSense MPU-6050 sensor on the “GY-521” module, which processes acceleration and carries the functions of a gyroscope. The sensor was located on two separate expansion boards. The l2c bus communicates with the Arduino microcontroller. Moreover, the tilt sensor with address 0x68 was programmed in such a way as to poll every 20 ms and provide an interrupt to the Arduino microcontroller. The other sensor has address 0x69 and is pulled directly to the Arduino.

When the user stands on the platform of the scooter, the load limit switch is activated, which activates the algorithm mode for balancing the Segway.

Step two: Creating the body of the hoverboard and installing the main elements.


After determining the basic concept of the gyro scooter operation scheme, the author proceeded to the direct assembly of its body and the installation of the main parts. The main material was wooden planks and bars. The tree weighs little, which will positively affect the duration of the battery charge, in addition, wood is easily processed and is an insulator. A box was made from these boards, in which batteries, motors and microcircuits will be installed. Thus, a U-shaped wooden part was obtained, on which the wheels and engines are attached by bolts.

The transmission of engine power to the wheels will be due to gearing. When laying the main components in the body of the Segway, it is very important to ensure that the weight is distributed evenly when bringing the Segway to a working upright position. Therefore, if you do not take into account the distribution of weight from heavy batteries, then the work of balancing the device will be difficult.

In this case, the author placed the batteries at the back, so as to compensate for the weight of the engine, which is located in the center of the device. The electronic components of the device were stowed in place between the engine and the batteries. For later testing, a temporary start button was also attached to the handle of the Segway.

Step Three: Wiring Diagram.



According to the above diagram, all the wires in the Segway case were carried out. Also, in accordance with the table below, all the outputs of the Arduino microcontroller were connected to the bridge motor control circuit, as well as to the balancing sensors.


The following diagram shows the tilt sensor installed horizontally, while the control sensor was installed vertically along the Y-axis.



Step four: Testing and configuring the device.


After carrying out the previous stages, the author received a Segway model for testing.

When conducting testing, it is important to take into account such factors as the safety of the testing area, as well as protective equipment in the form of protective shields and a helmet for the driver.

If you think that a hoverboard or a mini-segway cannot be made at home with your own hands and strength, then you are far mistaken. Oddly enough, there are a lot of videos on the Internet where many craftsmen make their own hoverboard. For some, it turns out to be very homemade, but there are those who were able to really get closer to the very technology of creation and reproduce a truly interesting and high-quality thing. So is it possible to make a gyro scooter with your own hands? Adrian Kundert, an engineer and just a good person, will tell us about this.

What is a gyro scooter?

How to make a gyro scooter with your own hands? In order to understand how to make a homemade hoverboard, you first need to understand what a hoverboard is, what it consists of and what is needed to create this interesting vehicle. A gyro scooter is a self-balanced vehicle, the principle of operation of which is based on a system of gyroscopic sensors and domestic technology maintaining the balance of the working platform. That is, when we turn on the gyro scooter, the balancing system also turns on. When a person gets on the gyro scooter, the position of the platform begins to change, this information is read just by gyroscopic sensors.

These sensors read any change in position relative to the earth's surface or the point from which the gravitational influence comes. After reading, the information is fed to the auxiliary boards, which are located on both sides of the platform. Since the sensors and the electric motors themselves work independently of each other, in the future we will need two electric motors. From the auxiliary boards, the processed information already goes to the motherboard with a microprocessor. There, the balance maintenance program is already being carried out with the necessary accuracy.

That is, if the platform tilts forward by about a few degrees, then the motors are signaled to move in the opposite direction and the platform is leveled. It also tilts to the other side. If the hoverboard tilts to a greater degree, then the program immediately understands that there is a command to move forward or backward to the electric motors. If the hoverboard tilts more than 45 degrees, then the motors and the hoverboard itself are turned off.

The gyro scooter consists of a body, a steel or metal base, on which all the electronics will be attached. Next comes two electric motors with the power to be able to ride under the weight of a person up to 80-90kg. Next comes the motherboard with a processor and two auxiliary boards, on which the gyroscopic sensors are located. And of course the battery and two wheels with the same diameter. How to make a gyro scooter To resolve this issue, we need to get certain details of the design of the gyroboard itself.

What do we need?

How to make a gyro scooter with your own hands? The first and main thing you need is two electric motor, with the power to carry the weight of an adult. The average power of factory models is 350 watts, so we will try to find engines of this power.

Then, of course, you need to find two identical wheels, about 10-12 inches. More is better, since we will have a lot of electronics. So that the patency is higher and the distance between the platform and the ground is at the right level.

Two batteries, lead acid, need to choose rated power at least 4400 mAh, and more is better. Since we will not metal structure, but it will weigh more than the original mini segway or scooter.

Production and process

How to make a gyro scooter, powerful and so that he keeps his balance when driving? First you need to build a plan for what kind of vehicle we need. We need to make a fairly powerful vehicle with large wheels and high cross-country ability on different roads. The minimum value of continuous driving should be 1-1.5 hours. We will spend about 500 euros. Let's put a wireless control system to our gyro scooter. Let's put the reader of malfunctions and errors, all information will go to the SD card.

Scheme of the hoverboard

In the diagram above, you can clearly see everything: electric motors, batteries, and so on. First you need to choose exactly the microcontroller that will control. Of all the Arduino microcontrollers on the market, we will choose UnoNano, and ATmega 328 will act as an additional information processing chip.

But how to make a hoverboard safe? We will have two batteries connected in series, so we will get the desired voltage. For electric motors, just need a dual bridge circuit. A ready button will be installed, by pressing which power will be supplied to the engines. When this button is pressed, the motors and the hoverboard itself will turn off. This is necessary for the safe driving of the driver himself and our vehicle.

The Arduino microcontroller will be at around 38400 baud, using serial communication with the XBee circuit. We will use two InvenSense MPU 6050 gyro sensors based on GY-521 modules. They, in turn, will read information about the position of the platform. These sensors are accurate enough to make a mini Segway. These sensors will be located on two additional accessory boards that will perform the primary processing.

We will use the I2C bus, it has sufficient throughput to quickly communicate with the Arduino microcontroller. The gyro sensor with address 0x68 has a refresh rate of 15 ms. The second address sensor 0x68 works directly from the microcontroller. We also have a load switch, it puts the hoverboard in balance hold mode, when the platform is in a level position. In this mode, the hoverboard stays in place.

Three wooden details, on which our wheels and electric motors will be located. The steering column, made of an ordinary wooden stick, will be attached to the front of the scooter itself. Here you can take any stick, even a handle from a mop. It is necessary to take into account the fact that accumulators and other circuits will produce pressure on the platform and thus the balancing will be slightly reconfigured, exactly in the part where there will be more pressure.

The engines must be evenly distributed to the right and left on the sides of the platform, and the battery as much as possible in the middle in a special box. We fasten the steering column to the usual feints and attach the ready button to the top of the stick. That is, if something went wrong and the button is pressed, the hoverboard will turn off. In the future, this button can be converted into a foot part or adjusted to a certain slope of the platform itself, but we will not do this for now.

The internal circuit and the soldering of all wires are made according to the same scheme. Next, you need to connect two gyroscopic sensors to our microcontroller, using a bridge circuit with a motor, according to this table.

The balance sensors should be installed parallel to the ground or along the platform itself, while the right and left turn sensors should be installed perpendicular to the gyro sensors.

Sensor setup

Next, we configure the microcontroller, download the source code. Next, you need to check the correct relationship between the gyro sensors and the rotation sensors. Use the Arduino Terminal program to program and configure the hoverboard. Be sure to tune the PID balance controller. The fact is that you can choose engines with different power and characteristics, the setting will be different for them.

There are several options in this program. The first most important parameter is the Kp parameter, it is responsible for balancing. First, increase this indicator in order to make the hoverboard unstable, and then decrease the indicator to the desired parameter.

The next parameter is the Ki parameter, it is responsible for the acceleration of the hoverboard. As the incline angle decreases, the speed decreases or increases with reverse action. and the last parameter is the Kd parameter, it returns the platform itself to a level position, and puts the motors into hold mode. In this mode, the scooter simply stands still.

Then you turn on the power button of the Arduino microcontroller and the hoverboard goes into standby mode. After you stand on the gyroboard itself, you stand with your feet on the push button, so the gyro scooter goes into the "on the spot" mode. The balancing sensors turn on and when the tilt angle changes, the gyro scooter moves forward or backward. In case of any breakdowns, you can easily repair the hoverboard with your own hands.

What will we need? To begin with - the wheels, take from the simulator for the press. Reducer for 12 volts and 160 rpm. Powerbank for 15,000 milliamp hours. To be able to manage vehicle, that is, turn right or left, accelerate and slow down, we will use the modules that have already been used in the manufacture homemade lawn mower. This will allow you to control the speed of the engine. Accordingly, 2 modules, 2 engines, 2 power banks.

The two sets work separately. Suppose we add revolutions to the right engine, the segway will turn left. Same thing, but mirrored when turning right. If you add speed to two motors at the same time, the tool will accelerate.

Let's install the gears first. To do this, apply in the center on plywood sheet, draw a contour and make a recess with a cutter. In the same way as the gearbox was attached on the left side, we do it on the opposite side.

You need to cut a few of these bars and screw on the sides. This is necessary so that the plywood does not sag.
Remove the wheels and put on the axle. As you can see, they are different from each other. It is necessary to pre-make two wooden bushings. We will use homemade lathe on wood. It turned out two wooden blanks.

We insert the workpiece. Drill a hole and glue the workpiece epoxy resin. (The author made an amendment at the end of the video, read below).

Now we will make the steering wheel. For this we will use a piece sewer pipe. We took the handle from the simulator. We will make holes in the upper part of the plywood, fix the pipe and the handle. The steering wheel of the Segway should be slightly sloped, so we made a hole in the plywood under the slope and cut the plastic pipe.

All control modules will be installed on the steering wheel. It is necessary to stretch 8 pieces of wires from the steering wheel to the gearboxes. So that they do not stick out from above, we first make a through hole in the pipe and push the wires.

And now again you need to glue everything with epoxy and wait 24 hours. The wheels turned out to be deformed, epoxy turned out to be not a very reliable material. I disassembled the gearboxes, removed the shafts and cut the threads on them. I also drilled holes in the wooden bushings. Inserted metal bushings and now it all looks much more reliable. The wheels can also be screwed very tightly. plastic pipe seemed not entirely reliable, a shovel handle was inserted inside it to strengthen it.

We put 2 modules in the panel. You need to drill holes in the pipe for resistors. It remains to glue the buttons with hot glue. Run wires to the module, reducers, Power banks. Screw on the wheels.

For those who are afraid to connect the wires incorrectly, everything is detailed on the modules.

The Segway will also have a bike speedometer. A test version of a homemade segway is ready. Let's test it.

Is it possible to make a segway with your own hands? How difficult is it, and what details will be required for this? Will it homemade apparatus perform all the same functions as factory-made? A bunch of similar questions arise in the head of a person who decides to build with his own hands. The answer to the first question will be simple and clear: to make an “electric scooter” by yourself is within the power of any person who is at least a little versed in electronics, physics and mechanics. Moreover, the device will work no worse than that produced on a factory machine.

How to make a segway with your own hands?

If you look closely at the hoverboard, you can see a fairly simple structure in it: it's just a scooter equipped with an automatic balancing system. There are 2 wheels on both sides of the platform. To carry out effective balancing, the Segway designs are equipped with an indicator stabilization system. The impulses coming from the tilt sensors are transported to microprocessors, which, in turn, produce electrical signals. As a result, the gyro scooter moves in a given direction.

In order to make a Segway with your own hands, you will need the following items:

  • 2 wheels;
  • 2 motors;
  • steering wheel;
  • aluminum blocks;
  • supporting steel or aluminum pipe;
  • 2 lead-acid batteries;
  • aluminum plate;
  • resistors;
  • emergency brake;
  • steel axle 1.2 cm;
  • printed circuit board;
  • capacitors;
  • Lipo battery;
  • gate drivers;
  • led indicators;
  • 3 x ATmtga168;
  • voltage regulator;
  • ADXRS614;
  • 8 Mosfets;
  • two springs;
  • and ADXL203.

Among the listed names are mechanical parts, and electronic elements, and other equipment.

Segway assembly order

Assembling a Segway with your own hands is not as difficult as it seems at first glance. With all the necessary components, the process takes very little time.

Collection of mechanical parts

  1. Motors, wheels, gears and batteries can be borrowed from Chinese scooters, and finding an engine is no problem at all.
  2. The large gear located on the steering wheel is transmitted from the small gear on the engine.
  3. The gear on the wheel (12") has a free play - this requires some changes to be made to work the rotating elements in both directions.
  4. A fixed axle attached with three aluminum blocks (they can be fixed with 5mm set screws) forms the basis of the platform.
  5. Using the SolidWorks program, you need to make a drawing of a part that will allow the hoverboard to turn to the sides while tilting the torso. After that, the part must be machined on a CNC machine. The machine used the CAMBAM program, which was also used in the manufacture of the box for the emergency brake unit.
  6. The handlebar is attached to a 2.5 cm empty steel pipe.
  7. To ensure that the steering column is always located in the center, as well as the reverse thrust is more intense, you can use a pair of steel springs.
  8. The steering wheel is equipped with a special emergency button connected to the relay - this allows you to reduce engine power.
  9. Motor power supplies - rechargeable batteries for 24 V.

Collection of electronic parts

In order to assemble a Segway with your own hands, it is not enough just to fasten the mechanical parts. Electronic control no less important in a hoverboard, because it is quite an important component of the unit.

  1. The printed circuit board, which has a computing function, collects information from sensors - a gyroscope, an accelerometer, a potentiometer, and then sets the direction of rotation.
  2. Without the ATmtga168 processor, the scooter will not be able to work normally. The connection to the computer is made via Bluetooth and RN-41.
  3. With the help of two H-bridges, the control impulses from the base board are converted into the force of the motors. Each bridge is equipped with ATmtga168, the boards communicate with each other via UART.
  4. All electronics are powered by a separate battery.
  5. In order to quickly get to the batteries, as well as program the base board and change the parameters of the control loops, you need to make a small box with connectors, equip its case with a trimmer potentiometer on top, and also provide an electronics power switch.

Segway software

How to make a segway with your own hands so that it will work for sure? True - install software(or software). Here are the required steps to complete this task:

  1. The microcontroller software includes a filter for the accelerometer and gyroscope and a PD control loop.
  2. Kalman and Complemenatry filters will do the job just fine.
  3. Write applications using the Java programming language - this will allow you to see the degree of battery charge, all sensor readings and control parameters.

That, perhaps, is all that is required from a person who decides to make a Segway on his own. Understanding the subject and process, as well as the necessary components, will allow you to build an excellent hoverboard at home.