Monday, May 18, 2015

Charge and discharge of a Capacitor



The purpose of this exercise is to measure see how a capacitor charges and discharges using a National Instruments DAQ which a device that allow us acquire data. The data that will be acquiring is the voltage of the capacitor while is charging and discharging.

First of all we have to talk about the National Instruments DAQ, I will be using the DAQ 6008 which has the following specifications:
  • 8 analog inputs (12-bit, 10 kS/s)
  • 2 analog outputs (12-bit, 150 S/s); 12 digital I/O; 32-bit counter
  • Bus-powered for high mobility; built-in signal connectivity
  • OEM version available
  • Compatible with LabVIEW, LabWindows™/CVI, and Measurement Studio for Visual Studio .NET
  • More info: Datasheet of the DAQ

Captura

This device will help us to measure the voltage on the capacitor while charging and discharging at 150 samples per second on a 12 bit resolution ADC (Analog to Digital Converter) and it will also help us to activate a relay connected to charge the capacitor, another one to discharge it and the last one for a quick discharge before we charge the capacitor.

The process to do that it is explain on the next state machine:
Maquina de estadps


To be able to do all that says the state machine I have design two Printed Circuit Boards to connect them to the DAQ, one of the boards is for the relays and the other one is the actual charge and discharge circuit. I began with the schematic as you can see in the picture below:

esquematico

Connections:
J1 This is a header block for the charge resistor.
J2 This is a header block for the capacitor.
J3 This is a header block for the discharge resistor.
J4 \
J5      > This connectors are for closing the circuit when it is need it.
J6 /
J7 Inputs to activate the relays.
J8 DuPont male header for connecting the contacts of the relays to close the circuit.
J9 This the power header.

NOTE:
  • The relays are 5V not 12V
  • The protection diodes are 1N4001
Now in the next picture you can see the PCB layout of the schematic:

pcb

You can see the boards working in the next video:



In order to measure the voltage and see that the values that the DAQ is reading are correct values we will use the next formulas:

Tension a buscar segun tiempo

Here we calculate the instant voltage based on given time, for all these formulas we have to know some values like:

Vf = 5 Volts.      This is the power supply voltage and it is constant.
Vi = 0 Volts.     To be sure that we are on zero we make a short circuit before we start to measure the charge and discharge of the capacitor.
Z = R . C           This constant is a multiplication of the resistor and the capacitor (one resistor for charging and another one for discharging)

Calculo del condensador para errores de medicion

This formula help us to calculate the real capacitance of the capacitor for measuring errors given by the capacitance meter.
Tiempo de carga segun vins

With the formula above we can calculate the time that it will take to get a voltage.

The values used in the formulas where:
Charging Resistor             996 Ω
Discharging Resistor         997 Ω
Capacitor                       452 µF
Initial voltage                  0 Volts
Final voltage                   5 Volts

Ok, so now let’s get into LabView and make a program that will do the state machine that I explained earlier.

The LabView program is simple, it just have a event case where it detects the change of value of a button, I will explain it with the next pictures:

Front_panel

This is the font panel of the program that could be the users interface where you can input the values of voltage, capacitor and resistors.

Labview0

As I always do in a event case I live like that.

Labview1

Next I set change vale event where it will do all the states we mention at the beginning:
  • Short circuit on the capacitor pins to get a zero voltage so we can then use our formulas and compare the results.
  • Start charging and at the same time measuring the values of the capacitor
  • When the capacitor is fully charged discharge it and also measure the voltages on it.
  • Make a graphic with the values
Labview2

This is an event case for an emergency or if something is not working properly we can stop the Vi at any time.

Labview3

This is measure again, we set the variables to its initial positions to start measuring again.

Labview4

Here we take the voltage base on the data store on a array.

Labview5

Here we calculate the time based on a ideal capacitor to get close to our formulas.

Here are some pictures of the board connected to the DAQ and a video of it working:

20150223_165022
IMG-20150504-WA0016               IMG-20150504-WA0015

And here as I promise, the video:



You can download the files in this link:
File name: Capacitor.zip
Version of LAbView 2013


1 comment:

  1. Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.mobile phone repair in Novi
    iphone repair in Novi
    cell phone repair in Novi
    phone repair in Novi
    tablet repair in Novi
    ipad repair in Novi
    mobile phone repair Novi
    iphone repair Novi
    cell phone repair Novi
    phone repair Novi


    ReplyDelete