Close

5. Getting Started With Infineon Version

A project log for Work-holding Robotic Arm for Electronic Workshop

Collaborative Robotic Arm Used as Assistant in an Electronic Workshop And Controlled by Voice Commands and Capsense Technology

guillermo-perez-guillenGuillermo Perez Guillen 07/29/2023 at 23:490 Comments

In this section we will use ModusToolbox 3.0 which has enhanced support for multi-core project workflow. The release features dual-core device support, a new graphical tool for customer board support package (BSP) development, infrastructure support for ModusToolbox Packs and backend system improvements.

ModusToolbox 3.0

ModusToolbox 3.0

About ModusToolbox software you can find the documentation here: https://www.infineon.com/cms/en/design-support/tools/sdk/modustoolbox-software/

The PSoC™ 62S2 Pioneer Kit features the PSoC™ 62 MCU (CY8C624ABZI-S2D44): 150-MHz Arm Cortex-M4 and 100-MHz Arm Cortex-M0+ cores, 2MB of Flash, 1MB of SRAM, Secure Digital Host Controller (SDHC) supporting SD/SDIO/eMMC interfaces, programmable analog blocks, programmable digital blocks, Full-Speed USB, a serial memory interface, a PDM-PCM digital microphone interface, and industry-leading capacitive-sensing with CAPSENSE™.

Documentation: https://www.infineon.com/cms/en/product/evaluation-boards/cy8ckit-062s2-43012/

The PSoC™ 62S2 Pioneer Kit

The PSoC™ 62S2 Pioneer Kit

CAPSENSE™ technology:

Controlling Servo Motor With ModusToolbox

Servo motors are electromechanical devices that have the ability to control the angular position of their axis, their operation consists of receiving the information of the desired angle through the pulse width of a PWM signal to bring the axis to said position. According to the datasheet of the SG995 we have this graph that helps us to control the PWM signal and the duty cycle.

SG995 Datasheet

SG995 Datasheet

The position of the axis of the motor depends on the duty cycle of the signal. There are some standard calculations for degree rotation. If the PWM signal is high for 0.5ms in a single cycle, the axis moves to zero degrees. To rotate the motor axis to 90 degrees, the signal should be high for 1.5ms. Similarly, a 2.5ms ON-time signal leads to 180-degree axial position. In this way, we can measure and control our servo motor to desired degrees.

Correlation between the duty cycle with the angle of the servo

Correlation between the duty cycle with the angle of the servo

According to the example "HAL PWM square wave" we see that it uses a library to control the PWM signal and the duty cycle. I just have to insert the values of the frequency and the duty cycle percentage. By interpolation, we can calculate: if 20 ms is 100% duty cycle, then 0.5 ms is 2.5% duty cycle. Similary 1.5 ms is 7.5% duty cycle, and 2.5 ms is 12.5% duty cycle.

I experimented with this data, and the only value I adjusted was the 0° angle at 3% duty cycle, because the servo was vibrating and making noise at 2.5%. The final data is shown below:

Correlation of the values with the percentage of the duty cycle

Correlation of the values with the percentage of the duty cycle

Fitting a data set to a trend line using excel

The data between the angle and the duty cycle percentage are not linear, so I found a method to get a formula with excel.

Obtaining the formula to calculate the percentage of the duty cycle (y), if I have the angle that the servo rotates (x)

Obtaining the formula to calculate the percentage of the duty cycle (y), if I have the angle that the servo rotates (x)

This is the formula that I will use in the next sections to move each servo of the robotic arm.

Discussions