Micro-processor Controlled Potentiostat - Home -...

51
1 Micro-processor Controlled Potentiostat -Full Report- By Chris Benton Prepared to partially fulfill the requirements of CSU ECE 402 Department of Electrical and Computer Engineering Colorado State University Fort Collins, Colorado 80523 Project Advisor: Dr. Jorge Rocca Approved by: Dr. Jorge Rocca

Transcript of Micro-processor Controlled Potentiostat - Home -...

Page 1: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

1

Micro-processor Controlled Potentiostat

-Full Report-

By Chris Benton

Prepared to partially fulfill the requirements of

CSU ECE 402

Department of Electrical and Computer Engineering

Colorado State University

Fort Collins, Colorado 80523

Project Advisor: Dr. Jorge Rocca

Approved by: Dr. Jorge Rocca

Page 2: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

2

Abstract

I conducted my senior design at the Colorado State University Engineering Research

Center (CSU ERC) under Dr. Jorge Rocca. One of the experiments being conducted at the center

is the Generation of Bright X-ray Sources by Femtosecond Irradiation of Vertically Aligned

Nanostructures, and this is the research group that I worked with. A potentiostat is an

electrochemical device essential to the production of the nickel nano-wire targets used in the

experiment. In order to improve the current production process, I was assigned to design and

build a custom potentiostat for our exclusive use in the lab. The final result of my senior design

was a multi-channel potentiostat that has the necessary features and capabilities for us to grow

nano-wire targets independently at the laboratory, with a cost significantly less than that of

purchasing a commercial potentiostat.

The potentiostats commercially available have many more capabilities than are necessary

to our operation, so the one that I have designed and constructed has only the features necessary

for our experiment. These features include being an enclosed and portable unit, multi-channel

simultaneous operation, and real-time current measurement. I began with the simplest form of a

potentiostatic circuit (a single op-amp design) and planned out how to improve it to operate as

desired. I then added the necessary circuitry to enable it to perform to specification. I stabilized

and refined the design using simple sheet nickel to copper electroplating as an analog for the

electrolytic cells. Following successful demonstrations of stability and performance, I created a

product grade electrical assembly and basic chassis to extensively test the unit design on actual

targets for use in the experiment. I also developed a graphical user interface (GUI) program in

order to control, and receive live feedback from, the unit. With experimentally sound target

production established, a final unit was constructed for permanent use with the lab.

Using these techniques, I successfully designed and built a multi-channel potentiostat

system. The device correctly operates as a potentiostat and has been shown to operate stably,

consistently, and accurately during target growth. It has been verified that the system provides

accurate live feedback on the operation of the cell accurate to 10 microamperes, allows direct,

independant control different potentiostat channels, and can display live data from the device,

plotting trends in current measurement as they occur. The device and interface constitute a nano-

wire growth system that meets all demands of the experiment and is comparable to commercial

units. Thus, the cost of a commercial grade potentiostat was avoided, and two of my units are

currently being used in production of targets for research.

Page 3: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

3

Table of Contents

Part 1: Introduction

Part 2: Design and Features

Part 3: Development and Stabilization

Part 4: Prototyping and Construction

Part 5: Graphical User Interface and Arduino Code

Part 6: Testing and Target Production

Part 7: Final Units and Continuation

Appendices

Page 4: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

4

List of Figures

Figure 1 Experimental Setup

Figure 2 Simple Potentiostat

Figure 3 Block Diagram

Figure 4 Circuit

Figure 5 Current vs. Time Plot

Figure 6 PCB Top Layer

Figure 7 GUI Display Capture

Figure 8 SEM Image 1

Figure 9 SEM Image 2

Figure 10 SEM Image 3

Figure 11 Photo of Complete Unit

Page 5: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

5

Part 1: Introduction

At the Colorado State University Engineering Research Center (ERC), one of the

research groups is the National Science Foundation Center for Extreme Ultra-Violet Science and

Technology. The center is exploring the development of compact coherent extreme ultraviolet

(EUV) sources and their applications in challenging scientific and technological problems. The

summer prior to working on my senior design project, I participated the Research Experience for

Undergraduates (REU) program at the center. I decided to continue my experience at the ERC by

conducting my senior design there with Dr. Jorge Rocca, the center director, as my senior design

project advisor.

My time at the laboratory over the summer gave me experience with the tools and

resources available at the ERC, as well as introducing me to the experiment I ultimately worked

with for my senior design project, Generation of Bright X-ray Sources by Femtosecond

Irradiation of Vertically Aligned Nanostructures. This experiment consists (as the name

suggests) of shooting nano-structure targets with a high contrast femtosecond laser and taking

diagnostics of the X-rays emitted (see figure 1). The experiment is dependent upon the

continuous production of the nanostructure targets. These targets are nickel nano-wire arrays

which are grown by electrochemical deposition. The overall motivation for my senior design

project is to better the nano-wire growing operation and to make it an independent process which

can be performed at the laboratory.

The experiment

was being run by

the graduate

students Reed

Hollinger and

Clayton Bargsten.

At that time, the

production of the

targets was

conducted at the

chemistry building

on campus,

utilizing much of

their equipment.

Specifically,

potentiostats.

Potentiostats are

devices used in

Page 6: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

6

electrochemistry and are essential to the production of the nano-wire targets used in the

experiment. One of the goals of the experiment is to rely less on the use of the equipment owned

by the chemistry department. However, commercial potentiostats can cost in the range of 10,000

to 15,000$. As such it was impractical to purchase one for this experiment alone. The significant

cost comes primarily from the exceptional performance and range of supply values demanded by

certain advanced chemistry applications. However the needs of the potentiostat for nanowire

growth are fairly limited, and so it was decided that we should construct our own. This

potentiostat became the primary focus of my senior design project.

Potentiostats are relatively simple in concept, but must be extremely precise and stable in

operation in order to produce good wires. In the target production process, the potentiostat is

what is used to deposit the nickel and grow the wires. Simple nickel electroplating only utilizes

two electrodes, the anode and cathode. The anode charges the solution and the nickel is

deposited onto the work which is connected to the cathode. Applying a voltages results in the

current through the solution which deposits the nickel. However, the electrolytic cell is a

dynamic environment, with changes in conductivity and variations in current flow that results in

poor production when growing precision structures like nano-wires. As such we use a

potentiostat to grow our wires. A potentiostat in its simplest form (see figure 2) has three

electrodes, the counter, the reference, and the work. The cathode connected to the work is the

same as for regular electroplating. The potentiostat uses a third electrode called a reference

electrode to measure the potential of the plating solution. The potentiostat then regulates the

voltage applied to the

counter electrode in order to

keep the reference at a

constant potential. This is

most often accomplished

through a feedback circuit to

an operational amplifier. The

input voltage is what the

reference electrode is

matched to, and determines

the rate of deposition. Figure

2 depicts a very simple

potentiostat and electrolytic

cell.

In this document, I explain

the process I went through in

creating a potentiostat and support system for the experiment, as well as my methods and

reasoning for design choices. In part two, I show and justify the modifications and improvements

I made to the figure 2 design in order to make a potentiostat suited to our purposes. There were

Page 7: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

7

many design requirements that had to be met, but following the design phase, I conducted

extensive testing a revision on my circuit. It was necessary to establish an extremely stable mode

of operation for all amplifiers in the design. Any oscillations or large ripples in output during

operation had to be stabilized. The process of testing the circuit and correcting for instabilities is

discussed in part three of this report. Following the completion of a stable and working

potentiostat, I expanded the single potentiostat into a four channel system where each channel

can be controlled independently, and the entire unit can function without assistance from

laboratory supply. Having a single portable unit is necessary to provide a device comparable to

commercial products. In part four, I discuss the process of designing the printed circuit board

(PCB) and the construction of a complete unit. The graphical user interface (GUI) was another

