0

Electret Microphone
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Electret Microphone

by elyssa on Fri Apr 14, 2017 4:00 pm

Hi there, so I have a rather unusual project that I am working on. What I want to do is use an omnidirectional electret microphone to pick up and record the heart beat of a bird that is sitting on her eggs. I want to put the microphone, battery, data storage device or bluetooth/UHF transmitter inside an artificial egg. I am not a tech savvy person and I understand the concept of doing this but don't know how to actually assemble the tech parts to make it work. My first big question is, how much battery power would a set up like this need? It needs to be able to run for a couple weeks without any intervention. Can I just use a bigger battery or is this just not going to happen? I know I want to be optimizing recordings in the 100-400 Hz range but am not sure if an adjustable or automatic gain microphone would be best. I have also considered using a piezoelectric sensor, since the bird would be applying pressure while sitting. I have many more questions regarding this but I'll start here. If anyone has thoughts on how I can create this setup, or glaring technical constraints I probably am not aware of, please share. I am new to using this kind of equipment so any advice would be much appreciated.

elyssa
 
Posts: 11
Joined: Fri Apr 14, 2017 3:50 pm

Re: Electret Microphone

by HowardP on Fri Apr 14, 2017 6:44 pm

A neat idea. Don't get discouraged by what follows. Remember a good engineer LOVES a challenge! I think it is entirely doable ... but it really depends on the Bird's Cooperation.

- How long does the egg have to be there before the mom bird accepts that it is hers ?

- Unless the bird (and her normal eggs) are huge, I can't foresee packing all that into an egg. I'd put just the microphone in the egg and run a small, shielded cable down to a "telemetry" box on an adjacent branch you can reach. Or strap it to the trunk. All the other gear goes in there. Make sure it's all waterproof (and locked up so no one steals it :-( )

- Constraining the bandwidth to 100-400Hz will reduce the SD storage requirements. The required audio sampling rate would be 800Hz (See Nyquist frequency).

Normally 8bit samples for audio is not good enough. Sixteen bit is normal - it's what CD's use for instance.

FYI: 8 bits are one byte. In the 8bit case, you get one sample per byte; at 16bits, it's 1 sample every two bytes. (Assuming the recording is only one microphone - or "mono".) You might be able to get away with a 12bit sampling rate. Many Analog to Digital (A/D) chips do 12bit.

Storage needs works out like this below. I'm showing the 8bit version first because it is the easiest to understand.

-8bit sample-
1 byte saved ("recorded") every sample.
@800Hz sample rate, that's 800 bytes each second, so
800 x 60 x 60 = 2,880,000 (2.88 MB "MegaByte") samples per hour.
x 24 hours = 34MB per day.
____________________________
-16bit sample-
2 bytes saved ("recorded") every sample
@800Hz sample rate = 1,600 bytes per second, so
1,600 x 60 x 60 = 5.76 MB samples each hour. (yes, it's exactly twice as much as the 8bit rate.)

So, if I did these calculations correct, if you use a 2GB (GigaByte) SD card to save the recordings at the best rate, the card would hold:
2,000,000,000 Bytes / 5,760,000 Bytes per hour = 347.222 hours or about 14 days worth.

And thus the next question:

- How long does it take to hatch ? :))

For more info on data logging, see Ladyada's nice tutorial here: https://cdn-learn.adafruit.com/downloads/pdf/adafruit-micro-sd-breakout-board-card-tutorial.pdf

EDIT: and, as an after thought, you might want to study this thread and the related items it mentions. https://forums.adafruit.com/viewtopic.php?f=45&t=59584

have fun!
- Howard in Florida

HowardP
 
Posts: 83
Joined: Fri Apr 03, 2015 6:42 pm

Re: Electret Microphone

by elyssa on Fri Apr 14, 2017 7:12 pm

Thank you Howard,

I was definitely confused about storage and how all of those terms interact. You did a great job simplifying that for me and I think I am starting to understand how it works.

