Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

METRO EXPRESS M0 not working with multiple servos
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

METRO EXPRESS M0 not working with multiple servos

by Cinbarker on Fri Apr 17, 2020 6:47 am

I recently purchased a Metro Express M0, and am using it with Makecode. I have found that while the basic function works, using more than two servos (or digitalWrites) at a time causes the code to freeze and stop working. I have tried all combinations of supported pins, and none are able to write to three servos at a time.
Does anyone know what type of issue this is, and whether there is an existing solution for it?
Thank you.

Cinbarker
 
Posts: 4
Joined: Fri Apr 17, 2020 6:32 am

Re: METRO EXPRESS M0 not working with multiple servos

by adafruit_support_bill on Fri Apr 17, 2020 6:54 am

Please post some photos of your setup and also please post the code you are using.

adafruit_support_bill
 
Posts: 79114
Joined: Sat Feb 07, 2009 10:11 am

Re: METRO EXPRESS M0 not working with multiple servos

by Cinbarker on Fri Apr 17, 2020 9:42 am

Here is a screenshot of the code in Makecode. My wiring setup is identical to the simulation. I tried addressing each servo individually and it does work. Only addressing all of them breaks it. I also tried moving the servos together with the Arduino IDE, and it worked. Unfortunately I have not been able to do the same in Makecode
Screen Shot 2020-04-17 at 15.35.42.jpg
Screen Shot 2020-04-17 at 15.35.42.jpg (339.3 KiB) Viewed 55 times

Cinbarker
 
Posts: 4
Joined: Fri Apr 17, 2020 6:32 am

Re: METRO EXPRESS M0 not working with multiple servos

by adafruit_support_bill on Fri Apr 17, 2020 9:55 am

3 servos powered by the 3.3v rail all moving at exactly the same time could be causing a power glitch sufficient to disrupt the processor.
What are you using to power the Metro?

adafruit_support_bill
 
Posts: 79114
Joined: Sat Feb 07, 2009 10:11 am

Re: METRO EXPRESS M0 not working with multiple servos

by Cinbarker on Fri Apr 17, 2020 10:11 am

Thank you for your reply. I now tried powering the servos with 3.3V (and 5V) from an external power supply, as well as powering the Metro itself with a separate 7V power supply via the DC jack. Unfortunately I still get the same result. The servos twitch once, and then the code stops executing altogether.

Cinbarker
 
Posts: 4
Joined: Fri Apr 17, 2020 6:32 am

Re: METRO EXPRESS M0 not working with multiple servos

by adafruit_support_bill on Fri Apr 17, 2020 10:16 am

OK. Let me check with some of our Makecode experts to see if they have seen anything like this before.

adafruit_support_bill
 
Posts: 79114
Joined: Sat Feb 07, 2009 10:11 am

Re: METRO EXPRESS M0 not working with multiple servos

by Cinbarker on Sat Apr 18, 2020 8:03 am

Thank you for the help! I have been doing more testing, and I found that putting the servoWrites in a run in parallel loop does help the problem. Unfortunately it is not only working on only up to 4 servos, and as soon as I add any music components, it also breaks. Attached below is the code I used.
Screen Shot 2020-04-18 at 13.55.15.jpg
This code works, however only with these pin numbers (9, 10, 11, 12).
Screen Shot 2020-04-18 at 13.55.15.jpg (115.39 KiB) Viewed 43 times

Screen Shot 2020-04-18 at 13.55.48.jpg
Adding the music breaks it.
Screen Shot 2020-04-18 at 13.55.48.jpg (133.21 KiB) Viewed 43 times

Cinbarker
 
Posts: 4
Joined: Fri Apr 17, 2020 6:32 am

Please be positive and constructive with your questions and comments.