Go Down

### Topic: Sine wave output conversion (Read 1 time)previous topic - next topic

#### karthick2011

##### Oct 13, 2014, 01:37 pm
Hi all,
I am working with an amr based angle detection sensor(KMZ60). The sensor continuously gives cosine and sine wave output on varying magnetic field. On feeding this output to UNO's analog pin, I get values ranging from 0-1024. How should i interpret this data ? The sensor takes 3.3v as Vref and the a to d values vary as the magnetic field varies. How am i suppose to find the phase and amplitude from this data ? Can you suggest me any other method, if there are any ? Thanks.

#### KenF

#1
##### Oct 13, 2014, 02:16 pm
Personally, I wouldn't attempt to do the maths on an arduino.  Instead, I'd do the maths on an excel spreadsheet and then copy and paste the results into your sketch to use as a simple lookup table.

#### jremington

#2
##### Oct 13, 2014, 05:50 pmLast Edit: Oct 13, 2014, 05:54 pm by jremington Reason: 1
After carefully calibrating the sensor for gain and offset errors, and subtraction of offset, angle (in radians) = atan2(y,x).

#### Magician

#3
##### Oct 13, 2014, 08:35 pm
From sensors's DataSheet:
Quote
The single-ended outputs are capable to drive inputs e.g. of an external
Analog-to-Digital Converter (ADC) referenced to VCC. For an optimal use of the ADC input
range the cosine and sine output voltages are tracking ratiometric with the supply voltage.

So, you just feed two outputs directly into arduino analog pins.
I didn't get:
Quote
The sensor takes 3.3v as Vref and the a to d values vary as the magnetic field varies.

There is no ref. pin, my understanding outputs biased around 1/2 V.
You need to run an FFT, that 'd produce magnitude and phase, plus approximate frequency

#### jremington

#4
##### Oct 13, 2014, 09:51 pm
Quote
You need to run an FFT, that 'd produce magnitude and phase, plus approximate frequency
That won't do anything useful, if the angle of the magnetic field is constant.

#### Magician

#5
##### Oct 14, 2014, 12:03 am
Quote
After carefully calibrating the sensor for gain and offset errors, and subtraction of offset
It's not possible to re-calibrate  sensor in all weather condition. At least you 'd need HPF some kind, to keep magnitude error under control. The tricky part is design good HPF for wide freq. band, and here fft comes, outperforming FIR in ~100x times.

#### toashwin

#6
##### Mar 03, 2016, 06:47 am
Can you post your setup/schematics? How did you hook up the signals?

#### MarkT

#7
##### Mar 06, 2016, 01:39 pmLast Edit: Mar 06, 2016, 01:40 pm by MarkT
From sensors's DataSheet:  So, you just feed two outputs directly into arduino analog pins.
I didn't get:There is no ref. pin, my understanding outputs biased around 1/2 V.
You need to run an FFT, that 'd produce magnitude and phase, plus approximate frequency
FFT is a complete red herring.  atan2 (y, x) as has been mentioned.

Or more completely:
angle = atan2 ((y-y_offset)/y_amp, (x-x_offset)/x_amp) ;
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up