significant part of making the unit a complete working system. The interface was designed in a

software called “Processing,” to run on a personal computer alongside the device. The software

allows for the direct control of the unit, and for live feedback to the operator. The arduino also

had to be programmed to control the unit and communicate with the user interface. The

development of the interface and arduino code is discussed in part five. In part six, I will discuss

the testing procedure performed on the complete prototype, and how the results verified the

device. Extensive operation of the prototype demonstrated that it was time to develop it into its

final form. The final unit, along with its features and performance are discussed in part seven.

Possible future work on the project is also discussed in that section. Multiple appendices are

included for reference and for proper use of the device.

Page 8: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

8

Part 2: Design and Features

Commercial potentiostats have a wide supply range for a variety of uses in advanced

electrochemistry, however the potentiostat I designed needs to only operate in the supply ranges

we use when growing nano-wire targets. It was also necessary to include significant margins in

order to allow for testing procedures that operate at different values than actual growth

parameters. The many design features I eventually went with come from seven primary design

requirements.

● 4 independent channels

● Control reference voltage and run time

● +/- 5 volt (minimum) reference voltage range

● <1mv ripple stability in output and regulation

● Up to 10 mili-amperes current supply per channel

● Current measurement with 10 micro-ampere resolution

● A single unit that operates independently of external devices

● A PC based user interface to control and observe operations

These design specifications were the guide for all design decisions made for the project. Where I

had a choice in methodology, I would generally choose to emulate the performance of a

commercial potentiostat where practical. I also chose technologies that I could easily learn about,

or that I already had experience with. In this way, I always knew that the project was within my

ability to complete. This was my guide to the design decisions I faced throughout the project.

While a potentiostat circuit itself is relatively simple, it requires a voltage input signal

that can be set depending on the rate of growth you desire. It also requires some way to read and

observe the current measurements. These are all things that can be handled by a microprocessor.

I decided to utilize products from Arduino for this role. Arduino products are praised for their

ease of use, the large amount of community support, and reliability for projects such as these.

Given the extensive resources available for them, they were the obvious choice for my

microprocessor. In addition, many of my peers have or are currently using arduino processors in

their own projects. This meant that I would have immediate help if problems arose during my

work on the project. I eventually chose the arduino mega, as it has enough digital and analog

communications pins to support all four channels of the potentiostat, as well as possible extra

features to add on later.

The challenge with most any microprocessor is how to easily interface with them. The

simplest solution was to connect the arduino with a personal computer. This is the same

technique used by the commercial potentiostat we use at chemistry. From the personal computer,

you can implement a graphical user interface (GUI) that will allow you to control reference

voltage, run time, and display a moving window of the current vs. time plot. The use of a

Page 9: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

9

personal computer led me to my overall block design of the potentiostat system (figure 3)

The user inputs into the computer the desired run time and voltage which sends the data

to the arduino. The arduino communicates through serial to a digital to analog converter (DAC)

which supplies the reference voltage to the potentiostat that runs the cell. The potentiostat is

connected to the arduino, so that the arduino can measure the current in the cell and passes the

data back to the computer. The computer displays a real time plot on the monitor for the user to

observe during the run. Combined together, these elements allow for a potentiostat and control

system comparable to that of a commercial potentiostat.

While the control systems are essential, the heart of the potentiostat is the amplifier

circuit which regulates the voltage of the counter electrode in the electrolytic cell. The amplifier

Page 10: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

10

circuit is what actually grows the wires, while everything else is simply a support system. The

rest of the system can only be developed and tested following the completion of the amplifier

circuit. As such, the amplifier circuit was the first objective. In figure 4, you see my design for

the amplifier used in the

potentiostat.

The red circuitry is the

core of the circuit: the

potentiostatic amplifier. This is the

amplifier that actually maintains

the reference voltage to the signal

and is a stabilized version of the

circuit seen in figure 2. The

amplifier is an OPA228, and was

chosen due to the extremely small

(10 microvolt) offset voltage, and

for its rating of up to 45 mA

supply range.

The blue circuitry is

hereafter referred to as the

“puller” circuit. For a potentiostat

to operate correctly, the working

electrode must maintain a zero

potential, but this makes it difficult

to make a current measurement in

this series circuit. As such, I

implemented another OPA228 that

creates a negative voltage across a

measuring resistor, and maintains

a virtual ground at the working electrode, “pulling” current flowing in the cell through the

resistor. In this way, I have a known resistance and measured voltage with which I can calculate

the current through the cell.

Unfortunately, the arduino on board analog to digital converter (ADC) can only measure positive

voltages with a ground reference. As such I built the green circuit, an analog inverter using a

simple 741 op-amp and matched resistors. The output of this circuit can be read by the arduino,

and a current measurement calculated.

By using different size measuring resistors, and by changing the internal reference that

the arduino uses for the ADC, I can change the range and resolution of the current measurement.

However, the best size for measuring during nickel wire growth is 150 ohms. Using the 10bit

Page 11: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

11

ADC and a 1.1 reference voltage will provide 7.16 micro-amp resolution to the current

measurement, and a range of up to 7.3 mili-amps. The inverting circuit resistors are 1kohm with

an error of .01% making them superbly matched to provide an accurate inversion of the analog

signal.

This circuit design is the final form of the potentiostat, and has been shown to operate

correctly. It was duplicated three more times in order to form the four channel potentiostat which

was the goal of this project. However, the amplifier had to undergo significant development and

testing before being duplicated.

Page 12: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

12

Part Three: Development and Stabilization

The development and refinement of the circuit took a significant amount of time. This is

because the stability and operational requirements of the potentiostat are extremely strict.

Finding a power supply smooth enough to provide rail voltages is difficult in and of itself. Given

that the resolution goal of the current measurement requires millivolt level accuracy, and that the

reference voltages vary by 10’s of millivolts, a sub millivolt level stability is required in all parts

of the circuit. As such, extensive stability testing and repair was necessary, and a significant

amount of time was dedicated to this.

I conducted the testing process by starting with only a single potentiostatic amplifier (the

blue circuit in figure 4), and slowly adding components and building the circuit larger, stabilizing

the sections as they are added. One of the challenges of testing a potentiostat circuit, however, is

finding an appropriate load for it to act on that will demonstrate correct or incorrect operation. I

began with simple series resistor networks that operated as a voltage divider to provide a

reference voltage. While it does not simulate the capacitive and dynamic nature of an electrolytic

cell, it does show if the op-amps are already in need of stabilizing capacitors. After stabilizing

the circuits operating on resistor networks using capacitors, I used a simple nickel to copper

electroplating process. The actual electroplating solution accurately models a nano-wire growth

run, changing impedance and adding a capacitive quality to the load. Testing was done on the

electroplating solution rather than wire templates due to the cost of the templates being in excess

of 20$.

Initial testing was done at the ERC under the supervision and guidance of Mark

Woolston, who advised on the general placement of stabilizing capacitors. Using his suggestions

I was able to gradually begin to develop my circuit. At this point in time, my circuit required a

minimum of 3 DC power supplies and an oscilloscope in order to perform a test run. Due to low

availability of supplies at the ERC, I used resources in the labs on campus for most of my

stability testing. Using the electroplating solution and Marks advice, I was able to determine

where I needed stabilizing capacitors in the circuit as well as on the power supplies I was using. I

was eventually able to minimize all ripple values to under 1 millivolt in magnitude and was able

to effectively plate nickel to the copper sheets I was testing with.

With a working amplifier circuit, the next stage in the project was to obtain a current

measurement using the arduino, and compare the magnitude and trends with the expected value

given the commercial potentiostat. Eventually this will be done automatically and the arduino

will export the data to be displayed on a computer. As it is, I instruct the arduino to perform 100

analog reads per second, and export them to a serial monitor. I then wrote the values from the

monitor to a data file and imported it into a data analysis program. This cumbersome method

Page 13: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

13

demonstrated proof of concept for the current measurement. By using current density and area

calculations, I estimated that the current while electroplating should be about 4.4 mA per square

centimeter. Below is the post processed plot showing current versus time for one of my runs that

ran for 120 seconds (figure 5).

Figure 5

The approximate size of the metal strip I was electroplating to for this test was

approximately one square centimeter. The data show approximate currents of 7 mA. Given the

rough nature of the calculations, the data shows a good correlation to the current density

expected. The trend of the plot is almost identical to the trends observed during actual nano-wire

growth. All of this supports the correct operation of the circuit, with accurate current

measurement.

At that time, the circuit is build on a breadboard with the arduino connected using test

leads. Using laboratory voltage supplies is impractical for a final unit. The next step of the

project was to design complete prototype unit that could operate independently, and be used for

thorough testing of the design.

Page 14: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

14

Part Four: Prototyping and Construction

The core most any electrical unit is a printed circuit board upon which most of the

electrical components are placed and soldered. Using a breadboard (as had been done up to this

point) is unacceptable in any professional unit, and eliminating it was the first step. The PCB I

designed holds the DAC’s, the four potentiostat circuits, power routing, and acts as a shield for

the arduino. I used the software a fabrication house of ExpressPCB for the design and

manufacturing of the PCB. It is a relatively user friendly software and allows for fast

manufacturing at a low price. The design of the board focused on some key aspects:

● Minimize cross talk between all measurement lines

● Provide clean and organized routing of all traces

● Keep all outputs separated from power distribution

● Minimize board size while keeping components adequately spaced

● Provide mounting for arduino and reliable connections

● Provide labeling for easy reproduction and population of board

● Allow for feature addition with access to unused arduino pins

The schematic and design of the potentiostat transferred to the PCB with no mistakes,

and population of the board went smoothly. The vast majority of the board was designed with

through hole components, such that if testing revealed an issues with a component value, it could

be easily replaced. An image of the top layer of the board can be seen in figure 6.

Figure 6

Page 15: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

15

In order to minimize the noise present inside the unit, I decided to use a linear +/- 12 volt

power supply. A linear supply, while more expensive provides a cleaner output, and puts out

minimal RF compared to a switching supply. It was also necessary to include a small board with

low power signal relays. Due to the intrinsic potential of the plating solution to the electrode,

simply setting the reference voltage to zero will not stop the plating process. In order to truly

“turn off” the potentiostat, it is necessary to physically disconnect it from the cell. Relays are

placed in line with the counter electrode output, and when a run is finished, the relay is simply

switched off. This also assigns a binary on or off value to whether or not the cell is running.

The rest of the prototype unit is the hardware consisting of fuses, clip leads, power

sockets, and indicators. All of the electronics and hardware were assembled and mounted inside

of a small project box. With the construction of the prototype unit complete, the only thing

necessary for final testing was an interface to operate the device.

Page 16: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

16

Part Five: Graphical User Interface and Arduino Code

In order to make the system complete and user friendly, it was necessary to implement a

GUI to be run on a companion personal computer during operation. A software called

“Processing” allows for easy development of on screen drawings and interaction, as well as

serial communication via USB ports. The coding environment of Processing and that of arduino

are very similar. Using a custom serial communications protocol, I established a method of

communication between the arduino and the interface. The interface would consistently update

the arduino with the state of the run for each channel, while receiving cell current data from the

ADC’s on board the arduino. In this way, the interface had active control over the unit, while

receiving live data on the deposition process.

The arduino only performs a limited set of operations. It receives the values via USB at

which to set the reference voltage for each potentiostat circuit. It then passes along these values

to the DAC’s which send an analog signal to each circuit. It then takes a reading on the value of

the voltage across each measuring resistor and compares that voltage to an internal reference of

1.1 volts. The arduino then sends the data back to the PC via the same USB cable. The arduino

also operates the relays that connect or disconnect each cell, depending on the instructions

received from the GUI.

Figure 7

Page 17: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

17

The appearance of the graphical user interface is seen in figure 7. The interface has a

much more complex operation than the arduino. For each channel of the potentiostat, the

interface has an edit button and display for the run time and reference voltage, as well as a start

and stop button. The interface also displays a moving window plot of the currents in the cells,

along with an average of the values displayed and an instantaneous read out of the values being

received. The interface also displays timers to indicate how long a cell has been running, and

how long until completion of the run. The GUI keeps track of the values being sent to and

received from the arduino, as well as boolean state for the operation status of each cell. Much of

the code is devoted to the implementation of buttons that are activated with mouse clicks. The

buttons have active response to indicate whether a value is being edited or not, and even prompts

the user with how to enter data. Due to the setup of the buttons you can edit multiple entities

simultaneously, start separate cells at different times, and even update the deposition parameters

mid run. The code regularly updates the unit with current values and constantly receives current

measurements from the unit. All of this provides for a clean and easy to use interface.

All code for the arduino and the GUI can be found in the appendices.

Page 18: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

18

Part Six: Testing and Target Production

The most basic testing of the unit was carried out immediately after completion and

covered basic power up, extended power on periods, extended idle periods, and basic function of

potentiostats on dummy resistor networks.

In particular, measuring the heat buildup in

the unit over extended operation was

extensively investigated to determine if

ventilation was required. However, the

minimal power usage of the device showed

that heat was a non-issue. Outputs of the

power supply and electrodes were also

observed on oscilloscope and were shown

to be within ripple tolerances. With basic

functionality tested, and with previous

electroplating tests showing correct

behavior, it was decided that the unit was

ready to be tested on actual target

templates.

At the time that the prototype unit

and user interface were completed and

initially tested, target production for the

experiment was being performed on

borrowed commercial potentiostats. The

commercial devices were only capable of

running one cell at a time, and production

was under great strain. The two units to

which we had access were being run late

into the night in order to keep up with target

production, as a single deposition can take

multiple hours. After a target is grown and

treated, it is inspected by scanning electron

microscope to verify high quality wire.

Even with commercial devices not all targets

meet requirements, so all targets must be

inspected. Due to the pressure on production, the testing of the prototype unit was conducted by

immediately trying to grow actually targets for the experiment. There was no risk to the

experimental accuracy because any target produced by the unit would be inspected before use.

Figure 8

Figure 9

Page 19: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

19

The SEM images of other target had been thoroughly characterized by the researchers to

establish characteristics of high quality targets. The ultimate evaluation of the potentiostat was if

it could produce targets that would pass inspection by SEM.

The demand for targets at that time

include a wide range of potentials and run

times, which would test the limits and

capabilities of the unit. Running the four

channel unit alongside the other two

borrowed units tripled the production of

targets during that week of testing, and

helped to ease the demand of target. All

targets produced by the custom unit were

prepared and evaluated using the SEM,

and they were found to be comparable to

those produced using the commercial unit

and viable for use in the experiment.

Figures 8, 9, and 10 show example SEM

images used to verify the quality of the

wires. The success of those trials indicated that the system was ready for a final version and that

the design was sound and reliable. The prototype unit continued to be used to aid in target

production, while a final version with cosmetic changes was being constructed.

Figure 10

Page 20: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

20

Part Seven: Final Unit and Continuation

With the prototype device

operational and tested, I was asked to

construct a second unit, as target production

was still under strain. Building a second unit

allowed me to make cosmetic changes to the

initial design to make it more professional

and reliable. This included adding LED

indicators to each channel on the unit for

extra feedback on the operational status of

the unit, as well as installing more aesthetic

power indicators and labeling. It also

allowed for more organized wiring inside of

the unit, as well as the use of IC cradles for

easy replacement of operational amplifiers

on the board. The two units are functionally

identical, ensuring consistent target

production from both the final and the

prototype unit. The final system was tested

in a similar manner to the first unit, and it

was verified that it too produced good

