# Measure current across shunt resistor (Power Analysis)

I am trying to reproduce the side-channel power analysis attack described in this paper: https://pdfs.semanticscholar.org/7946/a8ee82658e2ffb017270331f220a55f5ace6.pdf for educational purposes.

The attack (on the HCS3xx family of chips) requires measuring the power consumption (i.e. current) that the chip is using in order to reveal its cryptographic key.

In the paper, they describe their setup as attaching a shunt resistor in the ground path and using a digital oscilloscope (with a sampling rate greater than 1MHz) to measure the voltage drop across this resistor.

I have reproduced this setup to the best of my abilities (pictured in the schematic below), but the problem is I don't have an oscilloscope. simulate this circuit – Schematic created using CircuitLab

Therefore, I've decided to use an Arduino Uno I have lying around as a poor man's oscilloscope.

Besides the fact that the Arduino ADC has a much lower sampling rate (~77KHz vs. the ideal 20MHz described in the paper), I have been having an issue getting a reliable voltage reading across the shunt.

While trying to use the full 10-bit ADC, and producing samples as `(ADCH << 8) | ADCL` in my ADC ISR, I do not get any samples that are greater than 0.

However, when I left-align the ADC to only use 8-bit precision (with `ADMUX |= 1 << ADLAR` and read with just `ADCH`, I get non-zero values but none with a value greater than one.

Could it be that the amount of power that the chip consumes is so small that the Arduino does not have enough precision to read it? Or could it be that my shunt has too large of a resistance and is causing a reduced current throughout the circuit?

In the graphs they've got `2.5mA` tops, so you've got about `2mV` on that `1.2R` shunt resistor.
And Uno's default ADC reference is `5V` divided into `1024` steps each of them roughly `5mV`. That's more than peak value of measured voltage.