Shepard v1.1 Dev Log (Temperature DAQ) Started: 05-21-13

All of the work done on the temperature portion of the Shepard v1.1 DAQ system. This dev log was started on 05-21-13
Added by Jeremy Wright over 4 years ago

I had to wait awhile to go get parts to mount the load cell on the v1.1 structure, so I started to research communicating with the ADS1118 via an Arduino to get the thermocouple data.

I found this blog post which at least shows how to get a single ended voltage (single shot, high speed). I then got the register settings for temperature monitoring from this source .

Using these resources, I came up with the following simple source code for the Arduino:

#include <SPI.h>

void setup() {
  Serial.begin(9600);

  // Set up and start the SPI serial interface
  SPI.begin();
  SPI.setBitOrder(MSBFIRST); // Most significant bit first
  SPI.setClockDivider(SPI_CLOCK_DIV8); // Step down the arduino clock by 8
  SPI.setDataMode(SPI_MODE1); //Serial interface timing
}

void loop()
{ 
  Serial.println(readRaw());
  delay(1000);
}

/* Allows the caller to read the raw value from the ADS1118 */
int readRaw(void) {
  int rawValue; // Raw value received back from the ADS1118
  byte MSB, LSB; //The most and least significant bits read from the ADS1118
  byte MSBConf=B10001011; // Most Significant Bit configuration register
  //11010001
  byte LSBConf=B11110010; // Least Significant Bit configuration register
  //10000010

  // Read the ADS1118's channel's A0 and A1 as temperature in single-shot mode
  MSB = SPI.transfer(MSBConf);
  LSB = SPI.transfer(LSBConf);
  //SPI.transfer(MSBConf);
  //SPI.transfer(LSBConf);

  // Build the raw value from the most and least significant bits
  rawValue = (MSB << 8) | LSB;

  return rawValue;
}

/* Allows the caller to read the raw voltage */
double readVoltage(void) {
  int rawValue; // Raw value received back from the ADS1118
  double volts; // Converted voltage from the raw value
  const double amp = 0.256; // FS multiplier in register (check data sheet)

  // Get the raw value so that we can convert it to a voltage
  rawValue = readRaw();

  // Convert the raw value to the corresponding voltage (16 bits = 0 to 32767)
  volts = amp * (double)(rawValue / 32768);

  return volts;
}

Using the following resources, I then came up with the circuit below:

  1. http://www.ti.com/lit/ds/sbas457c/sbas457c.pdf
  2. http://arduino.cc/en/Reference/SPI

Fritzing Diagram

( Large ) ( Real Life Breadboard Photo )

The blue terminal block on the breadboard is what the thermocouple leads attach to.

Fritzing Generated Schematic

( Large )

The two open terminals on AIN0 and AIN1 represent the attachment points for the thermocouple leads.

For anyone reading this after the fact, keep in mind that this was my first time using Fritzing and I did a horrible job of routing. I really like Fritzing so far though.

When I tested the ADS1118 circuit with the source code above, I found that it wouldn't display any value except -1. I'm not sure yet what is causing this problem. If anyone reading this figures it out before I do, please feel free to leave a comment and let me know.


Comments

Added by Aaron Harper about 4 years ago

Cool stuff. Fritzing looks awesome... something I should probably learn everything considered. :) I just installed it and played around... not bad!

Question: why are we using the thermocouple and amp system instead of the MLX90614 IR sensors for 1.1? On one hand they are relatively expensive and will requite some work to give them a window to look through, but on the other hand, since it is I2C (SMBus actually, but compatible), I get the feeling that they would be simpler to wire and code, possibly saving time for 1.1 which would leverage to 2.0.

Added by Jeremy Wright about 4 years ago

I think the major holdup for me on the MLX90614 was that it would require a new mounting mechanism (as well as the addition of that field of vision window you mentioned) to get it in position. With that said, I wouldn't be opposed to discussing the use of it if we can come up with a simple solution. If it's mounted close enough to the motor casing we risk damage in an explosion, but eliminate the need for a sight window, right?

Added by Jeremy Wright about 4 years ago

Just had a thought on using the non-contact MLX90614. If we cut a short length of a motor mount tube, we could mount the IR sensor in it and then slide the tube on before each run. This would help precisely and repeatably position the sensor for each run as well. In the event of an explosion, the sensor would become a tethered projectile in the same way the thermocouple is. The difference there is that the thermocouple is somewhat lighter. We should probably add a safety requirement that the sensor must be positioned on the bottom side of the motor, so that if there is an explosion the sensor is pushed down into the stand and not out laterally.

Would this work? Does that sensor have any sort of minimum focal length requirements?

Added by Jeremy Wright about 4 years ago

One drawback that just came to me is that you'd have to drill a hole in the plastic motor adapters used for A and B motors. I don't think that's a huge deal though.

