Weekly Update 6-20-2016 to 6-26-2016

The biggest piece of forward progress this week was the waterproof enclosure. I tested the one I built last week and built a second one being a little bit more careful with the PVC primer and cement. I conducted the test by filling a bucket I got curious of the Society of Physics students with water and dropping the enclosure in. Not the fanciest test but it gets the job done. I did fill the enclosure with mass to make it sink and put in some scraps of a coffee filter to give a prudently indicator of moisture in the tube. I chose a coffee filter because it absorbs water well and is very clear if it is wet or not. I could of used more sophisticated methods for this but there was no reason to, I mostly just wanted to see if a lot of water was seeping in at the joints or the screw cap. The first enclosure water was not seeping in, but the second one does have a leaking problem. I believe the leak is caused by the screw cap not tightening nicely into the enclosure, I have cleaned both halves of the screw and that has not improved it. Instead of spending a lot of time trying the fix it I am just going to use the first enclosure, and call the second one a loss. This is a benefit of working with PVC, it is so cheap that not matter how you mess it up you don’t feel that you’ve really ruined anything. This coming week I am going to test a method for the enclosure that does not involve a screw cap at all.

My highly advanced waterproofing test. I did rearrange the mass so the whole enclosure was fully submerged after this picture.

My highly advanced waterproofing test. I did rearrange the mass so the whole enclosure was fully submerged after this picture.

Speaking of things not working last post I mentioned that the SD reader on prototype 3 stopped working and I spent a lot of time this week trying to figure out why. I started by teaching myself how to use a logic analyzer. A logic analyser is a tool that is attached to digital circuits, and can look at the timing and voltage across a lot of wires at once. The software can also interpret the signals going across the wire. This is really useful because it allows you to look at signals the same way the chips do. After spending a while just playing with the logic analyzer to learn it I connected it to a working SD card reader and the broken one and compared the signal in them. What I found was pretty strange in that the signals did not look anything alike. Before I saw this I assumed that the SD wasn’t working because of a wiring error, possibly some interference or crosstalk. This is not what I saw at all, I would have thought it was a software error except that I was using the same code on the same chips to control for that. This led me to the conclusion that the SD reader itself was broken and the problem did not have to do with my assembly so I ordered a new reader. Hopefully just changing out the readers work, if not I have a big problem.

The logic analyzer connected to prototype 3

The logic analyzer connected to prototype 3

This is what the logic analyzer shows for a working SD reader

This is what the logic analyzer shows for a working SD reader

Finally this week I did a lot of miscellaneous small stuff for the project and preliminary research into things we might want to do in the future. I had heard that different brands and sizes of SD cards used different amounts of power so I found a bunched and looked at them under the oscilloscope. I was not able to see any appreciable difference between them. We got a solder oven for surface mount soldering and I played with that to learn how it worked. I used the laser cutter to build a stand for prototype 3. I did this because we needed a way to hold it level for tests on the accelerometer and gyroscope. I figured out how to use our particle electron board, which is basically a fancy Arduino with cell access. I did some initial research into inductive charging (a way to charge devices wirelessly, it’s how your electric toothbrush works) so that when we build the final device we don’t have to worry about about including a charging port. And last but certainly not least I did a fair bit of work in Eagle continuing to try to consolidate all the sensors and devices onto a few small boards. Also the gyro boards I designed and ordered last week should come in soon, so I can see if I’ve actually been doing the Eagle design correctly.

Prototype 3 in it's laser cut testing stand

Prototype 3 in it’s laser cut testing stand

While I didn’t make any huge bounds this week, and actually have taken a bit of a step back with regards to prototype 3, I feel that I am well positioned to get a lot of good work done next week.

Ben’s Updates – Week 3

This is a cross-post from this site.

Yup, shark wrangling is mostly just data analysis and, for now, signal filtering. I’m not the best physicist, but right now, William’s working on the PVC enclosure we need to deal with the briny depths, so I’m on math duty. The upshot of this is that I’m working on two separate things right now, one (seemingly) simple and one (seemingly) complex.

My first goal is to use the accelerometer readouts to estimate the pitch and roll of our tag. When the tag’s not moving, this is extremely simple; we use a bit of trig to to find the angle between the current gravity vector and our theoretical reference frame of [0, 0, -1] g’s (tag face-down). The problem is that A) this is really susceptible to system noise (like sea currents or, you know, a moving shark) and B) there are a lot of edge cases to consider that my feeble CS mind cannot easily comprehend, like Gimbal lock.

Alongside the accelerometer, we’ve got a gyroscope, and unlike our janky accelerometry trig, we can just integrate the gyroscope’s angular velocity readings to get angle. The only reason we need an accelerometer is to correct for gyroscope drift – since we’re integrating, noise is cumulative, and gyroscope readings can be unreliable in as little as 10 seconds. To correct this, we’re going to use a Kalman filter, which combines both readings in a manner that removes drift and other noise as well. It’s pretty cool, and while it seems horrifying at first, there are a lot of sites out there that offer a gentle (or simplified) introduction. If you still don’t want to use it, you can use a complementary filter – it’s one line of code and takes up no extra RAM if you’re working with an embedded system.

To help with both of these problems and because I was bored of friggin’ MATLAB scripts I wrote a Python script that produced simulated tag output! It’s actually fairly useful to see how and where my work is going horribly wrong. If anyone wants to have a tag simulator, I could spruce it up a little and send it your way.

Be seeing you.

Weekly Update 6-13-2016 to 6-19-2016

