Gas station without pumps

2011 September 23

New board designed

I’ve just sent a new set of boards for fab.  The HexMotor rev2.3 boards have several new features: LEDs for +5v and +6.25v, a reset button, 16-bit shift register instead of 8-bit, servo outputs connected to pins 13, 7, 2, 9, 10 (rather than to the pins used for PWM).  The new board should be able to do either 6 PWM motors or 4 PWM motors, 5 servos, and 2 non-modulated reversible motors.

I’m also making some breakout boards for the MPXHZ6250A pressure sensors from Freescale Semiconductor, which will require doing some SMD soldering.  At least the design uses gull-wing pins, which can (supposedly) be hand soldered.  One of the breakout boards also has a place for mounting an ADXL335 accelerometer, which may be more difficult to solder.  I don’t think I want to spend the money for a hot-air rework station, and I’m a bit dubious about my ability to solder using a toaster oven.

The pressure sensors are tiny!  My original suggestion to the robotics club was to drill a hole in the dry box and superglue the pressure sensor to the inside of the box (after the pressure sensor had been attached to the breakout board, of course).  Now I’m not so sure that there will be enough glue area to hold firmly enough.  Perhaps a dab of some sealant on the outside of the box might help, if we can keep from plugging the hole in the sensor.

The breakout board that I think that the robotics club will end up using puts a pressure sensor on one side and headers for a piggyback ADXL335 breakout board on the back.  that way there only need to be one set of wires for connecting the analog inputs and power to the sensors.

One limitation of the Arduino for use with this combination of sensors is that the accelerometer is a 3v part and the pressure sensor is a 5v part. We’ll have to set up the analog-to-digital converter on the Arduino to have a 5v range, which reduces the precision of the acceleration readings.

I’ve also bought some other sensors (not for the underwater vehicle, but for physics class and dry robotics): a couple of ultrasonic rangefinders.  More on those in a separate post, after I’ve had a chance to play with them.

2011 August 14

Pressure sensor

I’ve been thinking about what other parts I need to buy for the high-school Robotics Club, so that they can finish their underwater vehicle.

Some I’ve known about for a while, but just haven’t gotten it together to buy the (expensive parts).  For example, they will need several IP-68 connectors for the tether power, for the tether CAT-5 cable (see Long USB cable problem solved), for the motors, and for whatever suite of tools they build for this year’s challenge.  I bought a 4-pin Buccaneer standard connector (made by Bulgin)  for the power tether, and am leaning toward 8-pin mini Buccaneer connectors for the motor and tools.  I’ve still  not decided whether to get another 8-pin mini Buccaneer for the Ethernet connection, or to try using their IP-68 ethernet connector.

One that I only just started thinking about is a pressure sensor for determining depth. The challenges for the past 2 years have involved going to a particular depth, so having a depth gauge is a good idea.

Pressure sensors are classified into 4 types: differential, absolute, gauge, and sealed gauge.  In truth they are all differential, measuring the difference in pressure.  The absolute gauges measure the difference to a vacuum chamber, the gauge-pressure sensors measure the difference to atmospheric pressure, and the sealed gauge sensors measure the difference to a sealed chamber that has a known pressure in it (probably around one atmosphere).

If the club members put the pressure sensor sticking through the wall of the dry box, we could use any of the types of pressure sensor, but absolute or sealed gauge would be best, since we don’t know how much the pressure inside the drybox changes as we submerge it.  The sidewalls will flex, so the pressure will go up, but we don’t know how much.

I spent some time today looking for pressure sensors at DigiKey. It looks like absolute pressure sensors are cheaper and easier to find than sealed-gauge, so we’ll go with them.  There are also price variations depending on whether the sensor has temperature compensation, and on whether the output is a low-voltage differential signal or an amplified one ready for input to a microprocessor A/D input.  I’m pretty sure that we need the simplest interface we can afford, so the ones that don’t need external amplifiers are the best bet.

I also spent some time reviewing how much pressure to expect at different depths, so that I could help the club select the appropriate part.  I found an on-line pressure calculator that can convert depth of water to pressure (in PSI, kPa, or atmospheres).  Each meter of depth adds 9.8 kPa (or 1.42 psi).  In a 20′-deep pool,  they could have up to 59.7 kPa, and in a 12m deep pool (like at NASA) they could have up to 117.6 kPa.  Of course, this is just the water pressure that is added to the atmospheric pressure, so the real range they need to cover is 100 kPa to 220kPa.

