Servos and motors: A-Star 32U4 Robot Controller SV with Raspberry Pi Bridge

I am building two different robots using the A-Star 32U4 Robot Controller SV with Raspberry Pi Bridge attached to a Raspberry Pi. On both I planed to use both servos and motors.

I see in Controlling a servo with an Arduino Leonardo or A-Star 32U4 Prime that I may need to make library changes but had a couple questions…

  1. after reading a similar thread, is the issue only if they are run concurrently? Should I have no issues if I am only running one or the other at a time?

  2. Changes to libraries/Servo/src/avr/ServoTimers.h will affect app projects built on that library… can I just copy and edit a different version for these two projects and call that instead of Servo… e.g. libraries/ServoP/src/avr/ServoPTimers.h and then in the sketch call #include <ServoP.h> ?

Hello @coyotlgw,

My non scientific answers based on the experiments I made to control the servos of my RPB-202 robot:

  1. Even though you might not run the servos and motors concurrently, my observations is that the motors will not behave as expected when calling .setSpeeds() method. You may try to detach the servos before running the motors but I haven’t tried it since I wanted to be able to run the motors concurrently with the servos (object tracking with the camera pan-tilt while moving) and the modification to the servo library is quite easy (below).

  2. Yes, you can modify the library and save it in a different folder of your libraries folder. I renamed mine ServoT3 and renamed the other files in the src and avr directories as well. I also updated the file so it shows up in the Arduino Library as well as the keywords.txt file to get proper syntax highlighting (see attached zip file). To use it, I just have to #include <ServoT3.h> in my sketch and it runs well without interference with the motors*.

Hope this helps.

*I did have issues with my encoder readings with this setup though (missing encoder counts). I haven’t had the time to investigate it yet. I am thinking of using a second Arduino to control the servos. This second Arduino would receive its commands via I2C either from the Raspberry Pi or from the A-Star. I have yet to try this.

Best regards. (8.4 KB)

1 Like