Forum Rule: Always post complete source code & details to reproduce any issue!
Page 19 of 19 FirstFirst ... 9 17 18 19
Results 451 to 463 of 463

Thread: Bat detector

  1. #451
    Junior Member
    Join Date
    Jun 2019
    Location
    Öckerö, Sweden
    Posts
    7
    Quote Originally Posted by CorBee View Post
    Hi,

    The amplitude will be depending on the distance from the key-ring to your detector, the loudness of your ring (intensity), the gain for the one-transistor amplifier (which design ?) and the mic_gain setting of the teensy_batdetector .

    One thing you can try to get a bit better understanding of the sensitivity is listening to for instance a constant high frequent signal coming from many devices with clocks inside. I have for instance an audio-player that emits this signal and I can pick it up about a meter away or so ... depending on the gain I use. Or a programmable timer (to switch appliances) will also. When you have a good and reliable source you can start recording/testing your device settings against that.

    Cor

    EDIT: this is my current 1-transistor amplifier (BC547=BC550c)
    Attachment 17298
    I use almost the same
    Click image for larger version. 

Name:	Mic amp.PNG 
Views:	5 
Size:	22.8 KB 
ID:	17299
    /bengt

  2. #452
    Senior Member CorBee's Avatar
    Join Date
    Jun 2018
    Location
    Netherlands
    Posts
    232
    Quote Originally Posted by benlenkar View Post
    I use almost the same
    Click image for larger version. 

Name:	Mic amp.PNG 
Views:	5 
Size:	22.8 KB 
ID:	17299
    /bengt
    I think Edwin has removed C2 from his design later on. But the simulation with LT-spice does show this is probably not going to change the amplification

  3. #453
    Member
    Join Date
    Nov 2018
    Location
    Netherlands
    Posts
    77
    Quote Originally Posted by CorBee View Post
    I think Edwin has removed C2 from his design later on. But the simulation with LT-spice does show this is probably not going to change the amplification
    Yes I removed C2, it was supposed to "short" RF signals to ground.
    Working with the opamp amplifier it just seemed to pick up display update noise so I chose not to place it.

    Also C1 can be changed, If you want to attenuate lower frequency sounds you can lower the value of C1. I guess you should not bring it below 220pF
    I do like 220pF myself but you can notice a bit less gain on 20Khz which is not a big problem because the microphones alleady have stronger signals on lower frequencies.

    For the microphone, if you have it inside the box, create a seal between the microphone and the box.
    Do not use it inside the box just behind a small hole.


    I use a cone that I can screw into the box. The cone is because it seems like the microphone behind a "long" audio channel does not work best. The cone also provide some amplification.



    I added a picture.

    On the left the construction I use,
    the second is a microphone behind a hole in the box. I do not recommend that.
    The third is a microhone in the box but with a seal, If you can construct that it, it is fine. (do not use a thick seal)
    The fourth picture is what I would suggest of the box wall is quite thick
    picture number five is just keeping the microphone outside the box.


    Click image for larger version. 