Let me give you a little more detail and that might make it easier. I am studying a large sea duck whose eggs are larger than a chicken, think g oose size. They nest on the ground on gravel/sandy islands off the Beaufort Sea coast of Alaska. So my study area is very remote. Burying components in the sand near the nest is a possibility but things need to be waterproof and not susceptible to salt water intrusion. Or if it is, the data needs to be recoverable at a minimum but not necessarily the egg. I want to place the egg into the nest during incubation and leave it there until hatch. So a 30 day operational time would be nice but I really want to get a minimum of 15 days. I want the microphone to record sound waves of heart beat that are then stored in a data logger either inside the egg, wired to the egg, or that can be transmitted via bluetooth or Xbees to a receiver in the vicinity. I know data storage will be a constraint but I am also worried about battery longevity. I would ideally record continuous heart beats to be analyzed after but if I must, perhaps there is a way to use a microprocessor that only transmits records of heart beat per minute or hear beat per 30 seconds or an average over 5 minutes or something. I won't be able to visit the nest until after hatch so this needs to work without intervention. There is very little risk of her abandoning the eggs and she should accept the fake egg readily, egg dumping happens all the time. Lastly, I want to be able to an egg into various nests on the same island. It would be great if they could transmit via different frequencies to the same receiver. I also need each record to be accompanied by a time stamp.

Thanks for the response!

elyssa
 
Posts: 11
Joined: Fri Apr 14, 2017 3:50 pm

Re: Electret Microphone

by HowardP on Fri Apr 14, 2017 10:49 pm

Hey, elyssa, you're welcome I think projects like your are wonderful.

Your idea reminds me of an engineering saying I'd like to coin: "A solved problem means something was chosen while something else was not."

OK, good! Those details do help. I still think it's doable, but it may be more expensive than you'd anticipated. I'd say you've correctly spotted the main problems to solve.

  • Environmental survival
  • Battery life
  • Data transmission: means, storage, and recovery

The environment moves to the top of the list --- salt water and salt-laden air are both surprisingly nasty business, up there with going into orbit, surviving a nuclear blast, and maybe even flying into the sun :))

I live at the beach in Florida, have done more than a few remote and water-based telemetry things ... not to mention watching post-doc students curl into the fetal position when they try their first ocean-related telemetry experiments. Even stainless steel and naval brass are not impervious to this stuff, which acts like smart acid: it seems to know just exactly where to get in and what to go after :-/

That boils down to having the least number of penetrations in the containers holding the gizmos. Zero openings are rarely possible. One access point, e..g a well-sealed case door, designed for that environment, is about the best you can hope for. You mentioned the eggs could be disposable. The benefit is you could (somehow) turn them on and fully seal them. (Forget silicone for sealer - the best thing I've found is an adhesive product called "5200 marine adhesive" which is used by boaters to seal penetrations through the hull - think fish sounders, etc. The second best is a generous helping of West System epoxy. Both of these typically need 24 hours of (real) cure time, although there are fast set versions too, but I've learned to trust them less. So you have to well-plan your deployment procedure.

Because of the above, I think the mic-in-egg-with-cable is not a good idea after all, although there are marine grade cables used for underwater sound recording - they are very expensive, and so too are enclosures that are salt-water tolerant.

I think you're on the right track with the radio link. If you could fit the mic, processor, radio, and battery inside the egg, turn it on, seal it, then give mamma duck a surprise g*ose egg (LOL), it might work. Unless the receiver is very close and in line of sight, bluetooth is probably not the route to go. There are "low power" bluetooth options available (Adafruit has some too), but anyone who's worked with them a lot will tell you these are a PITA to get going reliably and consistently. I'm also not sure xbee would be the right option, though it would probably work fine at the audio bandwidth you need. Off the top of my head, I remember XBee is somewhat power hungry. There are other radio options that might work better.

Having multiple eggs communicate with a "hub" is certainly possible. And you do need to factor that in when considering the "physical link" (even though radio isn't actually physically connected :) Then there's the "protocol link" or "protocol layer" - Xbee has good "node" networking, e.g. one egg far away could have it's data "relayed" to the hub via a closer-in egg. And these devices might make it easier to keep and record each egg's data stream separate. Here the trade offs (the choosing of one thing over another) are: power consumption .vs. bandwidth .vs. ease of setting up communication link(s) .vs. the over-all processing power of the hub.

The latter is significant because the hub has to be able to "consume" and keep up with all that data. (Number of eggs sending X bandwidth) + c.a. 10 to 15 % for overhead = required hub processing bandwidth.

There are a few other ways to do this, e.g. multiplexing the signals each with it's own unique signature or keycode, but that might be too complicated. (?) There are also other radio methods I have only superficially looked at.

Perhaps others more radio telemetry wise than I could also chime in here ? ....

cheers
- Howard

HowardP
 
Posts: 83
Joined: Fri Apr 03, 2015 6:42 pm

Re: Electret Microphone

by HowardP on Fri Apr 14, 2017 11:13 pm

another after-thought:

Do you actually need to record the audio of the duck's heartbeat, or just record the little critter's beats per minute?

If the latter, it could make things much simpler.

If the former, can you post 1) an image of the sound waveform - say two to four beats? Or even upload a sound file (.wav, .ogg, or whatever you have) on a server with a link here. And 2) a spectrogram - if you happen to already have any of this data from duck in the lab :))

