Sine Wave

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
Astrea Essandohe
Posts: 2
Joined: Thu Oct 15, 2009 1:26 pm
Contact:

Sine Wave

Post by Astrea Essandohe »

Dear All,

Nice meeting you.
I'm new to Flowcode and finding it very interesting. Please, assist me with some clue on a flowchart to output sine wave.
Thanks.

User avatar
Benj
Matrix Staff
Posts: 14929
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Sine Wave

Post by Benj »

Hello Astrea

How are you outputting the analogue value eg. Is it using a DAC device or using a PWM etc?

Does the Sine wave have to go negative or is it ok if it is shifted so that the min is 0v and the max is 5v so that the mid way is 2.5V?

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9008
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Sine Wave

Post by medelec35 »

If it was me, i would use a variable duty PWM, feeding into a resistor and electrolytic cap. That will produce 0 to +5V. Then I would use a dual supply e.g -10V 0V +10V
then have transistor push pull arrangement and bias so +5 from cap= +10V, 2.5V from cap = 0 V and 0v form cap = -10V. That is if you don't want sine-wave offset to a +ve voltage.
If you do then PWM resistor and electrolytic cap method , would use least amount of components, but this is my theory, not tried practical to produce a sine wave. The only thing related I have successfully done, is measure pwm duty, and converted this duty to another duty to control a FET which via a brdge rectifier controlled a 230V AC fan. This means the fan ran much quieter at low speeds and did not have the mains hum associated with triac control. Or you can use DAC as in bens suggestion.
Martin

mimiyum
Posts: 94
Joined: Wed Jul 16, 2008 4:39 pm
Location: Philippines
Contact:

Re: Sine Wave

Post by mimiyum »

Hello,
Sorry but I didn't get how to produce sine wave in flowcode :cry:
How is this done in flowcode for sine wave to go negative?
I would like to try to do this too using PIC16F628a.

User avatar
Benj
Matrix Staff
Posts: 14929
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Sine Wave

Post by Benj »

Hello Mimiyum

The best way to get a negative voltage would be to use Flowcode to create your sine wave 100% in the positive side of the voltage with "zero crossings" being at about 2.5V.

Once you have done this you should be able to use some simple analogue electronics to shift the sine wave so that the lower half moves into the negative and the "zero crossings" are actually at 0V.

Astrea Essandohe
Posts: 2
Joined: Thu Oct 15, 2009 1:26 pm
Contact:

Re: Sine Wave

Post by Astrea Essandohe »

Hello Benj:

Sorry for my absence, i been away from home and thanks for the replies.

Please, give me idea on using both options (DAC and PWM), to generate the sine wave.

Regards,
Astrea

User avatar
Benj
Matrix Staff
Posts: 14929
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Sine Wave

Post by Benj »

Hello,

Here is a good look up table example to get you started. Basically you save a portion of the sine wave into memory and then step through the memory to move through the sine wave. You then simply output the values to the PWM or DAC as you go along.

http://www.matrixmultimedia.com/mmforum ... =26&t=4869

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9008
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Sine Wave

Post by medelec35 »

Hello Astrea.
Did you have any success, or would you like some further assistance?
If you require assistance, I maybe able to help you out with some simple circuity to convert PWM directly to a sine wave
Martin

Post Reply