Sine Wave

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

Moderators: Benj, Mods

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

Sine Wave

Postby Astrea Essandohe » Thu Jan 21, 2010 4:07 pm

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: 14566
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4596 times
Been thanked: 4239 times
Contact:

Re: Sine Wave

Postby Benj » Thu Jan 21, 2010 4:57 pm

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: 8536
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2456 times
Been thanked: 3525 times
Contact:

Re: Sine Wave

Postby medelec35 » Thu Jan 21, 2010 9:11 pm

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

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

Re: Sine Wave

Postby mimiyum » Sat Mar 06, 2010 4:23 pm

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: 14566
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4596 times
Been thanked: 4239 times
Contact:

Re: Sine Wave

Postby Benj » Mon Mar 08, 2010 10:09 am

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

Postby Astrea Essandohe » Sat Mar 13, 2010 5:42 am

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: 14566
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4596 times
Been thanked: 4239 times
Contact:

Re: Sine Wave

Postby Benj » Mon Mar 15, 2010 9:41 am

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.

viewtopic.php?f=26&t=4869

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8536
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2456 times
Been thanked: 3525 times
Contact:

Re: Sine Wave

Postby medelec35 » Sat Apr 24, 2010 9:06 am

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
These users thanked the author medelec35 for the post:
prasha920 (Tue Oct 29, 2013 4:01 pm)
Rating: 5.26%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.