We continue on from last month with a different design principle, explore MEMS microphones, and experiment with inductors - by Daniel Koch
After putting in so much research before beginning last month's heterodyne ultrasonic listener, and performing so much experimentation, we had to push some of the project to this month. Partly, this was because of the size of the article was growing to: It would have been beyond anybody's attention span. The other reason was, of course, that we had no time left before publication to keep going! However, we have continued since then, starting with the frequency divider circuit.
FREQUENCY DIVIDER
We deliberately chose the harder option first in building the heterodyne ultrasonic microphone. However, in the end, the frequency divider design was not much easier! It still has an analog amplifier on the front end, so there was a lot of fiddling, tweaking, and mystery-solving going on. The first thing we needed to do was create an amplifier circuit to increase the signal level from the transducer, and make it big enough to drive the input of the binary counter.
There are quite a few designs out there that use the frequency divider concept. Many use one or two LM386 amplifier ICs as the input stages to the frequency divider. Some of them seem to work well, too, but we had some reasons to avoid this. One was to present something different. The other reason is that this amplifier is designed to take an audio signal from, say, a microphone, and boost it to headphones- or small speaker-capable levels. We suspected the signal from our sensors would, at times, be too weak to use the LM386 as designed and needed a pre-amplifier stage.
The binary counter is the heart of any frequency divider listener. The basic idea is that each wave cycle of the incoming signal will advance the counter, and the outputs can therefore be used to reduce the frequency of the incoming signal. The original plan looked something like the diagram here. Note that we have inserted buffers in places. This is because early experiments and some experience with the heterodyne version told us that some circuit blocks were loading or otherwise altering the behaviour of other blocks. In addition, the buffers also provide more current with no change in voltage, and that property is beneficial in certain situations.
As experimentation proceeded, however, things changed a lot. In the end, we traced quite a few of our issues back to an oscilloscope probe that was loading the circuit too much and causing problems. Switching to the 10x setting did alleviate some of the problems but never eliminated them. Had that realisation come earlier, we probably would have saved ourselves five full days of headache and frustration as designs did not do what they theoretically should have, and a bit more along the way. Many of the other challenges we had are also attributed to the fact that solderless breadboards are noisy, and full of both capacitive and inductive leakage. Finally, some well-used and probably internally worn potentiometers caused some spurious readings and intermittent faults, too. Unfortunately, that all means that over a week's worth of time was wasted, and only resulted in this paragraph as a contribution to the article!
In the end, however, we came up with a functional design. The first major change is the location of the high-pass filter, which now sits before the first buffer. The buffer feeds two amplifiers in series, which in turn feed a comparator rather than a buffer. This gives a square wave output (it doesn't, but read on for details) to the next stage, the binary counter. The frequency signal becomes the clock signal, and will be divided over the counter's outputs by whatever divisor they are listed as. One of these signals is fed to an audio power amplifier, which is used to drive headphones. The output of the counter IC alone is nowhere near strong enough to drive them.
THE FILTER
This item is necessary to avoid loading up the circuit with sounds that we normally would be able to hear, but we have set ours at roughly 16kHz. As noted last month, normal human hearing is usually quoted as 20Hz to 20kHz, but in reality, many of us actually cannot hear above the range of 17kHz or so in our twenties, and it gets worse as we get older. These sounds can become audible with this circuit and the right sensor, using a filter value as selected here. This block, formed by a capacitor in series with the signal and a resistor to ground, is now between the transducer and the first op amp block, the buffer, whereas the original design had it between two preamplifiers.
This one is a high-pass filter, meaning that it passes frequencies higher than the cut-off through to the following circuits, and shunts those lower to ground. There are many theoretical values of components that would work and a huge science in designing them but the important point here is that too small a capacitor, and it becomes charged before the waveform is complete, causing flat DC spots on the AC waveform. There are problems with going too large, too. We selected ours using the calculator described below, and some trial and error with an oscilloscope, a frequency generator, and a dummy load. Once we observed the behaviour we wanted, we kept those values.
In the Reading and Resources section, we have included a link to a calculator for high-pass filters, which also has some information on them. It's a third-party that we found and are not affiliated with, but we think it's a great resource.
THE BUFFER
The buffer and the next three stages are all built around an LM324 quad op amp IC, the pinout of which is shown above but relates to the next three stages as well. Pin numbers are noted on the schematics. The buffer is a unity gain configuration, formed by op amp IC1a. It is fed by the high-pass filter, but with a 100nF capacitor in between. This isolates the 300kΩ resistor involved in the high-pass filter from the voltage divider resistors on the op amp input, as well as making sure the sensor cannot alter the behaviour of the preamplifier input by draining some of the current from the 1MΩ resistors used to set the false ground. Without this buffer, the components of the high-pass filter cause problems: The resistor ends up in parallel with the voltage divider resistor, and the capacitor did not want to behave during testing, either.
On the oscilloscope, we observed the waveform die away as soon as the filter was connected to the amplifier. Many designs do connect a filter straight to the input, but these are usually in dual-rail designs where there are no voltage dividers needed on the inputs. In our earlier designs, we had the filter between the first and second preamplifiers, but the filter had the problems noted here and was not working well. The other advantage of the buffer is that we can make as many changes as we like on its input side, with no effect on the amplifier.
THE FIRST AMPLIFIER
The first amplifier is fed from the output of the buffer by, again, a 100nF capacitor. This serves to block any DC, including DC bias even though the waveform may have no flat spots. It is formed around IC1b. The 1MΩ resistors R5 and R6 form the voltage divider to give the false ground via the non-inverting input. The voltage at the capacitor can then be higher or lower than this point. The gain is set by the feedback voltage divider connected to the inverting input. The gain for a non-inverting amplifier is 1+(RF ÷ Rv). In this case, RF (F for feedback) is R8 and RIn is R7. Therefore, 1+(470 000 ÷ 10 000) = 48. C4 decouples the voltage divider from ground so that it only responds to the AC signal, not any DC bias that transfers through the output from R5 and R6.
THE SECOND AMPLIFIER
The second amplifier is variable. Once again, there is an AC-coupling capacitor of 100nF, and the false-ground resistors R9 and R10, both 1MΩ. Instead of fixed feedback resistors, however, there is a 100kΩ potentiometer R12, with 470Ω resistors R11 and R13 on either end so that the value is never 0Ω even when the potentiometer is at the end of its travel. This time around, the maximum gain is 1 + (100470 ÷ 470) = 214.7660 and the minimum is 1.0047. Again, the 3.3nF capacitor, this time C7, is there to decouple the feedback voltage divider from the DC bias that is inherent because of the effect of R9 and R10 on the input transferring to the output.
THE COMPARATOR
The output of the second amplifier is fed directly to the input of the comparator. There is no decoupling capacitor needed here because the high-impedance input of the op amp does not load or affect the feedback network of the previous stage, and there are no alternative current paths. In addition, because this block is designed to have a DC output, either on or off, the presence of DC is no longer problematic.
The only external component around IC1d is the 100kΩ potentiometer R14. This sets the threshold at which the comparator changes state and can be varied to change the sensitivity. We have not built in any hysteresis here, because the input waveform should be stable and regular. There is strong emphasis on 'should'.
Pin |
Output |
Divides By |
Divides 30kHz into: (Hz) |
Divides 56kHz into: (Hz) |
Divides 80kHz into: (Hz) |
Divides 92kHz into: (Hz) |
9 |
1 |
2 |
15000 |
28000 |
40000 |
46000 |
7 |
2 |
4 |
7500 |
14000 |
20000 |
23000 |
6 |
3 |
8 |
3750 |
7000 |
10000 |
11500 |
5 |
4 |
16 |
1875 |
3500 |
5000 |
5750 |
3 |
5 |
32 |
937.5 |
1750 |
2500 |
2875 |
2 |
6 |
64 |
468.75 |
875 |
1250 |
1437.5 |
4 |
7 |
128 |
234.375 |
437.5 |
625 |
718.75 |
13 |
8 |
256 |
117.1875 |
218.75 |
312.5 |
359.375 |
12 |
9 |
512 |
58.59375 |
109.375 |
156.25 |
179.6875 |
14 |
10 |
1024 |
29.296875 |
54.6875 |
78.125 |
89.84375 |
15 |
11 |
2048 |
14.6484375 |
27.34375 |
39.0625 |
44.921875 |
1 |
12 |
4096 |
7.32421875 |
13.671875 |
19.53125 |
22.4609375 |
THE 4040
The 4040 is a binary counter with twelve output stages. We have used binary counters before, including sometimes at the heart of a project, like the soldering iron alarm. The 4000 series ICs are all CMOS logic devices, which offers some advantages for us. The first is a wide operating voltage, with most devices operating from 3V to 15V. The second is very crisp, clean, fast switching behaviour. In addition, they do tend to be quite rugged. Sometimes they are written as 'CD40XX' but this is an original manufacturer prefix and other manufacturers use their own. For example, Nexperia uses 'HEF' and OnSemi uses 'MC1' which makes the device number look like it's 14040.
A binary counter has a clock input, and several outputs. Each output divides the one before it by two. In other words, the first stage turns on and off once for every two clock input on/off cycles. The second stage turns on and off once for every two cycles of the first stage, meaning it actually divides the clock input by four: Four clock inputs are needed for one output from the second stage. That means the divisor doubles for each stage.
Note that the action happens on the negative edge of the pulse, which means when the signal is falling from high to low. The effect of this is that we can divide a frequency by several powers of 2. The table shows the output stage, the number of times it divides the input clock signal, the pin number for each output, and the output frequencies for each stage for given input frequencies.
Note that only some of those, any between around 100Hz to around 5kHz, are useful to us. Anything higher, even if audible, is too piercing.
The pinouts are not sequential. Note that there is a 10kΩ grounding resistor, R15, on the clock input to stop floating between input pulses. This should not be necessary as CMOS ICs should have a fair amount of hysteresis and noise immunity on the inputs but we had some issues that we later attributed to breadboards being breadboards, and included it anyway. The outputs of use are taken to the pins of a rotary switch, so that the desired divisor can be selected.
THE LM386
The output of the rotary switch is fed to one end of a 5kΩ logarithmic potentiometer R16, the other end of which connects to ground. This gives a variable voltage divider, forming a volume control, as the wiper is connected via a 10µF decoupling capacitor C10 to the non-inverting input of the LM386 audio amplifier IC. The inverting input is grounded, as we do not need it. The gain pins remain unconnected, resulting in a fixed gain of 20. If you wish, we detailed last month how the gain can be altered with LM386 circuits. The output is connected through a 100µF capacitor to the headphones socket.
PUTTING IT ALL TOGETHER
The diagrams in the previous sections all came from this master schematic. You can see how the parts fit together, but there are some extra components, too. Resistor R1 is an optional 10kΩ resistor for using electret microphones. If using a passive sensor, it is not needed. Capacitors C5 and C8 are power rail filter capacitors and should be as close to the voltage supply and ground pins of IC1 as practical. With a breadboard, this may not be very practical at all. C9 and C12 are counterparts, but for the LM386.
The sensor depicted is no particular type: We used the same ultrasonic sensor as last month, desoldered from a Jaycar XC4442 ultrasonic proximity sensor meant for Arduino. Be careful to desolder the receiver, and not the transmitter, as the units look identical and getting it wrong will produce plenty of frustration and confusion.
We initially prototyped the circuit in blocks, testing one at a time with no connection between them. This process went on as each development informed the stages that had previously been built. For example, when it was discovered that the resistor in the filter was causing problems in its original location between the last amplifier and the buffer, by loading the feedback loop of the amplifier, it had to move. That necessitated a change to the first buffer, which at that point we thought had been completed.
After much to-ing and fro-ing we arrived at the prototype as pictured here. It's shoved on a breadboard, with all the evidence of experimentation spread around it. It works, and reasonably well, but it cannot stay like this. Initial testing of the individual blocks was done with a function generator directly feeding the input of that stage, set at 40 kHz, and an appropriate voltage to reflect what input that stage could expect. When the development was at the point pictured, where we stopped, testing was conducted by using an ultrasonic receiver, with the transmitter (the other half of the proximity sensor, in fact) connected to the function generator and set to 50mV so the signal was weak, as we expect in-field use to be quiet as well. Notice before that we did not say development was complete, just that we stopped here. Development of this circuit could go on for ages!
Following testing with the 40kHz transducers, which are quite narrow in bandwidth, we swapped back to the function generator, connected it to the filter input and set it to 50mV peak to peak, and swept it from 50Hz to 150kHz. During the individual testing, we were mainly observing with an oscilloscope. At times, after realising the loading issue we described above, we had to use another capacitor on the end of the probe to avoid loading the circuit with the low-impedance probe.
Every movement of a wire, component, the table, or even the air in the next room affects what happens on the breadboard, but we got useful testing done nonetheless. As a crazy aside, we had the wire between the binary
counter/frequency divider output and the input of the potentiometer before the LM386 disconnected from the frequency divider end, sticking up out of the board where it meets the potentiometer.
This was an absent-minded error, and we were playing with the volume potentiometer to see which end of its travel it was at (never put headphones on until you know the volume is turned down!) when all of a sudden, we heard music softly emanating from the headphones. Donning them, we heard the distinct sound of our local radio station's advertisement.
Thinking that maybe the transducer was sensitive to audio frequencies when it is not supposed to be, we listened to the room thinking one of the neighbours had a radio going and the transducer was picking up faint sound through the walls. It was then we spotted the disconnected wire. This only occurred with the potentiometer at the very end of its travel, when the wiper was connected to the breadboard and wire with no part of the resistance taper involved. Listening again, we realised that we could hear all three local radio stations, with two more faint than the first one we noticed.
Some part of this circuit is acting as a radio receiver and decoder, but it is untuned. We have not yet investigated this, but found it fascinating. We could not replicate it on the solder version, suggesting the capacitance and inductance of the breadboard may be playing a part.
The Build: Putting it on a board
Parts Required: | ID | Jaycar | ||
---|---|---|---|---|
2 x Solder Breadboards | - | HP9570 | ||
Packet of Wire Links | - | PB8850 | ||
2 x 470Ω Resistors | R11, R13 | RR0564 | ||
3 x 10kΩ Resistors | R1, R7, R15 | RR0596 | ||
1 x 300kΩ Resistor | R2 | RR0631 | ||
1 x 470kΩ Resistor | R8 | RR0636 | ||
6 x 1MΩ Resistors | R3, R4, R5, R6, R9, R10 | RR0644 | ||
1 x 5kΩ Potentiometer | R16 | RP7508 | ||
2 x 100kΩ 25-Turn Trimpots | R12, R14 | RT4656 | ||
3 x 3.3nF Capacitors | C1, C4, C7 | RM7033 | ||
3 x 100nF Capacitors | C2, C3, C6 | RM7125 | ||
1 x 220nF Capacitor | C12 | RM7145 | ||
1 x 470nF Capacitor | C8 | RM7165 | ||
1 x 10µF Electrolytic Capacitor | C10 | RE6066 | ||
1 x 100µF Electrolytic Capacitor | C11 | RE6130 | ||
1 x 220µF Electrolytic Capacitor | C5 | RE6158 | ||
1 x 330µF Electrolytic Capacitor | C9 | RE6188 | ||
1 x LM324 Quad Op Amp IC | IC1 | ZL3324 | ||
1 x LM386 Aplifier IC | IC3 | ZL3386 | ||
1 x 4040 Binary Counter IC | IC2 | ZC4040 | ||
1 x Rotary Switch, 6-way | SW1 | SR1212 | ||
Sensor of Choice | See Text | XC4442 | ||
1 x Jumper | - | HM3240 | ||
2 x header Pins | - | HM3211 | ||
19 x PCB Pins | - | HP1250 | ||
1 x 9V Battery | - | SB2423 | ||
1 x 9V Battery Snap | - | PH9232 | ||
2 x Plastic Potentiometer Knobs | - | HK7770 | ||
1 x Headphones Socket | - | PS0134 | ||
1m Single-Core Shielded Audio Cable | - | WB1500 | ||
1m Four-Core Shielded Audio Cable | - | WB1510 |
As stated before, breadboards are not the best beyond that initial workbench testing. To move anywhere with this circuit for in-field testing, it needed to be on a soldered circuit board. Last month, we had trouble getting stock of the solder versions of the longer breadboards. When we did find some in stock, we discovered that the ones we could get had a line of holes missing across all rows, parallel to the rails. Seeing as we used all five holes of several rows, we could not go down this road and needed to separate the circuit into two halves to be built on two boards. That was ok, because there is a natural division between the circuits built around the quad op amp, and those around the other two ICs. Therefore, we set about doing just that.
This turned out to be fortuitous. We dislike having wire jumpers on soldered breadboards, and with the op amp circuit arrangement on the breadboard, we would have had to have one from the comparator to the input of the frequency divider. By building the circuit in two halves, we could compensate for this without rearranging the op amp circuits, which we stubbornly would have done had we been able to build on one solder breadboard. In the end, the results are as you see here, glued onto foam core board for field testing. We added a 9V battery, and swapped two of the potentiometers for 25-turn trimpots.
Shielded wire replaced jumpers for connection to the remaining potentiometer, the headphones socket, and the transducer. We learned our lesson last time! Rather than use plugs and sockets again, we opted to add PCB pins to solder the sensor wires. We also added a jumper to connect the 10kΩ resistor for electret microphone use.
If you're building one of these yourself, start with the low-profile components such as wire links and any horizontal resistors. Do this for both boards. We like to mark in the location of the ICs to help us place things.
STEP 1
Fit the remaining resistors, which are aligned vertically, and the IC sockets. You can also add PCB pins now, along with the header for connecting and disconnecting the 10kΩ resistor R1. Note in the photo that we forgot the 470kΩ resistor, which appears in the next step, and one of the PCB pins for the 5kΩ potentiometer is in the wrong spot. It should be in the lower black rail as it is in the final photo.
STEP 2
Add the capacitors next, but in two steps: The smaller MKTs first (you may be using ceramics or even greencaps) followed by the taller electrolytics.
STEP 3
Finally, add the trimpots and the off-board components. Be careful to keep the trimpots aligned the same way so that adjustment for an increase in resistance on both is either anticlockwise or clockwise from your perspective, but the same direction for each one.
We used shielded wire to connect the potentiometer, the headphones socket, and the sensor. Because the signal was less sensitive around the binary counter, we used ribbon cable to connect it to the rotary switch rather than try to find shielded six-core cable. All of these items connect to PCB pins.
STEP 4
We glued the boards to a piece of foam-core board for continued testing and development, but in the long term, they will go in an enclosure. You might like to do the same, because changes are likely. Glue the potentiometer on its back so the shaft faces straight up, and gently push the rotary switch until its pins bed into the foam before glueing this too, and the headphones socket.
The switch wiring is as follows, with switch terminal first, and pin on IC2 second: A terminal to 5kΩ potentiometer; Terminal 1 to pin 6 (divide by 8); terminal 2 to pin 5 (divide by 16); terminal 3 to pin 3 (divide by 32); terminal 4 to pin 2 (divide by 64); terminal 5 to pin 4 (divide by 128); and terminal 6 to pin 13 (divide by 512).
That's it! Add plastic potentiometer knobs to the pot and switch, and connect a battery before inserting a headphones cable into the socket. You're now ready for some testing.
FIELD TESTING AND MODIFICATION
Before going out into the night, we wanted some source of ultrasonic sound that was not a bat, or a 40kHz proximity sensor. We tried our ever-reliable Wimshurst machine, as the high-voltage leakage is supposed to make ultrasonic noise. How much noise is really the question. However, we immediately had problems with the comparator section. It had worked well on the bench but was not playing along on the final build. We bypassed it by adding another PCB pin, this time at pin 12 which is the direct link between the amplifier output at pin 8 and the input to the comparator. We do suspect that the comparator would work better with a more involved design, with hysteresis perhaps, but in the end, it was unnecessary. The circuit functioned well with the amplifier carefully adjusted and connected directly to the binary counter.
On that note, we adjusted by first connecting the ultrasonic transmitter to the function generator, and using the oscilloscope to monitor the signal at each stage along, from the transducer input, onwards. This really helped tune the second amplifier stage to where it needed to be. If you are building this circuit, we recommend direct connection from the amplifier to the binary counter, and make your trimpot adjustments until sound is heard.
With the circuit in this state, we took it over to the Wimshurst machine. Sure enough, there are sharp ticks of noise as the corona discharge occurs radiating from the point source. Because there are no long pulses from this machine, there are no audio tones per se, just the short, sharp ticks. What we really need are some bats! We wandered around the office but found little in the way of ultrasonic sources to test it with. However, we did get an interesting sound from a tap that was spraying a tiny amount of water from a split washer, and more from the high-voltage terminals of an ignition coil. These sources suggest the unit does in fact work. However, the sensor needs to have a broader bandwidth. It is still the weak point of the system.
Outside, we were disappointed by the weather - there were no bats anywhere, nor much other nocturnal life. The conditions were simply not right for many to be out foraging for food. However, random noises of different frequencies were sometimes heard, and we saw at least one bat against the cloudy sky, catching three echolocation pulses from it. They definitely sounded longer than the Wimshurst corona discharge ticks, and made audible tones. It didn't hang around long enough for us to really test the different frequency division settings.
INDUCTOR EXPERIMENTS
Some online sources suggest using an inductor to broaden the bandwidth of an electret microphone or piezo sensor. This makes sense in a way, as genuine electret sensors are capacitive, and dampening the resonance means a broader response range at the expense of peak sensitivity. Common values used are between five and ten millihenries, with 6.8mH being the most commonly encountered. There were two major problems. The first is that our electret microphones, like most on the domestic market, are not electret sensors but whole circuits, consisting of the electret element and a FET amplifier and current stage all inside the housing. We're not sure of the insides of the ultrasonic transducer, either. It gives readings on an LCR meter but does not seem to behave purely as a capacitor.
The other major problem is that millihenries are quite large. Microhenries are more common. We checked retail suppliers but no one had any bigger than 1mH. Most were in the microhenry (µH) range. We ordered some from Element14 but the wait time was going to be two weeks, as they were overseas stock. That left making our own. There are a variety of calculators online and we found a couple that would do what we wanted them to. A great many inductor calculators are for air-cored inductors, and there was no practical way to make an air-cored inductor of the inductance we needed.
We have little experience with ferrite, and decided to give it a go. We bought some toroids from an over-the-counter retailer, and measured them so we could calculate the number of turns needed. We calculated that we needed 120 turns of 0.25mm wire for the toroid of the size we had. That didn't sound so bad! We were wrong. It was painful. The wire was quite long when cut to the length required for 120 turns, and it has to be threaded through the toroid and passed through its entire length to wind the coil turn by turn. We realised later we could have started in the middle of the length and wound out each way, but it was still a terrible experience. However, after nearly an hour and a half of winding, we were ready.
We hooked it onto the LCR meter, and waited excitedly for the analysis time to pass. It was only five seconds but it felt like many more. It took about as long to process the number that we saw, too. 27µH. Surely something was up? We re-sanded the ends of the wire, checked the connections, looked for breaks, and tried again with the same result. It was a pretty crushing feeling. We turned to the internet and soon discovered that not all ferrite is created equal. In fact, it is very, very unequal. The property we're interested in is the magnetic permeability. This is the way the magnetic flux interacts with, and is shaped by, the ferrite.
There are many different ferrite materials and the type we had was a powdered iron variety with relatively low permeability. The calculator had a default value right at the other end of the scale. This is classic palm-to-forehead, 'how could we not think of that' moment stuff, but when you work with something so rarely that you never learn much about it and don't retain what you do learn, this kind of challenge results. Recalculating after finding the correct permeability value for our toroids, and we discovered that we needed close to eight hundred turns. Not only would it not fit, but we would not be sane nor have skin on our fingers at the end of it.
Instead, we turned to ferrite rods. We could wind a great many turns on these. We put one in a drill and decided to just wind on as much wire as we could off a spare roll of 0.5mm wire we had. It would give us a rough idea of what was achievable. This was probably not a good plan, but we were frustrated by this point and just wanted a ballpark figure. We turned the rod around and wound on a whole roll of 0.25mm wire. Sanding the ends allowed us to connect an LCR meter, and we were pleasantly surprised to find a figure of 9.5mH for the 0.5mm wire, and 103mH for the 0.25mm wire! So, the play was valid, but not overly practical. Even using 100mm rods instead of the 180mm one we used, the thing would be very bulky. It was, however, ok for bench testing just to see if there was a measurable effect.
The challenge with this set of tests was that we needed to have a broad source of ultrasonic sound as well as the test receiver. What we really needed was two inductors the same, and two of the same piezo transducer for that test. For the electrets, it was altogether harder. While we could see what effect the inductor had on the microphone (which we doubted would be much because of the FET stage keeping the electret element isolated from the inductor), we lacked a suitable transmitter. In the end, we just ran the piezo test.
While we were fiddling with wire and ferrite rods, we discovered several inductors in a miscellaneous parts box, that were all 1mH each. Some were radial wire-wound types like the 6.8mH ones we had ordered from the trade supplier, and some were the small RF chokes that look like resistors. We strung ten of these in series which, while clunky, at least gave us another 10mH inductor to use with the 9.5mH one we made ourselves.
The RF ferrite inductors are the ones we really wanted, and we had ordered some through Element14, but they were coming from overseas. These are quite small, just like the 1mH ones we put in series. They are altogether more practical. The reasons they are so small when ours are so large are the different ferrite material used (which we could not get) and the tiny, machine-wound wire windings used. We just cannot make anything like that in the workshop.
The first test was to hook up two identical piezo elements, stuck to the workbench with Blu Tack to face each other. This also provides vibration damping between the element and the bench. The inductors are wired across in parallel, and the function generator hooked up to one. The oscilloscope was hooked up to the other, and this time we made sure the probe was set to 10x so we had the maximum input impedance we had available.
We set the function generator for 5V peak to peak, and to sweep between 500Hz and 15kHz. Previously, the piezo had a very narrow response of 3.8kHz, though its nominal centre is 4kHz. The first thing we noticed was no audible difference in the apparent sound from the transmitter piezo. The oscilloscope also showed that there was no noticeable difference in resonance with the inductor connected, and without it. Although the addition of a 5mH to 10mH inductor is regularly encountered online when researching bat detectors with piezo sensors, and the theory of damping the resonance of the piezo to broaden its response at the expense of peak response is sound, we could not make it work. However, not all piezo elements, or any other sensor, are created equal, so there is room for future experimentation.
While we were conducting this testing, however, we did notice something interesting. We set up the function generator again for testing the ultrasonic transducers, but not before disconnecting the piezo transducers. The circuit was still powered up, and we heard sound from the headphones! Although the piezo was far below its peak, it was emitting enough noise at 40kHz to be picked up by the ultrasonic receiver. We had no idea how well it would perform at, say, 60kHz or higher, but it was encouraging.
DIFFERENT ELECTRETS
During development of this circuit, an order from Element14 turned up with a new electret microphone and the MEMS units we had ordered. The electret in question has a stated frequency response of 20Hz to 20kHz but the graph of the frequency response does not show a significant drop-off after 20kHz. Many are trending downward by this point, while this one is only dipping slightly. This gave us some encouragement that it may pick up sounds much higher than 20kHz. It is a Kingstate KECG2740PBJ. Because we included the 10kΩ resistor, all we need to do to get this working with the circuit is add the header and solder this to the end of the wire in place of the transducer.
There are many other electrets on the market, including some that are dedicated ultrasonic units. The ultrasonic ones tend to be very expensive, but there are still some which cross over comfortably into the ultrasonic range even though the datasheets do not say they do. Remember, the ultrasonic range is specialised and few manufacturers intend their products to be used here even if they do work, so the datasheets pitch to the intended use. We found FEL Communications in the UK have a useful range, but shipping times stopped us getting any for either part 1 or this part of the project. Their website is worth checking out, in the 'Reading and Resources' section.
So, did it work? Again, it's hard to tell but there was definitely more activity using it outside at night when compared to the transducer we liberated from the proximity sensor. Some of this was from the upper range of the normal audio spectrum, we believe, based on the division selected on the dial and an estimation of the frequencies heard in the headphones. However, that on its own is useful and was one of the original goals of the project. In this case, whether it can hear bats or ultrasonic sounds or not is unknown, but it is still a success against some of the criteria.
MEMS EXPERIMENTS
To recap, a MEMS unit is a Miniature Electro-Mechanical System and covers any of the micro-scale devices like microphones, speakers, and buzzers which feature both electrical and mechanical (movement) properties used in modern electronic devices like phones and tablets. They are very sensitive and very low on power demand, but it is the former property that makes them interesting to us. Not all MEMS units are useful, however. Many have digital outputs, either as I2C, SPI, or even raw bit-banging. These are not useful to us, but the ones with analog outputs certainly are. We bought two from Element14, the IMP23ABSUTR from STMicroelectronics and the IM73A135V01XTSA1 from Infineon.
The MEMS units were where we expected most of our success to come from. These are often praised as having great frequency ranges, well in excess of those quoted in the datasheets. As with the electrets, this is usually because the data is not measured beyond 20kHz seeing as that's where the intended use stops. However, MEMS units are more likely to respond to ultrasonic frequencies because of their tiny scale. The movement in the diaphragm of a 10mm diameter electret, for example, is very small in the ultrasonic range compared to the audio range and so may not be picked up. In a MEMS unit, the movement range is tiny anyway, leaving it more open to picking up higher frequencies.
Wiring a MEMS unit into the circuit is not as simple as the other circuits: They have a power supply as well as a data line. The STMicroelectronics one has a supply voltage of 1.5V to 3.6V and a current draw of 150µA. While the Infineon one has a 2.3V to 3V supply and a supply and a current draw of 170µA when operating. The Infineon one has a differential output, while the STMicroelectroncis one has a single-sided output. Both are tiny, and the sensitive area is on the same side as the solder pads.
We chose to go with the STMicroelectronics one first, and set about giving it a 3.3V supply. This we achieved with a Zener diode, because they're perfect for such low-power applications. With far less than 1mA needed, we chose 1mA as the current requirement for our Zener circuit, and calculated the values. 'Air Wiring' was used, because there was so little going on, and the whole lot was glued onto a base to hold it. Then, it was just a matter of wiring the power supply pins to the power supply pins on the board, and the signal line to the input of the op amp. With such low power, we decided to skip the filter components and go straight for the buffer.
Performance with the MEMS was the most impressive so far. The frequency divider dropped most of the normal audio frequencies far enough that they could not be heard through the headphones, so the lack of filter was not critical. It would be nice to have, as sometimes very low sounds around the 50Hz to 100Hz mark came through. However, we could hear the most detail out of any of the sensors from the Wimshurst machine using the MEMS sensor, and outdoor use also gave the beginnings of a 'Night Chorus'. It's just a pity the bat life was almost non-existent during this time, as we are convinced we would have heard them well with this sensor. This is the configuration we will probably keep the unit in.
TO LED, NOR NOT TO LED
One of the options we explored while building this circuit was to add an LED to one of the outputs of the 4040 to gain a visual representation of the signals being processed. However, it induced a lot of noise in the circuit that was audible through the headphones. Even when limiting the current to 5mA and using all of the filter capacitors which are across the power supply in the final circuit, this did not go away. We also explored taking the output of the first buffer to an LED, and using a dedicated buffer, but both elicited noise. In addition, the flash of light was so fast that we needed to use an old circuit we had consisting of a phototransistor, NE555 in monostable, and an LED output, to serve as a pulse extender to even confirm that there had been a flash at all when used on the high-frequency input. In the end, while it would be a great feature, the benefit did not outweigh the problem-solving needed to achieve it.
OTHER POSSIBILITIES
While the heterodyne and frequency divider are two maker-accessible methods of hearing ultrasound, and were the only two around for a long time, more modern options are available to those more serious or with more money to invest. One of the best options is digital signal processing. This involves either a dedicated audio processor or an advanced microcontroller to sample sound and reduce its frequency. These systems can sometimes be made to process signals by varying amounts, too, rather than simply scaling them by a fixed amount. For example, you can set it to scale 20kHz down by a factor of 20, but 100kHz by a factor of 40. This idea tends to be the preserve of very expensive dedicated equipment, or for makers already well familiar with digital signal processing. Some microcontroller-based ultrasonic listeners that use an Arduino are available online as projects, but generally, they are not true DSPs. Generally, they are just frequency dividers using an
Arduino instead of a fixed IC like the 4040. The DSP option still relies on a good ultrasonic microphone, as the other designs do, and this is also expensive.
The other main method of listening to ultrasound is through recording and scaled playback. A microphone that can hear the range in question, and a recorder that can also work in the ultrasonic range, are needed. After that, however, the recording is downloaded onto a computer and software used to slow the recording, just like slowing the playback rate of a video.
At this stretched playback, the sound enters the audible range. This method has no in-field live listening capability, but researchers find this technique useful alongside live options because it allows later study of the details and in particular, measurement of the exact frequency and therefore the identification of bat species or even the specific behaviour, like the difference between echolocating prey and communication between bats.
WHERE TO NEXT
Some designs of frequency divider used two LM386s in series as gain stages, rather than the op-amp options we used. This is popular with people who are less confident with electronics in general or maybe just amplifiers in particular because the LM386 needs a minimum of external components and gain is very easy to control. In light of some of the op amp challenges we had, it feels like it is worth a try. In the same way, the Arduino frequency divider would be interesting to explore for its own sake, too.
Last month, we mentioned an enclosure. That still has not happened because this is very much still a work in progress. However, a basic 3D-printed enclosure is on the horizon, because further wholesale changes to the circuit are unlikely. The boards will be easy to remove so that minor changes can take place, and it will feature a plug and socket arrangement for sensor swapping. We will also add mounting points for more potentiometers, LEDs, and such as we add or remove features.
The last thing we would really like is a dedicated ultrasonic microphone, like some of the ones listed on FEL Communications' website or a complete one with housing like a regular microphone, but these are even more expensive and hard to find!