Stacy DeRuiter's How To Make Almost Anything Blog - Final Project
December 11, 2005
Progress on my project is slow, but measurable! Right now, I am trying to progress toward a logging ultrasound hydrophone in baby steps. The first step: record audio from a microphone and store it on a flash memory chip, then retrieve the data later via a serial connection to a computer. Learning to talk to Flash memory proved much harder than I thought it would be! So far, I have designed my PCB and written code that can begin recording when a button on the board is pushed (with a little LED flash to let you know it's working). The board takes input from a microphone, converts it to digital using the microcontroller's ADC, and then stores it in memory.
Here is a list of the parts I am using for this logging microphone #1:
-
Atmel ATtiny26L microcontroller (because I needed more than 6 pins)
-
Atmel 1Mbit Flash memory
-
Microphone from the MAS863 fab lab supply
-
Lithium button battery from Tadiran (3.6V)
-
Assorted resistors, LED, etc.
When I get a board working, I will be coating it with our meltable, peel-off protective plastic coating for waterproofing.
Here are pictures and code developed so far:
Assembly code to record to Atmel 1M flash memory -- this code is heavily annotated. I hope it might be useful to someone else some day: the only examples I could find of this type of data logging were in c-code, and c-code does not immediately help you know how to write the corresponding asm code.
Pictures:
My plan of action over the next week: Get to as many of the list items below as possible, in the order they are listed.
-
Get this board working - mainly, write the code to retrieve data from flash memory and send it serially (which should be a variation on storing it in memory, plus some putchar); then debug the board.
-
Prototype flotation and waterproof removable case for the board (I am going to try our peel-off protective coat - it worked well on a hello world chip I coated and then sent for a swim).
-
Plan my end-of-fab-class demo - probably a recording chip going for a swim, another one showing data offload, and a computer/web site demo of data previously offloaded from a chip. The web site will also have some info about porpoises and how I plan to develop and deploy this tag in the future.
-
Add a larger (Atmel flash 64Mbit) memory, which I have in stock: this should be easy, as the only difference between the 1M and 64M memories is a different package (same pins used for comm, and same communication protocol).
-
Consider the issues of datalogging to FLASH - talk to experts. The overall data logging rate to flash is fast enough for my purposes on average, but it has "gaps." the data is written to flash in 264byte pages - and writing a page takes up to 20msec. During that 20msec, the flash is busy and no data can be logged. 20msec is a long gap in the data at a sampling frequency of 500kHz, which I hope to achieve eventually! Note: To get a long enough recording time, if I do stick with flash, I need to move up to really large memories (Gbits), and those accept data via a more complicated 8- or 16-wire interface...but I am starting with the simpler, smaller chips to learn my way. After this class is over I will try to figure out the memory issues more fully.
-
Add an external ADC (rather than using the one on the microcontroller). I have a feeling this may be as hard as learning to talk to the flash memory.
-
Add a hydrophone (piezoceramic) element instead of the microphone (simple, but I want to get it working before I start hooking up expensive elements (or cheap, but I only have one, elements...)
-
Add lossless data compression (where you store the difference between each data byte and the one immediately before it, rather than storing the whole data byte). This will probably be another steep learning curve.
-
Design and prototype a timed-release attachment for a porpoise (a sort of armband for the pectoral fin that is held on by a nichrome wire connected to a pin; after some amount of time, the microcontroller will send current through the wire and it will corrode and the tag will break free.
-
Add amplification (an in-amp sample is coming in the mail for investigation)
-
Add IR communication for data offload and talking to the board
-
Add an RF beacon (This device is meant to be deployed at sea - when it's done recording, it will float to the surface and I have to find it. An RF/VHF beacon would do the trick).
If you want to see previous iterations/thoughts about this project, please see the Week Four Project Planning page. Here's the latest...
November 28, 2005
After talking to my advisor, I have decided that it would be much more useful to make a logging hydrophone than a logging accelerometer. It needs to be as small as possible, and needs to have:
-
a hydrophone: a piezoceramic sphere makes the most sense, since it will be sensitive omnidirectionally and I should be able to find one with the right sensitivity range (up to 200 kHz or so!)
-
A microprocessor: the AT Tiny13 should be fine, but its ADC capability is too slow and I would like a higher-bit ADC, so...
-
An ADC capable of processing samples at 1MHz (I actually need more like 500kHz, but I know they come in 1MHz...I need to do more research this afternoon on this one...
-
Flash memory: 16-bit digital samples at about 500MHz means that I will need to store 8 million samples per second (is that 1 Mbyte?) of recording! That means a minute of recording would take up 60Mbytes, and 30 minutes would take 1.8Gbytes...I wish I were making the calculations wrong!! The biggest Atmel flash memory I see on Digikey is 64Mbit so I have to think about this...
-
Power. Neil suggested a supercapacitor; I also may try a NiMH battery. Either way I have to be able to charge it without contact. I THINK that the components I am using are low-power enough, and the recording is memory-intensive enough, that memory space, not battery power, will limit the maximum possible deployment time of the tag. So...there should be power enough to run a VHF beacon (if added) for some time after recording is finished.
-
waterproof housing! I am thinking that the easiest thing to do is just to pot the whole thing in epoxy. I will do that with a plaster or clay (or maybe milled here in the shop...) mold.
-
Flotation. I think that this will be inside or attached to the epoxy potting. It will be just buoyant enough to make the tag _slightly_ positively buoyant. I can get away with using an air bubble or styrofoam, because porpoises do not dive very deep underwater, but syntactic foam may be better because of its acoustical properties (less reflection of sound off this type of floatation material).
-
A way to attach the tag to a porpoise. I have 2 ideas for attachment. One is attaching it to a ring places through the porpoise's dorsal fin, using a thin NiChrome wire. After recording, I will send current through the wire, so it will corrode fast, break, and release the tag. This sounds cruel, but the group I work with already puts plastic tags on all rescued porpoise dorsal fins for ID purposes, so as long as the tag is small enough I am not adding lots of pain and suffering. Alternatively, I can use a strip of neoprene or plastic (like the plastic that waterproof foam-type band-aids are made of?) and attach a 'button' to the top of the tag with NiChrome wire (same release mechanism). The strip will go around the porpoise's pectoral fin and then button on to the tag, holding it on (until the wire releases). I am not as confident this will work and it needs testing.
-
A way to find the tag once it comes off. First pass: make the tag fluorescent and write my address on it. Better: add a VHF radio beacon. If I can find out how to do this in time, I will try it.
-
A non-contact way to retrieve data from the tag once it's done field recording. Neil says this will be trivial and I will learn about it next week...