Machine Learning, Robotics, .Net Gadgeteer, Big Data, Cool stuff

Main menu

Post navigation

.Net Gadgeteer; Servo Connection

A few days ago I showed how to hook up Sparkfun’s Bluesmirf modules. Today, I will show how to connect a servo to .Net Gadgeteer.

To determine which sockets are capable of PWM you can consult the GHI Gadgeteer site. There is a useful diagram there of the socket mapping:
As you can see the sockets with a “P” have PWM (this would be sockets 8,11). And on these socket’s pins 7,8,9 are the PWM pins. Code below better illustrates this.

The servo I am using an older micro servo, Cirrus cs-21bb, but this should work with most servos.

The pin connections to the server are very simple:

The servos ground wire (black ) is connected to the ground of your 5v external power source. And be sure to also connect ground to the Gedgeteer’s ground pin on the Extender Module.

The servos power wire (red ) is connected to your external power source’s positive(+).

The servos control wire (white) is connected to the Gadgeteer’s PWM output pin which is pin 7,8, or 9.

Here is a close up of the Extender Module wired to the servo:
As you can see the breadboards power rail is powered seperately from the Gadgeteer but the grounds are common. It is important that the grounds be common.

Like this:

Related

10 thoughts on “.Net Gadgeteer; Servo Connection”

Nice writeup…wish I’d found this last night. I was struggling with making some FEZ panda servo example code work with Gadgeteer. Turned out that my big problem was trying to power the servo straight off the extender module, rather than from external power.

Maybe the FEZ Panda provides more current, but those examples showed hooking directly into the 5V and GND on the board itself. Learned a bunch in the process, though.

The extender module is extending your Gadgeteer into other circuits. So there are a few issues to consider here. The main issue in this case is servo noise. Servos are very noise (all DC motors are). Without a common ground, noise will travel back through the signal wire (white wire) and into your MCU (Gadgeteer Mainboard) or into other modules. When you fail to connect everything to a common ground, what you will usually experience is a MCU that shuts down or you might get noise in other signals. Its *usually* harmless but the program will stop running most often. If the difference in potential is great enough there is a risk of shock and circuit damage.

Basically, having a single power source with a common ground is a good idea. Capacitors across noisy circuits is also a good idea. Finding the right size of cap is more of an art however. For instance, the Sanyo IR range sensors can be noisy. Putting a 35uf cap across + and- can stop spikes from inducing noise.

Wow, thank you for you long reply. It is very helpful. But I still have one shot question. If I have two servo motors, each connected to own power source.
1. If I use one extender module. May I connect ground from extender module with ground of first power source and secound power source?
2. May I use two extender modules and on first connect ground of first motor power source and secound on other motor power source, or I need to connect all grounds (from power source 1, power source 2 and microcontroler) together?

In the case of two servos you will want each servo’s ground and the MCU (Gadgeteer mainboard) to all share a common ground.
Each extender module (all modules really) share the same ground with the MCU. So as long as you connect each servo’s ground to the extender module’s ground you will be good to go. By connecting everything to the extender’s ground you close the loop, driving everything to a common ground.

1.) Yes. I assume you are using regulated DC power sources.
2.) Yes. As I explained above, the ground on each extender module is common with the MCU and all modules.

I just realized you had an “OR” in your second question…so yes is a confusing answer. 🙂
Let me clarify, Yes, you can just connect the servo and its ground to the extender’s ground. You don’t need to connect each power sources ground together because connecting to the Gadgeteer’s extender’s ground you are effectively doing that already. I hope that makes sense.

Hmm, this sounds like something I should write a while post about. Thanks again for the questions.