I am trying to measure the magnetic filed coming from (only) magnetic field of magnet using HMC5883L magnetometer and arduino uno. However, it will measure the magnetic field of magnet (which I want actually) + earth magnetic field (which I do not want).
Is there any suggestions to calibrate? Does anybody have done this before?
It depends.
If the magnetometer does not move, simply subtract the values you read when no magnet is nearby.
If the magnetometer is mobile, one way to hack it is to have a second magnetometer on the same vehicle that either is far away from the magnet or find a way to compute the magnet's field from differences you read from the two magnetometers.
I thought it's measurement of local magnetic field are accurate, the purpose of calibration is to reduce local field distortion bias from earth's magnetic field, as a moving/rotating magnetometer's own orientation changes relative to this field.
In the case of fixed magnetometer I'm not sure if calibration helps or if a different type of calibration, if any, is needed. because it's actual readings of earth magnetic (with any local distortions) do not change, what changes is addition of another field - the one that needs to be measured.