I'm using the standard boost converter circuit
The general circuit topology might be standard, but we need to know the exact details of how you have hooked everything up. Please draw a full schematic, including how you are powering it and attaching the Arduino.
my problem is, the voltage range is from about 4.8v to 5.2v
Which voltage? The output? I presume you are powering your circuit with 5V, so that means it's not boosting at all.
BTW, with a load (led) the voltage doesn't change at all..
Are you using a resistor on the LED?
void loop()
{
potvalPre = analogRead(sensorPin);
potval = potvalPre / 4;
Serial.println(potval);
analogWrite(3, potval);
}
Is the pot sampling the booster's output voltage, or is it a completely separate (ie run off 5V)? If the latter then you have made an 'open loop' booster that will work, but it won't maintain a "constant" output voltage, instead varying depending on load. If the former: you have done your feedback the wrong way around (positive instead of negative) and you'll need to make sure you "smooth" the signal being analogRead() by the Arduino, or it will just be random numbers due to the 500Hz switching.
Also note that the default Arduino PWM speed (analogWrite() PWM speed) is 500hertz. Your boost converter will run much better at much higher frequencies (I'm aim for somewhere into the tens to hundreds of kilohertz).
Edit: i tried a coil, it buzzes, could you use it as a speaker?
Yes. That's all a common speaker is, plus a paper diaphragm and some stuff to support it.
You'll be hearing the 500Hz PWM being made by your Arduino.