PDA

View Full Version : How to generate data to follow a sinusoidal trend



wjsmarine
- 6th December 2012, 09:08
Hi All,

I want to make a Tide simulator which will periodically send serial data, not hard at all.

The problem is I want the sent values to follow the natural sine curve of tides. I can add the bells and whistles later e.g. the double hump per day, springs and neaps, minimum and maximum values, etc, etc,... but I have no idea what weight or how to apply these values to the data for the sine curve.

Does anyone have some thoughts on how to do this?

Thanks and regards,
Bill

AvionicsMaster1
- 6th December 2012, 14:55
I went here http://en.wikipedia.org/wiki/Tide and found more info than I knew existed about tides and tide data.

J. Mark Wolf
- 18th December 2012, 12:38
I used a DAC (digital to analog converter) formed with an R2R ladder on a PIC port, to generate a near perfect sine wave.

Generate the values you need with a spreadsheet using the Excel SIN function, put them in a software table, then periodically go get the values from the table one at a time, and write them to the port, with appropriate delays between writes.

You might add a capacitor to the output of the ladder for smoothing.

wjsmarine
- 19th December 2012, 10:24
Thanks J. I'm not interested in the analog voltages only sending serial values - but the Excel idea is a good one. I'm no guru with Excel but will learn from this and give it a go.

Regards,
Bill