Running PWM Servo FeatherWing By Itself

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Latinsk8er
 
Posts: 6
Joined: Mon Dec 19, 2022 12:55 pm

Running PWM Servo FeatherWing By Itself

Post by Latinsk8er »

So I am completely new to microcontrollers and this type of stuff in general. I want to control one to two servos for an animatronic and I came across the PWM Servo FeatherWing. So I quickly ordered it and now that I have it, I am lost. I may have misunderstood when the description said "You can stack it with any other FeatherWing or with itself (just make sure you have each wing with a unique I2C address)", as meaning that I only needed the FeatherWing to control the servos. But now that I have it in my hand, I am pretty sure I need a Feather or Arduino or something similar. I am lost in this awesome word of microcontrollers and electronics. I have not idea how, once I figure out the code, I would transfer it to the FeatherWing. Any help would be appreciated. Like I said, this is my first step into this. Thanks.

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Running PWM Servo FeatherWing By Itself

Post by adafruit_support_bill »

The PWM Servo Wing requires a microcontroller to control it. It is designed to plug directly into any of the Feather microcontroller boards. It could also be attached to most other microcontrollers via jumpers.

See the documentation for the Wing here: https://learn.adafruit.com/adafruit-8-c ... eatherwing

User avatar
Latinsk8er
 
Posts: 6
Joined: Mon Dec 19, 2022 12:55 pm

Re: Running PWM Servo FeatherWing By Itself

Post by Latinsk8er »

adafruit_support_bill wrote: Mon Dec 19, 2022 1:19 pm The PWM Servo Wing requires a microcontroller to control it. It is designed to plug directly into any of the Feather microcontroller boards. It could also be attached to most other microcontrollers via jumpers.

See the documentation for the Wing here: https://learn.adafruit.com/adafruit-8-c ... eatherwing
Thank you. I figured that was the case. I guess I need to hurry and order one. Any suggestion for which one for this simple task?

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Running PWM Servo FeatherWing By Itself

Post by adafruit_support_bill »

The Feather M0 Express would be a good choice: https://www.adafruit.com/product/3403
It can be programmed in either Arduino or CircuitPython. And it has a small prototyping area in case you want to add any circuitry for additional features on your animatronics.

User avatar
Latinsk8er
 
Posts: 6
Joined: Mon Dec 19, 2022 12:55 pm

Re: Running PWM Servo FeatherWing By Itself

Post by Latinsk8er »

Thanks again!!

User avatar
Latinsk8er
 
Posts: 6
Joined: Mon Dec 19, 2022 12:55 pm

Re: Running PWM Servo FeatherWing By Itself

Post by Latinsk8er »

So now I have my M0 Express and my Servo Featherwing. I have it all soldered up and connected. I have power to the wing and to the Express. I have a MG90D servo connected to servo channel 0 but I cannot get it to move. I am using MU and this is the code I copied from a tutorial, but I keep getting a error that "pca in not define". I don't know what to define it as.

1 import board
2 import busio
3
4 i2c = busio.I2C(board.SCL, board.SDA)
5
6 import adafruit_pca9685
7
8 servo_channel[0] = pca.channels[0]
9
10 pca.frequency = 50
11
12 import adafruit_motor.servo
13 servo = adafruit_motor.servo.Servo(servo_channel)
14 servo.angle = 180


My ultimate goal is to have the servo go from 0 to 180 and back every 10 seconds. I have been searching for 2 days on how to do this. I can't get the servo to move. I know I am in over-my-head, but I am trying to learn. Any help would be greatly appreciated. Please and thank you.

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Running PWM Servo FeatherWing By Itself

Post by adafruit_support_bill »

Not sure which tutorial that code came from. The Wing tutorial has example code using the current 'servokit' library. Make sure that you have all the right libraries installed: https://learn.adafruit.com/adafruit-8-c ... es-3012512

Servo control is explained here: https://learn.adafruit.com/adafruit-8-c ... os-3012505

And example code to sweep back and forth is here: https://learn.adafruit.com/adafruit-8-c ... de-3013006

User avatar
Latinsk8er
 
Posts: 6
Joined: Mon Dec 19, 2022 12:55 pm

Re: Running PWM Servo FeatherWing By Itself

Post by Latinsk8er »

adafruit_support_bill wrote: Thu Dec 29, 2022 1:15 pm
And example code to sweep back and forth is here: https://learn.adafruit.com/adafruit-8-c ... de-3013006
Thank you. I cleared out my lib and replaced the code.py. IT MOVES! I just need to look at those other examples to see how to create a loop. Thanks for the help.

User avatar
Latinsk8er
 
Posts: 6
Joined: Mon Dec 19, 2022 12:55 pm

Re: Running PWM Servo FeatherWing By Itself

Post by Latinsk8er »

[/quote]
Thank you. I cleared out my lib and replaced the code.py. IT MOVES! I just need to look at those other examples to see how to create a loop. Thanks for the help.
[/quote]

I finally got it to work the way I need it to!!

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Running PWM Servo FeatherWing By Itself

Post by adafruit_support_bill »

Good to hear. Thanks for the follow-up.

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”