827Views23Replies

# How can I get this to speak to my Arduino board? (watt meter)? Answered

Hello,

I have an arduino mega 2560 and a mystery two meter

Specification:
Input Power: MAx. 60.0V (Both on watt-meter and battery checker)
Max. Current: 100A(Watt-meter)
Min. Operating voltage: 7.2V
Current consumption: 20mA at battery checker program
Dimension: 105*50*20mm

I was wondering how i could get the micro controller to send the data to the arduino board or even make my own new one on the arduino board

Tags:

The forums are retiring in 2021 and are now closed for new topics and comments.

The meter already has an LCD. If the meter happens to have an output then you can connect it to your arduino if not you'll have to open it up and figure out how the meter works.

If you really want to turn your Arduino into a good power meter there is an easier way to do it. No need to try and hack an existing power meter. You can use a few simple parts with your arduino to measure the voltage and current then calculate the power usage.

First you will need a shunt resistor rated for the loads your looking to measure. Connect the ground side of the shunt to ground and the other side to an analog pin. Have the arduino measure the voltage across the shunt. The measured voltage will be in mV. Each mV is 100mA running through the shunt. Then have a protection circuit in place that can take the voltage reading from the source and put it into the 5V range the arduino can read from the analog pins. The arduino can then calculate the voltage multiplied by the current to get the power usage and track that as you see fit. As you measure higher voltages you will start to loose accuracy in your readings. Unless you make the voltage divider used between the voltage source and the arduino adjustable based on the voltages being measured.

Here is an arduino LCDVoltmeter project you can use to get  you started. Here is a thread from the old Arduino forms discussing measuring voltage and current. Of course all of this is measuring DC voltages. If you want to measure AS then go by a Kill-A-Watt and check out the project call Tweet-A-Watt.

thanks! nice idea i just been looking would something like this work as a current sensor?
http://www.ebay.co.uk/itm/30A-ACS712-Current-Sensor-Module-30-Amps-Amperage-Range-On-board-Power-Indicator-/300671398068?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item46016970b4#ht_4310wt_952

as for voltage it is 36 volt nominal but the voltage will sometimes be higher as the batterys (3 sla) will produce more than that proberly around 40 volt. what could i buy (or make) that is low cost, under £10 .

That sensor should work out great.

A simple voltage divider should do the trick. Make R1 715K ohm resistor and R2 a 100K ohm resistor. That should run you about \$8 US. That should get you pretty close to 5V with an input voltage of 40V. I'm not sure if that will work considering the amount of power going through the wires but the arduido won't be trying to pull that much through the voltage divider.

Then its a matter of getting the math right for the conversion. So if the battery is putting out 40V the arduino will read it as 5V. So you will want to take the reading from the analog pin, multiply that by 5. Then divide that number by 1024 to get the actual voltage reading. Multiply your voltage reading by the current reading and you have the wattage being used. the benefit of this is you now can display the battery voltage, the current being used and the power being used all on the same screen.

Hello again,
do you think these will work?

http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=251002916232#ht_702wt_1139

http://www.ebay.co.uk/itm/100K-OHM-100Kohm-CARBON-FILM-RESISTORS-1-4W-0-25W-X-100-/160687983794?pt=LH_DefaultDomain_3&hash=item2569c00cb2#ht_3060wt_952 that

Find a matching 1/4 W 715K Ohm resistor to go with that 100K Ohm. You probably don't want to deal with a tiny SMD resistor.

will it work the same providing that I soldered it correctly though?

It will work. Just be sure to Measure the actual resistance of each resistor so you will know what to expect in the Arduino measurements.

thanks, I really appreciate it,

Do you know how I can get a sauce code then combine it with another such as the volt meter and then a motor controller for example?

Thank you :)

another idea would it work if i bought a 680k and 35k and wired them in series.

How you get the 715K doesn't matter it will still work. There are actually a great number of resistor combos that will cut that 40V to 5V but the higher the resistor value is the better off you are and less power your wasting in the circuit.

As for the code... that you'll have to do some searching for. Run a google search with Arduino Voltmeter and Arduino Current meter. It should bring up several forum thread from the Arduino forums that will have some code you can draw from for your own code.

think i will stick to 715k what would happen though if i had 7150k and 350k would this be even more accurate or does it get to a point when it doesn't work

Check out this or any other Voltage Divider Calc and see what happens as you adjust the resistor values. With the values i gave you the output from the voltage divider will be about 4.9V. If you change R2 to 350K the voltage output jumps up to 13.15V. Ideally you will want a 700K Ohm and a 100K ohm resistor.

Like i said other resistor values can be used. For example R1 can be 700 Ohms and R2 can be 100Ohms, Or you can make it 7k and 1k, or even 700M and 100M. The lower the resistor value the more current is allowed to flow through the voltage divider and the more of a load the divider makes on the battery. The higher the resistor values the less load. You don't want your circuit that is made to measure the voltage and current being a drain on the overall battery output.  The larger the resistors the less of a drain on the battery it will be.

does it matter if it is a 5% tollerence resistor?

The tighter the tolerances of the resistors the more accurate your meter will be. As you know the stated value of a resistor and what the resistor's actual value is are different. Which is why resistors are marked with there tolerances. Under worst case conditions at a 5% tolerance the output voltage will be between 4.58V and 5.45V. But then your scooter isn't likely to be putting out a full 40V for very long so it shouldn't be a problem.

Thanks. i have completed the circuit and it all works really nicely however it is fluctuateing 38.67-38.87 volts other than this it is really accurate. how could i make it so it stays at one or the other

increase the delay in the loop so it isn't taking a reading as often. If your taking a reading as fast as it will allow then the reading from the analog pin could be jumping between (for example) 1008 and 1009. Putting in a 3 to 5 second delay should be good. No need for absolute real time data is there?

Hello,
i have edited the code but it is still doing it can you think of anything else?
thanks

Well the delay is only going to prevent it from being a blinding flash of the numbers on the screen. You may need to set it up so it takes several readings in a short time period then average the readings together before calculating the voltage and displaying it. Add a few more variables to store readings too then average them together storing the value to the final variable that will be displayed on the screen.

Here is an example sketch for you.
int vpin = A0; //analog pin for reading the voltage from teh voltage divider
int volt[4];  //creates array for reading the voltage input

void setup()
{
}

void loop()
{
for(int x=0; x<4; x++)
{
volt[x] = analogRead(vpin);  //reads the analog pin 4 times and stores it to an array

}

float voltage = (volt[1]+volt[2]+volt[3]+volt[4])/4; //averages the 4 analog pin readings