I'm new to Arduino programming and am having a "make" using a Nano I've had for a while - I'm bored with just dimming an LED now.
My thought is this: I have an old Smiths Tacho that is certified dead, but very tidy looking and I have a friend with a Mini we converted to Megaljolt ignition.
I'd like to gut the Tacho and use a RC servo to swing the needle. So far, the 180' servo swing is no good for the 270' tach, but a little thought brought me to Lego gears at 16:24 teeth, making 1:1.5 or 180':270'. So, the physical part is simple.
My Nano needs to read the tach output of the MJ ECU which is a 12V pulse for each ignition "event" (or spark lol), read this input and drive the servo from 0 to 100% when the engine's turning at 0 to ~7000 rpm. Obviously, we're talking a four-cylinder engine.
So, my questions.
1; the best way to get that 12v trigger down to a level that won't kill the Nano? I guess a 5v regulator would not give "clean" separate pulses to match the input.
2; The programming to have the Nano "read" the input and control the servo to reflect that?
Just use a couple of resistors as a voltage divider to reduce the voltage to (say) 3.5v or 4v. Just enough to get the Arduino to see a HIGH and leave room for the actual 12v being considerably higher - maybe up tp 15v.
And probably the simplest code is to use an interrupt routine to count the pulses. Something like
void myISR() {
pulseCount ++;
}
Then in you main code you can check how many pulses arise every 1000 millisecs and convert that to a servo position.
I suppose a stepper would give the output range desired without the need of a gear but it's hard to beat a servo for being easy to control.
I doubt the OP will have trouble attaching a gear to a servo but I thought I'd mention a trick which has help me when attaching gears to servos.
A lot of the metal gear servos use a M3 machine screw to hold the horn in place. This can make it easier to attach gears to the horn since a slightly longer machine screw can pass through both the gear and the horn.
I also really like Polymorph for attaching things to servo horns. I think polymorph is easier to work with when it's heated with hot air rather than hot water.
I personally think it's a toss up between a stepper and a servo. I'd think either should work fine. My guess is a servo would be easier to program.
IMHO a servo would be very much easier to work with. A stepper does not know where it is so you need an external switch to identify the zero position when the Arduino starts.
I remember a Thread (which I can no longer find) with a link to special instrumentation stepper motors (for automobile use) that were tiny and included a zero-set mechanism. If anyone can identify the devices I would be grateful. I think they were so small they could run directly off the Arduino I/O pins.
I had considered a stepper but as stated there needs to be means of setting a zero datum which complicated things a bit, plus, I can afford to kill a couple of old servos before this project cost a penny.
I think my biggest struggle will be getting the programme right, as that's the alien bit to me. Basically, if I can get the arduino to effectively "translate" the ECU output into servo position, I'll be laughing. And if the needle sits in a funny position when the engine's off, that's no big deal
Gilesy:
Basically, if I can get the arduino to effectively "translate" the ECU output into servo position, I'll be laughing.
I'm new to the Arduino so hopefully someone will suggest better alternative if there is one but this PinChangeInt library looks like it would be useful for counting pulses.
While I think the above library would be helpful, there might be easier ways to count pulses.
Once you figure out then number you need to display, it shouldn't be hard to convert it to a servo position.
Robin2:
I remember a Thread (which I can no longer find) with a link to special instrumentation stepper motors (for automobile use) that were tiny and included a zero-set mechanism. If anyone can identify the devices I would be grateful. I think they were so small they could run directly off the Arduino I/O pins.
Looks like I'm having a play tonight!! I'm going to have a go at getting it going in the bench first, with a servo, but I might move to a stepper in time, just to keep the learning up! Cheers gents!
Just thinking of another way to do it with a servo but use the gearing inside to do it.
The needle does not need a lot of torque so why not tap into the servo and drive it from the next to last gearing. The gear (gear #2 in the picture) would need to drive the extended shaft so a little work would be needed if you are so inclined.