Added by Aaron Harper about 4 years ago

The sensors have no real focal length to speak of, though the sensor has a single sigma sensor cone of about +/-40 degrees and a detection limit of about +/-75 degrees. You can limit the field of view by putting the sensor close or shrouding the sensor in a tube or cone.

Added by Jeremy Wright about 4 years ago

After the discussion on the MLX90614 sensor here, I decided to give it a try to see if it would be practical for version 1.1.

Using the resources below, I was able to build the following circuit. I used the example code from resource #3 to test whether or not I had everything working properly. An important thing to note is that there's a 5 volt version of the sensor, as well as a 3 volt (3.3 volt) version. We're using the 3 volt version.


( Large )


( Large )

  1. http://www.melexis.com/Assets/IR-sensor-thermometer-MLX90614-Datasheet-5152.aspx
  2. http://bildr.org/2011/02/mlx90614-arduino/
  3. http://interface.khm.de/index.php/lab/experiments/infrared-thermometer-mlx90614/

Here's a picture of the circuit IRL (in real life).


( Large )

The sensor gave values that made sense, and the sample rate seemed pretty decent. I'm going to start working on how to mount the sensor to the v1.0/v1.1 structure now.

Added by Aaron Harper about 4 years ago

That looks fantastic! Can you mount a second temp sensor on the same bus and read it? This would give Shepard 1.1 full NAR compliance!

Aaron

Added by Jeremy Wright about 4 years ago

I haven't tried running two temperature sensors on the same bus yet, but it shouldn't be too hard. Our DAQ software isn't set up for more than one sensor though. If we could find longer motor mount tube material, we could permanently mount the sensors in the proper locations. Whenever you slide the motor in, the sensors are automatically in the right spot.

Another thing holding us back from full NAR compliance (which probably always will) is the need for a NIST calibrated load cell. I think that our use case and budget will probably always preclude this. That's just my opinion though.

What I'm thinking about for the test mounting of the MLX sensor is this:

1. Get another cardboard motor mount tube like the one in this picture.

2. Cut a 0.5 to 0.75 inch length of the tube.

3. Put a hole in the tube just large enough so that the first shoulder of the sensor body (shown in picutre) will not fit through.

4. Glue the sensor shoulder to the tube body. This will require some filler because gaps are not desired between the sensor body and the curvature of the tube.

5. Slide this ring over the end of the motor in the mount before each test.

6. Make sure that the ring is rotated so that the MLX sensor is between the motor and the structure's slide. This will help lessen the chance of the sensor becoming a projectile in the case of an motor explosion.

7. Here's an rough, exaggerated, and out-of-scale sketch of what I have in mind.


( Large )

Perhaps a better alternative would be to use a small cardboard standoff tube for the MLX, where the shoulder closest to the pins would rest against the standoff tube.

I do have a couple of concerns about the design.

1. How do I make clean holes in the tube material so that temp sensor (or the standoff) mounts cleanly?

2. Will mounting the temp sensor in this way affect its ambient temperature readings?

Added by Aaron Harper about 4 years ago

Nicely done! To stabilize the MLX you may wish to mount it in a short tube as you mentioned, and this would hide ugly edges of the body tube hole, especially if the tube were mounted to the body tube with epoxy. As long as the hole does not affect the structure of the body tube and stray bits do not appear in the viewing area of the sensor, it should be fine. If the short tube used for the MLX is notched to match the body tube curve and mounted with epoxy, the resulting assembly should be stronger than the original.

Mounting the sensor like this will ensure the only thing it sees in its field of view (+/- 45 degrees) is the engine casing. This is exactly where we want to be.

Added by Jeremy Wright about 4 years ago

I spent some time last week writing an I2C library to specifically work with our implementation of the MLX60914 non-contact sensor on Shepard. It shouldn't be hard to expand it to work with an I2C interface for Shepard's load cell when needed on version 2.0.

I started today by gathering the materials that I expected to need to build leads and connectors for the MLX sensor. I'm also expecting to go to the hardware store to purchase a longer length of shrink tubing to help contain and protect the sensor leads.

