Is there a way to read the current draw of an Arduino Yun when powered via USB? I only know how to read the voltage input using the internal 1.1V reference. However this does not give me how much longer the battery will run. I don't wanna use batteries and power it through Vin due to the missing internal regulator. I'm also attaching a USB camera to the board which draws a lot of current so I'm using a USB powerbank. Could this be done using the Linino microprocessor?
You would need to add a very small resistor (less than an Ohm) in series with the power input. The current being drawn generates a voltage across this resistor generates a small voltage that is proportional to the current (Ohm's Law.) You then amplify that voltage and connect it to an analog input.
I get that. But as I mentioned, I'm powering the Arduino through USB.
So you will either have to rig up something in in the circuit before the USB connector, or rig up your own power supply and feed regulated power into the VIN connection. There is no on-board current measurement ability.
But I'm re-reading your post a bit more carefully, and I see two issues.
First is that you want to use a USB camera that draws a lot of power. The USB host port cannot deliver a lot of power, you may need to use an external powered USB hub.
Next, you are using a USB battery pack, and you want to know when the battery is running low. You probably won't be able to tell by looking at the voltage, as it's output is probably regulated so you won't see any voltage change until it is too late and the battery is already dead. You could try measuring current, and integrating the total amp-hour draw, but unless you always start with a fully charged battery, and carefully calibrate the system, the number you get will, at best, be an approximation.
If you really want to know the state of the battery charge, you need to be able to measure the actual battery voltage before it goes into any regulator or conditioning circuitry.
You can take the easy way, and use a USB battery pack, but then you lose out on the extra abilities a more sophisticated solution would give you. Or you could build a more sophisticated solution that can monitor and measure the battery performance, and supply the camera's power demands, but that is not a quick and easy solution.
It seems you are trying to use the easy solution, but want the sophisticated abilities. I don't think it will do what you want.
I'm currently using one of those chargers use for phones , Pocket Juice batteries like this one. Mine is 2500mAh. I have tested it with the camera and it works fine. However, like you said ShapeShifter, if I want to use the USB I can't tell what the power consumed is.
its a bit destructive, but you could cut the wire and run the connections through a meter and then on to the VIN
its a bit destructive, but you could cut the wire and run the connections through a meter
Or cut apart a cheap extension cord and add the circuitry in there? Of course, you still won't get the actual battery voltage.
I have a small device that measures the voltage and current drawn through a USB connection. I got mine form this web site, www.mpja.com. It is item 31858 ME. I just check my Yun when it has made a WIFI connection. The current draw is 250 milliamperes at a voltage of 5.01 volts. I hope this helps.
Enjoy Life, Just Greg
Live Well, Laugh Often, Love Much