Making a Robot Claw

The beginning of 2019 found me working to build a platform for promoting sea buckthorn organic juice. The first finished part of the platform was a 3D printed robotic claw. This claw is attached to a 6-axis robotic arm SainSmart. It is the classic robot arm which reproduces the industrial design.

The robotic claw is used to:

  1. grab a small plastic cup with juice;
  2. detect if the plastic cup was grabbed. I use a limit switch sensor to detect the plastic cup;
  3. detect when the plastic cup is taken over;

The design
The application is not very complex. I need a robot claw to carefully handle a plastic juice cup without breaking the plastic cup or losing it on the way. I analyzed the steps, actions and worst case scenarios and I decided to stay in the classic design for the robot claw. Two claws actuated by a servo motor are what I need to grab and move a plastic cup. A more complex design with several claws and many degrees of freedom would be too much.

I have a few constraints to accomplishing the above steps. First, the plastic cup has a height of 5.2 cm. The claws will not have to cover a large surface so there should be enough space for picking up the cup. Also, I can’t prevent the cup to not slide between claws with an abrasive material glued on the inner surface. The plastic cup should not resist when it will be taken over by a person.

Robotic claw: CAD design and 3D printed

The solution

  • the claws have a thickness of 1 cm, that is about 20% of the height of the plastic cup. I could have made them less thick but I needed space to add the limit switch sensor for sensing the plastic cup.
  • gluing a rubber piece to the inner surface of the claw is excluded. The rubber would have prevented the plastic cup from slipping, but it would have made it very difficult to take it from the claws. I would have risked the robot arm being pulled up together with the cup. The solution was to use a high-torque servo motor able to maintain the position of the claws. SainSmart uses for the 6-axis robotic arm gripper the SG-90 servo motors. These servo motors cannot hold anything between the claws.

Read more →

How to Control NEMA 17 Stepper Motor with Arduino and A4988 Driver

If you’ve come to this article, you’re probably at the same point as I was before I made my stepper motor move without noise, vibration or jump steps. That’s why in this article, I will provide a sufficient level of depth to know how to control a stepper motor (for example – a NEMA 17 or other stepper motor size) and fixing the problems that may arise.

When a stepper motor is used in a 3D printer, most likely a team of electronics and programming experts makes calculations and put everything together to works perfectly. Instead, when I try to use the same stepper motor in a hobby project (after a normal 8 hours daily job) it’s quite different. Moreover, things get complicated if you have a low budget and just wanted to use the stepper motor to make a robot or rotate a cup holder like in the way I did. All of these situations may give you big headaches.

Let’s start with the beginning and I’ll tell you in a few words from where the whole story started. It is possible to write a long story in this article, but I have a lot to explain to you about stepper motors.

How to Control NEMA 17 Stepper Motor with Arduino and A4988 Driver

How to Control NEMA 17 Stepper Motor with Arduino and A4988 Driver

How I Start With The NEMA 17 Stepper Motor

First of all, I will comment based on NEMA motors. Like many others, I’ve heard about the NEMA stepper motors and I thought ‘NEMA’ is the brand of the motors. Totally wrong! NEMA is a standard that describes stepper motors. For example, NEMA 17 is a stepper motor with a 1.7 x 1.7-inch faceplate. In other words, NEMA 17 is a size, not a series of stepper motors.
Read more →

How to Control Servo Motors With Arduino (no noise, no vibration)

In this tutorial, I provide enough level of depth to be informed about how to control servo motors with Arduino. I use PWM software and hardware resources because this is the right way to control one or more servo motors. After reading this article, you should be able to control your hobby servos without noise or vibration. In addition, I write a section at the end of the article where I describe how I fix several MG996R servos and a conclusion.

Before going into the details, I want to tell you something. I know how hard is to produce great work and then put it out into the world. But no matter how much was written on forums and blogs about how to control hobby servo motors like MG996R, almost all these tutorials provide information to control it while working freely, without applying torque. The servo changes its behavior under applying torque. If it is not controlled in the right way, the servos vibrate, make noise and rotate randomly. That is how I came to write this tutorial. I want to describe you in details the solutions tried to control the servos, as well as the solution to smoothly control many hobby servos like MG996R while applying torque – in my case, the servo actuates a robotic arm.

The story:

RoboBioca Robot Arm

RoboBioca Robot Arm

The MG996R servo is the main servo motor used to move the SainSmart 6-axis robot arm. From all of the 6 axes of the arm, four of them are actuated by the MG996R. Only two axes use the SG90 servo to move the end effector.