- H
PS having a hard time resisting saying "Quack Quack" LOL

HowardP
 
Posts: 83
Joined: Fri Apr 03, 2015 6:42 pm

Re: Electret Microphone

by elyssa on Sat Apr 15, 2017 2:55 am

Howard,

Wow lots of great information. I really appreciate your comments! I don't really want the actual sound of the heart beat. I want the beats per minute. But I guess I want beats per minute updated every beat if that makes sense. So like a Fitbit gives you beats per minute but it doesn't only tell you every minute, it is constantly updating that number. I just want to be able to detect the time at which it changes which is why I dont want to only get an average beats per minute of say a 5 minute period. I want to see it changing. Not entirely sure how they do that or if it's smoothed out in post processing. But does that make sense? I am still learning about all this stuff so I might not be articulating well.

Also direct contact with salt water isn't intended but is a potential risk associated with flooding that may or may not occur from a storm surge. So the receiver needs to be able to store the data such that I can recover it and could be put higher up to minimize risk of direct contact with water. The eggs could have the potential to float away which is why I like the idea of not storing the data in them. Hence they are disposable, but ideally only in worse case scenario.

elyssa
 
Posts: 11
Joined: Fri Apr 14, 2017 3:50 pm

Re: Electret Microphone

by HowardP on Wed Apr 19, 2017 2:25 pm

more ideas ...

it seems like all you really need is a wireless microphone, without all the overhead of digital conversions for transmission. The egg listens, the hub records. In other words, you could do this old school using old-style radios - a pair to transmit and receive the audio directly.

This opens the door to many possibilities. Adafruit has several radio options available. Look also at "transceivers" which do both transmit and receive in one device. Even that might be more machinery than you need ! This could be done very simply.

