From a9277e757af72ef318ab17114baab0b8804871d3 Mon Sep 17 00:00:00 2001 From: Tomas Mudrunka Date: Wed, 29 Aug 2012 01:15:58 +0200 Subject: [PATCH] Experimental switched voltage regulator using arduino ADC and PWM --- arduino/.gitignore | 1 + arduino/Regulator/Regulator.ino | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 arduino/Regulator/Regulator.ino 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)); +} + + -- 2.30.2