Variable Resistance output from Microcontroller

Hello all, new to Arduino and this forum, but I have a project that I am undertaking and don't really know where to start. I want to emulate a valve on my motor cycle that when not connected throws a code. The valve has a small 5v motor that controls a potentiometer, 0-7k ohm (3 wire, 1 common and 2 output with the total of the output equaling 7k ohm at all times). I'm not looking for a solution to this problem, just want to know where to start really. I am going to use an ATtiny25 to accept the input and give the variable output.

Thanks everyone,

Petey

No. A potentiometer has two inputs (one is usually ground, the other is usually a voltage) and one output, the wiper, which tells you how far from ground it is by the voltage output from it.
As the voltage from the potentiometer is analogue, you will need to input it to one of the ADC pins on the ATTiny25 to convert it to digital.
What are you going to output it to?
What do you mean by "throws a code"?

Henry_Best:
No. A potentiometer has two inputs (one is usually ground, the other is usually a voltage) and one output, the wiper, which tells you how far from ground it is by the voltage output from it.
As the voltage from the potentiometer is analogue, you will need to input it to one of the ADC pins on the ATTiny25 to convert it to digital.
What are you going to output it to?
What do you mean by "throws a code"?

Thanks for your reply and I apologize for my ignorance. I am new to the hardware side of things. The intent is to use the ATtiny in place of the potentiometer.

As far as "throwing a code" that is what the ECU (engine control unit) does when a module isn't responding properly, which causes the check engine light to illuminate.

I think what I need to do is adjust a PWM output (converted to voltage using a simple low pass filter) based on length of time that voltage has been received across two 5 V inputs.

Petey_08:
Thanks for your reply and I apologize for my ignorance. I am new to the hardware side of things. The intent is to use the ATtiny in place of the potentiometer.

How do you propose to change the value output by the ATTiny?
Edit. Sorry, my post crossed with yours.

If you want an Arduino to mimic what the valve does - i.e. to be able to vary a resistance - you need to use the Arduino to control a digital potentiometer. The Arduino sends a number to the digital pot and the pot changes its resistance accordingly.

However life may not be so simple because you can't simply wire 2 potentiometers together - they will "fight" by "averaging" their resistances. You will probably need some method to disconnect the pot that is not in use - and I don't know how to do that without affecting the resistance reading. Maybe relays could be used.

I guess you could completely "replace" the existing pot by getting the Arduino to read its value and adjust the digital pot to the same value and do whatever else you want when the engine is not running. That may interfere with the reliability of your bike.

...R

Hi, still not sure what you want, so here goes.

1: You have on your motorbike a valve that is controlled by a 5V motor, also connected to the motor is a 7K potentiometer, this would be to feedback to the ECU the valve position?
2: The valve wouldn't be the throttle, and its flyby wire throttle?
2: You want to measure what the pot is doing and let you know when the pot, valve or motor fails?

A picture please.

Tom..... :slight_smile:

I guess I didn't explain my problem statement well enough. I am looking to emulate the motor/potentiometer combination to remove them from the equation (the valve they control is not in place, so the only reason the motor/potentiometer is kept is to prevent the check engine light from illuminating).

How the system works:

The motor is controlled by the throttle position sensor (TPS), as more throttle is given, the motor turns and opens a butterfly valve in the exhaust (this is used to increase back pressure in the exhaust during low rpm situation theoretically increasing low range horse power). As the throttle is released, the TPS reverses polarity driving the motor in the opposite direction closing the valve. The motor direct drives the potentiometer, so the position of the valve can be determined based on the reading from the potentiometer. Simple 5 wire set up, 2 for motor and three for POT.

What I am looking to do:

