For this assignment I attempted to create a device for measuring current. My ultimate goal was to include the ability to limit current once it reached a user-set value but that will have to wait for next time...
I used the ATtiny45 because it had some very useful features which the Attiny13 lacked. These include a differential ADC which measures the difference between two analog values and 20x amplification.
As the schematic shows I set the device up to stand between a power source and another device. The current sensor must be powered independent (currently from the serial port) of the power source it is monitoring. The reason for this was to allow measurement of a wide range of voltages though I currently believe this only works for voltages below 5V. Though I need to look into this further it is my suspicion that the positive differential input can take no voltage greater than VCC.
The device works by placing a small resister (.1 Ohm) in series with the power supply it is monitoring. The two differential inputs will measure the voltage drop across this resistor, which, according to Ohm's law, should be equal to V = IR. Thus, because R is known I can be found by I = V/R. V will typically be a very small value (~1mV - 30mV) which makes a couple of the ATtiny45's functions very valuable. By utilizing the differential input combined with a 20x amplification and an internal 1.1v reference voltage it would be possible to accurately measure very small signals.
Here is the board laid out. As you can see the input and output are two pin headers on the right side. On the left side is the serial input. I also wired the board to receive input from the serial port though I later realized this might not be possible without a level shifter.
And here is the final board. I have a power supply attached to the input and a 110 Ohm resistor across the output.
As of the creation of this page the board was not in complete working order. There are some issues with getting accurate ADC values which will soon be figured out. Just give me time...