From: Tomas Mudrunka Date: Tue, 28 Aug 2012 23:15:58 +0000 (+0200) Subject: Experimental switched voltage regulator using arduino ADC and PWM X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=a9277e757af72ef318ab17114baab0b8804871d3;p=mirrors%2FPrograms.git Experimental switched voltage regulator using arduino ADC and PWM --- diff --git a/arduino/.gitignore b/arduino/.gitignore index dc5cbd5..f1ef629 100644 --- a/arduino/.gitignore +++ b/arduino/.gitignore @@ -1,4 +1,5 @@ *.* +!*.ino !*.pde !/.gitignore applet/ diff --git a/arduino/Regulator/Regulator.ino b/arduino/Regulator/Regulator.ino new file mode 100644 index 0000000..879654b --- /dev/null +++ b/arduino/Regulator/Regulator.ino @@ -0,0 +1,19 @@ +/* Software voltage regulator using analog read and PWM + Connect both voltage sensor and output pin to possitive side of capacitor + Then connect negative side to ground + Voltage should be approximatelly stabilized at AREF/2 + You can use some push-pull (totem pole) kind of buffer at output pin to supply more current +*/ + + +#define SENSOR A0 +#define OUTPIN 11 + +void setup() { +} + +void loop() { + analogWrite(OUTPIN, map(analogRead(SENSOR), 0, 1023, 255, 0)); +} + +