I spent most of this week working in Eagle. I began the week by trying to create boards with multiple sensors on them, and that had the same form factor as the Arduino pro mini. This would allow us to put the device into a very small package. The problem is eagle layout is a very slow and tedious process and I was not making very much forward progress but I was learning. After a day of working on the multi chip boards I had a meeting and we decided to table the multi chip boards and to work on making a board with just one sensor on it. The purpose of this is not to create something to be used in the proper deployment but to familiarize me with the whole process of going from an eagle layout to a printed board and then assembling the components onto the board. The sensor we choose to work with for this process was the gyroscope. The commercial version of it came on the largest board of all the sensors and had a lot of features we did not need, such as stepping down from 5v to 3.3v. I was able to get the schematics of the board we had and went about the process of simplifying and miniaturizing the board so that it would be the same size as the accelerometer and be stackable with it. This took me most of the week but by Friday I had a board designed that was ready to be shipped off and printed. I found a company to print the board and ordered all the components to solder onto it so hopefully I will have everything and see if my design worked next week or the week after.

Mockup of the gyro board without components

Mockup of the gyro board without components

In addition to creating a board for the gyroscope I worked on building a prototype enclosure for the sensor system. While that sounds fancy all it really is a PVC tube with an end cap on one side and screw cap on the other.

Prototype enclosure

Prototype enclosure

While this is fairly simple I did have a few small setbacks in it. I was hoping that I would be able to fit the battery in under the prototype in the enclosure, and while this is technically possible it is not a good idea. The bottom of the newest prototype (prototype 3) is very sharp with the solder joints and putting the battery under it is a tight fit so forcing it in enchanters puncturing and tearing up the batter. I ended up having to just make the enclosure longer so that I could fit the battery in the end. Also I did a pretty sloppy job with the PVC cement when I was assembling this prototype so I might just make another nicer one since PVC is so cheap.

In addition to working on the project this week I went on a tour of the NASA Langley facility for most of Thursday. It was a lot of fun, and I did not release how big that faculty was or how much cool since they were doing there.

Next week should be interesting, on Friday the SD reader on the prototype 3 stopped working in a very strange way. I have not been able to figure out what’s wrong with it so I will document what’s going on next week when I have less information. Just know that Friday was a frustrating and confusing day for me, hopefully Monday will be better.

Weekly Update 6-6-16 to 6-12-16

The first half of this week was dominated by soldering the new device prototype together. This was a very slow and tedious process since I was dealing with pretty small connections in a tight space. Additionally I released that it would be pretty difficult to go back and fix any mistakes, this means that I had to test things as I went. After about two days of soldering and a little bit of trouble shooting I got the device operational with the SD card, real time clock (RTC), accelerometer, and gyroscope. There are connection points for the temperature and pressure sensors but they are not attached. I from this process I learned that I did not do the designs in the most intelligent way. As you can see in last week’s post I laid out the connections from a top view, however the connections go on the bottom of the board not the top so when I was actually working the board was flipped over and the connections were mirrored from the design. Next time I’m going to take this mirroring into account and make designs form a top and bottom view. In the end though it turned out well. You can see some pictures of the device while it was in progress and the finished product below. Not to toot my own horn too much but I think this is the best looking prototype to date.

Device top side wiring before the sensors were placed

Device top side wiring before the sensors were placed

This is the completed protoype

This is the completed protoype

I did make a mistake with the orientation of the gyroscope in this prototype, it is 90 degrees off the proper orientation. While I did this on accident it would have had to be done this way anyway to keep the form factor needed for the prototype enclosure we are using.

Once I confirmed that the device was operational I began work on creating code to import the data from it into MATLAB. I thought this would be fairly simple to do, since all that was needed was to tell MATLAB to read 3 more columns for the x,y and z gyro data. This part was easy to implement but while doing so I found a logic bug in the data time interpolation for the data which I had to fix.

With the data imported into MATLAB I began to research into how to integrate the accelerometer and gyroscope data together to get device orientation and remove acceleration due to gravity from the data set. I did a fair bit of research into this but realized that it would be best to kick this part of the project over to Ben, so I passed off my notes and will let him discuss it in his updates.

Ben in returned passed something off to me. He had been working on code that would right data to SD card in binary instead of as text to hopefully decrease write time with the SD. He asked me to look at under the scope to see if it really had decreased SD write times. Also I had to look at the new device under the scoop to see how much adding the gyroscope to the system negatively impacted our power usage. I found that reading the gyroscope in addition to the accelrometer adds about 16ma to the reads. Additionally we found that the binary SD write does not decrease the SD write time but increases it. This was a surprising result and it is controlled for us writing more data to the SD due to the gyroscope.

Next this week I did a lot of research into batteries for the device and worked on some initial waterproof enclosure designed for deployment. This was very preliminary research for the most part and this post is already long so I will discuss it later. What is not preliminary is the first test enclosure. There are sharks in captivity at the eastern shore lab right now (see Ben’s post) and we need something to attach to them. For this I am just throwing together some PVC pipe to put the device in without the pressure or temperature sensor. I will hopefully be able to show this exiting tube next week once it is done.

Finally this week I have been working in Eagle to design my own PCB boards for the device. The idea of this is to put multiple components together on one board that is the size of the Arduino. We will probably be able to fit everything on two Arduino sized boards, we can then stack the boards on top of the Arduino, like standard Arduino shields, to get a very small form factor for the device. This is going to be a long term process since this sort of PCB board design is a slow process.

What is everyone else up to?

As Ben and I have noted in our updates we are part of the William and Mary 2016 Summer REU program. If you are curious about what the other undergrad researchers in the program are doing you can checkout their blog posts here. Additionally I (and maybe Ben) will be cross posting my weekly updates to that blog. The posts will be the same on both sites, the program just wants the information about what all the participants are doing collected in one spot.