It would be smart to befriend a HAM radio person. Radio amateur clubs and groups are everywhere. (Start here: http://www.arrl.org) You might be surprised to find some HAMs nearby, even if you live in a remote part of Alaska. Rural and remote locations have more need for communication - HAMs often fill that gap.

You can do the radio approach without a license, but a HAM could assist with technical details. (And I bet they'd be enthusiastic about your idea!)

On this track, here's some things to consider and research:

Wireless microphones are commonly used in sound production on stage or in a studio, or for public speaking, etc. Off-the-shelf versions would probably cost too much ... unless you can find some from Chinese vendors or on Ebay (but buyer beware).

However, you could DYI them inexpensively.

And egg would need only a microphone, battery, and transmitter. The battery would be the largest and, perhaps, most expensive object. A simple, small AM transmitter can be made from just a few components, costing only a few dollars. There are also cheap mics of various kinds ... I found one for <$6 online. It might also be possible to use a piezoelectric microphone, which might be more sensitive - you'd have to experiment. A piezo-mic would have to be glued to the inside of the egg wall. The wall itself then becomes the microphone's diaphragm. (Using an electret mic, also a good option, you'd probably still need to hot-melt glue or epoxy it to the egg wall for proper pick up.)

I'd put the battery on the bottom and mic on top, so the weight of the battery keeps the egg properly oriented. The transmitter, which could be as small as a US Quarter, could go in the middle. It would not need an external antenna if the nests are relatively close - ideally all in line of sight. The antennas of these little transmitters are just a small coil of wire. It could fit in the egg. Range out in the open is easily a few hundred feet. If there are rocks in the way, or the distances are further, you might need several smaller hubs closer in. (This approach is so inexpensive that the cost of the hub boxes and batteries would likely be the bigger factors.)

Each transmitter could be set to its own frequency by merely turning a "trim pot." Before sealing up in the egg, double check it with a listening receiver, tuned to the selected frequency.

The hardest part of this approach is the data-logging hub. You could "multiplex" all the various eggs into one high-speed data logger. But it might be easier, more straight forward, just to have the same number of individual small receivers as egg transmitters - each with their own SD card, putting all the receivers together in one hub box. The receivers and cards would be powered from one common source. The hub would need a bigger battery, and perhaps, ideally have a solar panel to recharge the battery. ( I have no idea how much sun light you'd get up there during the incubation period. Solar panels need a good amount of sun for some hours to convert the light to electricity effectively.) BTW, the SD cards would hold the audio in a directly playable format, e.g. a .wav or .ogg file. I'm uncertain if there are small devices that could take the audio (as audio) from the receiver then record straight (audio) to an SD card. However, there are many options that will convert the audio (Analog to Digital) into .wav or .ogg files. These are cheap too and would merely need some space and power in the hub box(es).

So the path is:
Mic->transmitter ---> >--- receiver -> [optionally] A/D conversion -> SD card
for each egg.


The other thing that would have to be determined empirically, experimentally is transmitter power consumption versus battery life. Transmitters tend to be power hungry, but line-of-sight can reduce the requirements. Also these old-school, direct audio transmitters would use less power than the previously considered approach, which needed the added step of A/D conversion in the egg, which, in turn, uses more processing power juice. You'd have to set up a couple of these and just let them transmit and see. Fifteen days in one go might be a lot ... off the top of my head, it seems borderline. Worse case, you'd have to have the battery separately stashed close to the nest with a small power cable snuck in.

You can estimate these consumption specs, if you can figure out how much power the transmitter uses. That's one of the things a HAM can help with.

How close to the rookery is the nearest inhabited area?

HowardP
 
Posts: 83
Joined: Fri Apr 03, 2015 6:42 pm

Re: Electret Microphone

by HowardP on Wed Apr 19, 2017 2:46 pm

another thought ...

the hub could have directional antennas, pointed at the egg, or in the direction of the nests. Directional antennas gather more signal, increasing the range. My antenna theory is weak, but I'm thinking that to be able to use directional antennas, the radios might have to be FM (instead of AM). Still pretty inexpensive.

Your OP mentioned UHF ... directional antennas in that band are not very large (1 to 3ft long and skinny?) and work in both AM and FM. So you might end up with a "base station" hub with a small pole (6 to 8 ft tall) driven into the ground or on a stand. It holds the directional antennas, pointed as needed.

This is also HAM territory :))

HowardP
 
Posts: 83
Joined: Fri Apr 03, 2015 6:42 pm

Re: Electret Microphone

by HowardP on Thu Apr 20, 2017 3:56 pm

Here's an example of a cheap mic w/ a microcontroller interface ... also does direct audio:
http://www.ebay.com/sch/items/?_nkw=arduino+microphone+sensor
Adafruit's got these, some of which would work too:
https://www.adafruit.com/categories?q=microphone

HowardP
 
Posts: 83
Joined: Fri Apr 03, 2015 6:42 pm

Re: Electret Microphone

by elyssa on Thu Apr 20, 2017 4:12 pm

Hi Howard,
I actually just purchased some things to test out during my prototyping phase. I ended up getting an Adafruit Feather MO Adalogger and a Lithium Ion batter to power it. I plan to try out some of Adafruit's electret mics and 12S MEMS mics. I also want to try a Raspberry PI zero board and see which is best, but it doesn't have analog inputs so I'll have to use an ADC. Now I'm just trying to learn how to code everything so I can give it a whorl. I think for the first phase of this project I am going to focus on validating the sampling method before I make tons of modifications to get my egg just right. With that said I am going to log data just to an SD card attached the board and worry about transmitting data latter. I also know with this approach I won't have enough battery power to last as long as I want, but it will be good enough for validation I think. I believe to really achieve what I want I will have to use external power to the egg. But baby steps. I appreciate your feedback!

elyssa
 
Posts: 11
Joined: Fri Apr 14, 2017 3:50 pm

Re: Electret Microphone

by HowardP on Thu Apr 20, 2017 5:04 pm

Hey, that's good to try out some stuff. I'd still stress the direct audio via radio - wish I'd realized that way when I first replied - it really is so much simpler and you'd have to code far less. :)) The Raspberry Pis are amazing little gadets; and the Feather products are nice to work with. I'm experimenting with a Pi Zero W and a Feather Huzzah ESP8266for an "Internet of Things" course I'm working on. The "0W" costs only $10 and has built in WiFi. THE Huzzah has WiFi too ... it's pretty simple to get them to talk to each other. You could certainly use an R.Pi for the brain of your data-logging hub.

Keep us posted - and feel free to ask me any questions you might have as you progress...

-H

HowardP
 
Posts: 83
Joined: Fri Apr 03, 2015 6:42 pm

Please be positive and constructive with your questions and comments.