2018-02-28 01:23 PM
Hi everyone,
With my STM32F103C8T6 I would like to receive the 2 signals I1 and I2 from the picture below in order to convert to
https://community.st.com/tags#/?tags=square%20signal
.All the square part is already coded and working great.
Now I would like to learn how to use this
https://community.st.com/tags#/?tags=sine%20waveform
and#
signal and interpolate them such as the file attached in order to have a decent precision. For example, in my case the step of the wave is 20 microns so I would like to interpolate it by 20 in order to have 20 pulses of 1 micron.This is an optical ruler on a milling machine so the ruler can travel in both ways with numerous direction changes
I'm a hobbyist so any bite of code is very welcomed
Right now, I only use Std periph lib, not HAL libraries.
Thank you for your help
#square-signal #sine-waveform #cosine Note: this post was migrated and contained many threaded conversations, some content may be missing.2018-02-28 02:00 PM
Easy, so long as you can express the 3rd signal as a result of the first two signals.
If you cannot, we cannot either.
2018-02-28 04:19 PM
So for e.g. 6m/min feed rate you're looking at 100k pulses / sec, right? And you want to do the interpolation on a µC? I doubt that's possible.
I'd look for a dedicated IC to do that. There are some around that spit out quadrature square signals which you can easily read on a mcu with your timers. -> no software overhead involved.
2018-03-01 12:43 AM
100mm/sec is way above my feed rate but this is not the point as I'm building an hélicoïdal rotary divider, I won't send that much of pulse. But I would like to be able to interpolate the 2 sine /cosine wave then I will calculate the number of pulses to be sent
But I have no idea how to proceed ?
2018-03-01 01:01 AM
That picture suggests that what you have is a Resolver:
https://en.wikipedia.org/wiki/Resolver_(electrical)
These are very long-established devices - so I suggest that you do some research & study into prior art; eg,
https://www.google.co.uk/search?q=synchro+resolver
As the Wikipedia article says,
For the position evaluation,
https://www.google.co.uk/search?q=Resolver-to-Digital+Converter
are commonly used. They convert sine and cosine signal to binary signal (10 to 16 bit wide) that can more easily be used by the controller.2018-03-01 11:31 AM
Hmm, you could hand-code the pulse thresholds into your code. would probably be the easiest way. Or you could model a generic sine-wave and put a kalman filter on top which then spits out the current phase angle phi which you can then use to generate the pulses.
All of these methods seem too slow in my mind though but try anyway.
Why don't you do some fooling around in matlab? Just create some sine/cosine data sets in there and then experiment with different approaches.
2018-03-01 11:37 AM
Again, Resolver technology has been around for years - there must be plenty of prior art.
Don't start by re-inventing the wheel ...
2018-03-01 06:56 PM
well that's what I first suggested:
'
I'd look for a dedicated IC to do that.'
2018-03-02 02:32 PM
Indeed you did!
And now we know that the required IC would be called a '
https://www.google.co.uk/search?q=Resolver-to-Digital+Converter
'Is
svc.paul
still listening ... ?2018-03-03 05:10 AM
Yes I am.
I followed advices above and bought an specific IC: IC-NV