I used this robot arm to build a robot waiter able to grab and handle a small plastic cup. Because I need something different for my project, I cannot use the default configuration of the arm. I replaced the SG90 servo motors with only one servo motor with metallic gearbox and claws. In this way, I reduced the number of degrees of freedom of the arm from 6 to 5.

In this project, I used the Blynk application to send commands to the robot. The communication between the Android tablet running Blynk and the robot is done wirelessly using a Bluetooth connection.

And because I would not have had enough problems to solve, the Bluetooth connection interferes with the servo motors. These are making noise and running randomly while is working the Bluetooth connection. So an extra problem to be solved.

The power supply
A stable power supply of 6V as required for powering the servo motors is mandatory. I used an adjustable LTC3780 DC buck/boost converter module. Also, I have a power adapter (12V – 3A) to feed the converter. I used a digital multimeter to set an output voltage as close as 6V for the converter.

First try
The first attempt was to control the servo motors with the Arduino Sensor Shield V5. The biggest problem with Arduino UNO is that I have only two PWM pins (pin 9 and pin 10) that can be used with PWM while running the Servo2 library. The PWM pins are used for the control signal of servo motors. Unlike DC motors, the PWM control is required for servos to determine the position rather than the speed of the servo shaft.

This is the Servo library distributed with Arduino 0016 and earlier. It can drive up to two servos using pins 9 and 10 on a standard board or 11 and 12 on a Mega. Other pins wont work.

I had two servo motors working well when I control them with PWM and that’s all. I leave them and make another try.

Second try
With five servos and only two pins with PWM that I can use, I tried another way to control the servo motors. I gave up the Servo2 library and I use capacitors and the Servo library. This attempt turned out more successful than the previous one. From the solutions found on the Internet, I used 470uF 50V electrolytic capacitor for each servo. It works, but not as I want it. Shaking and vibrations don’t occur in most of the servo positions, but the random rotations still continued.

Third try
The third attempt was successful. I used the Adafruit 16-Channel PWM/Servo driver to control all the five servos. The driver uses an i2c-controlled PWM driver with a built-in clock and 12-bit resolution for each servo, that means about 4us resolution at 60Hz update rate.

I used the Adafruit_PWMServoDriver library and the inspiration to write the code was coming from examples provides by the library.

This is a demo with the robot arm controlled with PWM using the Adafruit’s driver.

The story with the MG996R servo

The first failed servomotor was the one who turned the robot arm. It has failed quite easily – I have noticed some smoke being emitted during operation. The second failed servo was at the base. This one no longer recognized the position. Regardless of the commands for a particular position, it randomly changes its position. The cause was not using the Bluetooth module. I tried to position the servo motor without attaching the communication module.

The first servo failed after about 30 minutes of operation. The second was more friendly and failed after about another 2 hours of operation. During this time I’ve used the robot arm to test different positions.

I’m in the situation of having two failed MG996R servo motors while I start working to solve two problems that have actually increased my blood pressure: random shakes(vibrations) and noise.

Initially, I thought I do something wrong and that’s why the servo motors were broken so fast. After a search on Google, it looks like I’m not the only one who worked with the MG996R and have broken them in the testing phase. Finally, I ordered some new servos and I start working to see where I was wrong and how to fix this.

I ordered three MG996R servo motors. They came quickly and I started to test them. It’s not the first time when I bought something very cheap (the price for an MG996R is around €6/$7) and did not work. This time was something very special for me. From three servo motors, all of them did not work.

With three new servo motors that did not work, I thought it would be better to search for an alternative. I’ve looked for alternatives having the same size that could fit into the SainSmart robotic arm. I found Power HD Servo 1501MG. They are the same size as the MG996R plus higher torque.

Of the five MG996R servo motors used in the upgraded version of the robot arm (the original version of the arm uses 4 MG996R), there are three left. Two MG996R servos were replaced by 1501MG. One MG996R servo drives the shoulder yaw, another on the wrist yaw, and a third on the robot claw.

How I fix the MG996R

Any of the below methods require training in electronics and some experience with screws, gearboxes, and grease. Take great care when you work inside the servo, you will do it on your own responsibility.

  1. Two of the servo motors I’ve fixed just by removing the screws. I control them to move back and forth from position 30 to 160 without putting the cover of the gearbox, then I fixed the cover of the gearbox… and it works. Sounds a little stupid, but this is what I did and works. I suspect the problem was in the position of the gears inside the gearbox. Most likely, the DC motor was rotating without engaging all of them. There may be assembly errors or transport shocks.
  2. One of the new servos had some bigger problems. One gear doesn’t have one or two teeths. Besides that, I found a piece of plastic inside the gearbox. Fortunately, I have a burned servo from where I took the spare pieces, I mounted back all the pieces and it worked.

    MG996R missing theets

