how can i ensure that during runtime when i vary the voltage input at my boost converter and my duty cycle could change accordingly to provide a stable output voltage with the help of programming the arduino uno.
this is my coding for making high and low pwm, welcome any comment for improvement of this code.
*
const int IOPin = 9;
int IOState=LOW;
void setup()
{
pinMode(IOPin, OUTPUT); // sets the digital pin as output
}
void loop()
{
if (IOState==LOW)
{
IOState= HIGH; // sets the ON
delayMicroseconds(1);
}
else
{
IOState= LOW; // sets the OFF
delayMicroseconds(1);
}
digitalWrite(IOPin, IOState);
}*
A boost converter circuit usually includes hardware feedback/regulation. It's not normally done with a microcontroller and software.
But, I suppose it could be done. You need to feed the output of your converter to an analog input (with a voltage divider if the voltage goes over 5V and perhaps with some protection diodes if it can go over 5v.
You are not currently using PWM. Then, you'll need to adjust the PWM value up or down to hit your target voltage.
This can be a tricky thing to do. You might find the voltage oscillating or "hunting" for the target voltage....
Is the hardware connected in a way that allows you to control the voltage with PWM? Make sure that works before you try to control/regulate the voltage.
I was thinking of adding PID for the feedback inorder for my waveform to be stable.