Introduction: Automation of an Articulated Arm With Raspberry Pico

About: I spent my career in computer networks. Now retired I am interested in topics that work my neurons. I am passionate about home automation and site administration that I host at home. I acquired skills in the f…

Robotics is accessible to everyone and moreover it is simple to control. However, special attention should be paid to certain technical aspects. And more particularly to the handling of servomotors. 

The project uses readily available components. Once the components are assembled, they will be coordinated by a micropython program with the Thonny application.

A previous version of this project was driven by arduino-IDE. The new generation of microcontrollers gives a new direction to projects and programming. The micropython language seems to me easier to use and in particular the Thonny interface. Of the three published articulated arm automation projects, this is the most successful.

The robot is an articulated arm that moves on three axes and is driven by 6 servomotors.

The particularity of the program is to be able to memorize the successive positions of the arm.

We can then ask the program to place the arm successively in the positions recorded as visible on the video. For the video only 7 positions have been memorized.

The program is responsible for smoothing the movement.

The positions will remain stored when the power is off.

Everything is controlled using a smartphone using a Bluetooth app.

Supplies

Articulated arm kit

The complete articulated arm kit can be found for less than $50. Unfortunately if the mechanical parts are of good quality, the servomotors (MG996) are not. During the tests two servos burned out. They have been replaced by more expensive but robust DS3225MG servos. Mounting the arm does not pose any particular problems. Having noticed that screws were unscrewing under the effect of vibrations, I recommend adding self-locking washers.

Raspberry pico

A latest generation controller from the Raspberry family.

Bluetooth HC05

Easy to program module.

Power supply

The power supply must be efficient and allow current peaks of up to 2.5 amps. The display of the current consumption makes it possible to control the drifts. For example, in the event of a servomotor blocking, the current will increase sharply and the voltage may decrease below 4V, which may cause erratic movement of the servomotors. A visual control of the power supply becomes essential.

Android App

To control the arm, a smartphone or tablet with the "Bluetooth Remote" application will be used. This free application is simple to configure. It is based on the creation of programmable buttons. For each button, a sequence of characters to be sent via Bluetooth is defined. The Arduino equipped with the HC05 module will receive the information to transform it into actions.

EEPROM memory

The arm memory consists of a module containing an AT24C256 or AT24CXX Eeprom. This memory is used to keep the information after the model is turned off. This information is available after reboot. This module is connected in I2C.

Step 1: Diagram of Assembly

Diagram of the assembly

The electronic circuit is simple to make.

Step 2: Smartphone App

The "Bluetooth Remote" app is used to transmit movement commands.

This free application is simple to configure. It is based on the creation of programmable buttons. For each button, a sequence of characters to be sent via Bluetooth is defined. The HC05 module will receive the information to transform it into actions.

To begin we will program the keys necessary for the basic functions, namely the movement of the 6 servos. The programming is done according to the above drawing.


Step 3: Software

The implementation of the Thonny software is not covered here. Many articles are available on the web. 

The program consists of two files: a main program (main.py) and a file containing functions (functions.py).

The main "main.py" program is simple and refers to functions in the "functions.py" file. The use of functions avoids the repetition of code and facilitates the readability of the program.

In order to facilitate understanding, the explanations will be done with the help of drawings.

In the setup some servos cannot rotate through the full 180° range. They will be mechanically blocked by the supports and will begin to heat up. It is therefore necessary to protect them by limiting their rotation.

The following drawing gives the steps for calibrating the servos.

The "table_home" table (functions.py) contains the position of the arm at power-up. It is recommended before powering up to manually bring the arm back to this initial position. If the arm is in another position, a sudden movement will take place when the power is turned on!

All these values ​​are to be updated if you carry out this project!

Step 4: Software Functions

All functions are located in the "functions.py" file. All the sources can be downloaded here <== .

(A) the physical control of the servos is done by the pulse width. In our case the width of the pulses varies between 1700 to 8200. The program works with the angle of rotation (0 to 180°). We use functions to convert from one to the other.

(B) Eeprom memory configuration. We use the term "sequence" to define the position of the arm's 6 servos at a given time. Each servo value uses 4 bytes of memory. 

We use two pointers to move in the memory (current and max).

(C), (D) The motion functions of the robot.

Step 5: Continuation and End of App Programming

After the explanations on the functions, you can move on to finalizing the programming of the Bluetooth Remote application.

"POS" key lists the current state of the parameters to the console by calling the "infos()" function.

Key "seq+1, seq-1, max+1, max-1" increment or decrement the pointers at the start of memory (current and max pointer).

"write seq" key writes in memory the current position of the robot at the position indicated by the current pointer ("eeprom_write_robot_pos()" function).

"home" key uses the "servo_home_pos()" function to move the arm to its home position.

"play seq" key uses the "robot_move_seq()" function to move the arm to the position indicated by the current pointer.

Step 6: Animation of the Arm

Using the tools described above, it is now possible to create an animation of the arm by successively positioning it in various positions. Two additional functions allow to create an animation.

The "robot_move()" function moves the arm from the current position to a destination position. This function will alternately activate the 6 servos in order to make the movement of the arm fluid.

"play scenario" key uses the "scenario() function which calls "robot_move()" in order to place the arm successively in various positions from sequence 1 to the sequence indicated by the max pointer. The video showing the movement of object was only realized with 7 arm positions.

The scenario starts after 10s (time that can be modified at the start of the function).

Conclusion

This project demonstrates the possibility of simply creating an animation of a robot by memorizing a few positions.

You can now give free rein to your imagination for the modeling of your robots. Enjoy it!