0
\$\begingroup\$

I built a circuit for heater controller and it works fine.

I want to read poentiometer R3 values with microcontroller Arduino. I am not sure if I am doing correct way, but I connected Arduino analog pin to potentiometer wiper pin and Arduino GND to circuit GND (heater circuit and microcontroler have separate power sources.) I got values in range 500-1000, but somewhere in between of pot turning values drops to 20-40.

I know that we can read potentiometer values when we connect side pins to power and wiper pin to microcontroller analog pin. But how can I read the potentiometer when the wiper is already connected to +5V?

I am using the following code:

void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever: void loop() { // read the input on analog pin 0: int sensorValue = analogRead(A0); // print out the value you read: Serial.println(sensorValue); delay(1); // delay in between reads for stability }

enter code here

enter image description here

\$\endgroup\$
2
\$\begingroup\$

I'm guessing your circuit is using a 555 timer. These work by charging up C via R1 + R2 + R3 until the trigger threshold is reached (about 2/3 supply) and then the DIScharge pin is pulled low. This causes C to discharge through DIS and R1 until THReshold reaches about 1/3 supply at which point DIScharge is switched off and the cycle can repeat.

Your scheme won't work well because the voltage at the junction of R2 - R3 is oscillating. Instead, you can monitor the 555 output and do some timing measurements.

The big question: why are you using a 555 when you have a micro-controller? Feed the potentiometer into an analog input and control the output duty cycle with that instead. You may need a transistor to switch the relay but that's about it.

\$\endgroup\$
0
\$\begingroup\$

Rather than trying to use the ADC on an oscillating value, you could time the relay on and off times, and then calculate the pot value.

\$ R_3 = \frac{T_{ON} - T_{OFF}}{T_{ON}}\cdot R_1 - R_2 \$

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.