Modular 5-bar robot

A 5-bar robot with variable geometry to dinamically ilustrate changes in the spacework of the robot based on its dimensions

Similar projects worth following
This is a 5-bar robot which can be reassembled to change its dimensions in discrete steps, such as arms length or servos distance, to show how those changes affect its task-space through its code, which can control the robot movement using a plot of said task-space by selecting points on it manually. This robot is mostly for educational purposes, to understand easily the concepts of task-space and c-space in a robot, but its modular design allows the addition of different effectors to give the robot an actual purpose.

This 5-bar robot was designed with modularity in mind, so that not only you can make different components for the robot with relative ease, but also to easily visualize the changes on its task-space based on its current geometry. You can change the length of every arm by steps of 2 cm, and you can also change the distance between the servos in the same steps, and then the program to control the robot will show you where the robot can move. You can also give the robot positions to move to by simply clicking on its task-space. Additionally, this robot uses an Arduino Board to control an electromagnet, which can be controlled on the same program.

This robot's main purpose is mostly educational, showing how the task-space and the c-cpace change on a robot given its dimensions, but also integrating that aproach to a real robot to give a better understanding of it.

In regards to the code, there are 4 python programs here, as well as an Arduino sketch borrowed from the examples folder of Arduino IDE:

  • contains the functions to calculate the direct and inverse kinematics of the robot, that is, the final position of the robot given the angles, and the angles given the position, respectively.
  • contains the functions to plot the possible angles and points given a certain geometry.
  • has the code to send the signals to the Arduino board and control the electromagnet
  • compiles everything and communicates with the servo controller and the Arduino boards, while also translating everything into a simple user-friendly interface.
  • Finally, PhysicalPixel.ino allows to establish communication with the Arduino, by reading strings and changing the digital output of ine of its pins to control the electromagnet


The Arduino sketch used for serial communication through python.

ino - 5.63 kB - 12/20/2022 at 22:14


drilling pattern for the rectangular base in rectangular base.f3d and 3d printing files for everything else. It also includes an assembly of the robot without the base and the electromagnet Files: assembly.f3z -parts: >arm's half.f3d >bearing's elbow.f3d >electromagnert's elbow.f3d >left shoulder.f3d >pin's elbow.f3d >rectangular base.f3d >right shoulder.f3d >servo base.f3d -extras: >controller's box.f3d >relay's box.f3d

x-zip-compressed - 2.96 MB - 12/20/2022 at 19:22


application/x-zip-compressed - 15.19 kB - 12/20/2022 at 18:45


  • 2 × Lewansoul LX16A servos The servos we'll use for the robot
  • 1 × Bus servo controller The controller board for the servos, with it's USB cable and cables for the servos
  • 1 × Arduino Uno board Again, with its USB cable. It's important that the Arduino board is original and/or your PC port changes its name to COM[number] arduino or else the code won't recognize it
  • 1 × Electromagnet 10mm of diameter and with its own screw
  • 1 × Single channel 5V relay breakout board

View all 28 components

  • 1
    Step 1: verify that everything works properly

    NOTE: none of the following steps require a power supply connected to any of the boards, but in case you want to do so, connect the power supply to the board BEFORE plugging it to your PC and opening the port, as this may cause a short circuit on your PC and/or partially burn the board (we went through this twice, so please don't)

    Plug the Arduino board and open Arduino IDE (, then go to Tools, then Port, and check that the name of the port you connected the Arduino to includes "(arduino)" in its name, as the python program won't recognize it otherwise. Then, upload the blink sketch from the Basics examples folder. Verify that it was succesfully uploaded and that the Arduino board's LED blinks as it should.

    Then, upload the PhysicalPixel sketch from the Communication examples folder to the Arduino board. You can also find this sketch in the files of this proyect. Check that it was uploaded properly and disconnect the Arduino board.

    Now, install the Bus Servo Terminal V1.7 on your PC from the Lewansoul LX-16A documentation ( in the LX-16A folder) and plug in the bus servo controller with at least one servo connected to it to your PC. Run the Bus Servo Terminal program, you should see something like this:

    Click on COM and open the port you connected the controller onto and click Open port. If the servo works properly, the servo's LED should turn on and you should be able to see the servo's ID and the current position of the servo in current status. Without a power supply, the servo won't move if you change the position in servo test, but that's not necessary as we will do that in the python program. Now, go to parameters. You should see something like this:

    Change the servo's ID to the one you'll use in the code later (the ID's in the code are 4 and 6 for left and right servos respectively, but you can edit that in the code later), then click apply. Once you are done, you can click on Close port, connect the second servo and repeat, and make sure to asign a different ID from the precious one. Even if you don't use the ID's from the code, you still need to asign different ID's to each servo to use them at the same time. Once you are done, click on Close port again, then disconnect everything and close the program.

  • 2
    Step 2: build your own funny robot

    First of all, fix the servos bases to the base using the M5 screws and nuts like so. In case you are using the extra screws as support, place the larger ones on the corners as seen on the following image. If instead you are using anything else as support (like bottle caps), glue them underneath where the extra screws would be:

    Then, on the servos, screw the shoulders to each servo, using the M3 screws with different lengths and a nut for each, placing the nut between the servo and the bottom of the shoulder. 

    Then, connect the servos to the controller. The servos can be connected serially instead of using one port for each servo, by using the second port underneath itself, which in this case allows more movement for the controller board while assembling everything.

    Now, place them on the bases, and make sure the shoulders are not fully tightened, so you can adjust them later. Also, write down the ID's and the positions of the servos from BEHIND, so you can edit them in the code if necessary.

    Then to the arms: take 2 arms' halves, a bearing, a pin, an elbow for each, and at least 4 nuts, and assemble them like so. Make sure that everything fits tight, especially the pin. Note that you only need to put nuts on one of the arms' halves, and if you are planning to use the minimum amount of nuts, place 2 nuts on each end of one of one half of each arm:

    With this, put everything together using the M3 screws, 2 for each end:

    This will be the basic assembly for the arms, but put this one aside for now.

    Now, repeat this two more times, but only using one pin elbow for each arm, and screw these to the shoulders. Make sure the pin points downwards on the higher arm, and upwards on the lower arm like so:

    Now, assemble the electromagnet elbow. Place the electromagnet inside first, aligning its cables, then screw it to the elbow and put the bearing on top.

    Repeat the arm assembly with the remaining bearing elbow and the electromagnet. Take the remaining two arms and put them on each side, and make sure the pins don't slide inside their elbows while assembling:

    Finally, connect the ends of each arm, and make sure that the pin doesn't slide.

  • 3
    Step 3: the electronics

    First of all, connect the step down to the power supply, turn it on, and adjust the output voltage to 6V by tightening the golden screw on top of the step down, while checking with a multimeter.

    Now, turn off the power supply and proceed with the connections as follows, but DO NOT connect the USB cables to your PC yet.

    Note that you can also use 2 6V batteries instead of a power source and a step down, by replacing the connections on the strip: use one battery for the servo controller alone, and the other one for the relay and electromagnet circuit.

    At this point you can turn on the power source to verify that the boards and the servos turn on, and nothing starts burning itself, just in case.

View all 4 instructions

Enjoy this project?



Florian Festi wrote 12/23/2022 at 11:52 point

This is a really neat education tool. I wonder if there is a way to make with work with less screws to allow faster reconfiguration. What about having the moving blocks to clamp the rails from the top and bottom. Then you can get away with only one thumb screw. The rails could grow some notches to keep distances discrete.

Most of this kit could probably be laser cut for much quicker production times. In case you want to make this into something bigger.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates