I2C Servo Shield

I went out on a limb, bought a servo shield and just received it. Soldering as we speak and was wondering if anyone has used this shield? https://www.adafruit.com/product/1411

Is there a driver for this shield? Only have I2C example to go off of …

That’s the same I2C chip, PCA9685, that they use on the MotorShieldV2, which I’ve been using of late. It worked pretty much as expected until I added a bluetooth board (there’s a recent thread about it). After fighting for a few days with it and the bluetooth I finally stumbled on a solution that involved applying an additional pull up to the 5V on the N+2. We played with it for a good few hours this weekend though with no significant problems after applying that set of pull-ups. I’m not sure how well it’ll deal with the servos, as I’m only controlling DC motors at the moment, but I look forward to hearing your results. I’ve got plans for the servo control on the motorshield too.

I just got the temperature sensor today thats used in the tutorial I2C Reading - Wilderness Labs Developer Portal but looking at the servo shield documentation to try and grasp how to send/receive to the shield.

Looking at the ReadWrite for Temp example - I do not understand why when the return value is 13-bit why we shift the values 5 on the lvalue and 3 on the rvalue byte parts. The last thing I want to do is blow up my hardware with me hooking pins up and not understanding why. So I am probably being OVER cautious.

So if the shield to control DC motors is similar could you share your code? I have a share on drop box that you can upload to.?
https://www.dropbox.com/sh/lhx0xy15sapkxq5/AADq4cH1FwQ6J4rSXmh-QV50a?dl=0

I don’t think that my code will help directly since I’m controlling another shield, but the I2C chip is the same on both. Take a look here, specifically at the TA.NetMF.AdafruitMotorShieldV2 code.


I think that you’ll be able to work with the PCA9685 related classes, and the documentation from Adafruit on the servo shield to get started.

So, I’ve just looked at the data sheet for that TI TMP102. When you are reading the temperature register, if the rightmost bit in the second byte is 1 (indicates “Extended Mode”) you’ll need to do as you’ve suggested with your “shift and or” method, otherwise it’s a 12 bit result, and the tutorial method would be correct. Also if you aren’t using “extended mode” you don’t even need to process the second byte if you aren’t interested in the fractional part of the temperature, perhaps that’ll help.

There is a library (currently in development) with a number of I2C sensor examples in the Wilderness Labs github repository:

Netduino.Foundation

The I2CBus class (Netduino.Foundation.Devices) has a number of methods for communicating with I2C devices and also allows for multiple devices to be connected to the I2C bus. This is used in a number of sensors in the library.

Regarding the bit shifting on the TMP102, this is specified in the data sheet for the sensor and will be different for each device.

Please note that this is a work in progress and as such it is subject to change.

Regards,
Mark

1 Like

Mark

Thanks for the help I started looking at the projects that you listed and looked at the documentation for my shield. I am going on vacation for 2 weeks and cannot take anything. I will have the week off during Christmas and hope to get further along on this

Thanks