New Project: Analog CPU and RAM usage meters

This one is rather simple and easy, just to introduce me to the arduino and its capabilites. A couple of analog panel meters to show realtime cpu and ram usage, then have the data logged onto an SD card.

I’ve got the panel meters and have tested them. How they are gonna work is a simple PWM signal with the duty cycle adjusted to current load sent from the computer via serial port. The panel meters I have chosen are 0->1mA. So some calibration circuitry is needed so i can adjust the voltage and get a linear approximation of the data from the cpu. Now, this is rather simple.
What we want is 1mA of current being drawn when the PWM is driven to 100% duty cycle, and 0 mA when the PWM duty cycle is 0%. So, back to basics. Remember V=IR? I surely do. Bit of gypsy magic and we get R = V/I. Lets just assume the panel meter has no resistance, when it actually does, and calculate a “Perfect” resistance needed to get out 1mA.

R = 5v/1*10^-3
= 5kohms.

Tweasy. All we have to do is add a 5kOhm resistor in series between the PWM pin of the arduino and the panel meter. If you want to check that the response is linear as the voltage varies, compute I = V/R for several points and plot. You will notice it is a linear relationship*. Just what we want.

Plug it into the arduino, and you will find that it works! Fancy! Maths is again useful! <- Much to my dismay…

Nexzt, I’m gonna be working on the data logging to SD card. Now this would be MUCH more useful if I could find a particular library called uFat2 made by SirMorris. But alas, his code host no longer has it and I cannot find links to it anywhere else, So if any readers out there have it or can find it, let me know! Please!

Peace out.

*Technically, Ohms law is not a linear realtionship, as temperature varies, the line becomes less and less linear. For most applications though, we can ignore that…

Righteo, thanks, that appears to be the default baudrate on my micro of choice anyway, so there will be no need to modify what python and basic (a PICAXE, C’s beyond me) code i have already written; though i might have to learn a few things from your code…

Let’s calculate it!
So Power(Watts) = Voltage*Current (P=VI). We know we are using 5V and our max current draw is 1mA, we configured that using the resistor.
P = 5*0.001
= 0.005 Watts
So our max power loss across the resistor will be 5mW.
In this case, a 1/4W resistor (standard resistor) will suffice.
Hope it’s all coming together nicely.