Conclusion on the hobby servos

  • try as little as possible to manually change the position of your servo. This can quickly destroy the gearbox and the servo can give fails;
  • the servo motors used in hobby projects works well between positions 10 and 170. If you place a position less than 10 or greater than 170 it makes a noise and gets into vibrations;
  • the power supply of the servo must be as close as possible to the 6V value. A higher voltage can burn it, and a lower voltage makes it run randomly. Also, please do not try to feed servos directly from the Arduino board or any other controller used in your project. You will have many surprises;
  • if you work with multiple servo motors at once, for example for a robot arm, you would want to program them one by one. If one of the servos has an incorrect command and moves to a less desired position, it has a big impact on the other servos. The robot arm can touch the work table or other objects around it and broke the gearbox of the servo;
  • if you do not have a stable power supply source of 6V, it is necessary to use an electrolytic capacitor between the power supply wires of the servo motor;

Alternatives To Raspberry Pi 3 (B/B+) For Running ROS

More Powerful Alternatives To Raspberry Pi 3 (B/B+)

More Powerful Alternatives To Raspberry Pi 3 (B/B+)

I’m quite involved in developing an autonomous robot platform for outside work. The robot will work in the summer during the day for a few hours, which result in high temperatures for all its components. My main concern is the electronic parts. I have plans to install a cooling system for these, but I’m not sure if I can keep the temperature values at an acceptable threshold.

Besides, I want to reduce the temperature of the electronics using parts that do not work under stress. Low stress results in low temperature generated by the component. Thus, I’ve come to look for Raspberry Pi 3 alternatives to run ROS and communicate with the robot.

I use the Raspberry Pi 3 to run ROS Kinetic, monitor and control the robot. Raspberry Pi is a pretty stable platform and can work continuously for weeks without a problem. Its alternative must provide as much stability in operation, community support, and resources.

The budget for this change is not greater than €150. My research led to the next list (the list will be updated once new alternatives appear).

Jetson TK1 / TX1 / TX2 or Intel NUC is out of the question for the moment. Any of the three Jetson variants or the Intel computer cost a few hundred euros. It is worth investing money in such a board if running ROS and computer vision applications. Otherwise, I do not see any reason in spending hundreds of euro to run ROS nodes for sensors and navigation algorithms.

  1. Libre Renegade

    Added on 19.December.2018
    Renegade has the form-factor compatible with Raspberry Pi 3 and can run ROS without a big effort with its 1.4GHz ARM Cortex-A53 processor and 4GB of DDR4. It has a price of $80.00 (the version with 4GB DDR4), but the final price will increase by a few dollars considering that it has no WiFi. Is needed a USB dongle if you desire to use this function.


    XU4 has a competitive price of about €63 and on the specifications list is a Cortex-A15 processor that can provide 2Ghz and 2GB of LPDDR3. The only minus of this board is the lack of a built-in WiFi module. I need an extra €5 to buy a WiFi module to have an Internet connection.

  3. ASUS Tinker

    Asus Tinker runs ROS nodes on a QuadCore ARM SOC 1.8GHz processor with 2GB of RAM. It has an built-in WiFi module and a price around €49. I have some doubts about the operating system. In reviews from Amazon other users reveals stability issues for Android and Debian images. This makes me think twice about making a decision. It is very important to me to use a single board computer for months without interruption. An unstable operating system can lead to a large number of reboots and downtime.

  4. Rock64

    Rock64 comes in several variants and the strongest one has 4GB of RAM and an ARM Cortex A53 64-bit processor. The board can run a full version of Linux Ubuntu or Debian. The price is also good considering the performance – around €38. The only thing that concerns me is the community support. An active community could save me for a lot of hours to fix issues.

How To Setup ROS Kinetic To Communicate Between Raspberry Pi 3 and a remote Linux PC

How To Setup ROS Kinetic To Communicate Between Raspberry Pi 3 and a remote Linux PC

I have a Raspberry Pi 3 running ROS Kinetic and I use it to control an autonomous robot. The plan is to improve my robot by adding computer vision capabilities. The Raspberry Pi has resources to build intelligent robots and the community helps me more in fixing a lot of problems. These are the reasons for this moment not to change it with another single board computer with advanced hardware resources. The bad thing is that Pi 3 has limited capabilities for graphics applications such as rviz or running computer vision applications.

My idea (I hope is a good one and will work) is to use Pi 3 and a Linux computer in the same network to exchange data from one to another while I run rviz and the Gazebo simulator on the PC.

