2
\$\begingroup\$

Vin is a constant DC source. This circuit will take a random DC input between 12.6V and 48V, and then maintain a constant output voltage of 5V using a system of voltage feedback.

Voltage feedback

with the source code,

float D;

void setup()
{ 
  TCCR0B = TCCR0B & B11111000 | B00000010; 
  pinMode(5, OUTPUT); 
  pinMode(A0, INPUT);
  D = 0;
  analogWrite(5, D);
  Serial.begin(9600);
}

void loop()
{
  int A0in = analogRead(A0); 
  float Vin = 10 * (A0in + 0.5) * 5 / 1023;
  Serial.println(Vin);
  if(Vin < 5) {
    D += 5;
  }
  Serial.println(D);
  analogWrite(5, D);
}

Vout starts from 0V and increases up to 1.7V but no more :(

How to fix it? (In the simulation above Vin = 48V)

\$\endgroup\$

1 Answer 1

4
\$\begingroup\$

Q2 is configured as an emitter follower. Even though it has 48 V on its collector, the highest voltage there can be on its emitter is the maximum port output voltage minus 0.7 V. You need a different switching arrangement to bring a higher voltage into play on Q2's emitter.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ And if R1 really is 5 Ohms, Q1 isn't going to last long. The simulator probably won't tell you that. \$\endgroup\$
    – Finbarr
    Commented Dec 28, 2023 at 0:58

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