Name:	micoptions.png 
Views:	0 
Size:	69.5 KB 
ID:	17314

    I do not have any commercial detector so I can not compare.
    I was on a bat excursion two days ago, at some moments it seemed my own build picked up earlier, at other times the 300 euro commercial device picked up better.
    We were a few meters apart so maybe that also made some difference.

    Edwin

  4. #454
    Member
    Join Date
    Nov 2018
    Location
    Netherlands
    Posts
    77
    Compiling again in windows.

    I just put all the files I used together in this zip file.

    The text below is also in the zip file..





    Compiling Teenst Batdetector in Arduino under windows.



    The code written by Cor Berrevoets was made in Linux and not using Arduino. I guess a lot of people are using Windows and Arduino to compile code.
    I am absolutely no code writer so there might be a better way to get things going. All I know this works for me.

    I used a slightly older version of Arduino IDE. https://www.arduino.cc/en/Main/OldSo...eases#previous
    we choose version 1.8.7 since 1.8.9 have me some problems earlier.

    To be able to use teensy in Arduino we should also install Teensyduino
    https://www.pjrc.com/teensy/td_144/
    Version 1.44 works fine with Arduino 1.8.7

    Maybe newer Arduino IDE can work but 1.8.7 plus Teensyduino 1.44 or 1.46 work for sure.

    We need to copy all the contents of this .zip file to “My Documents”\Arduino
    This means we have a folder Libraries and a folder containing the code which now is called teensybat097win.ino in a folder with the name teensybat097win.



    Important changes made to the code.

    The .ino file actually is the main.cpp by Cor Berrevoets with two small changes.
    Around line 206 we have #include <TimeLib.h> this file seems to give us problems in windows so I changed it to #include <TimeAltLib.h> (the TimeAltLib is in the libraries folder you copied to “My Documents”)
    The second change was adding this line #include <ff.h> to the libraries.

    Now the code should compile in Windows.
    Kind regards,
    Edwin

  5. #455
    Senior Member CorBee's Avatar
    Join Date
    Jun 2018
    Location
    Netherlands
    Posts
    232

    v0.98 minor update, bugfixes and some additional options

    Hi,

    I have uploaded the source an hex to Github. No major changes, some cosmetic improvements in the screens (settings).

    Added a option to change the libraries used during compilation, #define COMPILER xxxx. As I am working using PlatformIO in Visual Studio Code the default is PIO but it can be switched to ARDUINO for those compiling using the ARDUINO/TEENSY IDE.

    Routines added to monitor the voltage on VIN when a resistor-divider and capacitor is added between AGND-pin17(a3)-VIN.

    Also added a routine (currently getting tested) to control the TFT-backlight using PWM (pin3). This can be used directly on TFT modules that have a Q1 transistor allready on the PCB, otherwise a few components can be used to achieve this. Pin3 from the teensy should be connected to the base of a NPN-transistor (eg. BC547) using a 1k resistor. The collector of the transistor is connected to VCC using another resistor (can be seen as a current-limiting setting), the value of this resistor will set the maximum backlight-intensity and no "default" is yet known. The Emitor of the transistor can be connected directly to GND and finally the LED-connection from the TFT should be connected to the collector of the transistor. The backlight can than be controlled by 1) setting #define USE_PWMTFT during compilation and setting the param value in the settings-page. Param=0 is maximum intensity, Param=25 is lowest intensity. As stated this is a featured to be tested !

    regards
    Cor

  6. #456
    Senior Member CorBee's Avatar
    Join Date
    Jun 2018
    Location
    Netherlands
    Posts
    232

    Lightbulb Testing SGTL5000 MIC settings (MIC_CTRL and REF_CTRL)

    Hi,

    In the past few days I have been trying to find out if the settings for the microphone on the SGTL5000 codec can be changed to improve the quality of the incoming ultrasound signals.

    For this I have used a simple UST (eg Monacor UST-40T) as a speaker directly connected to a TI Stellaris Launchpad that generates a standard sequence of signals. This generates 5 short (0.5 seconds) signals of 25, 35, 45, 55 and 65 Khz followed by a pause of 2 seconds (total sequence is 4.5 seconds). As the UST-40 was made for frequencysignal of 40Khz it can be expected that the 35 and 45 Khz signals will be stronger than the other signals, how much is something I cannot quantify. In the images below this effect is apparent but I cannot state that this is only due to the UST or partially due to the sensitivity of the microphone for a given frequency. The detector and signalgenerator weres for every measurement at exactly the same location/distance. The measurements were also made in a sequence and the settings of the two SGTL5000 registers I was testing was read from the SGTL and stored in a logfile directly after recording.

    This is a screenshot of the sequence after loading the RAW file inside audacity
    Click image for larger version. 