The first step in implementing my idea is to setup ROS Kinetic to communicate between Pi 3 and the remote Linux computer. Below are the steps that I did to make both computers communicate with each other.

  • Step 1: I checked that everything was okay with ROS Kinetic on my Linux PC. I installed it some time ago using the steps described here.
  • Step 2: I re-installed a Linux image and ROS Kinetic on the Raspberry Pi 3 board. It took some time since I chose to install ROS on the Raspbian Stretch Lite. This operating system is what I need for my robot: it doesn’t have desktop applications or a GUI of any kind.
  • Step 3: At this step, I pay some attention at the IP address for the ROS master node (Pi) and the IP address for other ROS node (the Linux PC).
    1. on Raspberry Pi 3 type the following command:
      sudo nano .bashrc

      Navigate to the end of the file and add these two lines:

      #The IP address for the Master node = the IP address of Raspberry Pi
      export ROS_MASTER_URI=
      #The IP address for the Master node= the IP address of Raspberry Pi
      export ROS_HOSTNAME=
    2. on the Linux PC, type the following command:
      sudo nano .bashrc

      Navigate to the end of the file and add these lines:

      #The IP address for the Master node = the IP address of Raspberry Pi
      export ROS_MASTER_URI=
      #The IP address for your Linux PC
      export ROS_HOSTNAME=

These are all the steps to make two Linux computers communicate and share nodes, topics, and services.

How to Install ROS Kinetic on Raspberry Pi 3 running Raspbian Stretch Lite

I want to control an autonomous robot with a Raspberry Pi 3 board and ROS Kinetic. The Pi 3 will be connected to another Linux PC used for monitoring and control settings. The setup for computers are in this article.

Due to the lack of Pi resources in terms of processor and memory, I’m forced to use resources more efficiently. The first step is to install on Pi an operating system like Raspbian Stretch Lite. The interaction with this system is done through type commands. It doesn’t have GUI and other software included with the Desktop version. Theoretically speaking, it is a perfect operating system if you want to not stress the Pi board with too many tasks that you do not need anyway.

The system will use the Raspberry Pi board as the master while the PC is the slave. This configuration means to run the Roscore on the robot instead on the remote PC. The PC is used to see the message that coming from Pi or send some manual correction back to the robot.

I installed the ROS Kinetic version with no GUI tools on the Raspbian Stretch Lite and I put all the steps below.

  • Step 1: Download and install Raspbian Stretch Lite
    The installation steps for Raspberry Lite are described here.
  • Step 2:Connect via SSH to Pi and run the below commands:
    sudo sh -c 'echo "deb $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
    wget -O - | sudo apt-key add -
    sudo apt-get update
    sudo apt-get install -y python-rosdep python-rosinstall-generator python-wstool python-rosinstall build-essential cmake
    sudo apt install dirmngr
    sudo rosdep init
    rosdep update
    rosinstall_generator ros_comm --rosdistro kinetic --deps --wet-only --tar > kinetic-ros_comm-wet.rosinstall
    wstool init src kinetic-ros_comm-wet.rosinstall
    rosdep install -y --from-paths src --ignore-src --rosdistro kinetic -r --os=debian:stretch
    sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic -j2
    sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic -j1

    (thanks CaJU and Bruce W)

    source /opt/ros/kinetic/setup.bash
    echo 'source /opt/ros/kinetic/setup.bash' >> ~/.bashrc
    mkdir -p ~/catkin_workspace/src
    cd catkin_workspace/src
    cd ~/catkin_workspace/
    source ~/catkin_workspace/devel/setup.bash
    echo 'source ~/catkin_workspace/devel/setup.bash' >> ~/.bashrc
    export | grep ROS
  • Step 3 (optional): The installation process takes several hours and sincerely, I don’t want to repeat the installation too soon. I decide to clone the memory card as soon as I finished the initial installation. Here are the steps needed to clone the memory card.

You can find additional information here and here.

A cheap system for detecting curved lanes (OpenCV, Raspberry Pi 3 and Nvidia Jetson TX2)

A relatively inexpensive method with good results for a robot capable of detecting the lines and the curved lines of a road is described in this project. Kemal Ficici has used OpenCV for computer vision, a Raspberry Pi 3 and an NVIDIA Jetson TX2. If we add the video camera, wires, and other accessories, the project does not exceed the amount of 1000 Euros for the hardware parts. A small price for a system capable of detecting lines and curved lines.

Detecting curved lanes in camera space is not very easy. – says Kemal Ficici

The system uses the contrast between lane lines and road to detect the driving path.

Here’s the current image processing pipeline:

  • Distortion Correction
  • Perspective Warp
  • Sobel Filtering
  • Histogram Peak Detection
  • Sliding Window Search
  • Curve Fitting
  • Overlay Detected Lane
  • Apply to Video

