I need to build a scale that is not attached to any computer. The goal is to weigh a dustbin and show the weight value on a small LCD screen. The weight I want to measure is approximately 10 kg, but I have to do the tare of the weight of the dustbin to weigh only the contents. The price of the equipment has to be cheap. I tried to look for an online solution and the only solution I found was with an Arduino. The problem is that the Arduino is connected and powered by USB to the computer and I can not use computer. How could I build the balance cheaply? Is there any way to run the program on Arduino without having to always connect it to the computer and feed it by stack for example?
Once you upload your sketch to an Arduino, it does not need to be connected to a computer anymore; the Arduino IDE uploads the sketch into Flash of the Arduino, which will stay there until overwritten again, even when the Arduino is powered off and not connected to any power source. The uploading process is called Flashing (done by the Arduino IDE normally).
For powering, instead of using the USB plug to the computer, use a socket adapter with a USB plug, same as a telephone/USB phone charger. This will have the same behavior as connecting it to a computer, except that flashing is not possible.
(from comment below)
You can simply connect the battery to the Vin, because the Arduino already has a voltage regulator (which works recommended from 7 to 12 V and absolute maximum rating of 20 V). The voltage output from e.g. the 5V or GPIO pins will be (approximately) 5 V. The reason that you the minimum voltage should be 7 V of Vin, is that the internal voltage regulator is not 100% efficient (no voltage regulator is).
So if you connect a battery that is at least 7 V (e.g. a 9 V battery or 5 or 6 AA batteries you are ok). Note that if you use 5 V batteries from 1.5 V, you get 7.5 V so the limit of 7 V will be reached quite soon as the voltage of the batteries drop.
The Arduino in your photograph has a barrel jack on it for powering from a battery. A suitable battery pack is one like this. Battery Holder - 4x AA to barrel jack connector
I teach Arduino robotics at the local university. As others have stated, use the computer and USB to actually program the Arduino, then remove it from the computer and simply run it from the battery pack.
short answer: yes. The program is written on the controller and can run without computer. Powering an arduino via USB charger is done frequently and using a battery is well within the possiblities. I guess you will find quickly plenty of examples for that. If money and size is of essence and you are willing/abled to handle a "bare" µC outside the arduino eco system I can actually recommend the MI0283QT Adapter v2. It is intended as an rpi/arduino shield but comes with a built in NXP LPC1114 µC which can be easily reflashed to work without an external rpi/arduino. Adding a simple Battery monitor system and li battery one gets a nice stand alone touch display mini "computer" with touch display.
Yup. It is very easy.
There are 2 ways:
- Provide 5-12 V on the Vin pin of arduino and connect (-) or ground to the ground on the arduino. You can also use an adapter whose output pin matches the black coloured jack on the arduino.
- Connect the programming cable to a mobile charger (USB port on the charger).
For the 5-12 V source you can very easily use a small LiPo battery (depending on budget) or AA batteries in series should also do the trick.
(Note: 5-12 means 5 to 12 V, any voltage in that range would work.)