Thursday, May 26, 2011

National Instruments DAQ Hardware

Hello everyone, if you’re reading this, thank you very much for taking the time to look at my first blog. I’m starting to post blogs about the projects I’m working on in hopes that it will improve my chances of employment. Come on, let’s face it, there is nothing stopping anyone from typing my name in a google search bar just to see what shows up so I figured, instead of viewing the silly stuff on face book, maybe something more positive can be made of this. The one thing I noticed in a job interview is that the people interviewing you don’t actually know what you can do; all they have to go on is the words on a resume. At least this way, I can give them a virtual tour of myself and technology of the 21st century.
Over the summer of year 2010, I started putting together my own data acquisition system. I got into building this after I have taken a class on DAQ technology at Red River College for my Instrumentation Engineering courses. We were using LabVIEW 2009 (however I recently upgraded to LabVIEW 2010) to explain how analog signal data is read by computers. It is basically the process of taking an analog signal, digitizing it so the computer can understand the data, then converting that digital computer processed signal back to analog again. A good example of that would be using an Audio Recorder that makes MP3 files when you talk into it. Your voice is the analog signal, it has to be converted to digital, handled by the microcontroller inside the recorder, than converted back to analog and out the speaker so you can hear what was recorded. However this system is far more complex then that.
What I did to get started was simple; I first went to the wonderful world of eBay and started looking for old National Instruments PCI DAQ cards that people were getting rid of. You wouldn’t believe what people were throwing away on there, some of the PCI cards were worth hundreds of US dollars that were very cheap to buy. Over time, I came across 3 really good DAQ cards, a NI PCI-6031E card (which has 64 analog inputs, 2 analog outputs and 8 digital input/output leads), a NI PCI-6509 card (which as 96 digital input/output leads), and a NI PCI-6704 card (which has 32, 16 bit analog outputs and 8 digital input/output leads). The next step was to find a way to make this portable. My solution was to get a StarTech PCI expansion board because it would give me a box with 4 PCI slots and a PCI Express 1x desktop PC interface card plus an ExpressBus 34 interface for my laptop much like you see on this photo…



I have to say, this little StarTech box was amazing. It was only 200 US dollars on eBay, and it worked flawlessly in all my computers except for 1, my laptop. I don’t blame the hardware, this was a problem caused by human error. My laptop only has PCMCIA card slots in it, this PCI expansion bus requires ExpressBus to use. Even with a PCMCIA to ExpressBus converter, I couldn’t make it work because the PCI bus required signals passed through an ExpressBus port that my laptop wasn’t capable of generating. So, I had to find an alternative.

Lucky for me, I did find an alternative. Instead of using a StarTech system, I had to go for a Magma PCI Expansion system. I had been trying to avoid a Magma system because the hardware is extremely expensive. A 4 slot PCI expansion bus kit would cost you $1,500 if you purchased it brand new. Lucky for me, I got a reasonable deal on eBay for the exact same system; it was just a little bit used and had some dust with brown tar inside it from the residue of second hand cigarette smoke. I loaded the cards inside the box, along with a PCI SATA 2 card and 4 extractable hard drive bays, and then bought a CBHIF68 interface for the box (that’s a PCMCIA interface card so it can plug into my laptop).

The next step was to get the 68 pin and 100 pin connection cables needed to interface with the DAQ cards inside the black Magma PCI expansion box. They were almost $90 per cable but I had no choice, there was no other way of interface to the hardware without them. I then needed terminal boxes that would plug into the other ends of the cables. This made me mad, everywhere I went; everyone wanted $500 for one of these SCB100 terminal boxes! Ya…500 bucks! Can you believe it? All the boxes had was a metal enclosure case, some screw terminals, and a big 100 pin interface plug in it. So, I was like “This is nuts, there is no way I’m paying 500 dollars on something as cheap as that! Time to put my brain to work!” and I did just that. What did I come up with? My own professionally made circuit boards. They are in the next set of photos, made with a black silkscreen. It took me 6 months to design them, just a board with screw terminals and some plugs, 6 months to do an epic job. However, I got all the parts and circuit boards both together for a total of $400, and they even have my name printed in the silk screen….”Designed by Matt Fryatt”, it just doesn’t get any better than that.
This pneumatic differential pressure
sensor will hopefully never be a problem
again when using the DAQ measurement
system

So now that I have the power to automate all the homes on my city block using my laptop…what was the purpose of this project? Well, last year, I watched everyone struggle with the Linear Process Controls class. Lucky for me, I dropped the class because I just don’t have the ability to do 9 college classes all at once (but 7 classes are ok). However this gave me plenty of time to sit back, pull up a chair, and watch everyone needlessly struggle with their labs. I had to think, “Next year I’m going to take this class again, how can I prevent myself from going through this chaos?” That’s when I got the idea about setting up this DAQ system. I wanted to interface this hardware to the technology we will be using for the labs to get more accurate readings for the reports. Plus, now that I can gather the data to my computer, I can get my teacher to just simply walk to my laptop screen to see if the data I collected is acceptable or not. Hopefully this will cut down the time I sped with the teacher so that I don’t take away help time from others who are doing their labs. Also for an added bonus, if I can get my computer to gather the data, then I can have it automatically generate my lab reports too on the spot. I predict this should cut down the time needed to study and do home work.
Thank you again for reading my blog

Monday, January 3, 2011

Open Loop Batch Control

Hello again, and thank you for taking the time to view my blog. Batch control, what is it? When you think of a factory with a bunch of little robotic arms for example working on an assembly line doing the same job over and over again, this is what batch control is.

In order for me to demonstrate a batch control process, one of my college teachers (Hassan Saberi)  dug up an old robotic arm from deep within some dusty closet room to spark life back into it (Thank you Hassan).

What the robotic arm looked like before I started working on it
Unfortunately this robotic arm required a lot of work to function properly. It would leak air all over the place, the valve array had 2 malfunctioning switch valves in it, and the hoses would get tangled all the time. However with the help of another instrumentation student (Dave Bertin), his scrounging through storage cabinets would show me that the college had many salvageable pneumatic parts that could solve many potential problems with the robotic arms. Many little valve arrays were in bags, along with replacement seals, pneumatic cylinders, and even pneumatic pressure regulators were found, so what I decided to do was gather all valves to make a whole new set of switches for the arm. I also added a 3rd arm to the table to enhance the batch process.
The new valve array uses a desecrate switching process (meaning it has a basic set of on/off switching connection points all bundled up together) which will eventually be connected to a DAQ controller. With the help of some new 0.6 mm internal diameter polyurethane tube (polyurethane had to be used because it was more flexible then polyethylene tube) and used salvageable tube fittings from an old pneumatic controller, I was able to restore these robotic arms to a more professional display setup. Plus with an added bonus, I even made a whole new pneumatic hook up port on the back of the arm table to make it more portable afterwards.

What the robotic arms look like after I fixed them up

The next task was to design an interface that I can use to control these robotic arms. Thanks to my previous knowledge that I acquired in the Electronic Engineering Technology program, I was able to whip up a fast and simple testing interface using Hex FET technology. What I used was transistor models IRF9Z34NPBF (which is a P-Channel FET) to switch 24 volt logic using 5 volts or less, and a bunch of 3904’s to shift the switching polarization to positive rather than negative switching then plugged it into a basic NI USB DAQ.
Because the valve array requires higher voltages to operate then what a USB
Port of a computer can offer, this switching interface allows this to happen
by using 5 volts to switch 24 volt logic
Now we get into the good stuff, building the batch control interface program. For this project, I used LabVIEW 2010 to make a quick interface which can be used to demonstrate what someone at a control console would see if they were tasked to monitoring a factories instrumentation. The program has both a manual control and an automatic setting which follows a set of step functions written in an initialization file (a *.ini file) for easy accessibility.
This is what a control console would look like when designed with
LabVIEW 2010
This is what a program made with LabVIEW 2010 actually looks like
close up.
So why is it called “Open Loop” batch control? Well it’s really quite simple; this robotic arm doesn’t have any sensors what so ever to report any kind of data back to the computer. The program does everything on a time coordinated sequence (and yes that also means if any of the arms didn’t operate the way it should in the second that the step sequence was switched, it would screw up the sequence that makes the block of wood move from arm to arm) which is called a sequence controller. A closed loop batch control would have sensors to report what each state cylinder is in since they are duel acting cylinders (that means you require air pressure to extend and air pressure to retract, single acting would have a spring so you only require one air pressure feed). This would allow an automatic waiting period so that each step will complete the way it should before entering the next step sequence.