how a metal detector circuit works