Inspired by Crea un voltímetro tan solo con tu placa Arduino y un par de cables (How to create a multimeter with an Arduino board and a couple of wires), I've created the following tutorial to show how easy and fun is to program with Visualino. Here you'll learn how to measure the voltage a battery with Arduino. For that, a multimeter is often used, but multimeters aren't smart. Arduinos are!
Arduino boards have two set of pins. The digital pins are the ones we usually use to blink a LED. Digital means they only have two states: ON and OFF. But we also have the analog pins, which are able to measure current and convert it from a voltage to a number, that can be read. To build the circuit these components are needed:
- Arduino Uno or Nano (or any other one).
- Two resistors 1K Ohms.
- Some wires.
- A battery: in my case 9V.
Next, place the components like this:
Now, we are ready to program the Arduino board using Visualino. You can see how to do that in the following video. First, we use the blocks to create the program. The program do these:
- It reads a number from the analog pin #0 and stores it in the "read" variable.
- It re-scales that number from 0-1023 to 0-900 and stores the result in "voltage". My battery is 9V. If your battery has max 3 volts, then use the appropriate max value (e.g. 300).
- The measured voltage is printed.
- After half a second, the measure is repeated.
After the program has been created, we build it and transfer it to the Arduino board.
As we can see in the video, Visualino has a Serial monitor. There we can see the voltage readings. That was easy, uh? :) But to make things easier, Visualino is able to convert those numbers in the Serial monitor to neat real-time chart!
And that's it! Stay tuned as other awesome features will be coming soon to Visualino. Enjoy!
Is same sketch is use for measure 12v battery?
Posted by: Kamran | June 20, 2016 at 07:21 PM
Great tutorial, I tweeted it @Hackerspacetech
Posted by: Arduino Class | January 25, 2017 at 03:15 PM