PWM Sine Wave

Hi all, I am completely new to arduino. For a 3rd year Mechanical Engineering project I have been asked to create an arduino control system for a single axis shaking table.

I want to use a low pass filter to convert the PWM output of the arduino board to an analogue signal to then input into the analogue to PWM converter inbuilt in the pre-existing actuator (the rig itself is many years old). Removing the analogue to PWM converter from the actuator for the shaking table doesn’t seem feasible at this point.

What I would like to know is how I can get the arduino to implement a sine wave in PWM and record it to a file I can open in Matlab/Simulink. This I hope would allow me to run simulations and determine the best RC values for the filter.

Thanks in advance R

What I would like to know is how I can get the arduino to implement a sine wave in PWM

You can't. PWM is performed by turning a pin on and off many times per second. The ratio of on/off time can be changed, but the on voltage and off voltages are fixed. PWM output, then, is a square wave.

Thanks very much.
Once i have created a repeating square wave how do I record it to a file on a computer? Do I need any special kit?
Thanks again

Once i have created a repeating square wave how do I record it to a file on a computer?

This doesn't make sense. The only way for the Arduino to send data to a computer is via the serial port, as bytes. A byte contains a value between 0 and 255. The PWM value is either off or on, but that changes far faster than the Arduino can send a 0 or a 1 to another computer.

A little googling of low pass filter should reveal that a low pass filter is composed of resistors and capacitors in very small quantities. Choosing the correct size resistors and capacitors is not rocket science.

Sorry I realise this has got confused. Obviously I didn't word my question correctly to begin with. I know the pwm output is a square form signal. I need to generate sinusoids within the Arduino software which are then output as equivalent pwm signals, that I can record.

I understand that creating a low pass filter is relatively simple however my tutor would like me construct a model to determin the RC values , so I don't really have a choice.

First off read this:- http://www.thebox.myzen.co.uk/Tutorial/PWM.html

Your PWM rate to sin wave frequency has to be high. The lower it is the higher order low pass filter you need.

There is no need to record the arduino output you can simply generate a file of numbers from a spread sheet to put into your simulator.

Thanks very much will have a go!