Wednesday, July 22, 2015

Making custom Vernier compatible sensors


First off I need to make a small disclaimer for this post: I don’t work for Vernier Software and Technology, nor do I receive any form of financial or otherwise support from them.
Their hardware is very well made and easy to use. Their very open approach to doing business is inline with my personal ethics so I just like using their products in my more education oriented work and projects.

As part of helping out New Zealand preparing for IYPT 2015 I made a couple of custom sensors that are compatible with the Vernier Software and Technology platform of data acquisition hardware.
The first sensor is a rotary encoder interface: Vernier sell such a device, called the rotary motion sensor. However unfortunately due to budget constraints purchasing one was out of the question.

eBay to the rescue: One can purchase low cost rotary encoders which are surprisingly good quality for all of about NZ$15 including shipping. They have an open collector output and happily run on 5v.
I sourced a Vernier BTD cable from Electroflash, Thanks Les!

There was one slight gotcha when I attempted to interface the encoder to a LabQuest Mini: The encoder has a quadrature output, whilst the Vernier Rotary motion sensor outputs Clockwise and Counter Clockwise pulses on two of the digital pins… This had me scratching my head until I reread the user manual here: http://www.vernier.com/products/sensors/rmv-btd/

I initially thought about building a circuit using discrete logic gates but in the end decided in favour of using an Arduino to interpret the quadrature signal and output the direction pulses. This means that the resolution of the sensor can be customised to suit the encoder and or the application if I want to.

I did some quick maths to work out how long to make the direction pulses in the code... Again using data from the user manual:
Maximum speed on the low resolution setting: 30 revolutions per second = 360ppr * 30 = 10.8kHz
Maximum speed on the high resolution setting: 7.5 revolutions per second = 360ppr/0.25 * 7.5 = 10.8kHz
Period = 1/10.8khz = 92.59µs
So assuming 50% duty cycle at full speed the pulse has to be about 45 microseconds wide.

With the code written I made a bit of a lashup using some terminal strip and the Arduino. After plugging the cable into the digital port and manually selecting the sensor in Logger Pro I was presented with an angle readout that changed with the encoder revolutions :-D




I then turned my attention to making the sensor a little easier to use by making it auto identify to the Vernier hardware. Things like Auto ID resistor values aren’t public knowledge, however Vernier did point me to some Arduino code which put me in the right direction.
The code listed the Auto ID voltages for all of the digital sensors, from that I calculated a voltage divider circuit made from two resistors. The divider was wired to the terminal strip and presto! My custom sensor would Auto ID as a rotary motion sensor!
To do on this project is to investigate whether the digital sensors have I2C memory capability, this would allow me save custom resolution data with the sensor itself.

The second sensor I made was a custom pressure sensor. Vernier also sell a pressure sensor which we had borrowed off of another school. For our applications we were measuring very low pressures and also needed the capability of measuring differential pressure…
Unfortunately the Vernier sensor did not have the resolution we needed, so I set about building something custom…

One application was measuring the pressure inside and between rubber balloons, this required both low range and differential pressure measurements. I purchased a Freescale MPX5050DP pressure sensor. It has a maximum pressure rating of 50kPa and conveniently is amplified so its output can be directly connected to the analogue input of a data logger.














As we were in a hurry to collect data, I stuffed the sensor into a plastic project box and connected an analogue cable I crimped myself. The students worked out the calibration slope of the sensor themselves, which they entered when setting up the sensor.

A week or two later I got the opportunity to borrow the Vernier GPS-BTA pressure sensor and took a look inside the case. At this stage I know that the calibration data and Auto ID data was stored in an i2c memory IC. Now I wanted to work out how…














The memory IC in the sensor is a tiny SOT-23 device which was only engraved with “B15B” sticking these numbers and i2c memory IC into Google wasn’t really turning up useful information, so I took a bit of a punt: I made the assumption that any kind of Arduino or similar tutorial would use a pretty common memory IC and starting with those would narrow things down a lot.
This approach worked incredibly well as by luck the first tutorial that I looked at used a 24AA01 i2c memory IC. Looking at the physical footprint information in the data sheet revealed some numbers that matched whose on the IC in the pressure sensor. Bingo!

I ordered a few of the same IC but in DIP format for easy handling, As the home made sensor was at the school, I dug out a dead TMP-BTA temperature sensor (Someone measured the temperature of a candle flame… Oops) and harvested its cable. I soldered the wires and two pullup resistors to the pins of a DIP socket to test everything in an artful rats nest.



You may be wondering right now how I intended to program the IC with data in the first place. Initially I was thinking that copying the data out of an existing sensor with something like an Arduino microcontroller. Then the I thought about whether Vernier had a procedure for fixing corrupted Auto ID information. Five minutes of Googling led me to this page: http://www.vernier.com/til/2289/ 

With my Labquest 2 connected to Logger Pro, I plugged the IC into one of the analogue ports, After telling Logger Pro I was using a pressure sensor and clicking “Restore Default Configuration” it seemed like it had worked. Holding my breath a little I plugged the IC into a different analogue port… It identified as a pressure sensor :-D



Interestingly the procedure did not work from the Labquest 2 UI so I had to use Logger Pro.

To do on this project is to actually install the memory IC into the sensor so it’s useful, I also have a much lower range (4kPa) differential pressure sensor that we intend to use for cool stuff like pitot static measurements of fluid velocity.

References:
My Analogue Sensor Notes:
My Digital Sensor Notes:

No comments:

Post a Comment