I am designing an embedded device for my personal project. It has a speaker which plays voice received from remote location and also records voice using a microphone while playing back the sound. The recorded voice is send back to remote location where it is delivered to the user sitting over remote location. It is similar to talking to someone over a phone call on speaker mode.
I am designed an amplifier using LM386 for speaker and it works perfectly. But i am confused over whether microphone will also record the sound coming out from the speaker and user over remote location will hear echo of his/her own voice.
My question is how to cancel the sound from speaker while recording using a microphone? Should i cancel them in hardware or in software? How it can be done in hardware?