Name:	Screenshot at 2019-09-05 10-14-23.png 
Views:	0 
Size:	596.3 KB 
ID:	17495

    The tests have been done on:
    CHIP_MIC_CTRL 0x002A // microphone gain & internal microphone bias (default 0x017x x=dependent on microphone gain)
    and
    CHIP_REF_CTRL 0x0028 // bandgap reference bias voltage and currents(default 0x01f2)

    More info on the options for these settings they can be read at https://www.nxp.com/docs/en/referenc...SGTL5000RM.pdf on page 60/61


    I have tested both for MIC_CTRL and REF_CTRL many different variations and these are the settings I found the most interesting:

    First (leftside graphs) the spectrum over the full recorded sequence including pause for the default settings and
    MIC_GAIN 29 in the second (rightside) graph only the 45Khz signal and I also added the measurement from the contrast function inside Audacity.
    IMPORTANT
    (the graphs are shown rather small and the left-side scales are different, so you need to click on the graphs !!)

    MIC_GAIN 29 REF_CTRL 0x01F2 MIC_CTRL 0x0170 DEFAULT
    Click image for larger version. 

Name:	defaults.png 
Views:	6 
Size:	34.4 KB 
ID:	17496 @45 Constrast 18dB Click image for larger version. 

Name:	default45.png 
Views:	3 
Size:	25.2 KB 
ID:	17497

    MIC_GAIN 29 REF 0x01F2 CTRL 0x0100
    Click image for larger version. 

Name:	2ndspectrum.png 
Views:	3 
Size:	23.2 KB 
ID:	17498 @45 Contrast 20dB Click image for larger version. 

Name:	2nd45.png 
Views:	3 
Size:	30.2 KB 
ID:	17499

    MIC_GAIN 29 REF 0x0002 M_CTRL 0x0170
    Click image for larger version. 

Name:	4thspectrum.png 
Views:	4 
Size:	28.0 KB 
ID:	17502 @45 Contrast 27dB Attachment 17505

    MIC_GAIN 29 REF 0x0002 M_CTRL 0x0100
    Click image for larger version. 

Name:	3rdspectrum.png 
Views:	6 
Size:	27.9 KB 
ID:	17500 @45 Contrast 28dB Attachment 17504

    To me a few things look interesting, first off all changing REF_CTRL seems to give a very strong difference compared to the defaults. The signals at the 25/35/45/55/65 frequencies are (for the same MIC_GAIN) a lot stronger and the backgroundsignal is lower. Secondly most of the harmonics seen in the default graph (look at 75Khz and 90Khz) are nearly invisible in the lowest graphs.

    As I have not found any other references to people testing these settings on the internet (looked at several fora and also the PJRC-forum) I also wonder why this was not tested before ? All I did - to make this possible - is adding a public routine to the SGTL5000 library that allows me to read/write to a register.

    The results have been so interesting that I have allready built the setting REF=0x0002 and CTRL=0x100 into the next release of batdetector code.

    Hope that anybody who has a proper understanding of this (I am NO expert on this) can check if what I have done/tested and concluded are indeed right.
    EDIT: The raw datafiles and corresponding logfiles can be found overhere https://github.com/CorBer/teensy_bat...aster/rawfiles

    Cor
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	3rd45.png 
Views:	4 
Size:	28.0 KB 
ID:	17501   Click image for larger version. 

