Page 1 of 2

PWM to Com Port

PostPosted: Wed Jan 19, 2011 10:26 pm
by Klaus
Hi FlowStone users,
I am just introduced to FS and English is not my first language, so please be patient with me.
I want to create a PWM signal via FS and send it out to the serial port (Com port).
I used the PWM module but it only works with mono connectors. How can I convert the
mono signal into the String signal of the com port out interface module?

Any help is welcome.

Greets,
Radian

Re: PWM to Com Port

PostPosted: Wed Jan 19, 2011 11:02 pm
by Morph
You can use an Mono to Float primitive with an Ticker 25 or 100, which is the fastest for green stuff. Note that green stuff depending on windows timer and is not sample accurate as mono is.

Re: PWM to Com Port

PostPosted: Wed Jan 19, 2011 11:23 pm
by sal
hello,
the mono to float module needs to be triggered so the signal will get fragmented.
I have tried something of similar with the network modules and It depends on what you want to accomplish, but if you need a continuous signal this is not the solution.
S.

Re: PWM to Com Port

PostPosted: Fri Jan 21, 2011 7:53 am
by DSP
What you are asking is not possible. PWM is usually used to control DC motors and is usually in Khz , Com ports are relatively slow and are used to send numbers not pulses.

If you want to control a motor then I would suggest you use a Phidgets DC Motor controller:

http://www.phidgets.com/products.php?category=12&product_id=1064

or if you want to control a RC servo motor:

http://www.phidgets.com/products.php?category=11&product_id=1061

What is your application?

Re: PWM to Com Port

PostPosted: Fri Jan 21, 2011 8:02 pm
by Radian
Thanks guys.
I only need a frequency of 200-500hz to supply a solenoid that turns a lever.
What about direct sound out. How does a PWM signal look after the soundcard?

Greets,
Radian

Re: PWM to Com Port

PostPosted: Sun Jan 23, 2011 4:55 am
by DSP
The Audio out would work to give you PWM, you would just need a transistor to provide sufficient current.

Having said that if it is a solenoid why do you need PWM?

Solenoids are usually on or off so it's not necessary to use PWM.

A simple relay would do the trick :

http://www.sigma-shop.com/product/7/usb-relay-controller-one-channel.html

Re: PWM to Com Port

PostPosted: Sun Jan 23, 2011 8:08 pm
by Radian
I am building a combined power heat system with a Volkswagen TDI engine. The computer is missing
and I actually don't want it anyway since it will only run at 1500 rpm and full load to drive the 22kw
asynchronous generator.
The fuel pump is governed with a solenoid that is driven by a 200-400hz PWM signal of about 12V.
What I want to do is use FlowStone to control the whole system (heat, rpm, pumps, ect)
For the rpm control I need to use hall sensors and feed it some how to FS which suppose to keep
the engine between 1550 and 1570 rpm.
If a soundcard is able and reliable enough to receive the hall sensor signal and to put out PWM to a solid state relay
I would use it. If not I will get a Phidges 8/8/8 board.

Radian

Re: PWM to Com Port

PostPosted: Mon Jan 24, 2011 12:03 am
by DSP
Sounds Interesting!

For sure the audio out should be reliable enough to use for the PWM out.

I wouldn't use a Phidgets 8/8/8 for PWM as the timing of these board isn't that accurate, hence why they have dedicated PWM boards.

You could used a Phidgets encoder to give you the feedback or use the audio in. The timing in FlowStone of the audio is sample accurate, so no problems there.

Re: PWM to Com Port

PostPosted: Mon Jan 24, 2011 5:57 pm
by Radian
Do you think that the voltage swing of a chep hall sensor will be enough for a soundcard input?
I am still not convinced that the com port can't handle the needed 400hz adequately.
Look how this guy used up to 20khz signal to control his fan speed: http://sites.google.com/site/chrisatronics

Radian

Re: PWM to Com Port

PostPosted: Mon Jan 24, 2011 8:33 pm
by DSP
The issue with the Com port is the timing accuracy, in FlowStone the Blue connections are high speed and sample accurate and the Green connection are lower priority and should not be relied on for actuate timing. So using the COM port, which is Green, wouldn't be accurate enough for PWM timing even at 400hz!

As I have said before this is why there are separate PWM board like the Phidgets to externally handle the timing, you only have to send the pulse width ( a single number) to them and they do the rest.

Re-the haul effect sensor. The usual Line Level in for a sound card is +/- 1V P-P @ 16bits, so I would say you would need at least 100mv out of the sensor to reliably read the input level.