Analog input: PWM

Hello everyone,
I have just received my first Arduino, and am very impressed with it. Hardware that's simple enough for a software guy like me! ;D

However, I've also run into my first problem. I'm trying to read an analog control voltage that I measured to be in the 0-5 V range. Couldn't be simpler as it is already in the perfect range for an Arduino, right? Well, what I discovered after trying it out was that the voltage is microprocessor controlled, and looks like this when I read it from the Arduino:

So, I am assuming this is some kind of pulse-width modulation..? :-?
For the record, reading the analog input as such works ok, with the connection in the AnalogInput tutorial. My connection is the same, except ground goes to ground and analog0 to the control voltage on the device.

So, my question is: how should I go about reading the voltage correctly (so that the value I get is unfluctuating, like the display on my voltmeter)?

Thanks in advance :slight_smile:

To convert a PWM signal to a true analog voltage it has to pass through a low pass filter. That can be as simple as a resistor/cap filter to a op-amp active filter. Search around the site you should fine something on using a low pass filter.

Lefty

This goes a little into filtering a PWM signal:-
http://www.thebox.myzen.co.uk/Tutorial/PWM.html

Alright, thanks for the tips! I will post about my progress as I make some :wink:
Happy holidays!

Alright! I think I actually understood the PWM guide, to a degree, and managed to get the input working. Many thanks for the help! :slight_smile:
You can have a look at my project here.

Glad you got it working, thanks for the link to the PWM page.
Cheers.

Is it really measuring brain activity, or is it something else like electrical signals from muscle contractions in your forehead when you frown in concentration?

Andrew

My guess is the latter. :wink:

Is it really measuring brain activity, or is it something else like electrical signals from muscle contractions in your forehead when you frown in concentration?

From Wikipedia: "EEG is the recording of electrical activity along the scalp"
So, it is measuring brain activity, and it is measuring electrical signals on your forehead :slight_smile:
It's a science toy, so it is not to be taken too seriously, but the principle is the same as in medical EEG. The main differences are probably resolution, and the fact that a real EEG cap looks like this:

:wink:

So, it is measuring brain activity, and it is measuring electrical signals on your forehead

So you put an electrode on your head. How do you tell if the resulting signal is coming from the brain activity or from muscle activity?

Quoting a definition of what an EEG recording is does not mean that is what you have.