I want to completely remove the motor, potentiometer, and valve (valve is already gone). I am looking to use a very small circuit comprised of an ATtiny25 as well as a few resistors and capacitors (as a low filter pass) to emulate the response of the motor. The system won't actually drive anything, but rather fool the ECU into thinking that the motor and POT are still connected and working properly.
So as voltage is given, the PWM from the AVR needs to be constantly adjusted to reflect the change in resistance of the POT. When polarity is changed, the PWM needs to be adjusted the opposite direction to simulate the motor changing direction.
So I figure I need two inputs with one output. I realize it is on me to determine what the ECU is actually reading so I can mimic it in the circuit. What I am really looking for is a place to start with the coding of the micro controller, as this aspect is very new to me. I have coding experience, but not on the imbedded level.

Petey_08:
So as voltage is given, the PWM from the AVR needs to be constantly adjusted to reflect the change in resistance of the POT.

Maybe I'm just slow, but I don't understand how PWM can emulate a Pot. PWM produces a stream of HIGH/LOW pulses that, on average, represent a voltage IF they are fed into a suitable object - such as an electric motor . A Pot is a passive component that divides a voltage provided from elsewhere.

...R

Robin2:

Petey_08:
So as voltage is given, the PWM from the AVR needs to be constantly adjusted to reflect the change in resistance of the POT.

Maybe I'm just slow, but I don't understand how PWM can emulate a Pot. PWM produces a stream of HIGH/LOW pulses that, on average, represent a voltage IF they are fed into a suitable object - such as an electric motor . A Pot is a passive component that divides a voltage provided from elsewhere.

...R

Robin,
I'm quite new to this experience, so please correct me if I am wrong, but won't passing the PWM through a low pass filter effectively convert the digital wave into an analog voltage? In that case, changing the duty cycle of the PWM will change the analog voltage output, much like the POT changes the voltage output as it is adjusted (given a constant current and voltage in)?

Hi, so you want a circuit that will take the power supplied to the motor and convert it into a voltage that would correspond to the position of the motor that will not be there anymore.

I hope you realize that the motor and pot are part of a positioning feedback loop.

That is the ECU reads the throttle position sensor and probably other conditions to calculate what position the exhaust valve needs to be, for example the valve needs to be 1/4 closed.
The ECU looks at the pot to see what position it is currently in, say 1/2 closed, then determines if it needs to be opened or closed, close the valve.
As it closes the motor it monitors the pot so that it will stop at the correct position, 1/4 closed.
The control of this valve is more complicated than just opening and closing when the throttle does.

I would suggest you leave the motor pot combination in the loop.

Tom...... :slight_smile:

Hi, I'm not saying it can't be done but a lot of work involved to get response and level characteristics correct to prevent any ECU fault alarms.

I would suggest you leave the motor pot combination in the loop.

Tom....... :slight_smile:

It sounds like the 5 volts coming from the control unit would be done by an Hbridge which to make the motor go forward or backwards which means that it would not be so simple as tying one lead to ground and then read the other (which would go from plus 5 to minus 5 ). You would need a circuit to convert this.

As far as the t25 doing the variable voltage I don't see a problem (using the filer).

How about a non cpu method. Just get an rc servo,gut the electronics except the pot, hook up the pot as per the original setup, then hook up the 2 motor wires to the servo's motor (might need to reverse the wiring for correct rotation) and there you have it. I bet you could get by with a small servo to boot.

I thought I would try creating a simple diagram from your description in reply#7...

Petey_08:
I'm quite new to this experience, so please correct me if I am wrong, but won't passing the PWM through a low pass filter effectively convert the digital wave into an analog voltage? In that case, changing the duty cycle of the PWM will change the analog voltage output, much like the POT changes the voltage output as it is adjusted (given a constant current and voltage in)?

I may be wrong about this, but it seems to me the ECU expects a Pot to provide feedback based on a voltage that the ECU provides rather than to have an external voltage presented to it.

That's why I think it would be much simpler to have the Arduino control a digital potentiometer.

Of course, as others have said, this is just the physical end of the system. You also have to get the feedback logic correct.

...R