PanTiltHat servos with Explorer pHat or direct GPIO

Hello,

I’m assembling a kite photography rig of sorts with a raspberry pi zero w and was wondering if I could use my pimoroni Pan-Tilt Hat minus the Hat with some other (lighter and smaller) pHat (1) or in a direct GPIO connection scheme (2).

  1. The Explorer pHat comes to mind in which case the doubt would be if I could use the pantilthat python library even if some reconfiguration would be in order.

  2. Direct GPIO connection does work but initial tests show what I would describe as a very nervous servo, one that is not exactly stationary between displacements. (I followed these instructions https://electronicshobbyists.com/raspberry-pi-pwm-tutorial-control-brightness-of-led-and-servo-motor/ )

Any recommendation (considering my very low electrical knowledge, specially) regarding direct GPIO connection of these 2 servos would be very much appreciated.

Thank you very much,
peter

Explorer pHat is a motor controller. I don’t think the H bridges will work very well controlling servo’s? If that was your plan?
This may be a better choice, https://shop.pimoroni.com/products/adafruit-16-channel-pwm-servo-bonnet-for-raspberry-pi

1 Like

The various ways of driving servos directly from the Pi are kind-of terrible, and tend to result in jittery servo performance. It can be done, though. Explorer pHAT or HAT is unecessary since it inverts the protected outputs and makes generating the right signal for a servo slightly trickier.

Definitely don’t use RPi.GPIO PWM for servo control in particular, though, the results are pretty awful. Look at something like Servo Blaster- https://github.com/richardghirst/PiBits/tree/master/ServoBlaster

Or, as @alphanumeric suggests, grab another, more compact servo driver since you really can’t beat dedicated chips! (Of course it depends what you want to do with your servos, sometimes a bit of inaccuracy and jitter is fine)

1 Like

Thank you very much, @alphanumeric and @gadgetoid,

I have read about this a while back but forgot about motors not being servos! I’m sorry for that.

Thank you again for your help, not only for having a precise servo for my current project as well as having a better way to setup the jittering servo (which is, in itself, a very interesting thing to explore next)

Cheers!

Hello! Returning to this topic since I’ve finally bought the Adafruit 16 servo bonnet as suggested.

I’ve followed the adafruit instructions using the servos from the Pimoroni Pan-Tilt Hat I got before, connected external 5v power (powerbank+cut up cable) but ended up with a quite non-tuned servo pair, moving all over the place and quickly disconnected for fear of self-destruction.

Could I use Pimoroni’s wonderful pantilthat library with Adafruit’s servo bonnet? Or do you know of any resource for tuning servo setup with Adafruit’s library?

Thank you very much!

I believe @caperjack bought one of those. I would use the adafruit library with it.
Maybe they were just hunting for their limits? Jack will likely know if that was normal or not.
I have played around with servo’s once or twice. I don’t remeber them moving on their own though?
It was a while ago, on my BBC Micro-Bit I think?

This power supply will likely work well with that, https://shop.pimoroni.com/products/5v-3a-barrel-jack-power-supply 3A and no having to rewire it, the barrel jack should plug right in.

EDIT: Looking at the adafruit servo bonnet, it goes ground, V+, then signal. You didn’t maybe plug the wrong wires into the wrong pins by accident?

1 Like

ordered explorer phat but didn’t pickup my order yet …and it will take me some time to figure out how to use it ,lol.

Hey Jack, I was referring to the Adafruit Servo Bonnet. pnbv switched to the servo bonnet after figuring out the Explorer pHat wasn’t going to do what he wanted. I do believe you also bought one of those? I think you mentioned it in the Raspberry Pi thread on Ten Forums.

Hi, @alphanumeric!

Good idea but re-checked the wiring and it was ok. Maybe my power source isn’t right.

I’m getting some electrical noises with servos stationary some of the times but I think I figured it out regarding erratic movement.

It seems it is only a question of setting the right range since the servos are assembled to the Pan Tilt mechanical frame (don’t know what to call it:) which prevents some degrees of motion.

This is, I believe, what happens with Pimoroni’s pantilthat library, it has settings appropriate to the specific Pan Tilt Hat kit. Pimoroni’s Pan Tilt Hat works very well in general and from zero’s gpio power, which is convenient. Considering moving KAP rig to a RPi 3 A+ with Pimoronis’s hat.

If anyone has experience of using Pimoroni’s pantilthat python library with Adafruit servo bonnet

Will continue testing.

Thank you too, @Caperjack1953!

Thank you again!

Ah, OK, I figured it couldn’t hurt to make sure you didn’t get the plugs on backwards by accident.
I “think” most servo’s have a 180 degree range of motion. The standard inexpensive ones anyway. The range of motion on the pan tilt thingy may be less than that, and accounted for with its matching hat. Mixing and matching can get you unexpected results. Been there done that, lol. Its all part of the game. ;)

I don’t have the Pimoroni Pan Tilt, or the Adafruit servo bonnet.

1 Like

I’m no expert, by any means. But my understanding is the library is written for the hardware, the chip thats controlling the servo’s. Not the servo’s per say. That being said, you need to look at what chip is used on either board, how its addressed, i2c etc, and what address it uses etc. Then make the necessary edits /changes.
I have no idea how easy or hard that might be.

1 Like

no i don’t own one of those ,i have this kit
https://www.monkmakes.com/servosix/

Ah, OK. Same thing but different.;)

1 Like

Something that just occurred to me is, it looks like its important to get the horns / arms on the servos in the correct position. The white bits that screw on the servo shaft. If it uses them that is. I haven’t found the assembly instructions yet.
If your orientate those wrong your range of motion will be wrong and it will hit up against the stops. probably some thumping, bumping and buzzing as it tries to keep moving but can’t.

EDIT: Found the instructions, could use more detail IMHO though.
https://learn.pimoroni.com/tutorial/sandyj/assembling-pan-tilt-hat

And saw this on the product page," The module pans and tilts through 180 degrees in each axis."
I would ay you’ll get the full range of motion if assembled correctly. ;)

EDIT: 2 Better assembly instructions, https://learn.adafruit.com/mini-pan-tilt-kit-assembly
Shows you how to get the white arms on in the correct position. If you bought the pre assembled version, just ignore this info. ;)

Yes, that’s a good tip.

I got the assembled variety of the Pan Tilt Hat, so it was aligned already. But since the Adafruit Servo Bonnet is not intended to be run with particular servo or servo assembling I guess it needs figuring out which start / end positions are appropriate.

I got this aspect on the back-burner as I’m in need of some other parts to take the pan-tilt to the sky and I’m now concentrating on the projects’s power supply.

Thanks again, @alphanumeric and @Caperjack1953!

Will get back to this thread when resuming adafruit bonnet / servo investigations.

Watching the video on the pan tilt, the servos have the full 180 degree movement. The pan can swing 180 left to right. And the tilt goes from looking straight up, to straight down. If yours was pre assembled the servo’s shouldn’t be bump stopping on anything other than their internal limits. Near as I can tell from the video anyway.

1 Like