+ All Categories
Home > Documents > pH display

pH display

Date post: 10-Dec-2015
Category:
Upload: jack-neo
View: 8 times
Download: 1 times
Share this document with a friend
Description:
BCD pH Meter
Popular Tags:
21
1 In this experiment you will explore using the National Instruments DIO-32 digital input/output board, driven by LabVIEW, to control first some LED’s, then a DC fan, and lastly to construct and read a re- cording pH meter. After the pH meter has been built, you will test the linearity, the response time and the drift of a new “triode” style of glass pH electrode. In the next experiment, you will compare these performance specifications to a new, Field Effect Transistor (“FET”) pH-sensing electrode. In both of these experiments, you will be developing a routine that could be used professionally as part of an analytical method “validation”. Since this is the first experiment that we do, and since much of this will be new, some tutorial exer- cises will be suggested. Later experiments will build on what is done here, so these tutorials will be directed toward future work, as opposed to general instruction in digital I/O. Much work will be done in the I/A lab using the National Instruments programming environment called LabVIEW. The Student Edition, version 6.1 and the Professional development edition, version 6.1.x, will be used. Many features of LabVIEW® will have to be learned as they are used for the first time. One such feature that will be used in this experiment is the “cluster”. Some introductory material on making clusters of digi- tal indicators also will be given. The Lab Layout The lab room that we will use is set up to hold four people at a time (see Figure 1). Each person has a personal “small desk”, a Mac computer with large video display and a set of DIO and A/D-D/A boards, and a comfortable chair. The room is set up somewhat differently for each experiment, with the excep- tion of the Zymark laboratory ro- bot that is in place for the whole semester. The lab room does not, unfortu- nately, have enough room for winter coats and bulky book bags. These will have to be left outside. Each small desk has a cable above it with clips to which you can fasten individual copies of the fig- ures presented in the experiment. In this way, you need only have the diagrams and figures at hand that are needed to make the ex- periment happen. At either end of the lab room are larger electronic soldering benches. Computer Interfacing Work Station #3 Computer Interfacing Work Station #2 Computer Interfacing Work Station #1 Computer Interfacing Work Station #4 Electronic Wiring Bench #1 Electronic Wiring Bench #2 Figure 1 The lab room layout ©Prof. John P. Walters Dep't. of Chemistry St. Olaf College Northfield, MN 55057 507-646-3429 [email protected] Fall, 2000 Chemistry 382/378 Role-Playing Lab in Instrumental Analysis Experiment #01 Digital Input/Output
Transcript
Page 1: pH display

1

In this experiment you will explore using the National Instruments DIO-32 digital input/output board,driven by LabVIEW, to control first some LED’s, then a DC fan, and lastly to construct and read a re-cording pH meter. After the pH meter has been built, you will test the linearity, the response time andthe drift of a new “triode” style of glass pH electrode. In the next experiment, you will compare theseperformance specifications to a new, Field Effect Transistor (“FET”) pH-sensing electrode. In both ofthese experiments, you will be developing a routine that could be used professionally as part of ananalytical method “validation”.

Since this is the first experiment that we do, and since much of this will be new, some tutorial exer-cises will be suggested. Later experiments will build on what is done here, so these tutorials will bedirected toward future work, as opposed to general instruction in digital I/O. Much work will be donein the I/A lab using the National Instruments programming environment called LabVIEW. The StudentEdition, version 6.1 and the Professional development edition, version 6.1.x, will be used. Manyfeatures of LabVIEW® will have to be learned as they are used for the first time. One such feature thatwill be used in this experiment is the “cluster”. Some introductory material on making clusters of digi-tal indicators also will be given.

The Lab Layout

The lab room that we will use is set up to hold four people at a time (see Figure 1). Each person has apersonal “small desk”, a Mac computer with large video display and a set of DIO and A/D-D/A boards,

and a comfortable chair. The roomis set up somewhat differently foreach experiment, with the excep-tion of the Zymark laboratory ro-bot that is in place for the wholesemester.

The lab room does not, unfortu-nately, have enough room forwinter coats and bulky book bags.These will have to be left outside.Each small desk has a cable aboveit with clips to which you canfasten individual copies of the fig-ures presented in the experiment.In this way, you need only havethe diagrams and figures at handthat are needed to make the ex-periment happen. At either end ofthe lab room are larger electronicsoldering benches.

Computer InterfacingWork Station #3 Computer Interfacing

Work Station #2 Computer InterfacingWork Station #1

Com

pute

r In

terf

acin

gW

ork

Sta

tion

#4

Electronic W

iringB

ench #1

Electronic WiringBench #2

Figure 1 The lab room layout

©Prof. John P. WaltersDep't. of Chemistry

St. Olaf CollegeNorthfield, MN 55057

[email protected]

Fall, 2000Chemistry 382/378Role-Playing Lab in

Instrumental AnalysisExperiment #01

Digital Input/Output

Page 2: pH display

2

The Small Desks

The next exploratory activity to do is to se-lect a small desk at which to work and studythe layout it has for working on the Digitalinput/output (“DIO”) experiment (see Figure2).

Each small desk has several DIO items on it.Locate them. They are:

• The Corning type 130 digital pHmeter and associated “triode” combi-nation electrode.

• A set of three or four calibrationbuffers. A more extensive set of 11buffers also is available for bettercertification of the meter.

• A 12 VDC and a 110-vAC fan usedas part of the experiment dealing with switching on and off inductive loads with solid state re-lays.

• An electronic experimenter’s station used to make all of the digital connections between theMac computer and the corning pH meter. The station also has a set of built in Light EmittingDiodes (“LED’s”) that are used to follow the binary condition of the Mac and pH meter digitallines.

• A holder containing many stripped, 22 gauge, solid hook-up wires of various lengths and col-ors that are inserted into the columns of the various experimenter’s sockets on the desk to makethe Mac pH - DIO connections. By using these sockets and wires, no soldering is needed.

• One or more 50 pin terminal blocks that connect via flat ribbon cables to the digital I/O andanalog A/D boards in the Mac. These are provided with either push-in or screw-down connec-tion one end of the hook-up wires.

• 5 and 12 VDC power supplies. The 5 VDC supply powers the LED’s on the experimenter’sstation and the NB-relay board. The 12 VDC powers the fan and other select DC loads.

The “electronic experimenter’s station” forms the heartof the small desk for this experiment. The Corning pHmeter is connected to one side of the columns on theexperimenter’s socket on it, and also to the LED’s.Thus, all of the pH meter information is available indigital form to view and to observe. The other set ofcolumns on the experimenter’s socket is used to con-nect to a 50 pin terminal block and the Mac usingpush-in, hook-up wires (see Figure 3).

The creative part of this kind of interfacing is choosingthe desired pH meter functions to have appear on thecomputer video display and then assigning their digitalbits to the appropriate columns and pins in the experi-menter’s socket and 50 pin terminal block.

12345678910 12

11

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

12345678910 12

11

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

Terminal Block for A/DBoard (optional placement)

5 VDCPower Supply

NB - Relay Board

Ribbon Connector Block

Terminal Block for DIO Board(optional placement)

Small Experimentor’s Socket for Relay Board

Long and Short Hook-up

Wire Holder

R R RY Y YG G GR R RR

R R

Y

12345678910

12

11

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

12345678910 12

11

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

Terminal Block for A/D or DIO Board

Electronic Plasticware Experimentor’s Station

+

-

12 VDC Fan

12 VDCPower Supply

Experimentor’s Socket for A/D Board

Corning Model 130pH Meter

Corning Model 130 pH Meter

Set of 4 Buffers

Figure 2 A small desk set up for DIO

Figure 3 Patching wires in station socket

Page 3: pH display

3

The pH Meter

The Corning Model 130 pH meter is a sophisticated system of operational amplifiers and digital cir-cuitry. It would be well beyond the scope ofour beginning work to attempt to actuallyconstruct this meter. However, interfacing itto the Mac computer turns out to be fun,useful, and manageable. We then can usethe full power of the Mac, of Excel, and ofLabVIEW® to display and to analyze theperformance of the meter.

The input operational amplifier stage of themeter is represented schematically in Figure4. The glass electrode and saturated calomelreference electrode have a pH dependentpotential developed between them. This po-tential is amplified by the input stage. In thefeedback loop of this amplifier are variableresistances to control the slope (mV/pH unit)and temperature compensation of the elec-trodes. The output of the amplifier and theSCE are attached to resistances that offsetthe voltage it produces, allowing correctionfor liquid junction potentials (standardiza-tion) and meter electronic drift (zero adjust-ment). During the lab we will explore howto set these adjustments.

Not shown in Figure 4 are the actual digital outputs of the Corning meter. Most of the meter functionsare available on a ribbon con-nector at the back of the meter.These functions are shown inFigure 5.

For example, each digit of thepH reading is brought out in 4bits (“binary integers”) of bi-nary coded decimal (“BCD”)information. Since we will use5 digits of pH information, 20pins are required to representthis. In addition, we will usethose individual bits that tellwhether pH or millivolts havebeen selected for display, andone bit to reflect the sign of thepH or millivolt reading.

Each bit of all of this informa-tion will require one physicalwire to be connected betweenthe pH meter and the Mac DIOboard, going through the ex-periment plastic station. Map-

ping these wires and making the physical connection forms the essential core of digital I/O computerinterfacing.

Figure 4 Input stage of Corning 130 pH meter

Figure 5 pH meter digital output functions

Page 4: pH display

4

The way in which the pH digits are used toform a complete binary coded decimal wordis shown in Figure 6.

Each pH digit is represented as one BCD 1-2-4-8 “nibble”. The sum of the 1-2-48 BCD“bit weights” is equal to the decimal value ofthe digit.

Two nibbles are combined to make an 8 bit“byte”, and two bytes are combines to makea 16-bit “word” containing all four pH dig-its.

Since we never encounter pH values greaterthan 20, the most significant pH digit, forvalues over 9.99, are simply represented asa single bit. We will later combine it withother single bits to make a 5th nibble.

All of these bits will be used to light LED’son the Plastic experimenter’s station. Noticethat when the BCD nibbles are combinedinto a full word, the actual decimal value ofthe word increases to reflect the total numberof bits in it.

Connection between the pH meter digitaloutput and the Mac computer is made via a

set of digital “ports”. A port is a physical represen-tation of a byte. Each of the eight bits in the byte isbrought out to an individual electrical connector.

The resulting 8 connectors are physically connectedtogether to form half of a port. Usually more thanone port is built. The result is called a “terminalblock”. Such a two port, 50 connector (or 50 “pin”)device is shown schematically here in Figure 7.

Here, there are four 8 bit bytes (A, B, C, and D)connected into two 16 bit ports (0 and 1), for a totalof 32 bits of digital input or output traffic.

This terminal block is physically constructed to al-low wires or other devices to be screwed into smallholes on its face (see Figure 8). The screw ar-rangement is called a “guillotine” because of the

Figure 6 BCD representation of pH digits

Figure 7 A 50 pin, 2 port, 4 byte terminal block

Figure 8 A physical terminal block

Page 5: pH display

5

way the edge of the inside of the connectioncuts into the wire to hold it in place when theappropriate screw is tightened down.

When the pH meter is wired into the Mac, it isdone through the terminal block. A “logicalmap” is made showing how to push a wiredbetween the terminal block and the experi-menter’s socket on the Plastic station (see Fig-ure 9).

Making this map is one of the creative parts ofthis experiment. The only required wire place-ment is the ground. The other leads can be as-sociated with any byte and any combination ofLED’s that are pleasing. It will be learnedthough that the BCD order of the wires is im-portant, as is getting the right information out ofthe computer byte after it has been read. The

logical map design thus, while creative, must be done with regard to how the information is to be readby the computer.

Project #1 - Learning Digital I/O by Flashing Bytes

Before any interfacing is done between the Mac and the Corning pH meter, it is best to just use theMac to Output to a set of LED’s. This little exercise is called “flashing bytes”. It allows you to practicemaking the physical wire connections between the terminal block and the LED’s on the Plastic station,and to build some beginning LabVIEW® VI’s to make the lights turn on and off as the individual bitsmaking up bytes and words change from low (“0”) to high (“1”) state.

Figure 10 shows the first nibble of abyte being wired from the Mac to a setof four LED’s. Note the 1-2-4-8 BCDweighting of each bit in the nibble.

The BCD weight corresponds to, and isfixed by, bits B0, B1, B2, and B3 ofport 0 on the terminal block. The wiresthat carry these bits could be connectedto any 4 LED’s. There is no special re-quirement.

But, once the connection order has beenchosen, then the 1-2-4-8 BCD arithme-tic is fixed too. If you want to knowwhat the decimal digit was that set someparticular LED pattern, then you mustknow the 1-2-4-8 BCD weight eachLED has, and that is where you mustkeep a record of how the LED’s werewired. This requires good collaborationbetween Software and Hardwarepeople.

Start this work by drawing your ownlogical/physical-wiring map using theblank version of Figure 10 that is ap-

Figure 9 A logical map for wiring to pH meter

Figure 10 wiring a nibble on the Plastic station

Page 6: pH display

6

pended to this experiment. To help get used to turning off and/or on a set of LED’s in one instruction,a “basic byte flasher” LabVIEW® is built. There will be time for some tutorial help here. Be preparedto use it.

The front panel of the basic byte flasher is shown inFigure 11. There are several LabVIEW® “controls”and “indicators” that will need to be explained toyou. Some are easy to follow. Others are subtler.

The one that is hardest is the “cluster”. Note in Fig-ure 11 that there are two boxes containing 16 LEDindicators. These boxes are “clusters”, and they arefilled with the LED’s. In the tutorial, you will beshown how to fix a cluster on your front panel, howto put LED’s into it, and how to label and order them

so that they correspond to the properly weightedBCD bits of a 16 bit binary word. An example ofthese operations is shown in Figure 12. Make surethat all of this is done and understood before goingon. After that, you will have to “size” the cluster thatyou have made. This is tricky in that there is no wayyou would know to do it without being told first. Thesequence of steps required is shown in Figure 13.

The “wiring diagram” for the basic byteflasher is shown in Figure 14. This is abit of an artistic rendition, since youwill not be able to see both of the “FORloop” constructs at the same time.Again, you will need to have a tutorialon how to select the icons to make thisVI. You will need to know how to con-vert the cluster of LED’s on the frontpanel to an array of binary bits, how to

convert that array to a number, andthen how to wire that number out tothe digital port that you will connectto at the terminal block on the Plasticexperimenter’s station.

After you have built the VI, and havewired the LED’s via the Plastic sta-tion as started in Figure 10, you mayrun the VI to make sure that you havethe correct BCD coding between theMac and the LED lamps. By usingthe LabVIEW® “finger” you can setthe LED pattern you want to write onthe VI front panel. Then when yourun the VI, the same LED lamps onthe Plastic station should light as you

have pressed in the VI write cluster.

Figure 11 Basic byte flasher front panel

Figure 12 Making a cluster of Booleans

Figure 13 Sizing a cluster of Booleans

Figure 14 Wiring diagram for basic byte flasher

Page 7: pH display

7

You also can read what you have written. Change the VI from “write” to “read”. Now, on the Plasticstation, use push-in wires to connect some of the LED lamps physically to ground. This is done byconnecting a wire between the appropriate column in the top set of columns on the experimenter’ssocket to any hole in the top or bottom row of holes that make up the ground buss. The LED will goout. Now, when you “read” the station, the LED indicators in the read cluster should match the physi-cal condition of the LED lamps on the station.

If you are unsure of this operation, or are having trouble with it, ask for a tutorial. Being able to buildand use this basic byte flasher is necessary before you can go on to other parts of today’s work.

Project #2 - Running the 12 vDC and 110 vAC Fans

Simple “byte flasher” kinds of VI’s can be used to do more than turn on lamps. With the proper auxil-iary electrical devices, they can be made to turn on and off power loads. One such load is the 110 vACsingle-speed fan. This fan is either turned on or turned off by switching 110-vAC power to it. Anothersimilar load is the twelve-volt direct current (vDC), variable-speed fan. This fan is an example of thoseused in GC ovens for temperature regulation. Its speed is regulated by a pulse-width modulation con-trol, which is fed by a 12 vDC supply, which itself is turned on or off by switching 110 vAC power toit.

Power is switched to both of these fans by turning on or off a set of solid state relays. This is a relaydevice that takes a digital signal directly from one or another of the DIO lines on a National InstrumentsDIO-32 board. It switches on or off the 110-vAC line connected to it at loads up to 10 amperes. ItIs diagrammed below in Figure 15. The two lines that are called the “Digital Control Signal” are con-nected directly to the National Instruments 50 pin terminal block at the proper positions for ground,DIO channel 0, and DIO channel 1.

In this part of the experiment, there are two SSR’s that are used. One switches 110 vAC to the 110-vAC fan. It thus just turns this fan on or off. The other switches power to a 100 vAC to 12 vDCpower supply. The output of this power supply goes to a pulse width modulator that is used to adjustthe width of pulses of 12 vDC power that are delivered to the 12 vDC fan. The fan inputs are also con-nected to this modulator. Adjusting a resistor on the pulse width modulator sets the width of thepulses, and thus the fan speed. Look at Figure 16 on the next page to see a block diagram of theseconnections.

110 vAC in Switched 110 vAC Out

Solid State Relay

Digital Control Signal In

+-

Figure 15 The Solid State Relay (SSR)

Page 8: pH display

8

Terminal Block with Digital Outputs

Channel 0 and Channel 1

110 vAC Connections to Wall Sockets

Solid State RelaysTTL Trigger Inputs

110 vAC Power Outputs

110 vAC Fanon Plastic

Support Box

12 vDC PowerSupply

Pulse Width Modulator.DC Input.

Pulse Output.Adjustable

Resistor SetsPulse Width.

Variable Speed12 vDC Fanon Plastic

Support Box

+-

+

-

Figure 16 Block Diagram Showing Connections of Fans and SSR Power Switches

Page 9: pH display

9

The 12-vDC fan and pulsewidth modulator speedcontrol are shown in Fig-ure 17 at the left. Thespeed control has two ter-minal blocks on the leftside for wiring. Powercomes in at the bottom forthe 12-vDC-power sup-ply, shown in Figure 18,and goes out to the fanleads at the top.

When you connect theseleads pay attention to thepolarity of each – the redwire is + and the blue is -.Use the small screwdriverfurnished to tighten theconnectors onto the wires.

Figures 18 and 19 show how to connectthe 110 vAC fan and the 12-vDC powersupply into the two open SSR switchedpower outlets. By putting two night-lights into the top sockets of theswitched power outlets, it is possible totell when they are hot. This can be use-ful for diagnosing any problems.

Figure 17 12 vDC Fan and Pulse width Modulator Speed Control

Figure 18 The SSR Switched Outlets, the 12 vDCPower Supply, and the 110 vAC Fan.

Figure 19 The 110 vAC Fan

Page 10: pH display

10

The solid state relays are housed in asmall plastic sandwich box. 110-vAC power comes in from a terminalstrip, and exits to the outlets shownin Figure 18. You will not have anyhookups to make to these connec-tions. There are however two triggerlines that enter the SSR box. Thesehave to be connected to the properpins on the 50 pin terminal block thatis itself connected to the DIO-32 cir-cuit board inside the computer.These trigger lines are shown inFigure 20.

A small inset is shown below fororientation to the way these triggerlines are connect to the computer.The larger diagram that you canuse during the experiment isshown on the next page as Figure21.

Figure 20 The SSR Box Showing the Two TTL TriggerLines that are connected to the Computer.

Page 11: pH display

11

In Figure 21, the trigger lines come into the LED indicator box from the lower right. The black leadsare ground, and are plugged into the lower ground lines. The red leads are positive, and are pluggedinto a column of holes desired. Stripped wires are then inserted into an indicator light column, as wellas an appropriate connection socket on the 50 pin terminal block. This can be chosen using the diagramshown below in Figure 22.

Figure 21 Connection of the SSR Trigger Lines to the NB-DIO-32 Board via the Plastic LEDIndicator Box.

D1D2 D3D6

D0 D4D5 D7

2468111112222233333444445

1357911111222223333344444

C2 C3 C5C6

C0 C1C4 C7

GNGNGNGN

GNGNGNGN

A0A1

A2A3

A4

A5 A6

A7B0

B1 B2B3

B4 B5

B6

B7

WORD

WORD

WORD

WORD WORD

WORD

WORD

WORD

Port Port

Port 0 Port 1

Figure 22 50 Pin Terminal Block Connection Assignments to DIO Ports and Lines

Page 12: pH display

12

Digital Fan Control VI’s

One way to digitally control the fan is shown inFigure 24. Building this VI will give you addi-tional experience in converting between binaryand BCD numbers. The panel is just a cluster ofBooleans. Inspection of the diagram howevershows that the cluster is first “unbundled” be-fore each Boolean is individually to a 0 or a 1decimal number.

These numbers are then “BCD scaled” by mul-tiplying them by the appropriate decimal weightfor each digit. The weighted numbers are thenall added together to get a final decimal number,and this decimal number is then sent out to 8bits of the digital port that is already connectedfor you to the NB relay board. You would wirethe fan into one or another of the relays on theboard. Then, when you turned on the particularswitch that controlled that relay, the fan wouldgo on or off.

Figure 23 The Completed Fan Setup on the Lab Desk

Figure 24 A BCD fan control VI

Page 13: pH display

13

This form of control is essentially no different than that provided by the basic flashing bytes exampleexcept that each bit of the controlling Boolean byte is available as a separate device in the diagram, in-stead of being buried as one element in a Boolean array. Thus, more can be done with the switchesinside the wiring diagram.

When you have the fan operating, build a VI that will alternately turn the fan on and off at a rate thatit’s effective (“average”) speed is adjustable. This technique will be used later in the term when the“mock GC oven” is made. Record what you have done so you can use it then.

Project #3 - Multiple Flashing Bytes

An interesting extension to this work is to combine the cluster of Booleans with the LabVIEW® con-structs of a FOR loop and SEQUENCE frames to make a timed set of multiple flashing bytes. This isthe kind of digital controller that is used in larger analytical instruments, such as the GC/MS, or in in-dustrial process controllers.

The panel of a multiple byte flasher that you can build is shown in Figure 25. There are six clusters of16 LED’s. These are easy to make by “cloning” the first one that is made by hand. Each cluster willactivate the LED’s on the Plastic station for a fixed time. The time is entered in the controls at the rightof each cluster.

Figure 25 A multiple flashing bytes VI

Page 14: pH display

14

The clusters will execute in order from top to bottom of the panel. If desired, the top to bottom se-quence can be repeated a number of times by entering the desired number in the “Repeat?” control at

the top of the panel. The “Pass #” indicator at the topshows how many times the pattern has been exe-cuted.

The multiple byte flasher wiring diagram is shownin Figure 26. Two of the six sequence frames areshown (mostly for teaching) to indicate that eachframe is more or less identical. The reason that themultiple flasher works is that each frame uses itsown cluster of LED’s. For example, frame 0 usesthe cluster at the top of the panel and converts itfrom a cluster of Booleans to an array of Booleansand then from an array to a number, which is sentout the digital port. The port width is set to 16 bitson the front panel so that all 16 LED’s on the Plasticstation are lit each time a number is output.

The little clock icon in each frame sets the time delayfor each pattern. You will want to look this up to seethat it counts milliseconds. Thus to wait one second,the front panel delay is first multiplied by 1000 toconvert it to milliseconds and then wired into thedelay clock.

The FOR loop construct is what determines howoften the pattern of 6 clusters repeats. The way this is set up, the same pattern is repeated for eachcount of N. If a different pattern were required for each count, then a different set of frames would beneeded. This would make the exercise too detailed for where we are now working.

A nice set of flashing byte patterns can be takenfrom the data presented in Figure 27. These can bekeyed into the clusters shown in Figure 25 and se-quence executed. The LED’s on the Plastic stationshould then flash on and off for the times shown.Figure 27 shows A/B patterns. It probably would bebetter for you to just select some patterns from thoseshown and make them sequentially execute.

Other options that have proven interesting in the pastare variations on the movie marquee flashing lights.Patterns H through K follow this reasoning, as do Lthrough O. Later in the semester patterns of byteslike this will be used to control the electrochemicalapparatus that we will use, as well as the lamp andfan on the mock GC oven. The better you under-stand how to make them now, the easier it will befor you to use them then.

Figure 26 Wiring diagram for multiple byteflasher

Figure 27 Set of test byte patterns

Page 15: pH display

15

Project #4 -Building the Corning pH Meter Interface

The interface that you will make to connect the Corning pH meter to the Mac will be done in Lab-VIEW® and will have many interesting functions. It will combine all of the experience you have ac-quired making the flashing bytes VI’s, and add a few more features as well. A picture of one student’sprevious front panel is shown below in Figure 28. You will probably want to design yours differently.

At the top of the panel are a set ofsquare LED’s that will indicate theBCD value of each digit of the pH,as well as single bit indicatorsshowing The 5th pH digit, and ifmV or pH functions have been se-lected. Each nibble of 4 LED’sshows the BCD weight of the digitdisplayed, and what its decimalvalue is. Note that there are “digitAND value” notations by the deci-mal digits. The AND function isone new feature that you will needto explore to convert the binaryreading you take from the pH meterto a properly weighted decimaldigit.

Below the decimal digits are somecontrols that you will need to use tomeasure the response time of theelectrodes being tested. You can,for example, just “toggle” the pH meter by pressing the “Run Once” button. If, however, you want tocontinuously sample the meter, you can select the time between readings on the slider control shown.You also can choose to save your data to a file that later can be read into an Excel 5.0 spreadsheet.And, of more use than you might first expect, you can choose to make the VI issue a faint beepingsound each time it takes a reading.

The decimal value of the pH is not only displayed in the large digits at the top of the VI, but also as an“analog” value on the “strip chart” graph shown at the bottom. This makes your interface a “recordingpH meter”, a device that would be more expensive than the entire Mac system were it to be purchased

as a stand alone instrument. Thestrip chart feature will allow you tovisualize the way in which the elec-trode responds when it is movedbetween buffers of differing pH.

The wiring diagram for the pH me-ter is shown in Figure 29. Note thatthere are two figures overlapping inthis illustration. This is to show theempty contents of the two, true/falsecase structures. Notice also thatthere is a set of “AND” gates oper-ating on the binary value read fromthe digital port. This is new andneeds study.

Figure 28 The pH meter VI suggested front panel

Figure 29 Wiring diagram for the pH meter interface

Page 16: pH display

16

Figure 29B pH Meter VI Diagram - rotated and enlarged

Page 17: pH display

17

The AND Function and Hardware Wiring

The AND function is a Boolean logical ma-nipulation of the bits in a digital word (se-quence of bytes, nibbles, and bits) that wewill use here to “extract individual bits”from the full word.

To understand this better, let’s begin bylooking at the physical way that pH infor-mation is brought into the Mac via the Na-tional Instruments DIO-32 board. This isdone on the Plastic experimenter’s station bypatching wires between the 50 pin terminalblock connected to the Mac and the indicat-ing LED’s on the experimenter’s socket thatare prewired to the back of the Corning pHmeter by a “spectra-strip” 26 wire ribboncable. An example of beginning to wire justthe first digit is shown in Figure 30.

Note (in the middle of the diagram) that allof the pH meter functions are available onthe columns that make up the top of the ex-perimenter’s socket. These columns areshaded black on the socket. There is nothingconnected to the white columns that separatethe black ones. The columns of 5 holes onthe top of the socket are not connected tocolumns on the bottom of the socket. Theshaded columns are pre-wired to the LEDindicators at the top of the Plastic experi-menter’s station, so you will not have toconcern yourself with making those connec-

tions.

Take the time now to notice the way that the BCD weighting isdone for each pH digit, and how it is brought out to the shadedset of 4 volumes as shown in Figure 31. The least significantbit (“1”) is on the far left of each nibble, and the most signifi-cant bit (“8”) is on the far right.

This is opposite of the way you have wired the socket whendoing flashing byte experiments. Thus, when you wire to theMac via the 50 pin terminal block (see Figure 23), the wiredconnecting to byte A, bit 0 (terminal block socket #37) willhave to connect to column 7 (not column 1) in the experi-menter’s socket. This can be confusing if you do not studyFigure 30 carefully before you actually start wiring.

Figure 30 Hardware connection from Mac to pH meter

Figure 31 BCD pinout order

Page 18: pH display

18

When all of the wires have been connected between the 50 pin terminal block and the experimenter’ssocket, you will have made a large word containing at least 17 bits of information (if only the pH isdesired) and up to 20 bits (if the functions, etc. are selected as well). When the LabVIEW® VI readsport 0 on device 4, as in Figure 30, and the “Port Width” is set to 24, then 24 bits of binary informa-tion are read into one word at the same time. To do anything with this information, it has to be“parsed”, or, the bits we want have to be extracted from it, a nibble or a bit at a time. This is what theAND function does.

Note the table at the left. This iscalled a “truth table” for theAND function. There are showna “Test Bit” and a “Mask Bit”,which when ANDed togetherproduce a “Result Bit”. Notethat when the Mask Bit is a zero,the Result Bit is always a 0, nomatter what the Test Bit was.

But if the Mask Bit is a 1, then the Result Bit is the same as the Test Bit. Thus, by making the Mask bita 1, we have “extracted” the contents of the Test Bit and placed it intact into the Result Bit.

Using the AND function to extract a bit from a bit is not what we do. We will want to make a nibble ora byte of the Mask, and set thebits in the Mask Byte to 1’swhen we want to extract certaininformation from a Test Byteinto a Result Byte. Note the ta-ble below. Here the Test Byte isbinary 01110011 (decimal 206)and the Mask Byte is 01111110(decimal 126). The Mask Byte isset with 1’s to extract the middle6 bits from the Test Byte. TheResult Byte is 111001 (decimal78), reflecting the fact that bits 3and 4 of the Test Byte were 0and the others being extracted all1’s.

The AND function thus can beused to extract any number of bits we want out of the 24 bits we capture from the pH meter. For ex-ample, we could extract the first 4 bits (the lowest nibble) by ANDing the pH meter word with binary

1111 or decimal 15. The result would be a set of 4 bitswhose BCD value represented the 1’s pH digit, according tothe map shown in Figure 30.

The extraction of other bits into nibbles or larger bytes is bestunderstood by building a VI to practice with. The one tomake here, called an “AND machine” is shown in Figure 32.Now is the time to build this VI and see how the extraction isdone.

Bit1TestByte

CombinedBit2MaskByte

ActionBit3ResultByte

1 AND 0 ignore Bit11 AND 1 extract Bit1 10 AND 1 extract Bit1 00 AND 1 extract Bit1 01 AND 1 extract Bit1 11 AND 1 extract Bit1 11 AND 1 extract Bit1 10 AND 0 ignore Bit1

Decimal Decimal Decimal206 AND 126 extract middle

6 Bits78

Bit1Test Bit Combined

Bit2Mask Bit Action

Bit3Result Bit

0 AND 0 ignore Bit 1 01 AND 0 ignore Bit 1 00 AND 1 extract Bit 1 01 AND 1 extract Bit 1 1

Figure 32 an AND machine

Page 19: pH display

19

For example, suppose that we want to extract the nibble of bits from the 20 bit “WORD” that corre-spond to bits 13 through 16. To do this, we would set these bits high (make them 1’s) in the MASK,and when the MASK and WORD were ANDed, the RESULT would be all zeros except those bits,whose values would be the same as bits 13 through 16 in WORD. The arithmetic way of saying this is:

629145 .AND. 61440 . IS . 36864

The AND machine shows the arithmetic way, the binary way, and the cluster of LED’s way. Practicewith this until you can see how to extract any bit, nibble, or byte you want from WORD by ANDing itwith MASK.

Figure 33 shows how the indi-vidual pH digits are ANDedout of the larger 20 bit word anibble at a time. The digitalport is read by the “DIG PORTREAD” sub-VI, and 24 bits ofinformation are presented as asingle decimal number at itsoutput. When this number isANDed with 15 (binary 1111),the least significant or lowestnibble is extracted.

The next AND is with decimal240 (binary 11110000). Thisextracts the next most signifi-cant, or next highest, nibble.But, note that the result is an 8-bit byte. To see the decimalweight of just the top nibble ofthat byte, we have to divide itby 16. This is because the bit000X0000 of the byte changesevery time the lower four nib-bles are all 1’s, or we say theupper nibble counts the numberof 16’s that have occurred in

the word.

Each of the nibbles that are needed to represent a particular pH digit are extracted with their own ANDfunction, and after each AND the decimal number of that digit is determined by dividing by one morethan the full BCD weight of the previous byte when it’s binary representation is all ones. This is astandard digital interfacing technique, and one that you should both understand and remember for fu-ture work.

The AND operations just extract individual digits. They do not give a decimal number that representsthe pH. To get such a number we have to apply true decimal (not binary coded decimal) weighting toeach of the digits. For example, the digit extracted by ANDing with decimal 15 (binary 1111) is the 1’sdecimal place in the pH. We know this by the way in which the interface was physically wired. InFigure 33 we also see that 1, divides the ANDed digits by 10, by 100, and by 1000 to build a pH be-tween 9 and 0.001. The one digit needed to give pH greater than 10 is extracted as the 21st bit byANDing with 65536 and converted to a 1 by dividing by the same number (it is either 1 or 0 since wehave no lab pH values >20), and then multiplied (not divided) by 10 to put it into the proper decimalplace. The final pH is built as a total decimal number by adding together all of the decimally weighteddigits. This is all shown in Figure 27.

Figure 33 ANDing Digits to Get a pH Value

Page 20: pH display

20

Project #5 - Measuring Electrode Response Times

At last. The pH meter is now built and can be used to measure the response time of the electrode andmeter combination.

This response time is a complex process. It is not just the meter that must quickly respond to changesin solution pH. Also, the glass membrane that makes up the sensing electrode must rehydrate and re-equilibrate with changes in AH

+, but also the reference electrode, since the two are housed in the samebody. Perhaps even subtler is the fact that the solution must be remixed inside the electrode body tocause this re-equilibration. If the electrode combination is suddenly plunged into a buffer solution, thenthere will be an acid base reaction as the buffer components adjust. But, if it is just moved betweendilute solutions of different acidity (unbuffered), then it will be just the rate of mixing and subsequentdilution that determines how quickly the solution composition changes in the immediate vicinity of theglass membrane. There also are mechanical stirring of the bulk solution effects that have to be consid-ered. And, if there are differences in solution temperature then they will distort the calibration of thepH meter and make it appear that the response time has changed. Clearly, this is not a simple meas-urement!

An example of sudden changes in pH being recorded by the LabVIEW® pH meter interface is shownin Figure 35. The VI was set to sample once per second. The results were not save to a file. Beepingwas turned on. The measurement was to go from 4 to 7 to 120 buffers, then to water, and then back to4.

Even in this simplistic example, it is clear that there are many things happening. Not all of the responsetimes are the same. And, it also is not clear if the VI was set to sample fast enough to show the truesystem response.

Figure 35 An example of recording pH system response

Page 21: pH display

21

Here are the factors to explore when you measure your system response. They are objectives of thepractical part of this experiment.

• Determine what the sampling time of the pH meter is. Timing the right flashing LED on thePlastic station over a dozen or more samples can do this.

• Determine how fast your VI will sample with and without Beeping. This can be done by mak-ing it repeat a dozen or more times.

• Make a series of measurements that will reveal if the plunging the electrode between buffers ofdifferent values, and going in different pH directions, makes a difference in system responsetime.

• Make a series of measurements to determine if plunging the electrodes between solutions ofsimilar pH but different buffer capacity, and going in different pH directions, makes a differ-ence in system response time.

• Make a series of measurements to determine if plunging the electrode between solutions that arepoorly buffered and differ only slightly in pH, and going in different pH directions, makes adifference in system response time.

• Make a series of measurements to determine the degree to which mechanical stirring of the so-lutions into which the electrode is being plunged, and going in different pH directions, makes adifference in system response time.


Recommended