Step 8: Displaying Seconds in an Analog Meter
An ammeter is a meter that is hooked up in series with the circuit, and thoeretically has 0 resistance (and a voltmeter is hooked up in parallel and theoretically has infinite resistance). What's important when buying your ammeter is the maximum current it measures. In order to swing the needle to 100%, your circuit must draw that much current. 1 A (or Amp) of current is enough to cause serious injury (I've been told it's enough to stop your heart). Aside from it being dangerous, our circuit probably won't be able to generate that much current. According to this article, most microcontrollers can output about 5mA of current, some less, so you should buy an ammeter whose full value (100%) is less than 5mA.
I purchased a 50uA ammeter. If I were to feed 5V (which is what the Arduino digital pins supply) into this ammeter without a current-limiting resistor, I'd probably see the needle swing to (or past) 100% and most likely damage the meter. In order to figure what resistance is needed, we turn back to Ohm's Law.
V = IR
R = V / I
R = 5V / 50uA
R = 5V / 0.000050 A
R = 100KΩ
So, connecting a 100KΩ resistor in series to the ammeter and applying 5V to the circuit would cause the needle to stay safely at 100%.
Getting the meter to display a fraction of 100% is done simply by using PWM (pulse width modulation). You can read up on it, but by applying 5V and 0V alternating at a specifc ratio, you can effectively get the needle to stay at any position between 0 and 100%. Due to how the meter is constructed, the needle's movement is natually dampened and you won't see any pulsing or jittering of the needle!