PWM with Netduino 3

  • 666 Views
  • Last Post 28 March 2020
cd_sharp posted this 11 October 2018

Friends, I started playing with Netduino 3 to find the best way to do PWM with very low Duty Cycle. So far, this is the best result, 0.025% (thanks, Chris for the piece of code):

public static void Main()
        {
            var port = new Microsoft.SPOT.Hardware.PWM(SecretLabs.NETMF.Hardware.Netduino.PWMChannels.PWM_PIN_D6, 250d, 0.00025d, false);//1 = 100%
            port.Start();
            Thread.Sleep(Timeout.Infinite);
        }

This is probably very close to the hardware limits. I think is more than enough for any PWM application we need.

The oscilloscope calculates 0.5% duty cycle, but I am convinced it is wrong, so don't count on that reading.

  • Liked by
  • Chris
  • Vidura
Order By: Standard | Newest | Votes
Chris posted this 11 October 2018

Hey CD,

I have done some tests and it appears that the Microsoft .NET Microframework is limed to a resolution of: 0.0001

My tests show, a duty of: 0.00001 is out of range.

This is still well within what we require, being: 0.0005

My duty, on a TIP122 was 16% or 0.16, so we are well within range.

   Chris

 

P.S: Nice Work my friend!

  • Liked by
  • Vidura
  • cd_sharp
cd_sharp posted this 15 October 2018

Guys, thanks to Vidura I came up to trying this circuit which is mostly from him:

Here, my Netduino is powered by my laptop USB (which is disconnected from mains, it's only on battery). Let's say D6 pin is the output PWM and D5 pin is ground.

I have my DC power supply feeding MCP 1407 with 12 V.

This is the issue with this exact circuit:

It outputs 5V to the MOSFET gate, similar to Netduino's output signal when I was thinking it would output 12V pulses.

If I disconnect the gate of the MOSFET, it works as expected, it outputs 12V pulses:

Any idea what I'm missing and how I can make it deliver 12V pulses between the gate and the source?

Any idea why my function generator (connected to mains) delivers 12V in both scenarios?

Thanks

  • Liked by
  • Chris
Chris posted this 15 October 2018

Hey CD,

I do not quite understand the setup.

NOTE: Drawing too much current from your Netduino, may damage the Netduino. So, always use an external Supply.

Is the 12V source Current Limited?

Do you see the same ratio drop on the Netduino side of the PWM Signal?

The MCP1407 IC should put out a signal that is proportional to its input signal. So perhaps the Input Signal is also lower.

The Gate of the Mosfet or Transistor, is effectively a Capacitor, so it looks like a Short Circuit to the Current Source. For Current Limited Power Supply's, including the Netduino, there may not be enough Current available to charge up the small Capacitance.

Also, making sure pulldown resistors are turning off the required rails:

 

R1, the 220 Ohm Resistor, could be replaced with a 470 Ohm resistor. Also R1 could have a parallel Cap, 16pF or something.

I cant think of anything other than this.

   Chris

 

 

  • Liked by
  • Jagau
Vidura posted this 15 October 2018

Hey cd, check the components on the output, the mosfet, diode, pulldown  if any is damaged, check also if the 12v supply is providing enough power. By the way this IC dont need the pull down on the output, it is internally tied to ground even when power supply is  removed. on the input you can use a pulldown resistor to avoid to be triggered  the driver ic by interferences when the netduino is disconnected. if you note any undesired oscillations of the signal the R1 resistor with a small capacitance in parallel mentioned by Chris acts as a filter, but should not be necessary in usual frequency range.

  • Liked by
  • Chris
Chris posted this 15 October 2018

True, Vidura is correct:

 

 

I cant see if each Output marked above is on a different Pin, being 6 or 7, but the schematic has them connected anyway. So, the lower internal Mosfet is the pull down.

   Chris

Vidura posted this 15 October 2018

 cd, you mentioned that with the function generator you got 12 pulses correctly?  have you connected the negative of the 12v supply together with the common ground ?

cd_sharp posted this 16 October 2018

Hey, guys,

Is the 12V source Current Limited?

No

Do you see the same ratio drop on the Netduino side of the PWM Signal?

No, the output of Netduino is the same. With gate disconnected it looks good (magenta is the output of Netduino and blue is the output of MCP1407):

and with gate connected there is a time constant, probably from the MOSFET gate cap, as Chris said:

have you connected the negative of the 12v supply together with the common ground ?

Yes, a better schema of the 2 setups is this:

Thank you, guys, for all the help!

  • Liked by
  • Chris
Chris posted this 16 October 2018

Hey CD,

I would suggest a Resistor in between the Netduino and the Mosfet Gate Driver: The MCP1407 IC

I think this will help protect your Netduino by Current Limiting the Output Current, it is as a precaution.

The datasheet for the Mosfet should give you a Gate Capacitance value. It does appear this mosfet is very slow to switch!

Check your grounding, make sure all pins that are Input and not used, are grounded.

R x C is in Seconds, and if you have the gate Capacitance value, then you can at least change the Gate Resistance to change the RC Time Constant.

You don't have a capacitor between Gate and Ground there? Or Gate and IC Output?

My poor old Brain is not able to get any helpful info from your RC Time Constant Scope Shot. I cant see time, is it 5 Microseconds? per division?

If so, I think try another Mosfet, it appears to be Toast.

Try a Resistor on the Output to Ground: 10K, measure the Voltage Drop, if any.

   Chris

 

P.S: Try and implement this Circuit: 

 

  • Liked by
  • Jagau
cd_sharp posted this 16 October 2018

Hey, man,

all good and safe things to do. I'll try.

You don't have a capacitor between Gate and Ground there? Or Gate and IC Output?

No.

I cant see time, is it 5 Microseconds? per division?

Yes, 5uS, on the top left.

Thanks

  • Liked by
  • Chris
cd_sharp posted this 16 October 2018

Problem solved. R1 is to blame.

If I connect the output of the MOSFET driver directly to the gate then the pulses look good.

Thinking about the next step.. taking into account all your advises.

  • Liked by
  • Chris
Vidura posted this 16 October 2018

Then your R1 certainly was not 10ohm☺

  • Liked by
  • Chris
cd_sharp posted this 16 October 2018

You are wise. My oldest multi-meter is not measuring the correct values. It's probably the retirement time for it frown. Too bad I've never learned the resistor color codes.

  • Liked by
  • Chris
Jagau posted this 16 October 2018

hi cd
gate mosfet need to be at ground with a resistor ex: 10K have a complete time off in order to avoid the heating of the mosfet. The resistance must be according to the mosfet used.
In addition series resistor with the gate to control time on, this resistor absorbs energy of your input circuit and adapts the impedance and is directly proportional to the switching speed, it must be also calculated. See uppuer circuit Chris provide for exemple.
just to help
Jagau

  • Liked by
  • Chris
  • cd_sharp
cd_sharp posted this 18 October 2018

Guys, I've just realized I don't have a proper cable to power up my Netduino 3 through the VIN pin. All I have is the USB cable. Do you know what's the name of the cables we see here?

Thanks!

  • Liked by
  • Chris
Zanzal posted this 18 October 2018

Dupont connectors. In addition to some pre-mades of various combinations (male/female, male/male, female/female), I'd recommend getting a kit and a crimping tool and learning to make your own. Like:

https://www.amazon.com/Dupont-Connector-620Pcs-2-54mm-Housing/dp/B07BJ6WXT3

 

 

 

Chris posted this 18 October 2018

Hey CD, Zanzal is correct!

I know them as two names:

 

Of course you can get Male / Male, Male / Female, Female / Female Jumper Cables.

I sometimes spend a little time on the SparkFun website, browsing the iproducts. Its funny how one thing can have many names!

   Chris

 

cd_sharp posted this 16 March 2020

Hey, guys

I did some work lately on my Netduino to make it easy for using a constant on-time while fiddling. Unfortunately, the PWM pins on Netduino3 output 3.3V and it's not high enough to feed the signal into the Quadratron, for example.

Anybody knows how I can get the output voltage up to 5V? Maybe a DC/DC converter can do it?

Thanks

  • Liked by
  • Chris
  • Vidura
Chris posted this 16 March 2020

Hey CD,

Yes a 5.5 Volt Logic Converter:

 

There are a few places you can get this. Sparkfun might be one of the best. Here is what they have to say:

If you've ever tried to connect a 3.3V device to a 5V system, you know what a challenge it can be. The SparkFun bi-directional logic level converter is a small device that safely steps down 5V signals to 3.3V AND steps up 3.3V to 5V at the same time. This level converter also works with 2.8V and 1.8V devices. What really separates this Logic level converter from our previous versions is that you can successfully set your high and low voltages and step up and down between them safely on the same channel. Each level converter has the capability of converting 4 pins on the high side to 4 pins on the low side with two inputs and two outputs provided for each side.

The level converter is very easy to use. The board needs to be powered from the two voltages sources (high voltage and low voltage) that your system is using. High voltage (5V for example) to the 'HV' pin, low voltage (3.3V for example) to 'LV', and ground from the system to the 'GND' pin.

 

Sparkfun have a: Bi-Directional Logic Level Converter Hookup Guide

 

I hope this helps some.

Best wishes,

   Chris

  • Liked by
  • cd_sharp
Vidura posted this 17 March 2020

hey CD

If you use the Power Switch modules of the switching tool you can feed 3.3V directly if you change the "emitter diode current limiting resistor"(see users guide) . The default value is 330ohm, with 220 ohm you will be fine for 3.3V signals. 

Regards Vidura

  • Liked by
  • Chris
  • cd_sharp
cd_sharp posted this 18 March 2020

Hey, guys

Work in progress, a tool that allows keeping on-time constant. This is the hardware part finished and a successful test.

 

I wish to thank Chris and Vidura for the invaluable advice. I use the SparkFun Logic Level Converter - Bi-Directional . It's a wonderful little circuit.

Thanks for reading, friends

cd_sharp posted this 28 March 2020

Hey, friends

Long time no talk. I had my hands full with work and dodging COVID-19, but I didn't freeze my work completely. Here is a heads up for the Android PWM Client app I'm working on. I'll use it to control my Netduino from my smartphone. Notice the capability of setting the on time value, a feature my SG lacks:

Coming back soon,

Thank you

Members Online:

No one online at the moment

Since Nov 27 2018
Your Support:

More than anything else, your contributions to this forum are most important! We are trying to actively get all visitors involved, but we do only have a few main contributors, which are very much appreciated! If you would like to see more pages with more detailed experiments and answers, perhaps a contribution of another type maybe possible:

Donate (PayPal)

The content I am sharing is not only unique, but is changing the world as we know it! Please Support Us!

Donate (Patreon)

Thank You So Much!

Weeks High Earners:
The great Nikola Tesla:

Ere many generations pass, our machinery will be driven by a power obtainable at any point of the universe. This idea is not novel. Men have been led to it long ago go by instinct or reason. It has been expressed in many ways, and in many places, in the history of old and new. We find it in the delightful myth of Antheus, who drives power from the earth; we find it among the subtle speculations of one of your splendid mathematicians, and in many hints and statements of thinkers of the present time. Throughout space there is energy. Is this energy static or kinetic? If static, our hopes are in vain; if kinetic - and this we know it is for certain - then it is a mere question of time when men will succeed in attaching their machinery to the very wheelwork of nature.

Experiments With Alternate Currents Of High Potential And High Frequency (February 1892).

Close