Main Site Documentation

PulseinOut Module Help me ! pls!


Hi all,

I’m newbie with gadgeteer techno. Actuallly, i’m working on PulseInOut Module. First, I seek everywhere a tutorial for this module. But I can’t found somethings. So, the best way is go ahead and do it myself.
On the pic attached in this post, I wired the pwm 3, I even take attention to ground pin. Unfortunately, not run ! :(, T_T

My code for this test is quite simple :

void timer_Tick(GT.Timer timer)
Debug.Print(“Setpule 3”);
pulseInOut.SetPulse(3, 20000, 1500);

I have some other questions, can you please clarify me :

  • I see three pins attached with PWM 3 (on the right hand side of PWM 3), what
    are their features ?
  • On the left hand side, I see also three other pins attached with INPUT 3. I see that at the top of INPUT 8, there are 3 indications GND (ground), NC (notConnect ??? ), IN (get input state of current pwm), can you confirm me that these three pins are corresponding to these indications above ?

Sorry for my stupid questions

Can you help me, pls !

Best regards and thanks a lot your helps.

Gadgeteer’s newbie.


Let me first explain what the SetPulse function does. It sets up a particular output to a PWM signal of a certain type. So what your timer does is set up the PWM to be exactly the same every time. So you really can’t tell if it’s doing anything, because it’s not changing over time. You would be better off testing this in a thread that changes the signal so that you can see/measure some tangible change. Perhaps the setting you used just doesn’t give you a visible output on your LED?

You should also take a look at the schematic. From that, you can see the centre pin on the PWM outputs are connected to nothing, unless the jumper is across JP1. This should only affect things if you’re using the centre pin or if you’re trying to use servos (eventually; it’s easy to see you’re just using LEDs to start)

Another test you should do is to explicitly power the LED from 3v3 from the module to make sure you have that working before trying to get PWM working. You can also test PWM from a PWM pin on the mainboard to understand what is visible and what is not.

There’s the test application available on codeplex in the module’s source code - should be the direct link to it. From there you can see an example of how the GHI team have used to demonstrate that the device works.

Do you have a voltmeter? If so, you can use that to measure the “approximate” voltage that is on the outputs. a duty cycle of 50% should give you a result of around 1.65v.


Just further on pins. Take a look at the hi-res silkscreen image on, all my notes are based on that image

on the INPUT header:

  • GND is Ground. It is located closest to the edge of the PCB.
  • NC means “not connected”, so it’s not connected to anything and there’s no point connecting anything external to the module to it. It is the centre pin of the 3.
  • IN is the actual INput pin. So if you want to measure IN8, you connect a wire to the IN pin on the input 8 row, which is the pin furthest away from the PCB edge.

on the OUTPUT header:

  • GND is on the edge of the PCB.
  • the centre pin is connected to the jumper at the top of the PCB (you’d have to check to confirm this, but I expect it to be the BOTTOM pin, and the top pin will link to the module’s 5v supply)
  • the pin furthest from the PCB edge is the PWM signal output (so in your case, is the one you need to use)


@ Brett : You’re adorable :clap: ! I will come back to you after trying to follow your instructions.
Thanks again.


Hi Bret and all Gadgeteer’s members,

I have followed the Bret’s instructions. I thinks that I get some errors about my circuit with PWM - see it in the attached file, I think it’s not correctly wired ! because I don’t see any change of light power. Can you please give me some helpful informations.

Thanks a lot.
Gadgeteer’s newbie.

Here is the code i have used for the test application.

void ProgramStarted()
            Debug.Print("Program Started");

            Thread thread = new Thread(run);


        void run()
            for ( ; ; /*=while(true)*/ )
                for (ushort i = 0; i < 1900; i++)
                    Debug.Print("Timer " + i.ToString());
                    if (i % 4 == 0)
                        pulseInOut.SetPulse(4, 5000);
                    if (i % 4 == 1)
                        pulseInOut.SetPulse(4, 10000);
                    if (i % 4 == 2)
                        pulseInOut.SetPulse(4, 15000);
                    if (i % 4 == 3)
                        pulseInOut.SetPulse(4, 20000);
                    int high = 0;
                    int low = 0;

                    pulseInOut.ReadChannel(4, out high, out low);


Your code is not going to generate anything sensible. You flip, with only a 50ms pause between each change, from 5000 to 10,000 to 15,000 to 20,000. You should just use the same structure as the demo code that the GHI team provided, at least it steps through sequentially and you may see that change ! Also note, in the GHI sample code, they set the frequency once, which you never do, so you may not actually have the PWM running! (but also note, their PWM is intended to turn a hobby servo, so you may need to change the lower and upper limits of the inner FOR loop).

Did you test PWM on the other LED? Did you get it to work ? From looking at your breadboard, the blue jumper wire that runs from the power rail and up to the point where the IO from the pulseinout module comes over will always power the LED, so really it’s no wonder that it doesn’t change - get rid of that and see if you can see the LED flicker with your current code, or make the change above and you should see a more understandable change in intensity.


Hi Brett,

Thanks for your answer. Unfortunately, the setFrequency is not enable since .netmf 4.2
You can see it at :

Is there an equivalent function for it ? Or we need to implement it ? In waiting your response, i will try with different methods I can imagine :slight_smile:

Best regards,


@ Jeff@ GHI (or whoever manages the code) the module code and the example (also in the code) are out of sync as they won’t compile. Please fix :slight_smile: While I have your attention, this seems redundant or at the minimum pointless, because a highTime with no full pulse length being known is… what, a non-oscillating signal?

@ hoavinh, then you need to use the only PWM call that makes sense without the ability to set an overall frequency.... 

```cs]SetPulse(int pwm_id, uint period_microsec, uint highTime_microse)[/code

Don't change the period, just the highTime value.  Vary the highTime from 0 to the period. That should show you a change from 0 to 100% intensity.


Thanks Brett, I have one question about the pin 5V and OUT/GND on the top of the PWM module.
How to use these pins ?
I can directly wire on this 5V pin and out/gnd pin for powering an electronic circuit ?


You can not just connect them without telling us more information. But lets go back a step…

Go back to my earlier note. The silkscreen labels are telling you that the ORDER of the 3 pins from left to right (interior pin to the one on the outside edge of the PCB) are the output pin (so the PWM output signal), the “5v” line, and the GND. This structure is repeated for the 8 outputs. This 3-pin layout is exactly the layout that a hobby servo uses.

From the schematic you can see that the “5v” line is actually not connected to the 5v power rail from the Gadgeteer socket, UNLESS you close the jumper JP1. JP1 is the two headers at the top of the module, at the point where the “5v” on the silkscreen is. The intent of this jumper is that if you ARE using servos which draw more current than the Gadgeteer mainboard can supply, you want to use an external power source for them and you can inject your own 5v source into the lower of those two points, which then powers the bank of 8 servos. If you are not using servos that require more current than the Gadgeteer mainboard can provide, you can connect those two pins and the servos would be powered by the mainboard.

The main reason for needing more information is to understand what current requirements you have and how you’re powering the device in the first instance. Typical onboard 5v power is limited to either 500ma if powering over USB (you might get more, but can’t guarantee it), or 800ma if you’re using a DP power module. So tell us more about what you’re trying to achieve and then we can talk more about what options you might have. If you just need to power an “electronic circuit” that consists of an LED like we’ve seen, then yes that works, as we’ve seen, but is only using 3v3 signal from the onboard processor, not 5v…

And did you prove PWM works ? :slight_smile:


Thanks Brett for your kindness, that is clear for me.

Best wishes,


I’ve finished my small project about PWM module gadgeteer. Thanks a lot Brett for your help.
I want to post here 2 pictures, the first one use the power 5v supply provided by mainboard spider, another use the external power 12v. That may helps everyone to discover PWM Gadgeteer module