driving a speedometer galvanometer with arduino uno R3

Hi all!

I want to use an uno R3 to replace a 30 year-old speedometer/odometer circuit board. The speedometer is a galvanometer that draws 40 mA max and the odometer is a 2-pole stepper slightly out of phase. my questions are:

  1. can I get the arduino to modulate current to run that galvanometer? the spec sheet says it can do 40 mA on the IO pins. Should I use the analogue or PWM pins? I can ofcourse throw a capacitor between the galvanometer and the arduino to smooth the signal.

  2. as far as I understand it should be possible to program the 2-pole out of phase stepper motor signal on the PWM pins. should I use some kind of motor control circuit or can I run it directly from the arduino?

  3. how should I go about varying both of the above output signals proportionally to a square wave from the wheel speed sensor? is there a particular sketch that works well?

thanks for any advice, will try to update if I make any progress

the spec sheet says it can do 40 mA on the IO pins.

No it doesn't. It says 40mA is an Absolute Max, and adds a further notice:

*NOTICE: Stresses beyond those listed under “Absolute Maximum Ratings” may cause permanent damage

to the device. This is a stress rating only and functional operation of the device at these or

other conditions beyond those indicated in the operational sections of this specification is not

implied. Exposure to absolute maximum rating conditions for extended periods may affect

device reliability.

And also

  1. Although each I/O port can source more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed:

1] The sum of all IOH, for ports C0 - C5, D0- D4, ADC7, RESET should not exceed 150mA.
2] The sum of all IOH, for ports B0 - B5, D5 - D7, ADC6, XTAL1, XTAL2 should not exceed 150mA.
If IIOH exceeds the test condition, VOH may exceed the related specification. Pins are not guaranteed to source current greater than the listed test condition.
4. Although each I/O port can sink more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed:

1] The sum of all IOL, for ports C0 - C5, ADC7, ADC6 should not exceed 100mA.
2] The sum of all IOL, for ports B0 - B5, D5 - D7, XTAL1, XTAL2 should not exceed 100mA.
3] The sum of all IOL, for ports D0 - D4, RESET should not exceed 100mA.
If IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater than the listed test condition.

So I wouldn't plan for getting more than 20mA at 4.2V from an IO pin.

Thanks CrossRoads, I hadn't realised that the specs were absolute maximums, I assume that applies to momentary draw. This would be used daily so that would be a problem. I will investigate a motor driver shield or ... possibly build something myself. I have limited electronics experience but the learning is what makes it fun.

Yes, you can use PWM to drive the galvanometer. You will need to add either a logic level MOSFET or a bipolar transistor and series base resistor to act as a switch. Use that to drive the galvo. via a resistor to limit the current to your require 40 mA.

You don't use PWM to drive a stepper motor.

Russell.

Thanks Russel. I will try your idea out tomorrow if I get time to go buy components. The stepper I will figure out later.