View Full Version : New project: Mitutoyo EV counter + Basic stamp + ezVid2 = Production Gage

05-18-2005, 02:50 AM
(skip this post and go to the next if you want to jump to the meat of the project)
Hi all, I've been lurking the group for months now and I've finally jumped in with a project that I hope will generate a lot of interest and a lot of help from everyone. first a little about me. I became insterested in the stamp when i was doing research on what it would take to build an autopilot for the experimental plane that I'm building. So about a year ago I bought a whole bunch of goodies from Parallax and started playing. I don't much about electronics but I'm slowly learning the basics. My background is more in the line of programing which I have been doing for several years. My job is at an aluminum die casting plant in which I am the supervisor for the quality inspection departments. My expertise is in CMM's and all the hardware and software goodies that go with them. I'm posting this project on here in hopes that people will help me build it and I will learn along the way. When the project is complete, I will make sure all the code and schematics are posted in the projects section for everyone to use. I have been pro open source for all of my programing career so to me nothing is proprietory. Unless it's product specific and is owned by the company I work for. That will not be a problem with this gage. The gist of the gage that I need to build is a simple gage to check the machine stock condition of a cast part. I have built 2 gages of this type already but they are lab gages and are slaved to a PC. What I need now is a gage that will be set on the production floor and used by the operators. The environment will be harsh, high heat and humididty. I want to build the controller outlined below for the experience that I will gain and just for the fun of it. I'm lucky in the fact my company is funding the whole thing so at this point (crossing fingers), money is no object. I will outline the prject in the next post so please read on. And remember, I'm new to this so I will be asking a lot of dumb questions
-john f

Post Edited (its_gotta_hemi) : 5/17/2005 10:52:22 PM GMT

05-18-2005, 02:54 AM
Functional Go/No-Go Gage
Project Description: Functional gage to check the machine stock condition of a cast aluminum part. Mitutoyo LGD Leaner Gages coupled to one or more Mitutoyo EV counters will provide input via a rs232 serial link. The pilot project will not include data logging or time stamping. Once the gage is built and deployed, further development will incorporate full data logging to include part number, cast machine number and date/time of measurement. The stored data will then be transferred to a PC based application that will convert the raw data to xml so it can be submitted to the SPC database.

Basic function of the gage

When the gage is first turned on, the video display will illustrate the outline of the part to be gauged. This graphic representation will also have ‘indicator dots’ at the approximate location of where the encoders are measuring. Initially, the indicator dots will be white and will turn green or red based on the pass fail condition of the reading. The actual encoder values (adjusted for calibration) will also be displayed under each indicator dot when the measurement is complete. There will be 3 LED indicators visible to the operator, Blue, Green and Red that will indicate the overall status of the measurement. A flashing Blue LED will indicate the measurement cycle is in progress, Solid Blue indicates the measurement is complete, Green indicates the part pass’s, Red indicates the part fails. No LED’s indicates the gage is idle.
When the gage first boots up, the program will jump directly to the calibration routine. The calibration routine will use the video display to instruct the operator to place the master calibration plate on the gage. The calibration cycle will work just like the measuring cycle except that when the measurement is complete, each value from the encoders will be stored in an ‘offset’ variable. The video will display a message indicating to the operator that the calibration is complete and instruct the operator to remove the master calibration plate. Then the main program loop will execute.
The main loop will poll channel #1 from the Mitutoyo EV counter and poll the MEMkey. EV counter channel #1 should return a value of ‘0.000’ when it’s in a non depressed state. As the operator places a part on the gage, Channel #1 will start showing a non-zero value. Now we can request the EV give us the values of all the encoders (start flashing blue LED). We do this because of the time it takes the EV counter to poll each encoder and return the measurement string. Each measurement channel from the EV counter will get its value stored in a temporary variable that is used to compare its stored value against the incoming value. This portion of the program will loop until the incoming values are the same as the stored values, then we know that part is correctly down on the gage locator stops and we have stable values to use for measurement.
The program will then stop polling the EV counter ( Blue LED on) and compare the measured values to the stored tolerance values hi and low. For each channel falling outside the stored tolerance, the corresponding indicator dot will turn red and the measured value will be displayed. The measured value of each encoder is derived from the actual string coming from the EV Counter minus or plus the stored calibrated offset values. All channels that pass will be set to green and the actual measurement value will be displayed as well. Now the measurement cycle is complete and the program will poll channel #1 again until the value returns to its idle state of zero. When the idle state is detected, all LED’s are turned off and the program returns to the main loop.
If the main loop detects a button push on the key pad, then we branch to the user setup menu. The main loop will only respond to a particular keypad character (perhaps the ‘*’ key). When the ‘*’ key press is detected, the user will be presented a small menu that is selectable by pressing the correct number -

Select Option
1) Set High Tolerance
2) Set Low Tolerance
3) Set Time
4) Calibrate

Each menu option will have the corresponding code to perform the request. The high/low tolerance values will be stored in non-volatile memory so they don’t have to be reset each time the gage is powered up. The gage should also have a battery backup for the real time clock so it doesn’t have to be set each time the gage is powered up. As long as no data logging is taking place, the real time clock is optional. Without data logging, there really is no practical purpose for it. It could be used to show the last time the gage was used. This would aid in determining the gage is being used at the correct intervals according the quality control plan.

Description Parallax Items Item # Cost Used For
BASIC Stamp 2 OEM Module (Assembled) 27290 59 Micro controller
RS-232 DCE AppMod 29120 29 Interface to Mitutoyo EV Counter
MEMKey - AppMod 27963 39 Interface to Keypad
Pocket Watch B 27962 29 Real Time Clock for recording gage times - needs to keep time when powered down

Description - Non Parallax Items
5" TFT Full Color Video LCD SK-3022 179 Display - http://store.earthlcd.com/s.nl/sc.7/category.255/it.A/id.4238/.f
ezVID 2.0 SERIAL VIDEO MODULE NA 64.95 Display controller - http://www.multilabs.net/ezVID_20.html
16 BUTTON KEYPAD (4 X 4) CAT# KP-23 12.5 User Input - http://www.allelectronics.com/cgi-bin/category.cgi?category=300&item=KP-23&type=store

Mitutoyo Items
LGD Linear Gage 575-331 447 measurement encoder - http://www.mitutoyo.com/pdf/E4174-542.pdf
EV Counter 564-064 1320 Input device for LGD - Ouput for Microcontroller - http://www.mitutoyo.com/pdf/E4174-542.pdf
Variouse cables and power supplies

Still Needed
Some type of eeprom for data logging

John F

05-18-2005, 05:22 PM

Sounds like an interesting project. As a metrology guy for a semiconductor manufacturer, I find this type of application very interesting. Keep the data coming.

six sigma rules


05-18-2005, 09:14 PM
Here's my comments (keep in mind I'm still a new Stamp user myself):

You should consider swapping the BS2OEM ($59) for a Stamp that has a larger EEPROM. The BS2PX-IC ($79) has 16 KB of memory (which you can use for your program AND to store data), it runs 4.5 times faster than the BS2 and it has built-in I2C commands. The built-in I2C commands will be very useful if you want to add additional memory and you can interface the DS1307 real-time clock very easily.

www.sparkfun.com sells a DS1307 module with battery backup for $14.95 - which is a better deal than the Pocket Watch B in my opinion.

All of the Basic Stamps do fixed-point math - not floating point. If you want to do floating point math, then consider adding a floating-point coprocessor such as the uM FPU V2 which Parallax stocks (P/N 604-00030a for $14.95)

You'll need a carrier board to plug the Basic Stamp, clock, ezVid, etc into. A good, low cost choice is the Parallax Super Carrier board (P/N 27130, which will be reduced to $19 today).

You might consider adding Multilabs ezMouse (PS/2 mouse interface) to your setup - to add a GUI front-end to your application. Multilabs is selling the ezVid 2 bundled with ezMouse for $69.90

05-19-2005, 12:37 AM
I have a NX-1000 dev board that i will be using for starters. When I get ready to put the thing together for production I will use what ever you guy's recomend. I also have the stamp collection so I can use what ever stamp I need. I have all the stamps except the BS2PX. I also have a Javilin which I don't really want to use on this project. Saving it for something else. As far as processor speed goes, I think the polling of the EV counter and the video display will be the big bottle neck so I'm not to concerned with how fast the chip is. Today I recieved the manual on the Mitutoyo EV counter and it has more capabilites than the Mig-2A I have hooked to the PC gages. It has tolerance settings and go/no-go capabilities that should allow me to offload a part of what I was planning on doing with code. I'll no more when I dive into the manual later today. This way I wont have to deal with tolerance math and shouldn't need a math coprocessor. Even if I do need to calculate the measure/tolerance, I was thinking I could do it with integer math and just re-insert the decimal point for display. I ordered the ezVid2 and the memkey last night so they should be here in a few days. I plan to start with getting display to the screen via inputs from the key pad. This should let me develope the core code that I will need for the finish gage.

05-19-2005, 12:40 AM
Here's an image and a model of the final design.
http://www.modelpress.com/default.htm <-- heres the link to the free viewer for the model
I had to add the .txt extension to get the uploader to work so be sure to remove it from the filenam before you try to view it with the ModelsPress viewer.. let me know what you think.

Post Edited (its_gotta_hemi) : 5/18/2005 6:56:30 PM GMT

05-19-2005, 01:09 AM
I look forward to seeing your results - I setup (not designed) a similar system about 10 years ago on a 386PC. It was used to check hole location in printed circuit boards - so it was just 2D.

Since you're not going to do all the number crunching on the Stamp, you could probably use any of the Stamps that have I2C commands and at least 16 KB of memory (to hold your data) such as the BS2P24, BS2PE or BS2PX