Digital power supply


Digital Linear Power Supply Unit (PSU)





This is a 12V 1.5A Power Supply with a maximum error of +-0.06V. It can be controlled with its keypad, from a computer or from an Android powered smartphone. BlueTooth is used to establish communication  between the computer/smartphone and the power supply.


1)     Block Diagram





2)     Arduino Mega 2560




The microcontroller board used is Arduino Mega 2560, which has following specifications:

Operating Voltage5V
Input Voltage (recommended)7-12V
Input Voltage (limits)6-20V
Digital I/O Pins54 (of which 15 provide PWM output)
Analog Input Pins16
DC Current per I/O Pin40 mA
DC Current for 3.3V Pin50 mA
Flash Memory256 KB of which 8 KB used by boot loader
SRAM8 KB
EEPROM4 KB
Clock Speed16 MHz

The Arduino Mega can be programmed with the Arduino IDE.



3)  4x4 Keypad



The output voltage can be entered through a 4x4 keypad. The decimal point can be entered with '*' key and Enter/OK is represented by 'A' key.


4)  C# Based Computer Software




This computer software is developed with Microsoft C#. C# is intended to be a simple, modern, general-purpose, object-oriented programming language. The software was developed in Microsoft Visual Studio with Microsoft .NET framework. For graphing the voltage VS time, we’ve used ZedGraph library .


5)  Android Application


A bluetooth terminal application  from google play store is used.


6)  BlueTooth Module HC-05


Bluetooth module HC-05 is used to communicate between computer software/smartphone app and PSU. Bluetooth is a standard wire-replacement communications protocol primarily designed for low power consumption, with a short range based on low-cost transceiver microchips in each device and because the devices use a radio (broadcast) communications system, they do not have to be in visual line of sight of each other.

The blueTooth module HC-05 is used which converts buetooth to a serial port. We have used BlueTooth Serial Port Profile (SPP) which simulates a Serial Port like behaviour for communication.


7)  Adjustable  Duty cycle PWM signal 


A PWM signal is generated by the Arduino , whose duty cycle/pulse width can be adjusted. In Arduino the resolution of PWM is 8 bit, which means that the PWM signal can be adjusted for 2^8=256 different pulse widths/duty cycles. This PWM signal can be filtered through a low pass filter to get a clean DC signal whose amplitude is directly proportional to the duty cycle of the signal.



8)  Step Size/Error


At 5 volts the DC step size is 5/256 =19.5 mV. Further as this signal is amplified, the step size increases to 19.5*2.8=54.4 mV, so the maximum error between the desired value and achieved value of DC signal is 54.4 mV.


9)  Second Order Low Pass Active Filter





R1=  10k         R2=10k

C1=0.1uF           C2=0.1uF

f=1/2*pi *(R1*R2*C1*C2)1/2

f=159 Hz               by putting the mentioned values

This is a simple second order low pass active filter having a cutoff frequency of 159 Hz.The PWM signal discussed in above paragraph is applied to the input of this filter which suppress all the harmonics and only passes the DC component (I.e. the average value). The range of this signal is 0-5V.



10)  Non-Inverting Amplifier





R1=1.1k        R2=2k


G=1+R2/R1

G=2.8                     by putting the mentioned values

Thi is a non-inverting amplifier having gain (G) of 2.8.
The DC signal from the low pass filter is amplified by 2.8 times to amplify the range from 0-5V to 0-14V.




11)  BJT Darlington Transistor


The output of the non-inverting amplifier is fed to the base terminal of a BJT darlington transistor which amplifies the current. The output voltage of the darlington transistor is 1.25V lower than the voltage at the base terminal and it also varies with different load currents so there is a need of some feedback mechanism to adjust the output voltage which matches the set voltage value.







12)  Feedback


Output of the darlington transistor is reduced to 0-5V range by a resistor divider network because Arduino can not endure signals >5V. This de-amplified signal is read by ADC in Arduino and the PWM duty cycle is adjusted to get the output voltage to the desired set voltage. A capacitor is used to suppress the fluctuations.


12)  LCD


A 16x2 LCD displays the set voltage value.

13)  Cooling fan


The darlington transistor regulates the voltage by passing the required voltage to the output while burning the rest of the excess voltage to heat. Therefore, specially at low voltages and high currents its temperature rises above that of ambient.
Other heat producers include LM7812 which powers up the 12V fan and LM7808 which powers up the Arduino board. These components are heatsinked to help them dissipate heat to the air. A computer power supply cooling fan is used to throw the heat out of the casing into the atmosphere.

14)  Applications


1. This power supply has very tight voltage regulation, thus it can be used in labs.

2. In software the feedback system regulates the voltage precisely. Therefore, it can be used in precision applications.

3. It is also controlled by PC and Android phone which can be helpful in automated production environments.

15)  Future Enhancements