The system also has weaknesses. It is affected by shadows, drastic changes in road texture, rain and snow.

How the system works:

Which Is The Best ROS Ready Robot Arms Under $1000?

I have this robotic arm with 6-axis and very cheap servo motors. When I bought it, I did not think I would use it to who knows what applications. I buy it because is cheap and I can control it with an Arduino Mega and ROS.

The problem is that I want to build a robotic arm capable to identify objects (like an apple or a pear), to pick the fruit from a tree, and put it in a basket near the robotic arm. For these operations, I need an arm with a relatively solid structure and some powerful servo motors. In conclusion, the kit I have is not helping me.

The second plan is to buy a ROS ready robotic arm with servo motors that can handle a weight around 200 grams. Because it is a personal project with a limited budget (maximum $ 1000), I searched for and found the following three robotic arms that would fit my project.

The first option is a PhantomX robotic arm with 4 degree-of-freedom and a gripper with a rated holding strength of up to 500g, while the wrist itself can lift up to 250g horizontally.

The second option is also a PhantomX arm that can handle the same weight as the first one. But it comes in addition with 5 degrees of freedom, a greater range of action and up to 300 degrees of motion.

The third option is the most expensive and I may have the surprise not to receive it in the next few months when I need it. It’s about Niryo One. For now, the arm can only be pre-ordered. The combination of Raspberry Pi, Arduino, ROS, parts that can be printed with a 3D printer – attracts me a lot.

Robots in Agriculture: Present and Future

This is a guest post by Jack Simmer (a writer for DO Supply)

Robots are gradually changing every industry and agriculture isn’t an exception. The use of robotics in this field isn’t widespread yet. However, it’s expected to grow significantly by 2020-2028.

Why There Aren’t Many Robots in Agriculture Now (But Will Be More in the Future)

The most important reason that prevents the use of robots in agriculture today is the fact that the technology hasn’t been created yet. The majority of automation solutions are either in a testing or development stages and have far to go before they can be commercialized.

This technology progresses a bit slowly because of the high costs and complexities involved. At the moment, the level of visual tech isn’t high enough to create an efficient robot for harvesting or weeding. The trick is that the vision of the robot must be taught to not only identify different objects but to analyze them and determine which should be removed.

There are a few machines capable of doing this, such as a tomato-harvester robot from Panasonic and cucumber-harvester currently developed by scientists from Germany. However, neither is commercially available yet.

The other issue that makes the development of agricultural robots so difficult is the fact that they must be taught how to perform their tasks with extreme gentleness and accuracy. While surgical robotics have proven that accuracy isn’t an issue for a machine, automating a fresh fruit-harvesting robot proves to be a much greater challenge. One can certainly make a well-calibrated teleoperated robot to pick even as soft a fruit as grapes. However, yet again, the technology isn’t at the level when it can be mass-produced and used by agricultural businesses.

There’s also a debate going on whether one should create one big multifunctional robot or multiple small robots that will fulfill various tasks. The second solution seems like a more efficient option at the moment. The main concerns are the weight of the device and its maneuverability. Lighter and smaller robots have a lower risk of damaging the crops and soil.

Money is also a challenge for the implementation of robots in agriculture. The tech available now is too expensive to make these solutions viable for these businesses. However, as this field develops rather fast, we can expect to see commercially available agricultural robots within 1-2 years. After all, some types of them exist and are used even today.

Types of Robots in Agriculture

Robots can perform a variety of tasks and make the business of growing crops much less taxing for humans. The main areas for the implementation of robotics in agriculture are harvesting, weeding, mowing, pruning, seeding, spraying, sorting, and packing.

Some types of robotics that are already used include drones (monitoring and spraying) and automated tractors. Note that the tractors of today still require a lot of human input into the controls. However, these machines get more advanced and are expected to become fully autonomous by the late 2020s.

At the moment, drones are the leader of robots in agriculture. They are extremely cost-efficient and are widely used by small farms. The reason for this is undoubtedly the fact that drone technology has become extremely commoditized and therefore affordable.

Harvesters are also getting out there as these machines are in the highest demand due to the inefficiency of picking fresh fruit by hand. The harvesting of seeds is nearly 100% motorized these days. However, only a few strawberry-picking machines are available commercially and even those require the redesign of strawberry farms to function efficiently.

In the coming years, we can expect to see much more work invested into the creation of robot-harvesters that will completely eliminate the need for back-breaking labor inherent to this low-paying and extremely difficult task.

The demand for robots in agriculture grows by the day and scientists respond to it by creating more and more advanced robotic solutions.