targets for use in the experiment. A picture

of the completed unit can be seen in figure

11.

Both the final and the prototype units are currently in parallel use producing targets being

used in the experiment, capable of running eight simultaneous depositions. The experiment has

transitioned from nickel to depositing other materials as well, requiring a variety of plating

potentials. Aside from minor trouble shooting, they have both operated consistently for over six

months. Other groups at the research center have also expressed interest in the units, as normal

electroplating is commonly desired, and potentiostats facilitate controlled growth.

Future work on this project would most likely consist of the construction of yet another

unit. Given the PCB files, code, and this report, it should be relatively easy to construct

additional units. If there is ever a need to plate with higher currents, the devices could be

modified by using high current rated amplifiers, and adjusting the internal reference of the

arduino. As for the GUI, there are several modifications that could be made. Some possible

options for improvement are listed below:

Figure 11

Page 21: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

21

● Include a feature that allows for exporting the history of a run into a data file

● Allow for two units to be operated from a single PC

● Include active scaling of the plot window in order to view data more closely

● Include auto-turn-off protocols for unusual behavior in cells

● Impose limitations on possible input values to prevent misuse

While there are small improvements one could make to the system, it fulfills all

requirements set out at the beginning of this project. The system is currently being used in

conjunction with the research center experiment, and it has been shown to operate comparably to

a commercially bought system in that context. The final cost of development was also shown to

be significantly lower than that of a commercial solution. Should there be a continuation to this

project, it would be to meet entirely different or expanded criterion.

Page 22: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

22

Appendices

Appendix A: Abbreviations

● CSU: Colorado State University

● ECE: Electrical and Computer Engineering

● EUV ERC: Extreme Ultraviolet Engineering Research Center

● REU: Research Experience for Undergraduates program

● LCD: Liquid Crystal Display

● GUI: Graphical User Interface

● DAC: Digital to Analog Converter

● ADC: Analog to Digital Converter

● SEM: Scanning Electron Microscope

● RF: Radio Frequency

● LED: Light Emitting Diode

Appendix B: Budget

The list below contains an itemized cost of a single potentiostat unit.

Part name Part number Cost

Unit enclosure RMCS19038BK1 $78.96

Measuring Resistor x4 Y0785-1.0KA-ND $14.92

Potentiostat amplifier x8 OPA228PA-ND $3.33

Inverting amplifier x4 LM741 $0.70

DAC x2 MAX5322EAI $12.15

Filter capacitors x32 399-9775-ND $0.33

Stabilization capacitors x8 478-5097-ND $0.73

Stabilization capacitors x4 399-9714-ND $0.79

Stabilization capacitors x4 399-9771-ND $0.40

Disconnection relays x4 306-1251-ND $1.63

Power Switch 451-1182-ND $3.65

Relay breadboard V2010-ND $7.33

Linear power supply 179-2305-ND $52.66

Page 23: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

23

Neon power indicator 1091-1101-ND $4.32

Channel LED indicators x4 350-2794-ND $2.20

Power cable 839-1179-ND $5.35

USB feedthrough MUSB-D511-00-ND $9.36

USB cable 1175-1413-ND $3.22

AC power connector Q335-ND $0.78

Cell clip leads x8 501-1332-ND $4.34

Cell clip leads x4 923835-GN-ND $14.15

Capacitor x8 493-5956-ND $0.25

Printed circuit board Custom PCB $69.28

Total cost of 1 unit 478.13 not including shipping. The goal of producing a unit for less than $500.00 was met

Appendix C: Past Version of Timeline

*Written Sept 2012*

Timeline Overview: The Potentiostat that is the subject of my senior design is to be used with

an experiment at the CSU Extreme Ultraviolet Research Center. The experiment that I am

working with requires the creation of nanowire targets. The production of these targets uses

a potentiostat to grow the nanowires. The focus of my senior design for the first half of the

year will be the design and construction of a potentiostat for growing these targets. Following

the completion of the potentiostat, I will move on to one of the other long term projects for the

experiment.

First Semester Timeline: September 2012

September:

● Amplifier circuit component selection process

● Component ordering and shipping

● Breadboard testing of amplifier circuit

October:

● Revision of amplifier circuit and project boxing

● Initial Arduino research and familiarization

● Analog and digital interface component selection and ordering

● Acquire components for multiple amplifier circuit channels

November:

Page 24: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

24

● Arduino development with digital/analog interfaces

● Construction of all four channels of amplifier circuits

● Arduino testing with amplifier circuits

December:

● Development of arduino user interface and PC communication

● Testing and boxing of all components and channels

January:

● Revisions and improvements on potentiostat design

● Add features and more control options to potentiostat

● Begin planning on possible follow up projects to occupy remainder of semester

Second Semester Timeline: January 2013

December:

● Establish a moving window in the GUI

● Transfer the prototype amplifier circuit to a soldered breadboard

● Duplicate the prototype as three additional channels

● Find and purchase all components for rail voltage supplies and DACs

● Perform nano-wire growth and use SEM to absolutely verify good growth

January:

● Implement the DAC as a signal voltage source

● Implement run time and voltage control into the GUI

● Begin work on enclosure box and rail voltages

February:

● Install circuitry and microcontroller in unit with fuses and indicators

● Add features such as LCD current display

● Make improvements on GUI and finalize product

March:

● Possibly begin reproduction of final potentiostat or add features to existing model

Appendix D: Calculations

Current Measurement Resolution:

voltage resolution=reference voltage/(2^ADC bit count)

1.1/(2^10)=1.07mV

current resolution=voltage resolution/Rm value

.00107/150=7.16 uA

Current Density:

total current/(area of exposed target*porosity)=current density

0.005/((pi*0.55^2)*0.12)=4.38mA/cm^2

Page 25: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

25

Expected current:

expected electroplating current=current density*plating area

.00438*1.0=4.38mA

Appendix E: Processing Code

// Chris Benton

// Microprocessor Controlled Potentiostat Project

// [email protected]

// spring 2013

//Compatable with arduino potentiostat code 4_0 and 5_0

//setup imports

import processing.serial.*;

import java.awt.*;

Serial myPort;

int backgnd=50;

char HEADER = '#';

//declare arrays used

float[] channelDisplay1A= new float[250];

float[] channelDisplay1B= new float[250];

float[] channelDisplay2A= new float[250];

float[] channelDisplay2B= new float[250];

float[] analogReadings= new float[4];

// declare max current for graphing scale

float maxCurrent;

//declare time for cells to run

float runTime1A;

float runTime1B;

float runTime2A;

float runTime2B;

//start and stop variables

boolean overStart1A;

boolean overStart1B;

boolean overStart2A;

boolean overStart2B;

boolean channelRunning1A;

boolean channelRunning1B;

boolean channelRunning2A;

boolean channelRunning2B;

Page 26: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

26

float timeRemaining1A;//run time is added to current millis to get timeRemainingXX,

timeRemainingXX-millis is time left on run.

float timeRemaining1B;

float timeRemaining2A;

float timeRemaining2B;

boolean overStop1A;

boolean overStop1B;

boolean overStop2A;

boolean overStop2B;

//value from 0 to 255 to represent value between +0 and+5

int toArduino1A;

int toArduino1B;

int toArduino2A;

int toArduino2B;

// time set variables

boolean overSetTime1A;

boolean overSetTime1B;

boolean overSetTime2A;

boolean overSetTime2B;

boolean settingTime1A;

boolean settingTime1B;

boolean settingTime2A;

boolean settingTime2B;

String timeInput1A;

String timeInput1B;

String timeInput2A;

String timeInput2B;

//voltage set variables

boolean overSetVolt1A;

boolean overSetVolt1B;

boolean overSetVolt2A;

boolean overSetVolt2B;

boolean settingVolt1A;

boolean settingVolt1B;

boolean settingVolt2A;

boolean settingVolt2B;

String voltInput1A;

String voltInput1B;

String voltInput2A;

String voltInput2B;

int channelByteVoltage1A;

Page 27: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

27

int channelByteVoltage1B;

int channelByteVoltage2A;

int channelByteVoltage2B;

int buttonColorHighlight;

int buttonColorRunning;

int buttonColorDefault;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void setup() {

//set window and modes

size(1200,700);

frameRate(30);

rectMode(CORNER);

smooth();

//setup serial comm

println(Serial.list());

myPort = new Serial(this, Serial.list()[0], 9600);

myPort.bufferUntil('\n');

//initialize currents to 0

for (int i=0; i<4; i++) {

analogReadings[i]=0;

}

//set max current in mA

maxCurrent=6;

//initialize the displays to zeroes

for (int i = 0; i <= 249; i=i+1) {

channelDisplay1A[i]=0;

channelDisplay1B[i]=0;

channelDisplay2A[i]=0;

channelDisplay2B[i]=0;

}

//set colors used to color buttons

buttonColorHighlight=125;

buttonColorRunning=75;

buttonColorDefault=200;

Page 28: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

28

//initial send is disconnect the cells

toArduino1A = 0;

toArduino1B = 0;

toArduino2A = 0;

toArduino2B = 0;

//state that indicates if the mouse is over a button

overStart1A=false;

overStart1B=false;

overStart2A=false;

overStart2B=false;

overStop1A=false;

overStop1B=false;

overStop2A=false;

overStop2B=false;

//state tells if the cell is running

channelRunning1A=false;

channelRunning1B=false;

channelRunning2A=false;

channelRunning2B=false;

//value is initialized to 0

timeRemaining1A=0;

timeRemaining1B=0;

timeRemaining2A=0;

timeRemaining2B=0;

overSetTime1A=false;

overSetTime1B=false;

overSetTime2A=false;

overSetTime2B=false;

settingTime1A=false;

settingTime1B=false;

settingTime2A=false;

settingTime2B=false;

timeInput1A="";

timeInput1B="";

timeInput2A="";

timeInput2B="";

overSetVolt1A=false;

overSetVolt1B=false;

overSetVolt2A=false;

overSetVolt2B=false;

settingVolt1A=false;

settingVolt1B=false;

Page 29: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

29

settingVolt2A=false;

settingVolt2B=false;

voltInput1A="";

voltInput1B="";

voltInput2A="";

voltInput2B="";

// to be entered by user

runTime1A=1800; //in seconds

runTime1B=1800;

runTime2A=1800;

runTime2B=1800;

channelByteVoltage1A=11796; //0 to 65535 scale map from 0 to 5

channelByteVoltage1B=11796;

channelByteVoltage2A=11796;

channelByteVoltage2B=11796;

}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void draw() {

update(mouseX, mouseY);

//initialize display sums.

float displaySum1A=0;

float displaySum1B=0;

float displaySum2A=0;

float displaySum2B=0;

// no change in toArduinoXX for testing prior to shutoff condition implement.

//timers. if cell is running and time runs out, state of cell is changes and output is set to

disconnect.

if (((timeRemaining1A-millis()/1000) <= 0) && channelRunning1A ) {

toArduino1A=0;

channelRunning1A = false;

}

if (((timeRemaining1B-millis()/1000) <= 0) && channelRunning1B) {

toArduino1B=0;

channelRunning1B = false;

}

if (((timeRemaining2A-millis()/1000) <= 0) && channelRunning2A) {

toArduino2A=0;

channelRunning2A = false;

}

Page 30: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

30

if (((timeRemaining2B-millis()/1000) <= 0) && channelRunning2B) {

toArduino2B=0;

channelRunning2B = false;

}

//Transmit to Arduino

if (frameCount%30 == 0) {

myPort.write(HEADER);

myPort.write((0xFF) & (toArduino1A >> 8));

myPort.write((0xFF) & (toArduino1A));

myPort.write((0xFF) & (toArduino1B >> 8));

myPort.write((0xFF) & (toArduino1B));

myPort.write((0xFF) & (toArduino2A >> 8));

myPort.write((0xFF) & (toArduino2A));

myPort.write((0xFF) & (toArduino2B >> 8));

myPort.write((0xFF) & (toArduino2B));

myPort.write('\n');

}

//setup display field

background(backgnd);

fill(200);

rect(25,25,250,300);

rect(325,25,250,300);

rect(625,25,250,300);

rect(925,25,250,300);

//scale plots

for (int k=0; k<4; k++) {

fill(255,255,255);

textSize(10);

textAlign(LEFT, CENTER);

for (int i=0; i<8; i++) {

text("-"+ i*maxCurrent/6 +"mA", 275+k*300, 325-i*50);

}

}

//label plots

textSize(20);

fill(255);

textAlign(CENTER);

text("1A", 150,25);

text("1B", 450,25);

text("2A", 750,25);

text("2B", 1050,25);

Page 31: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

31

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//start button drawing

textSize(20);

textAlign(CENTER,TOP);

//draw start button 1A

if (overStart1A && (channelRunning1A == false)) {

fill(10,125,10);

rect(100, 400, 100, 25);

fill(255);

text("Start", 150, 400);

} else if (channelRunning1A) {

fill(25,75,25);

rect(100, 400, 100, 25);

fill(100);

text("Running", 150, 400);

} else {

fill(0,200,0);

rect(100, 400, 100, 25);

fill(0);

text("Start", 150, 400);

}

//draw start button 1B

if (overStart1B && (channelRunning1B == false)) {

fill(10,125,10);

rect(400, 400, 100, 25);

fill(255);

text("Start", 450, 400);

} else if (channelRunning1B) {

fill(25,75,25);

rect(400, 400, 100, 25);

fill(100);

text("Running", 450, 400);

} else {

fill(0,200,0);

rect(400, 400, 100, 25);

fill(0);

text("Start", 450, 400);

}

//draw start button 2A

if (overStart2A && (channelRunning2A == false)) {

fill(10,125,10);

rect(700, 400, 100, 25);

fill(255);

text("Start", 750, 400);

} else if (channelRunning2A) {

Page 32: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

32

fill(25,75,25);

rect(700, 400, 100, 25);

fill(100);

text("Running", 750, 400);

} else {

fill(0,200,0);

rect(700, 400, 100, 25);

fill(0);

text("Start", 750, 400);

}

//draw start button 2B

if (overStart2B && (channelRunning2B == false)) {

fill(10,125,10);

rect(1000, 400, 100, 25);

fill(255);

text("Start", 1050, 400);

} else if (channelRunning2B) {

fill(25,75,25);

rect(1000, 400, 100, 25);

fill(100);

text("Running", 1050, 400);

} else {

fill(0,200,0);

rect(1000, 400, 100, 25);

fill(0);

text("Start", 1050, 400);

}

//draw buttons for Set Time

if (overSetTime1A && (settingTime1A == false)) {

fill(buttonColorHighlight);

rect(100, 500, 100, 25);

fill(255);

text("Set Time", 150, 500);

} else if (settingTime1A) {

fill(buttonColorRunning);

rect(100, 500, 100, 25);

fill(150);

text("Enter Secs", 150, 500);

} else {

fill(buttonColorDefault);

rect(100, 500, 100, 25);

fill(0);

text("Set Time", 150, 500);

}

if (overSetTime1B && (settingTime1B == false)) {

fill(buttonColorHighlight);

Page 33: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

33

rect(400, 500, 100, 25);

fill(255);

text("Set Time", 450, 500);

} else if (settingTime1B) {

fill(buttonColorRunning);

rect(400, 500, 100, 25);

fill(150);

text("Enter Secs", 450, 500);

} else {

fill(buttonColorDefault);

rect(400, 500, 100, 25);

fill(0);

text("Set Time", 450, 500);

}

if (overSetTime2A && (settingTime2A == false)) {

fill(buttonColorHighlight);

rect(700, 500, 100, 25);

fill(255);

text("Set Time", 750, 500);

} else if (settingTime2A) {

fill(buttonColorRunning);

rect(700, 500, 100, 25);

fill(150);

text("Enter Secs", 750, 500);

} else {

fill(buttonColorDefault);

rect(700, 500, 100, 25);

fill(0);

text("Set Time", 750, 500);

}

if (overSetTime2B && (settingTime2B == false)) {

fill(buttonColorHighlight);

rect(1000, 500, 100, 25);

fill(255);

text("Set Time", 1050, 500);

} else if (settingTime2B) {

fill(buttonColorRunning);

rect(1000, 500, 100, 25);

fill(150);

text("Enter Secs", 1050, 500);

} else {

fill(buttonColorDefault);

rect(1000, 500, 100, 25);

fill(0);

text("Set Time", 1050, 500);

}

Page 34: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

34

//draw buttons for Set Volt

if (overSetVolt1A && (settingVolt1A == false)) {

fill(buttonColorHighlight);

rect(100, 575, 100, 25);

fill(255);

text("Set Volt", 150, 575);

} else if (settingVolt1A) {

fill(buttonColorRunning);

rect(100, 575, 100, 25);

fill(150);

text("Enter mVs", 150, 575);

} else {

fill(buttonColorDefault);

rect(100, 575, 100, 25);

fill(0);

text("Set Volt", 150, 575);

}

if (overSetVolt1B && (settingVolt1B == false)) {

fill(buttonColorHighlight);

rect(400, 575, 100, 25);

fill(255);

text("Set Volt", 450, 575);

} else if (settingVolt1B) {

fill(buttonColorRunning);

rect(400, 575, 100, 25);

fill(150);

text("Enter mVs", 450, 575);

} else {

fill(buttonColorDefault);

rect(400, 575, 100, 25);

fill(0);

text("Set Volt", 450, 575);

}

if (overSetVolt2A && (settingVolt2A == false)) {

fill(buttonColorHighlight);

rect(700, 575, 100, 25);

fill(255);

text("Set Volt", 750, 575);

} else if (settingVolt2A) {

fill(buttonColorRunning);

rect(700, 575, 100, 25);

fill(150);

text("Enter mVs", 750, 575);

} else {

fill(buttonColorDefault);

Page 35: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

35

rect(700, 575, 100, 25);

fill(0);

text("Set Volt", 750, 575);

}

if (overSetVolt2B && (settingVolt2B == false)) {

fill(buttonColorHighlight);

rect(1000, 575, 100, 25);

fill(255);

text("Set Volt", 1050, 575);

} else if (settingVolt2B) {

fill(buttonColorRunning);

rect(1000, 575, 100, 25);

fill(150);

text("Enter mVs", 1050, 575);

} else {

fill(buttonColorDefault);

rect(1000, 575, 100, 25);

fill(0);

text("Set Volt", 1050, 575);

}

textSize(20);

textAlign(CENTER,TOP);

if (overStop1A) {

fill(75,10,10);

rect(100, 650, 100, 25);

fill(255);

text("Stop", 150, 650);

} else {

fill(175,0,0);

rect(100, 650, 100, 25);

fill(0);

text("Stop", 150, 650);

}

if (overStop1B) {

fill(75,10,10);

rect(400, 650, 100, 25);

fill(255);

text("Stop", 450, 650);

} else {

fill(175,0,0);

rect(400, 650, 100, 25);

fill(0);

text("Stop", 450, 650);

}

if (overStop2A) {

Page 36: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

36

fill(75,10,10);

rect(700, 650, 100, 25);

fill(255);

text("Stop", 750, 650);

} else {

fill(175,0,0);

rect(700, 650, 100, 25);

fill(0);

text("Stop", 750, 650);

}

if (overStop2B) {

fill(75,10,10);

rect(1000, 650, 100, 25);

fill(255);

text("Stop", 1050, 650);

} else {

fill(175,0,0);

rect(1000, 650, 100, 25);

fill(0);

text("Stop", 1050, 650);

}

//show the average of the moving window

for (int i=0; i<250; i++) {

if (i == 0) {

displaySum1A=0;

displaySum1B=0;

displaySum2A=0;

displaySum2B=0;

}

displaySum1A=displaySum1A+channelDisplay1A[i];

displaySum1B=displaySum1B+channelDisplay1B[i];

displaySum2A=displaySum2A+channelDisplay2A[i];

displaySum2B=displaySum2B+channelDisplay2B[i];

}

textAlign(CENTER,TOP);

textSize(20);

fill(255);

text("Avg= " + nf(displaySum1A/250,1,2) + "mA", 150, 325);

text("Avg= " + nf(displaySum1B/250,1,2) + "mA", 450, 325);

text("Avg= " + nf(displaySum2A/250,1,2) + "mA", 750, 325);

text("Avg= " + nf(displaySum2B/250,1,2) + "mA", 1050, 325);

//Show current value

textAlign(CENTER,TOP);

Page 37: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

37

textSize(20);

fill(255);

text("Current Value=" +nf(channelDisplay1A[249],1,2) + "mA", 150, 350);

text("Current Value=" +nf(channelDisplay1B[249],1,2) + "mA", 450, 350);

text("Current Value=" +nf(channelDisplay2A[249],1,2) + "mA", 750, 350);

text("Current Value=" +nf(channelDisplay2B[249],1,2) + "mA", 1050, 350);

//Show time remaining

textAlign(CENTER,TOP);

textSize(20);

fill(255);

text("Time remaining: " + nf((timeRemaining1A-(millis()/1000)),1,0) +"s", 150, 375);

text("Time remaining: " + nf((timeRemaining1B-(millis()/1000)),1,0) +"s", 450, 375);

text("Time remaining: " + nf((timeRemaining2A-(millis()/1000)),1,0) +"s", 750, 375);

text("Time remaining: " + nf((timeRemaining2B-(millis()/1000)),1,0) +"s", 1050, 375);

//show the voltage value being sent to the arduino

textAlign(CENTER,TOP);

textSize(20);

fill(255);

text("Voltage out: " + nf(5*(toArduino1A/65535.0),1,3) +"V", 150, 450);

text("Voltage out: " + nf(5*(toArduino1B/65535.0),1,3) +"V", 450, 450);

text("Voltage out: " + nf(5*(toArduino2A/65535.0),1,3) +"V", 750, 450);

text("Voltage out: " + nf(5*(toArduino2B/65535.0),1,3) +"V", 1050, 450);

//show the total time for which the cell is set to run

textAlign(CENTER,TOP);

textSize(20);

fill(255);

text("Run Time: " + nf(runTime1A,1,0) +"s", 150, 525);

text("Run Time: " + nf(runTime1B,1,0) +"s", 450, 525);

text("Run Time: " + nf(runTime2A,1,0) +"s", 750, 525);

text("Run Time: " + nf(runTime2B,1,0) +"s", 1050, 525);

//show the voltage at which the cell is set to run

textAlign(CENTER,TOP);

textSize(20);

fill(255);

text("Run Voltage: " + nf(5*(channelByteVoltage1A/65535.0),1,3) +"V", 150, 600);

text("Run Voltage: " + nf(5*(channelByteVoltage1B/65535.0),1,3) +"V", 450, 600);

text("Run Voltage: " + nf(5*(channelByteVoltage2A/65535.0),1,3) +"V", 750, 600);

text("Run Voltage: " + nf(5*(channelByteVoltage2B/65535.0),1,3) +"V", 1050, 600);

//plot the moving windows

for (int xaxis=0; xaxis <=249; xaxis=xaxis+1) {

stroke(0);

Page 38: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

38

line(xaxis+25,325,xaxis+25,325-map(channelDisplay1A[xaxis],0,maxCurrent,0,300));

line(xaxis+325,325,xaxis+325,325-map(channelDisplay1B[xaxis],0,maxCurrent,0,300));

line(xaxis+625,325,xaxis+625,325-map(channelDisplay2A[xaxis],0,maxCurrent,0,300));

line(xaxis+925,325,xaxis+925,325-map(channelDisplay2B[xaxis],0,maxCurrent,0,300));

}

//shift the moving windows

for (int i=0; i<=248; i=i+1) {

channelDisplay1A[i]=channelDisplay1A[i+1];

channelDisplay1B[i]=channelDisplay1B[i+1];

channelDisplay2A[i]=channelDisplay2A[i+1];

channelDisplay2B[i]=channelDisplay2B[i+1];

}

for (int i=0; i<4 ; i++) {

analogReadings[i]=(analogReadings[i]/1024)*(1.1/150)*1000;//1.1 for internal arduino

reference,150 ohms, 1000 for milliamps

}

channelDisplay1A[249]=analogReadings[0];

channelDisplay1B[249]=analogReadings[1];

channelDisplay2A[249]=analogReadings[2];

channelDisplay2B[249]=analogReadings[3];

}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

boolean overRect(int x, int y, int width, int height) {

if (mouseX >= x && mouseX <= x+width &&

mouseY >= y && mouseY <= y+height) {

return true;

} else {

return false;

}

}

void update(int x, int y) {

//check over start flag button 1A

if ( overRect(100, 400, 100 , 25) ) {

overStart1A = true;

} else {

overStart1A = false;

}

//check over start flag button 1B

if ( overRect(400, 400, 100 , 25) ) {

Page 39: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

39

overStart1B = true;

} else {

overStart1B = false;

}

//check over start flag button 2A

if ( overRect(700, 400, 100 , 25) ) {

overStart2A = true;

} else {

overStart2A = false;

}

//check over start flag button 2B

if ( overRect(1000, 400, 100 , 25) ) {

overStart2B = true;

} else {

overStart2B = false;

}

//Check over the set time buttons

if ( overRect(100, 500, 100, 25) ) {

overSetTime1A = true;

} else {

overSetTime1A = false;

}

if ( overRect(400, 500, 100, 25) ) {

overSetTime1B = true;

} else {

overSetTime1B = false;

}

if ( overRect(700, 500, 100, 25) ) {

overSetTime2A = true;

} else {

overSetTime2A = false;

}

if ( overRect(1000, 500, 100, 25) ) {

overSetTime2B = true;

} else {

overSetTime2B = false;

}

//Check over the set volt buttons

if (overRect(100, 575, 100, 25) ){

overSetVolt1A = true;

} else {

overSetVolt1A = false;

}

if (overRect(400, 575, 100, 25) ){

Page 40: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

40

overSetVolt1B = true;

} else {

overSetVolt1B = false;

}

if (overRect(700, 575, 100, 25) ){

overSetVolt2A = true;

} else {

overSetVolt2A = false;

}

if (overRect(1000, 575, 100, 25) ){

overSetVolt2B = true;

} else {

overSetVolt2B = false;

}

//check over the stop buttons

if (overRect(100, 650, 100, 25) ){

overStop1A = true;

} else {

overStop1A =false;

}

if (overRect(400, 650, 100, 25) ){

overStop1B = true;

} else {

overStop1B =false;

}

if (overRect(700, 650, 100, 25) ){

overStop2A = true;

} else {

overStop2A =false;

}

if (overRect(1000, 650, 100, 25) ){

overStop2B = true;

} else {

overStop2B =false;

}

}

void mousePressed() {

//change the states channelRunningXX and set the timers if clicked on button

if (overStart1A) {

timeRemaining1A = (millis()/1000) + runTime1A;

channelRunning1A = true;

toArduino1A=channelByteVoltage1A;

Page 41: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

41

}

if (overStart1B) {

timeRemaining1B = (millis()/1000) + runTime1B;

channelRunning1B = true;

toArduino1B=channelByteVoltage1B;

}

if (overStart2A) {

timeRemaining2A = (millis()/1000) + runTime2A;

channelRunning2A = true;

toArduino2A=channelByteVoltage2A;

}

if (overStart2B) {

timeRemaining2B = (millis()/1000) + runTime2B;

channelRunning2B = true;

toArduino2B=channelByteVoltage2B;

}

// Change the state of if imputing set times to suit entry.

if (overSetTime1A) {

settingTime1A=true;

}

if (overSetTime1B) {

settingTime1B=true;

}

if (overSetTime2A) {

settingTime2A=true;

}

if (overSetTime2B) {

settingTime2B=true;

}

//CHange the state of if inputing set volts to suit entry

if (overSetVolt1A) {

settingVolt1A=true;

}

if (overSetVolt1B) {

settingVolt1B=true;

}

if (overSetVolt2A) {

settingVolt2A=true;

}

if (overSetVolt2B) {

settingVolt2B=true;

}

Page 42: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

42

//stop button activation

if (overStop1A) {

timeRemaining1A = (millis()/1000);

}

if (overStop1B) {

timeRemaining1B = (millis()/1000);

}

if (overStop2A) {

timeRemaining2A = (millis()/1000);

}

if (overStop2B) {

timeRemaining2B = (millis()/1000);

}

}

void keyTyped() {

if (settingTime1A) {

if (key == '\n') {

settingTime1A=false;

runTime1A=int(timeInput1A);

timeInput1A="";

} else {

timeInput1A= timeInput1A + key;

}

}

if (settingTime1B) {

if (key == '\n') {

settingTime1B=false;

runTime1B=int(timeInput1B);

timeInput1B="";

} else {

timeInput1B= timeInput1B + key;

}

}

if (settingTime2A) {

if (key == '\n') {

settingTime2A=false;

runTime2A=int(timeInput2A);

timeInput2A="";

} else {

timeInput2A= timeInput2A + key;

}

}

if (settingTime2B) {

if (key == '\n') {

Page 43: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

43

settingTime2B=false;

runTime2B=int(timeInput2B);

timeInput2B="";

} else {

timeInput2B= timeInput2B + key;

}

}

if (settingVolt1A) {

if (key == '\n') {

settingVolt1A=false;

channelByteVoltage1A=int(65535*(int(voltInput1A)/5000.0));

voltInput1A="";

} else {

voltInput1A= voltInput1A + key;

}

}

if (settingVolt1B) {

if (key == '\n') {

settingVolt1B=false;

channelByteVoltage1B=int(65535*(int(voltInput1B)/5000.0));

voltInput1B="";

} else {

voltInput1B= voltInput1B + key;

}

}

if (settingVolt2A) {

if (key == '\n') {

settingVolt2A=false;

channelByteVoltage2A=int(65535*(int(voltInput2A)/5000.0));

voltInput2A="";

} else {

voltInput2A= voltInput2A + key;

}

}

if (settingVolt2B) {

if (key == '\n') {

settingVolt2B=false;

channelByteVoltage2B=int(65535*(int(voltInput2B)/5000.0));

voltInput2B="";

} else {

voltInput2B= voltInput2B + key;

}

}

}

Page 44: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

44

void serialEvent(Serial myPort) {

//read data from arduino

String fromArduino = myPort.readStringUntil('\n');

fromArduino = trim(fromArduino);

analogReadings = float(split(fromArduino, ','));

println(fromArduino);

}

Appendix F: Arduino Code

#include <SPI.h>

const int CS1 = 49; //Chip Select Pin1: low for select

const int CS2 = 46; //Chip Select Pin2: low for select

const int analogPinChannel1A = A8;

const int analogPinChannel1B = A10;

const int analogPinChannel2A = A13;

const int analogPinChannel2B = A15;

const int relayPin1A = 31;

const int relayPin1B = 35;

const int relayPin2A = 39;

const int relayPin2B = 43;

//voltage that will be sent to the branches

float voltage1A;

float voltage1B;

float voltage2A;

float voltage2B;

//state of if power should be sent to the channel

boolean power1A;

boolean power1B;

boolean power2A;

boolean power2B;

int serialCounter; //Keeps track of which byte is being received from processing

byte fromProcessing[20]; //byte array of current settings received from processing

boolean DACdataValid; //whether the array fromProcessing is currently dynamic

int HEADER = 35; //ASCII # is header character sent first from processing

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Page 45: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

45

void setup() {

serialCounter=0;

power1A=false;

power1B=false;

power2A=false;

power2B=false;

voltage1A=0;

voltage1B=0;

voltage2A=0;

voltage2B=0;

// pinmodes

pinMode(analogPinChannel1A, INPUT);

pinMode(analogPinChannel1B, INPUT);

pinMode(analogPinChannel2A, INPUT);

pinMode(analogPinChannel2B, INPUT);

pinMode(CS1, OUTPUT);

pinMode(CS2, OUTPUT);

pinMode(relayPin1A, OUTPUT);

pinMode(relayPin1B, OUTPUT);

pinMode(relayPin2A, OUTPUT);

pinMode(relayPin2B, OUTPUT);

DACdataValid=false;

Serial.begin(9600);

analogReference(INTERNAL1V1);

SPI.begin();

SPI.setBitOrder(MSBFIRST);

SPI.setClockDivider(SPI_CLOCK_DIV4);

SPI.setDataMode(SPI_MODE0);

digitalWrite(relayPin1A,LOW);

digitalWrite(relayPin1B,LOW);

digitalWrite(relayPin2A,LOW);

digitalWrite(relayPin2B,LOW);

delay(2);

digitalWrite(CS1,HIGH);

digitalWrite(CS2,HIGH);

Page 46: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

46

//power up

digitalWrite(CS1,LOW);

SPI.transfer(0xE800);

digitalWrite(CS1,HIGH);

digitalWrite(CS2,LOW);

SPI.transfer(0xE800);

digitalWrite(CS2,HIGH);

//set to 0

digitalWrite(CS1,LOW);

SPI.transfer(highByte(0x1800));

SPI.transfer(lowByte(0x1800));

digitalWrite(CS1,HIGH);

digitalWrite(CS2,LOW);

SPI.transfer(highByte(0x1800));

SPI.transfer(lowByte(0x1800));

digitalWrite(CS2,HIGH);

}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void loop() {

//measure analog pins

int rawmeasure1A = analogRead(analogPinChannel1A);

int rawmeasure1B = analogRead(analogPinChannel1B);

int rawmeasure2A = analogRead(analogPinChannel2A);

int rawmeasure2B = analogRead(analogPinChannel2B);

//prevent measurements from being newline character

if (rawmeasure1A == 10) {

rawmeasure1A=11;

}

if (rawmeasure1B == 10) {

rawmeasure1B=11;

}

if (rawmeasure2A == 10) {

rawmeasure1A=11;

}

if (rawmeasure2B == 10) {

Page 47: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

47

rawmeasure2B=11;

}

//tell processing the measurements

Serial.print(rawmeasure1A);

Serial.print(",");

Serial.print(rawmeasure1B);

Serial.print(",");

Serial.print(rawmeasure2A);

Serial.print(",");

Serial.print(rawmeasure2B);

Serial.print("\n");

/*

Serial.print(power1A);

Serial.print(",");

Serial.print(power1B);

Serial.print(",");

Serial.print(power2A);

Serial.print(",");

Serial.print(power2B);

Serial.print('\n');

// used to check the values being received from processing

*/

//whenever valid data is received from processing, update outputs

if (DACdataValid == true) {

//Set the flag of powerXX to on or off if processing sends 0(turn off condition) or !0

if (((fromProcessing[1] << 8) + fromProcessing[2]) != 0) {

power1A = true;

}

else {

power1A = false;

}

if (((fromProcessing[3] << 8) + fromProcessing[4]) != 0) {

power1B = true;

}

else {

power1B = false;

}

Page 48: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

48

if (((fromProcessing[5] << 8) + fromProcessing[6]) != 0) {

power2A = true;

}

else {

power2A = false;

}

if (((fromProcessing[7] << 8) + fromProcessing[8]) != 0) {

power2B = true;

}

else {

power2B = false;

}

//turns on or off the relays depending on flag called powerXX set by processing =0

if (power1A) {

digitalWrite(relayPin1A, HIGH);

}

else {

digitalWrite(relayPin1A,LOW);

}

delay(2);

if (power1B) {

digitalWrite(relayPin1B, HIGH);

}

else {

digitalWrite(relayPin1B,LOW);

}

delay(2);

if (power2A) {

digitalWrite(relayPin2A, HIGH);

}

else {

digitalWrite(relayPin2A,LOW);

}

delay(2);

if (power2B) {

digitalWrite(relayPin2B, HIGH);

}

else {

digitalWrite(relayPin2B,LOW);

}

Page 49: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

49

delay(2);

voltage1A= (((fromProcessing[1] << 8) + fromProcessing[2])/65536.0)*5;

voltage1B= (((fromProcessing[3] << 8) + fromProcessing[4])/65536.0)*5;

voltage2A= (((fromProcessing[5] << 8) + fromProcessing[6])/65536.0)*5;

voltage2B= (((fromProcessing[7] << 8) + fromProcessing[8])/65536.0)*5;

//Determine DAC outputs from processing data

int DACoutput1A= (((voltage1A/(10))+1)*2048);

int DACoutput1B= (((voltage1B/(10))+1)*2048);

int DACoutput2A= (((voltage2A/(10))+1)*2048);

int DACoutput2B= (((voltage2B/(10))+1)*2048);

int DACcommand1A = 0x4000;

int DACcommand1B = 0x5000;

int DACcommand2A = 0x4000;

int DACcommand2B = 0x5000;

int SPIoutput1A = DACcommand1A|DACoutput1A;

int SPIoutput1B = DACcommand1B|DACoutput1B;

int SPIoutput2A = DACcommand2A|DACoutput2A;

int SPIoutput2B = DACcommand2B|DACoutput2B;

digitalWrite(CS1,LOW);

SPI.transfer(highByte(SPIoutput1A));

SPI.transfer(lowByte(SPIoutput1A));

digitalWrite(CS1,HIGH);

digitalWrite(CS2,LOW);

SPI.transfer(highByte(SPIoutput2A));

SPI.transfer(lowByte(SPIoutput2A));

digitalWrite(CS2,HIGH);

digitalWrite(CS1,LOW);

SPI.transfer(highByte(SPIoutput1B));

SPI.transfer(lowByte(SPIoutput1B));

digitalWrite(CS1,HIGH);

digitalWrite(CS2,LOW);

SPI.transfer(highByte(SPIoutput2B));

SPI.transfer(lowByte(SPIoutput2B));

digitalWrite(CS2,HIGH);

}

}

Page 50: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

50

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void serialEvent() {

// get the new byte:

byte incoming = Serial.read();

// Data from procesing is being recieved. fromProcessing is dynamic

DACdataValid=false;

// add it to the inputString:

fromProcessing[serialCounter]= incoming;

serialCounter++;

if ((serialCounter == 10) && (fromProcessing[0]==HEADER) && (fromProcessing[9]== 10))

{

DACdataValid= true;

serialCounter=0;

} else if ( (serialCounter > 10) && (fromProcessing[serialCounter-1]==10) &&

(fromProcessing[serialCounter-10]==HEADER) ) {

serialCounter=0;

}

}

Page 51: Micro-processor Controlled Potentiostat - Home - …projects-web.engr.colostate.edu/ece-sr-design/AY12...1 Micro-processor Controlled Potentiostat-Full Report-By Chris Benton Prepared

51

Appendix F: Images of Final Unit