1. PWM resolution can be increased to reduce the step size and hence error. With a resolution of 12 bits and an amplifier gain of 3, the maximum error will be reduced to 3 mV or 0.003V.

2. Output current capability can be increased by using multiple darlington transistors in parallel.

3. Current limiting can be implemented to save the devices from over current damage.

4. This supply can also be programmed to get a constant current source if current sensing is implemented.

5. Op-amp can be used to regulate the voltage in the hardware because software voltage regulation is a bit slow.



16)  Problems Faced


At first we tried PWM generation with PIC microcontroller but it had a lot of problems manipulating floating point numbers, so we switched to Arduino. The sampling network for feedback was noisy, which was decoupled with a capacitor.


17) References


[1] www.Arduino.cc

[2] EEVblog #225 – Lab Power Supply Design Part 4 – PWM Control

http://www.eevblog.com/2011/12/07/eevblog-225-lab-power-supply-design-part-4-pwm-control/

[3] http://playground.arduino.cc/code/Keypad

[4] “Electronic Devices & Circuits Theory Ed. 10th”, Floyd, Chap #11


18) Video of final working product








19) Arduino Code


#include <LiquidCrystal.h>

#include <Keypad.h>


float incomingByte = 6;

float vol=6;

String s="";

char b=0;

volatile  char key;

volatile int count=0;

bool keyInput=false,c=0;

float keyInputNum=0;



// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(25, 27, 29, 31, 33, 35);



const byte ROWS = 4; // Four rows

const byte COLS = 4; // Three columns

// Define the Keymap

char keys[ROWS][COLS] = {

{'1','2','3','V'},

{'4','5','6','B'},

{'7','8','9','C'},

{'.','0','#','D'}

};

// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.

byte rowPins[ROWS] = {53,51, 49, 47 };

// Connect keypad COL0, COL1 and COL2 to these Arduino pins.

byte colPins[COLS] = { 45, 43, 41,39 };



// Create the Keypad

Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );



void setup() {

Serial.begin(9600); // set up Serial library at 9600 bps

pinMode(23, OUTPUT);

digitalWrite(23, LOW);



//buzzer pin

pinMode(37, OUTPUT);

digitalWrite(37, HIGH);



pinMode(A0, INPUT);



// set up the LCD's number of columns and rows:

lcd.begin(16, 2);

// Print a message to the LCD.



//interrupt

pinMode(2, INPUT);

attachInterrupt(0, keypad, FALLING);



setVoltage();

}



void loop() {



if(!keyInput){

lcd.clear();



lcd.setCursor(0,0);

lcd.print("Digi Power Suply");



lcd.setCursor(5,1);

lcd.print(vol);

lcd.print(" V");



if (Serial.available() > 0) {

// read the incoming byte:

incomingByte = Serial.parseFloat();

if(incomingByte>=1.3 && incomingByte<=12){

vol=incomingByte;

Serial.print(vol);

//Serial.println(incomingByte, DEC);

setVoltage();

}//end inner if

}

int x = analogRead(A0);

float v=x*0.00488758*4.83;

if(v-vol>0){

if(incomingByte-1>=0)

incomingByte--;

else

incomingByte=255;

}

else if(v-vol<0){

if(incomingByte+1<=255)

incomingByte++;

else

incomingByte=0;

}

analogWrite(13, incomingByte);

//bounce back to serial, the voltage value

delay(500);

}//end if

//hardware keypad processing

else{

char cursorCount=7;

String s="";

key='t';

while(key!='V'){

key = kpd.getKey();

delay(50);

if(key)  // Check for a valid key.

{

digitalWrite(37, LOW);

delay(50);

s+=key;

lcd.setCursor(cursorCount++,0);

lcd.print(key);

digitalWrite(37, HIGH);

}

}//end while

keyInputNum=StrToFloat(s);

if(keyInputNum>=1.3 && keyInputNum<=12){

incomingByte=keyInputNum;

vol=incomingByte;

Serial.print(vol);

setVoltage();

}//end inner if

keyInput=false;

}//end else

}



void keypad(){

digitalWrite(37, LOW);

lcd.clear();

lcd.setCursor(0,0);

lcd.print("Input:");



keyInput=true;



delay(70);

digitalWrite(37, HIGH);

}



void setVoltage(){

vol=incomingByte;

                incomingByte-=1.18;

incomingByte/=2.8;

                incomingByte*=100;

incomingByte/=5;

incomingByte*=255;

incomingByte=incomingByte/100;

analogWrite(13, incomingByte);

delay(1000);

}



float StrToFloat(String str){

char carray[str.length() + 1]; //determine size of the array

str.toCharArray(carray, sizeof(carray)); //put str into an array

return atof(carray);

}


Index Terms—Power Supply, BlueTooth, SPP, Serial Communication, Regulator, Arduino , C#


Comments