First of all, MarkT, thank you very much for your detailed answer. I'm new in Arduino and electronics in general and it's hard to get to know everything on time. I really appreciate that experienced people like you answer our questions to make mi life easier.
Now, I would like to ask you some things and specify other things about my project.
Well the noise is a product of the measurement technique:
Ok, I understand that there might be noisy due to the meassuring technique, but I also think there is noise due to the fact that I'm providing the driver with a PWM signal, and also due to the fact that this motor has brushes, so the current is fluctuating also due to that (am I right?).
I would also like to ask you about my motor driver. I'm providing it with a PWM signal, but... is it transfering also a PWM signal to my motor? I guess if it does, this would be too bad for getting a stable signal.
Measuring the current can be done in several places - only the current in the motor
winding itself is likely to be low noise as the winding inductance is acting to smooth
the current. This is a good place to use a non-contact sensor such as hall or GMR.
I don't understand this part , is not the same measuring the current at different points in the same wire? I only have 2 wires for supplying current to the motor. I asume this wire is conected to the winding so measuring in this wire should be the same no matter at what point , am I right?
Since I want to supress noise as much as possible, I think I will avoid the hall sensors, and since I presume the GMR sensors are not cheap (I'm trying to measure currents around 0.1-2A and this project is for my studies), should I go for the shunt current measure?
For shunt + amp current measuring the best place is usually the ground-return
from the H-bridge.
The next picture shows the driver I'm using which is made with MOSFET:
(I'm sorry I don't know how to resize the image. It's here: http://a.pololu-files.com/picture/0J4621.1200.jpg)
As you can see, the supply (12V)section is on the left and the logic section is on the right. On the left there are outputs for two motors. Where do you think should I put the shunt resistance? Can you tell me some amp or IC I could use to get that measure in Arduino?
If the PWM frequency is high you can usefully low-pass-filter the current measurement
to get a cleaner more meaningful signal.
I'm using Arduino PWM analogWrite function, so I've read this PWM signal frequency is 490Hz (not high enough, right?). Nevertheless, my motor driver allows frequencies up to 100kHz. Would it be better for me using a higher frequency? Can I do this through software in Arduino? How?
When you say using a low-pass-filter, do you mean build it up on code? How could I do that?
In case I achieve a stable current meassuring, the next step would be making a control loop to get the torque I would like. My basic knowledge tells me that I could get torque knowing that P=Tw (where P=power; T=Torque, w=angular speed) and P=VI (V=voltage; I=current), so that way I could obtain: T=(V*I)/w (am I right?)
In this case I know current because I've meassured it, but what is the voltage? I guess it is directly proportional to the PWM I'm using on the logic side of my driver, right?
So I should create a loop, computing each time the actual Torque using the previous obtained values and calculate the error comparing with the desired torque and processing this error using a typical PID controller to obtain a new PWM signal to supply my motor driver, am I right?
I'm sorry because I know I'm making a lot of stupid basic question for many of you, but I really have very little idea about electronics. I appreciate very much your patience.
PS: Excuse my poor English.