It looks like Freescale Semiconductor makes some absolute pressure sensors with a 20–250 kPa range (for example, the MPXH6250AC6T1), which is just about right for us.  They run on 5 v and provide a ratiometric output, that we should be able to read to 10 bits of precision, or about 0.25 kPa, which would be a depth resolution of 1 inch. The accuracy of the pressure sensors is only ±1.5% of 250kPA, which is ±3.75kPa, ±15in, or ±38cm.   They get full points if they are within 50cm, so this is accurate enough for us.  The could calibrate to higher accuracy, by lowering the machine at the side of a pool while looking at a ruler or tape measure along the side of the pool and taking measurements.  So, now that I know what is needed, I can have the robotics club try to solve the design problems.

I think I will have to do one more thing for them, though—the pressure sensor is a surface-mount component, so I think that they will need a breakout board for it.  I’ll design a breakout board that has room for some bypass capacitors and an output filter capacitor.  Although surface-mount, the part has 0.05″ pitch leads sticking out, and so should be hand solderable, though it might be worthwhile to get a heat gun and solder paste to try reflow soldering.

Come to think of it, since the pressure sensor will be glued to the side of the drybox, it might be a good idea to mount the 3-axis accelerometer on the same board.  That would reduce the amount of cabling they need to do.  But the ADXL335 chip has the SMD pads underneath the chip, which can’t be easily hand-soldered.  That brings up the question of whether we try soldering with a heat gun or toaster oven, or pay $12 more for the chip already on a breakout board. (The DigiKey breakout board is the same price and a similar design to the LadyAda  breakout board—both are copying the ridiculously overpriced breakout board from Analog Devices.)

I could play around with a few different designs and stick them on my next PC board run—I want to do a revised version of the HexMotor board anyway, and it won’t cost any more to toss in some sensor boards on the same fab run.

2011 June 29

Data Acquisition

Filed under: Accelerometer,Data acquisition,Robotics,Software — gasstationwithoutpumps @ 19:28
Tags: , , ,

One of the science-teacher blogs that I read has recently discussed using an Arduino for data acquisition: The DAQ-ness Monster « Science Learnification.

I’ve not played with the Arduino much that way, but I do have a 3-axis accelerometer, the ADXL335 from Analog Devices, on a breakout board from Adafruit Industries.  This accelerometer has analog readout, so I connected the three X, Y, and Z pins to analog pins 0,1, and 2 of the Arduino, and powered the breakout board from the Arduino 3.3 volt supply.  I also sent the 3.3 volt input to the AREF pin of the Arduino so that the I could use “ratiometric” measurements.  The ADXL335 is designed so that 0g acceleration is mid-scale, so using the same voltage for powering the chip and for the Arduino AREF input means that 512 is 0g and the scaling is approximately 1g for each difference of 100.  It turns out that the calibration is not perfect (no surprise there), so you can improve the measurements by tweaking the offset and scaling for each axis separately.  I did this manually for my code, and the results are only good to about 1%.

I should be able to do better if I write a calibration program on my laptop that gathers results from the Arduino and tries to optimize the magnitudes of the reported acceleration vectors to be one.  If the accelerometer is held steady in several different orientations, this should auto-calibrate.

I wrote a little program that measured the X, Y, and Z values 1000 times, averaged them, and sent the average over the USB line to my laptop.  I’ve put the code on-line at  Each of the measurements takes about 3.3 msec (about 1msec per DAC reading)

Limitations of the Arduino as a data-acquisition device:

  • Only 6 analog inputs
  • Only 10-bit resolution
  • All 6 channels on same scale, and input must be between 0 and a single reference voltage (3.3v for the setup I used).
  • No faster than about 1msec/sample (so don’t try to collect audio or video data)

UPDATE 8 October 2011.  I’ve just found out how to put code into the blog itself, so here it is:

// Accelerometer (ADXL335) test
// Kevin Karplus
// 29 June 2011

void setup()
  analogReference(EXTERNAL);   // essential if you are going to connect to AREF

// I used wires to connect the breakout board to 
// three analong inputs, 3.3v, and ground.
// I also connected the AREF input of the Arduino to 3.3v

const int Xpin=2;
const int Ypin=1;
const int Zpin=0;

const int num_to_sum=1000;
const float xscale = 0.0098/num_to_sum;
const float yscale = 0.0097/num_to_sum;
const float zscale = 0.0099/num_to_sum;

const int zero_x = 500;
const int zero_y = 506;
const int zero_z = 511;

long xsum,ysum,zsum;

void loop()
  unsigned long startTime=millis();
  xsum = ysum = zsum = 0;
  for (int i=num_to_sum; i>0; i--)
     xsum += analogRead(Xpin) -zero_x;
     ysum += analogRead(Ypin) -zero_y;
     zsum += analogRead(Zpin) -zero_z;
  float x=xscale*xsum;
  float y=yscale*ysum;
  float z=zscale*zsum;
  Serial.print(" X=");
  Serial.print(" Y=");
  Serial.print(" Z=");
  Serial.print(" total=");

%d bloggers like this: