Hello, in first lines i want to say thanks to all developers of myrobotlab, great work!

I have a question about Raspberry Pi2 and Adafruit16Channel HAT, i downloaded latest release of MyRobotLab from github, in raspbian, i started it by java -jar myrobotlab.jar, but in runtime tab i not found Adafruit16Channel PWM, only AdafruitMotorShield and other..

How to control servos with Adafruit16Channel HAT (Raspberry) with MyrobotLab, sorry for my bad english.

have a nice day!

Mats

8 years 10 months ago

I don't think that there is any service available today to use it directly.

I can think of at least three different alternatives, that are more or less difficult to do.

1. Use the I2C bus on the PI. That would require a new service, that probably only work on the PI since a PC doesn't have any I2C ports. 

2. Use a dedicated Arduino whereyou make a sketch that can talk with the Serial service. The sample that Adafrit provides could be used as a template. https://learn.adafruit.com/16-channel-pwm-servo-driver/using-the-adafru…;

3. Incorporate I2C communication into MRLComm, but I think that may be difficult for two reasons. The Adafruit_PWMServoDriver library may conflict with other librarys already used in MRLComm. I'm not sure if it will. MRLComm is already close to using to much storage.

I would try alternative 2, since it would be possible to do without any changes in MRL, and the method would work in both a PC and a PI. Probably also the least difficult to do.

 

 

 

 

Sorry. I looked at the wrong hardware. 

https://www.adafruit.com/products/2327

If that is what you want to use, then alternative 1 is the option to go for. But that's not an easy path.

Adafruit provides examples for Python, but the Python used in MRL is not Python, but Jython ( A java implementation of Python ). And it can't use Python libraries. So you need something like http://pi4j.com/ to be able to access I2C from Java. And it would also require someone to build an MRL Service.

Perhaps it's possible to make a Python program that can communicate with the I2C bus and MRL in some alternative way. Named pipes or some network protocol perhaps.

 

Hi

I just want to tell you that the hardware that you have is now supported in MyRobotLab.

The services involved are

Servo => Adafruit16CServoDriver => Raspi

You can start it manually from the GUI by first starting the Adafruit16CServoDriver service and then start a Servo service. Attach the servo to the Adafruit16CServoDriver and select the pin you want to use.

/Mats