Name:	4th45.png 
Views:	3 
Size:	28.1 KB 
ID:	17503  

    Last edited by CorBee; 09-05-2019 at 09:47 AM. Reason: added link to recordings

  7. #457
    Member
    Join Date
    Jun 2019
    Location
    France
    Posts
    39
    Hello Corbee,
    Interresting Test.Could-you add more reference about the generator*?

    I think you have too much sub-systems in your test-setup. The first step is the conducted test with a well knowed amplitude , frequency , and impedance generator connected to the input with capacitor. Check with osciloscope too. You will see the effect of parameter change with exactly the same input signal. Adjust the input level*: you will define the best signal input range value. I suggest to start to 0dB internal gain. We have many amplifier before. Don’t change reference for internal ADC.

    Thus You wil define the parameters for beautifulest FFT, without harmonics, with best results..and also the range for amplitude signal far from saturation,

    If all is OK you should see the best result for 0dB gain with amplitude little lower than max fullscale ( 1,8Vpp?) of ADC. If not there is someting wrong.

    Increasing the gain will also increase amplitude , saturations, harmonics witch is confirmed by your results.

    The next step will be*: check amplifier stage to be sure that amplitude at codec input in as the same order, as your previous conducted generator, little lower.

    Sorry to say it again*: the common mistake is to try all together and pray.
    Step by step is the best solution, used also to go to the moon...

    I describe some basic amplitude test, fullscale and impedance check in previous message #371.
    Could you confimed the mic gain used in your previous version*?
    Regards

  8. #458
    Senior Member CorBee's Avatar
    Join Date
    Jun 2018
    Location
    Netherlands
    Posts
    232
    Hi Remis,

    I do not have equipment to do that kind of testing but maybe others can. The "generator" is as stated a simple MCU generating a PWM signal for a given frequency that is than transmitted using a UST. The only thing I (can) do is use the detector to listen/record those signals using many settings. I cannot measure "parts" of the system as the SGTL5000 is a closed system. Mic_input goes into the SGTL5000, gets processed and can be recorded directly. Be aware that you also see the "top" of all the tests I ahve tried in the past days. I have been first testing step-by-step differences for each register separately to get to the current values for the two settings. But this kind of testing is not difficult and if you have the right equipment to test parts of the setup better I encourage you to do so.
    I think the tests I have conducted show that the default settings (as setup in the SGTL5000 library) are not necessary the best settings, NXP not for nothing added the option to change these registers to tune things.

    regards
    Cor
    Last edited by CorBee; 09-05-2019 at 06:50 PM. Reason: Added a bit more info

  9. #459
    Member
    Join Date
    Jun 2019
    Location
    France
    Posts
    39
    Ok i understand.
    Other intermédiate solution could be : compile an oscilloscope :Use the bat detector as a simple oscilloscope to check the fullscale, and the level and the signal seen by the ADC. Some people will say that it is the same as FFT view...but without calculation artefact and FFT windowing effect.
    For different parameters you will see the effect on FFT screen

    But a low cost oscilloscope with USB connection could be a good calculation also for futur design...

    Remi

  10. #460
    Senior Member CorBee's Avatar
    Join Date
    Jun 2018
    Location
    Netherlands
    Posts
    232
    Hi,

    Isnt the data you can see in the files (raw files on github) allowing that ?
    Click image for larger version. 

Name:	Screenshot at 2019-09-06 07-45-34.png 
Views:	2 
Size:	44.5 KB 
ID:	17522

    Cor

  11. #461
    Member
    Join Date
    Jun 2019
    Location
    France
    Posts
    39
    Yes your are right! I forgot the simplest way....
    I suggest to start with typical audio spectrum, close to typical application( 3Khz signal with SR=44Khz ) to try understanding and confirm the effect of MIC CTRL paramètres changes, following NXP use case.
    Use a low cost DDS sine generator from audio to Ultrasonic test : less than 10$ It could help for your next test.
    Regards

  12. #462
    Senior Member CorBee's Avatar
    Join Date
    Jun 2018
    Location
    Netherlands
    Posts
    232
    Hi,

    I invite anybody who has this kind of equipment to try and test this. For me this was a test and I am allready happy with the progress I made.

    Another option would be to generate (using the SGTL5000) a sine, send it out via the DAC of the SGTL5000 and connect the output to the MIC_INPUT.
    Both the sine and the DAC are completely controlled so you can set both frequency, signallevel and outputlevel ...

    This is the SGTL5000 schematic, you could also bypass the MIC_GAIN part by connecting the sine from lineout to linein. That way you "isolate" effects from the mic pre_amp which only has 4 levels.
    Click image for larger version. 

Name:	Screenshot at 2019-09-06 09-36-16.png 
Views:	11 
Size:	50.3 KB 
ID:	17526


    regards
    Cor
    Last edited by CorBee; 09-06-2019 at 07:39 AM.

  13. #463
    Senior Member CorBee's Avatar
    Join Date
    Jun 2018
    Location
    Netherlands
    Posts
    232
    Hi,

    If anybody is willing to do such a test and record the data in a raw-audio file I will be volunteering to do the analysis of the datasets in a standardized way. For this I will be studying some python code to easily do analysis of chuncks of data from a large dataset.

    Cor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •