A crummy little servo tester and other minutia

The little servo tester
Well, I needed a way to test all of these servos I got from EBay and I decided to spend a little time making a quick and dirty little board for doing that. It uses a PIC12F683 and has a linear pot attached to it. Simple.

Crummy servo tester
Crummy servo tester


Viscometer Board and stuff
I’ve been working on the software for the viscometer. Every function appears to work, at least based on the rudimentary prototype I have currently running. I am working on a scripting system for this device. I could make it just a basic viscometer but, as anyone that knows me, I simply can’t do. Here’s a pic of the working board.
The prototype viscometer board
The prototype viscometer board

An EEPROM file system
After thinking about how to store files appropriately and trying to have a file system that can work easily with 1024B of space, I started coming up with ways of defining a reasonable file system. Here it is.

  • First 2 bytes are settings, things like block size, filename size and special behaviors like for EEPROMS that can only be written to with blocks.also defined is the address size 8b, 16b or 32b
  • Each file in the FAT consists of a name of either 2,4 or 8 bytes. this is determined by the setting.
  • Following the name is one byte detailing the flags such as read-only, archive, and whether it’s open or not.
  • After the filename and attribute byte, are the addresses. These addresses can be 8, 16 or 32 bits, however, an 8 byte address can address something larger, say 2k rather than 256B if you set the block size appropriately. This of course lowers the efficiency of storage space but allows for some growth in the file. The file can have any number of addresses in order to remove time wasted moving stuff around.

Anyways, that’s what I’ve been working on as of late. Fun!

Viscometer board proceeding, some RS232 fun.

  Well, things have been proceeding apace, and I’m feeling pretty confident that I’ll have both versions done fairly soon. For debugging the device I’ve decided to create a kind of terminal, this allows one to directly access commands and see log information from a terminal program. This is handy for seeing data over time and for various other uses.
 
Here are some pictures…
 


Prototype viscometer board out futher
Prototype viscometer board out futher

Prototype viscometer board
Prototype viscometer board

The early output of the sample terminal. I have created a kind of console, I will implement commands as they are created.
The early output of the sample terminal. I have created a kind of console, I will implement commands as they are created.

 
I think this is going to turn out well.

One last kick at the can, Viscometer Style!

Well, since funding for the viscometer has fallen through for various, understandable reasons, I have decided to take one last kick at the can before I shift my focus on to other ventures. The last kick at the can? Two similar viscometer heads, two very different purposes.

This is the rough mockup of the new head, it is the same for both designs
This is the rough mockup of the new head, it is the same for both designs

The hand-held stormer
 
  This device is designed to work in the field and provide readings in KU, Grams and perhaps Centipoise. The device itself doesn’t feature any communications of any kind. Also, there is no LCD display, instead a 7 Segment x 4 LED display is used since it’s a bit cheaper and more visible in various lighting conditions. Also, since it will be use tables of values rather than calculating it on the fly, I can use some slimmer hardware such as the PIC18F2620 Microcontroller or an ATMEGA8.
 
  Also of note is the fact that everything is fairly cheap to build, these low-cost viscometers could be used in paint shops in any size container. I am building one to go to Cold Lake where they’re going to try one out since they’ve been having trouble getting decent consistency using only a mixing stick to test viscosity. 🙂
 
  Here’s a rough mockup of what it will look like. Of course none of the boards or covers are shown, also the display isn’t visible, I haven’t decided the best location for it yet. I may actually put it inside of a separate enclosure to make the unit lighter since it requires 12 volts.
 

Mockup of the handheld viscometer
Mockup of the handheld viscometer

 
  This is probably the most marketable device thus far.
 
The Super-Visc
 
  Over the last 9 months or so I have developed a number of interesting methods for determining error and correcting for it, I have also develop methods for calibration and symbolic parsing. Since I would hate to come away empty handed and waste all the of knowledge accumulated over the course of 2+ years, this is the coup de grace of rotational viscometers.
 
  To my knowledge, most other rotational viscometers use a beryllium copper torsion spring to provide a fixed, known spring rate, or torque on the sensing shaft. The cheap ones like the stormer viscometer base it on time and run a fixed speed AC synchronous motor, whereas the more expensive ones use a variable drive and encoders on the top and bottom to determine the difference from top to bottom. My viscometer uses the cheaper method of determining difference and RPM by using the timing via ether opto-interrupters or hall effect sensors. By using a a very high sampling rate, I can get very precise measurements of the rotation, though some differences may occur during rotation. Accuracy is achieved through error correction in the form of running averages, temperature and friction compensation and angular displacement compensation. While this is places a heavy burden on the software side of things, it is extremely effective.
 
  This viscometer works on three key concepts: Variables, Equations and Test Programs.
 

  • Variables – These are variables that are calculated dynamically before any other calculations have taken place. These include ambient temperature, fluid temperature, angular displacement, spring length, time from test start, time from last sample and other mathematical constants such as PI and E.
  • Equations – These are the equations that determine the units. You may (and for basic units, must) include variables in order to calibrate the device. These equations are completely configurable by the user and includes every standard mathematical function such as Cos(), Sin(), Cosh(), Powers, Square Roots and many others, perhaps even logical equivalents say to multiply by 1 or 0, could be useful. While developing this I had a choice, either computationally expensive or memory intensive, I chose memory intensive symbolic storage in order to improve performance. This also allows one to develop any unit with any paddle one wishes!
  • Test Patterns – These are the patterns that develop the test. For example, let’s say you want to test for KU. You place the appropriate spindle in the machine and select the KU test run. KU test runs would appear as follows (200 RPM Fixed, Equation KUPU, Out->FLTP, Out->KU) or for Centipoise vs RPM (50-220 RPM variable, Equation CNTP, Out->CNTP, Out->RPM, Out->FLTP). These are a boon for the experimentor.

 
  One key disadvantage of this device is the initial difficulty of calibration. However, if done en masse in the factory, it wouldn’t be an issue. One of the major advantages of this device is for the experimenter. You could put a hotdog on a stick, put it in a fluid, create a relationship via an equation and call it whatever you want. The device is very configurable and would probably be well suited to materials engineers and chemists who need either standard or non standard tests with a large amount of automation in terms of data collection.
 
Here’s a mockup of the finished laboratory device.
 


Potential mockup of finished device
Potential mockup of finished device

 
The device will feature an RS485/232 output along with perhaps a touch screen or simply a keypad and 20×4 LCD display. The processor will either be a DSPIC33F or PIC32, I may stray towards Atmel since they have great throughput. My current prototype board however has a PIC18F4680, it’s enough to test on but its limits on RAM are starting to bother me.
 
Well, this was a long post… Whew 🙂
 
As always, anyone who has any questions can leave a comment or E-mail me.

Stormer Viscometer Grams to Oz-Inch Conversion

Trying to make sense of the standard stormer viscometer and methods that could be used to calibrate a device, I’ve been looking at the original stormer viscometer in order to get an idea of what ‘grams’ actually means in the case of the stormer viscometer. Here are some facts.

The weight in grams is held on a pulley and pulls on a rotating pulley that is 1.125″ in diameter. That pulley rotates some gears or belts at a ratio of 11:1 (1 rotation of the pulley = 11 rotations of the spindle). Taking the torque applied on the main pulley and dividing it by 11 results in the actual torque to the spindle.

Simply because I use it in these cases, here is the conversion ratio for grams hung on the instrument to oz-inches. Also, one should keep in mind that there is some loss of torque due to mechanical limitations.

oz-inches == .00367056 * grams

therefore, using this formula, a KU meter ranging from 32 grams to 1099 grams ranges from .1174 oz-in to 4.0339 oz-in.

yay! Hopefully someone finds this useful as well. 🙂

Grams to Krebs conversion formulae

After many a day scratching my head as to why I can’t get my viscometer to calibrate correctly, even assuming logarithmic and quadratic relationships, I find out why I have been having so many problems.

Krebs units are in not very linear!

I have found an old chart with lots of grams to krebs conversions on it and after painstakingly transcribing them, I have come up with the following graph.


Grams to Krebs (grams on horizontal axis, krebs vertical)
Grams to Krebs (grams on horizontal axis, krebs vertical)

As you can see, there are a number of points of inflection along this graph. Here are some images of the various best fit scenarios regarding this set of points. These points encompass the KU values 40.1 to 141, just for reference.

Linear (0.0813637)*x+(64.5289)
Linear (0.0813637)*x+(64.5289)

Quadratic (-0.0000813007)*x^2+(0.173302)*x+(46.274)
Quadratic (-0.0000813007)*x^2+(0.173302)*x+(46.274)

Cubic (1.01193e-7)*x^3+(-0.000252971)*x^2+(0.253045)*x+(37.7895)
Cubic (1.01193e-7)*x^3+(-0.000252971)*x^2+(0.253045)*x+(37.7895)

Quartic (-2.3958e-10)*x^4+(6.42986e-7)*x^3+(-0.000653817)*x^2+(0.359922)*x+(30.3868)
Quartic (-2.3958e-10)*x^4+(6.42986e-7)*x^3+(-0.000653817)*x^2+(0.359922)*x+(30.3868)

Quintic (1.93677e-13)*x^5+(-7.87171e-10)*x^4+(1.20087e-6)*x^3+(-0.0008998)*x^2+(0.403747)*x+(28.1763)
Quintic (1.93677e-13)*x^5+(-7.87171e-10)*x^4+(1.20087e-6)*x^3+(-0.0008998)*x^2+(0.403747)*x+(28.1763)

As you can see, a quartic relationship is quite passable though I still added a quintic relationship. It may be possible to make a simpler equation based on these values but I thought it prudent to stick to what I know.

You can see the dataset here. GramsvsKrebs.txt

Be warned, I may have made mistakes or the chart may have been wrong, Do your own research if you want to be certain of your results. Hopefully this is of help to somebody.

Working on new viscometer head

  Well, I’ve been designing some new stuff since having a little wind of inspiration. This head weighs in at about 700g and provisions have been made to allow an attachment to a handle and therefore a hand-held version could be made. Here are some images.
 

Line Drawing
Line Drawing

Fully Assembled visc head
Fully Assembled visc head

Viscometer head opened
Viscometer head opened

Viscometer head from the back
Viscometer head from the back

 
  I’m going to use these design concepts on the next in-process version. I’m going to design the external case for the electrical portion and for possible battery storage. Since the motor only draws 100ma at 24v or 200ma with a 12v motor, a hand held version is definitely possible. This version will use a PIC16F767 for control and using a smaller LCD display to display info.
  Now, on to developing some other devices. I’ve wasted far too much time in the last many months, time to get busy.

Getting closer to final completion

A long road behind and still some ahead, here are some pic of the viscometer in its state of completion.

stormer viscometer with cover looking in
stormer viscometer with cover looking in

viscometer from the back
viscometer from the back

viscometer standing up
viscometer standing up

viscometer laying down
viscometer laying down

stormer viscometer with cover
stormer viscometer with cover

Now to implement the ModBUS protocol and finish up this project.

Krebs to Poise Formula

Looking for a decent formula on the net for a Krebs to Poise conversion I’m left empty handed. I found a chart that had listed direct numerical conversions.

Here’s the Best Fit value in the Quadratic form ax^2+bx+c=y

y=0.00419037x^2+(-0.306745)x+6.40025
y=poise
x=krebs

It may be somewhat rough, but since KU is a unitless value…

(Update Nov 4, 2013)

Got some info from a fellow in Costa Rica that the formula seems to match more closely to Newtonian Poise. Using this for Thixotropic fluids would most likely be innacurate at best! I would agree since Thixotropic fluids require specific velocity differences to accurately determine viscosity at a value differing from standard measuring techniques.

In-Process Stormer Viscometer – Damn near complete

  The viscometer is nearing full completion! YAY! To mark this occasion to mark the end of a long two years, I am placing a small gallery of the almost finished product. The only thing missing is the outside cover which consists of a 4″ od aluminum tube. Also, the springs I’ve ordered have also not arrived as yet, however, for now, the elastics will suffice. Here are some of the features and facts:
 

  • Can be used in-lab or in-process
  • Selectable RPM with a tight tolerance on RPM +/-0.5RPM
  • User calibration routines. This allows the end user to calibrate with 3 fluids of known viscosity
  • 16 key keypad, used for calibration and settings, also for running special tests
  • Can be used as a laboratory gel-timer
  • Can be used for custom tests besides stormer viscometry
  • Low power consumption <100ma or <2.4W
  • RS-485 Serial output
  • Control electronics have complete galvanic isolation
  • 24VDC supply required
  • repeatability (requires further testing) +/- 1.5%
  • Modbus protocol (not yet implemented)
       
      Here’s the Gallery!

       
       Yes, a few too many pictures, oh well.
       
       This thing took me quite a while and what I learned from it was immeasurable. Thankfully now that everything works as expected I can focus on my other projects without having this thing hanging over my head. Here’s to completion!
       
      As an aside, here’s an interesting document on viscosity.
      here

Spring Stormer Viscometer, proceeding, the board works.

Well, I recently recieved my boards back from ap circuits in Calgary and I’m pleased with the result. I kind of fucked up by ordering 4 of the same board and not 2 of the control board and 2 power boards. Oh well! I can use the current boards for the new ones. Anyways, here are some images of the board.


The two boards together, unpopulated and populated
The two boards together, unpopulated and populated

The board, populate with SMD's
The board, populate with SMD's