If you can get input signal when it doesn't contain any useful signal (I mean only noise is presented), you can estimate average noise power at first. Simply find a power of such a signal:
- $P_n=1/N \cdot \displaystyle\sum_{k=0}^{N-1}|s(k)|^2$.
Choose $N$ in $2^{12}\ldots 2^{15}$ range for example.
Then you can measure a power of $signal+noise$ mixture, $P_s$, by the same way, when input signal is presented at the input. Caution: the measurement of $P_s$ is only valid if the signal exists all the measurement time. SNR could be calculated by:
- $SNR=10 \cdot \log_{10} \frac {P_s - P_n}{P_n}$.
If your noise is stationary and white it's possible to measure it once in the setup and use $P_n$ as a constant.
If you can't measure noise power at any reason, you can try to estimate SNR in the frequency domain via FFT. But you have to know your signal's band. The point is the same but you should use FFT frequency indexes instead of sample numbers $k$ while estimating integral power. $P_s$ is now power of $signal+noise$ in the band of interest, while $P_n$ is the noise power in total band ($0...fs$). In this case power spectral density of the noise in your system should be evaluated at first. This method could be far too complex for your task.
Both methods show you pointless result in the case of low SNR in the signal band (not total band in general). Frequency domain method will be preferable if your signal's band is quite less than $f_s$, otherwise time domain method will be good enough. To estimate SNR of the order of 5 dB or lower it's better to know signal and noise power (or power spectral density) a priory. So the task has robust analitical solution.
Hope this helps.