Part List:
  1. CAT-5 Ethernet cable
  2. Heat shrink tubing
  3. 40-pin 2.54mm male long header (I'll only use 4 of the pins)
  4. 0.1 uF Tantalum capacitor
  5. MLX60914 non-contact IR temperature sensor

Added by Jeremy Wright about 4 years ago

1. The first thing I did was remove the CAT-5 wires from the sheathing. I chose orange for +3.3v (Vdd), green for ground (Vss), and blue and blue-white for the SCL and SDA pins respectively.
2. I clipped 2 contiguous header pins for the SCL and SDA leads, and 2 separate pins for the +3.3v and GND leads.
3. I soldered the capacitor directly between the MLX sensor's Vdd (3.3v) and Vss (GND) pins, making sure that the capacitor's leads stuck out far enough to attach the CAT-5 leads to. I used to spring clip heat sink attached to one of the alligator clips of my hands-free soldering station to hold things for the soldering. Not an ideal setup, but it worked. During this free form soldering, I was careful not to let the capacitor body come to rest against the MLX sensor body.

4. I stripped the ground and 3.3v leads and soldered them next.
5. I then stripped the leads for the SLC and SDA pins and soldered them.

Before doing anything else, I wanted to test to make sure that the sensor was working properly. I hooked it up to the Arduino and ran the sample program I had written last week (available in the repository by the end of the day today). The Arduino would pull sensor readings from the MLX for awhile and then stop. I coded the Mach 30 I2C library to wait on the device if it was busy, so I'm guessing that my test leads are too long and not connected solidly. I'll cut them to length and make sure the connections are good and try again.

I felt that the sensor leads should be about 4 inches longer than the leads for the load cell since this temperature sensor has to reach the back of the motor. That left the leads being 1 foot too long. I shortened those up and tried again. That seems to have fixed the problem, but it's still something to keep an eye on.

The next step will be adding some heat shrink tubing, but I think I'll post this dev log segment first to give people a chance to comment.

Added by Aaron Harper about 4 years ago

Does the I2C bus you are connecting to have a terminator?

Added by Jeremy Wright about 4 years ago

I started by adding heat shrink tubing to keep the connections on the MLX sensor separate.

Then I added the sheathing shrink tube to keep all the leads manageable. I left 3 inches of the leads loose on the Arduino end of the cable so that the leads could be run to their perspective female headers on the Arduino.

Next I was ready to start soldering the header pins on the Arduino's end of the leads, but I needed to get heat shrink tubing on the leads first because I couldn't fit them over the pins after.

Added by Jeremy Wright about 4 years ago

I figured out this morning that I've been transposing a couple of the numbers in the MLX sensor's part number. It's actually MLX90614.

After a discussion I had with Aaron, I decided to take another look and make sure that the Arduino's internal pull-up resistors were really being activated by our new library code. They were not. I fixed that bug and now I think we should be in the clear on any read stalls due to the MLX sensor appearing not to be ready on the I2C bus.

At this point, I was ready to shrink the tubing on the connectors and do a longer test to make sure everything was working well.

I let the setup run for about 2 hours with no problems. I was then ready to integrate the new I2C library into the main body of the ShepardDCS code. This required only minor changes to both the Arduino and Processing programs, and were done in a few minutes. They need to be tested of course though.

Before posting this part of the dev log, I wanted to do a sample rate check with the Arduino sampling both the load cell channel and the MLX sensor. I hooked the load cell back up and did a test run by simply pushing on the load cell with my finger. When I looked at the data I ended up with 357 samples per second.

Added by Jeremy Wright about 4 years ago

The next step was mounting the temperature sensor in a way that would allow us to consistently measure the temperature of a motor casing at the throat of the nozzle. I got another section of motor mount tube from a local hobby store, and a 1 foot length of 3/8 I.D. x 9/16 O.D. vinyl tubing from a local hardware store. The main part of the body of the MLX90614 sensor fits down inside the tubing, and the shoulder of the sensor body rests on the outside wall of the tubing. A little bit of clear silicone should hold the sensor in place.

Aaron has told me that the throat of the nozzle on the Estes motors should be 10 mm from the exhaust end of the motor. My thought is to cut a section of motor mount tube the length of the motor (or adapter) which sticks out of the back of Shepard's motor mount tube.

Then I'll measure back 10 mm from the end of the tube section and try to put a hole in it with a single hole punch. Then I'll try to match the curve of the cardboard sensor mount tube with a curve cut in the end of the vinyl tubing.

Added by Jeremy Wright about 4 years ago

The red motor adapter sticks out approximately 23 mm from the end of the motor mount tube, so I think I'll cut the sensor's tube to 23 mm. To keep from crushing the tube I'll insert an adapter inside of it while I mark and cut the tube. I'll also use an old circle template to try to get the circumference of the tube marked as straight as possible.

Since the circle template was flexible and had a hard edge, I wrapped it around the tube and lined it up with multiple 23 mm markings. You could use any flexible material with a hard edge, the circle template is just what I had on hand.

I then started cutting along the marked line with a fine bladed knife.

The cut wasn't the prettiest, but it works for my uses.

I tried a dry fit with the tube and found that it covered the notches for the engine retainer clip. The notches are a couple of millimeters deep, so I'll need to knock the length of the mount tube down to 20 mm.

With the tube cut to the right length, I wanted to measure from the clean end of the temperature mount tube to find the position to put the hole for the sensor with a hole punch. Since the length from the motor mount tube to the end of the motor is 23 mm, if I measure 13 mm from the end of the motor mount tube that should put me at 10 mm (the location of the nozzle throat) from the end of the motor. I put a mark there and then used the hole punch to put a clean hole in the tube.

Next, I needed to put a curve in the end of the vinyl tubing to match the curve of the cardboard tube body. There was no clean way for me to cut the curve, so I tried using a pair of scissors. The scissors couldn't make a tight enough curve in the tubing. I ended up cutting a V in the end of the tubing with the intention of filling any gaps with adhesive later.

I then cut the tubing to about the length of the MLX90614 sensor (~3 mm).

The next step is to go to the local hardware store for some adhesives. Chris has suggested 3M Scotch Weld for the bond between the vinyl tubing and the cardboard tube, and I'm thinking about putting a small amount of clear silicon on the sensor to hold it in the tubing. The idea is to let the sensor pop out of the tubing easily in the event of a motor explosion so that it doesn't become a projectile as easily.

Added by Jeremy Wright about 4 years ago

I wasn't able to find 3M Scotch Weld locally, and I'm too impatient to wait. The only thing I could find that looked like it would work within the temperature range I needed with Elmer's Stix-All Hot/Cold Extreme Cement. I'm going to do a test to see if it sticks well at all before I try it on the final piece. The adhesive is fairly tacky, so it's easy to stick the two parts together while you work on a clamping method. I glued an extra piece of vinyl tubing to an extra piece of cardboard tubing and I'll wait to see how well they bond. It should be set within 24 hours. If it looks promising tomorrow morning I'll probably go ahead and finish the temperature probe for our partner CCSSC and get it shipped.

Added by Aaron Harper about 4 years ago

Looks great. The mount needs to hold the sensor and make sure it's looking in the right direction, not necessarily be the physical bond or limit the field of view. Great job!

-Aaron

Added by Jeremy Wright about 4 years ago

The test parts adhered well together, so I went ahead and glued (and clamped) the vinyl tubing and cardboard tube together.

After letting the clamped mount sit overnight, it looked like this.

With the sensor dry fit, the assembly looked like this.

I tested the sensor and it seemed to work fine, so I went ahead and put clear silicone on opposite sides of the sensor housing to hold the sensor in the vinyl tube.

The temperature sensor will be ready to use once the silicone has set up, and the adhesive between the vinyl should technically have a couple of more days to reach full strength. I was wanting to get this shipped out today, but I think I'll hold off. I don't expect to be able to get back to this before Monday of next week, but I'll try a test firing and ship it then.

Added by Jeremy Wright almost 4 years ago

We still owe our educational partner CCSSC a temperature sensor. The one that I built above ended up going to the NewSpace conference and will be going to the Open Hardware Summit.

I've been trying to find enough free time to build another probe with a few changes that I thought of while building the first one. The build was the same as above except for the changes listed below.

1. I wanted to bend the pins on the MLX sensor 90 degrees so that the sensor can be tucked up between the motor mount tube and guide rail. That way if there's a motor failure it reduces the risk even more that the sensor will become a projectile.

2. I re-used the sheathing of the CAT5e cable that I tore down for the wire instead of heat shrink tubing.

This also had the effect of making the finished cable slightly more flexible, which was a welcome improvement over the somewhat stiff cable I made for the first sensor.

3. Instead of only using 2 pins on the headers for the sensor lead connections to the Arduino, I used several contiguous pins to reduce twisting and loosening. J had a little trouble with the connections at NewSpace which prompted this change. I clipped the unused outlet pins to reduce the risk of them being shorted out.

The finished connections on the Arduino side looked like this:

And the overall setup looks like this when finished:

The next step is to build a duplicate of the sensor housing (shown above).

Added by Jeremy Wright almost 4 years ago

I built the temperature sensor housing the same way I did above and glued the MLX90614 in place with two small rounds of the high temperature Stix-All glue on opposite sides. I was trying to avoid completely sealing the sensor body to the inside of the tube so that pressure could escape around the sensor body during a motor explosion, and not propel the sensor outward with as much force. I also oriented the sensor leads so that they run towards the load cell at what I believe J calls the "back" of the test stand (towards the back plate where the load cell is mounted). This will allow the user to route the temperature sensor leads cleanly with the load cell leads if desired. My hope is that it also helps users remember to rotate the sensor to the underside of the motor mount tube. In that orientation a motor explosion would push the sensor down into the linear guide rail and not out laterally into potential observers.

It will take 24 hours before the glue is set up enough to ship this sensor assembly, so I'll hopefully get it tested and shipped tomorrow.

Added by Jeremy Wright almost 4 years ago

We had a bit of an engineering process breakdown and the dev log entries beginning with the non-contact IR sensor should have been published under the Shepard v2.0 target version and not Shepard v1.1.