Pages: [1]   Go Down
Author Topic: Powering a battery test meter as part of a prop - best way?  (Read 519 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 152
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I am new here.  smiley-red I am building a toy prop for my daughter. Part of it is an old battery tester meter (9V). I am controlling the needle with an Arduino and the code below. The video shows what the code is achieving. Is there an easier way to do this (and to use the full 9V of the batter I am using for power)? I want the needle to go all the way to the top and to be controllable as I want to sync it with 5 LEDs that are lighting up sequentially.



Code:
/*
 Moving a battery test needle

The circuit:
 * Battery test leads attached to digital pin 9 and ground.
 
 */


int ledPin = 9;    // + battery test lead connected to digital pin 9

void setup()  {
  // nothing happens in setup
}

void loop()  {
  // move needle up from min to max in increments of 5 points:
  for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) {
    // sets the value (range from 0 to 255):
    analogWrite(ledPin, fadeValue);        
    // wait for 30 milliseconds to see the needle effect    
    delay(30);                            
  }

  // move needle down from max to min in increments of 5 points:
  for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) {
    // sets the value (range from 0 to 255):
    analogWrite(ledPin, fadeValue);        
    // wait for 30 milliseconds to see the needle effect    
    delay(30);                            
  }
}
« Last Edit: December 28, 2012, 04:51:56 pm by arduinokov » Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

First, don't battery testers put a load on the battery? You might want to measure that, you may be exceeding the output pin current.

Second, to use the full range you would need to output 9V, right? So I imagine some transistor would be required (connected up to, say 12V DC) so that it "amplifies" the output from the Arduino.
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12568
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The Arduino can only output 5V so there is no way to directly drive the meter to 9V. If you can cope with the complexity of a transistor circuit, you could use the Arduino to turn the transistor on and off (using a PWM control scheme similar to the current one) and use the transistor to switch a 9V supply to the gauge on and off.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
First, don't battery testers put a load on the battery?
The tester does. The meter doesn't. It appears that OP is only using the meter.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is the deal with most basic dc meter movements. They are current operated devices made to several standard current ranges say 0-50ua, 0-1ma, 0-25ma, etc. What turns such a meter movement into a voltmeter is a series resistor (called a 'multiplier' resistor in meter talk) that limits the maximum meter current to coincide with the maximum applied 'measurement voltage to the series resistor/meter circuit. This is not unlike sizing a resistor for a simple led, but instead of having to know the Vf of the led you need to know the 100% current rating of the meter movement. So if you look around you might find the series resistor for the meter and just change it's value such that 5vdc will drive it to full scale rather then the 9vdc it now requires. Reducing the resistor to approx half what it is should do the trick.

Lefty
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 152
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The Arduino can only output 5V so there is no way to directly drive the meter to 9V. If you can cope with the complexity of a transistor circuit, you could use the Arduino to turn the transistor on and off (using a PWM control scheme similar to the current one) and use the transistor to switch a 9V supply to the gauge on and off.

Would a TIP120 Darlington Transistor be suitable? And power it with a separate power source? The transistor can then be controlled by using a PWM pin and similar code to what I have been using, correct? Any recommendations for the power source for the Transistor? Am I on the right track?

Thanks  smiley-roll-blue
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 152
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is the deal with most basic dc meter movements. They are current operated devices made to several standard current ranges say 0-50ua, 0-1ma, 0-25ma, etc. What turns such a meter movement into a voltmeter is a series resistor (called a 'multiplier' resistor in meter talk) that limits the maximum meter current to coincide with the maximum applied 'measurement voltage to the series resistor/meter circuit. This is not unlike sizing a resistor for a simple led, but instead of having to know the Vf of the led you need to know the 100% current rating of the meter movement. So if you look around you might find the series resistor for the meter and just change it's value such that 5vdc will drive it to full scale rather then the 9vdc it now requires. Reducing the resistor to approx half what it is should do the trick.

Lefty

Thanks so much for your reply. The idea of changing out the resistor seems like the easiest solution to the problem.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 152
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Changing the resistor did the trick.  smiley-lol
Logged

Pages: [1]   Go Up
Jump to: