programing the output voltage using a power supply

Hello i am new to arduino , and i am trying to learn how to use it : :slight_smile: :slight_smile:

I am currently working on a project where i need to drive an outuput voltage of 12v to a heater, but i want to use a power supply .. that \ can manually change the values of the output

I also have in my mind an idea of using a rotary encoder or a potentiometer to change the output voltage in order to to change the heating .

But again also want to use a power supply to see how it works.

Do you have an idea of which power supply i can use

And please can you tell me if my point of using a rotary encoder or potentiometer would be accurate


Use a transistor (probably MOSFET or Darlington) to drive the heater and PWM to control the power.

i Know that but i need to be changing the output power .

do you know of any power supply that i can connect to the arduino that would help me ?

How much current does the heater need?

the heater needs 3A max . is there a manual regulating power supply that exists , that can be used

As it is a heater, its physical state will not quickly change.
You could use a PWM output to control the heater.
For example, with
analogWrite (pinX, 128); // pinX = 3,5,6,9,10,11 on an Uno
then the 12V would be on 50% of the time, so the heater would run with the effect of the heater having 6V applied.

analogWrite (pinX, 64); // 25% on
analogWrite (pinX, 25); // 10% on
analogWrite (pinX, 192); 75% on

This is similar to how PWM is used to make LEDs appear dimmer or brighter.

Here is a manually controllable 3A supply

You can find others with a google search for:
variable lab bench power supply kit 0-30v 0-3a

Whqat you are looking for is commonly called a "programmable power supply" and by your description any power supply with 12 volts and maybe 10 amp capability which is adjustable output will serve your purpose. Google is your friend. Such power supplies have been around for decades. You know your requirements. You don't mention an interface? Programmable power supplies have different interfaces so what did you want?


then the 12V would be on 50% of the time, so the heater would run with the effect of the heater having 6V applied.

Power is V^2.R. 50% PWM@12V is like 12/sqrt(2) ~ 8.5 V 100% of time.

is there a way to reduce the heating with a pot , when i program the pwm on 50 % only ?

Like so. Read the pot, send the value to the PWM pin. Divide by 4 to convert 0 to 1023 to 0-255.

yeah i get that But my question is how am i going to vary the heat with PWM?

for example if i have

constint analogpin=3
int motorPin=map(analogRead(A0),0,1023,0,255);
analogWrite(analogpin, 128);

but now where i could put motor pin i put there analopin and where i could change the brightness of the LED i put there 128...

if the answer is long may be we can videotchat through snaptchat:mine is kaydee462 :slight_smile:

If your idea here is to PWM the heater CrossRoads post #9 gives you a fine schematic. Your code example is incorrect. You call out analog pin 3. You read your pot on pin 3 and that gives you a value between 0 and 1023. You take that 0 to 1023 and map it to 0 to 255 or simply as suggested divide the analog input by 4. I have no idea what your analogWrite is about? You are writing 128 to pin 3.

Here is a code example.

const int pwm = 9 ;    //naming pin 3 as ‘pwm’ variable 
const int adc = 0 ;   //naming pin 0 of analog input side as ‘adc’
const int sensorValue = 0 ;
void setup()
     pinMode(pwm,OUTPUT) ;  //setting pin 3 as output
void loop()
     int adc  = analogRead(0) ;    //reading analog voltage and storing it in an integer 
     adc = map(adc, 0, 1023, 0, 255);  //map the analog input to 0 to 255 for PWM out.
 Serial.print(" ");  

 analogWrite(pwm,adc) ; 

This is where it is also nice to have comments in your code explaining what the code is doing.

You can PWM a heater element but it is not normally done that way. Heating elements are slow responding. As written there is really no control.