Bat detector

The next update is using mode 3 in SDFat so will support Fat16/Fat32 and ExFat. And we have added extra buffering to prevent possible dataloss during a write to the SD.
 
TeensyBat V1.3 release pending (end of the week)

Hi,

The final testing of our code thusfar has not given much problems. I have allready added the libraries we use on the github repository. We will release the code but it will be structured to be used on a PlatformIO environment, we took this step since it was too much work to keep an ArduinoIDE based version that also worked. In PlatformIO we have more control over the usage of specific libraries that are provided locally. One example of this is AudioStream. This is part of the core-libraries of Teensy but this does not allow us for instance to use PSRAM memory for the Audio-system. And for the Teensy 4.1 this is one of the real nice features. In ArduinoIDE we could not get this to work as planned.

Next too all the current code we will also release a few pre-compiled HEX files.
As its unclear what people "want" to have available in the HEX you can state which one of the the following features should be enabled :

PWM -TFT: this will allow the TFT to be dimmed/brightned by digital control and also allows the screen to go dark for instance in "autorecording" mode
DEEPSLEEP: this allows the user to specify a daytime-timewindow where the Teensy will go into hibernation and save as much energy as possible.
VIN_ON: this is mainly usefull for DEEPSLEEP. When using unprotected LIPO batteries as a powersource this allows (only T3.6) the voltage to be monitored.
The device will go into DEEPSLEEP as soon as the battery gets "low".
GPS: tested for Beitian 180 and Beitian 220
TEMPERATURE: only DS18B20

A standard HEX without anything special will be released for both T36 and T41 (to allow testing), but based on demand I will add a few more into the mix.
We will provide this extra set of HEX files only for Teensy 3.6 as there are (apart from our testing team) no "Teensy 4.1 batdetectors" in the wild.
The code is however fully working and active and as soon as there are PCBs available (Edwin is busy) the HEX files for the Teensy 4.1 will be available also.

During the week I hope to explain a few more things,

cheers
Cor
 
All the new features and the features for T4.1 sound great, particularly the waterfall display during recording, auto gain control, and the buffers for T4.1.

As for what I want precompiled into the HEX, all those features sound useful but I'm less interested in temperature and perhaps GPS, although I'd probably like to experiment with it at some point in the future. Perhaps the most useful for me would be Deepsleep


Thanks for all the great work - I love this detector and it's now my go-to device, more so than my Echometer Touch2.
 
Deepsleep and AGC

Hi Duncan,

Both AGC and Deepsleep can be used for both models. Deepsleep is however dependent on a TFT screen with a backlight that can be switched OFF. For most of the TFTs that are used this needs a very simple modification (documented in this thread), breaking a connection between the backlight and the supplied voltage and putting a resistor between the PWM-pin and the TFT backlight. I will create a HEX with DEEPSLEEP (AGC will be in all) and that will also assume the TFT is PWM controlled.

As promised a bit more details on the new functionality, first up DEEPSLEEP and AGC.

How does DEEPSLEEP work ?

Deepsleep will put the teensybat in the lowest possible energy-state. For both T3.6 and T4.1 this means the device will be in hibernation, only the RealTimeClock will be active. At wakeup the system will restart completely as if you switched the device newly on. One thing at this special startup is different, it will immediately switch to AutoRecording (using the user-saved settings from EEprom) and will also switch off the screen fully.

Edit: Deepsleep can be started (after setting it ON) from the main menu when AutoRecord is choosen.

In the Auto Recording menu you need to set the USE DEEPSLEEP parameter to ON. The Sleep Start and Sleep End parameters allow you to set which part of the day the system will be sleeping. This has been currently been tested in cases where the sleep is only "during" the day. The code does however allow setting the Sleep Start for instance at 23:00 and Sleep End at 02:00 but this has NOT been tested.

When the system is actively recording (in Autorec) you can always interrupt this by pressing the LEFT recording button, just as in normal "auto-recording" mode. When the system is asleep pressing a button wont work. But there is a way to wake the system up (and break the deepsleep routine). If you press the LEFT recording button for a long time (at least as long as the value of DEEPSLEEP_TIMER (default 5 seconds) in bat_defines.h) the system will wakeup with a reset. After this deepsleep will not continue and you can alter settings or just use the device handheld.

Deepsleep is -as far as we know from testing - the most efficient on the Teensy 3.6 models, they use often less than 1mA when asleep. For the Teensy 4.1 we have not gotten energyuseage that low, it was often between 5-10mA. Most of my testing was done using a 1500mAH Lipo that was directly connected to VIN on the Teensy to power everything with the 3v3 that the Teensy can deliver. I got about 20 hours of recording and 55 hours of sleep using that setup. But thats on one of my machines and I hope people will experiment with
this to find out what the best way is to power the device for a very long time.

On the Teensy3.6 you can monitor the voltage on the 3v3 pin automatically and even stop the TeensyBat from further recording when the voltage drops too low. This feature is mainly
interesting if you use an unprotected LIPO battery. These should not be drained below 3V normally. This is set in bat_defines using VIN_ON (monitoring of 3v3) and VIN_LOW (currently 3000). This is ONLY for the T3.6 as the T4.1 has no option to directly read the output from the 3v3 pin.

How does AGC work ?

The Automatic Gain Control was added to react to very strong signals that normally would not allow proper recording. This option can be set in the STARTUP DEFAULTS section of the settings menu. There are 3 user controlled parameters.
AGC : On or OFF
AGC_increase (ms): time it takes the AGC to increase the GAIN after a strong signal was encountered
AGC_decrease (ms): time it takes the AGC to decrease the GAIN when a strong signal is present.
The AGC decrease is currently set to 5ms, so 5ms after the system detects a signal that is considered too strong it will step the current GAIN one position down.
If the signal still is too strong the gain will keep going down. When the strong signal has passed by the GAIN will increase again to the original value step by
step and the time between these is set by the AGC_increase value. Behind the screens (in the code) there are more parameters that allow more control
over this feature.

When AGC is ON and you do a manual recording (using the Recording Button) the AGC will be active also. When you use AutoRecording and you want to use
AGC that this needs to be activated in the AUTO RECORDING settings.



cheers

Cor
 
Last edited:
SDConfig

In version 1.3 we have added SDconfig. This is a new feature that can be enabled from the bat_defines.h file (by default it is ON). This allows you to store your preferred settings
in a readable textfile on the SDcard. All settings that are stored in EEprom are also stored in this file, so when you press SAVE from the settings menu and this feature is
active it will write the current settings in this file. This allows you to easily store your preferred settings to allow restoring later.
At startup you can always force the device to read these settings (if available) by pressing the RIGHT pushbutton during startup. It will show on the TFT that it is restoring
the settings from the configFile on the SD.
 
Improved HIGHPASS filter

The HighPass filter has been changed considerably. The settings now allow you to set the number of "stages" the HI_pass filter will use.
The previous setup was using only one stage, this created a filter that was not very steep at 12dB/octave. The new setup allows you
to use up to 4 stages so the filter can be very steep at 48dB/octave. Be aware that setting the center filterfrequency for instance
at 20Khz does not only affect frequencies lower than 20Khz, the effect of the filters also affects frequencies above that frequency.
 
TeensyBat V1_3 development-release available

Hi,

I have just uploaded all sourcecode including libraries and platformio.ini file and several compiled HEX files on the github repository:
https://github.com/CorBer/teensy_batdetector/tree/master/version1_3development

We have marked this release "development" to make clear that not all features have been tested in all possible ways the current TeensyBat can be configured. But most of the improved/new
features have been tested for some time by Edwin, Adrian, Thierry. They have spend quite some time trying the new code, initially mainly to get the Teensy 4.1 working on a new prototype PCB Edwin is developing but we also have tested the new code on the Teensy 3.6. Thanks to all of them !!

The options you can use to compile certain features can be found in the bat_defines.h file. Hopefully the description is clear enough.
If you want a specific HEX file and cannot compile the current source yourself, please tell and I will see if I can add that.

If you encounter any problems, please take the time to document what goes wrong and if the problem you experience can be replicated also. The best way to "complain" is using the issues section of the github https://github.com/CorBer/teensy_batdetector/issues. But you can also give more general feedback using this forum.

We hope you like it !

cheers
Cor
 
Kudos to all developers of the new version 1.3 .. The point to the right of the time is the seconds. What struck me, however, is that the temperature above 4 ° C shows too little. The GPS is also not recognized, it works in the Update1.1dev10april21. I haven't been able to test more than that, because without the GPS no settings are possible, no matter where you press or turn, you don't get into the menus anywhere.
 
I don't know about the temperature. The sensor usually shows a bit to high, becaus of the electronisc or operators hands. I think we have an offset in the code, bu maybe Cor can tell a bit more.


The GPS was just sending data to the Teensy before, now changed to bidirectional communication.
Connect the GPS RX wire as well to get bi directional communication (Teensy pins 0 and 1 are RX and TX serial pins).
 
Hi Helge,

As Edwin allready has stated we have upgraded the GPS setup and this now actively communicates with the GPS-module during setup. You can see the necessary connections in the bat_defines.h file, RX and TX are using the defaults for serial communication on the Teensy.
On the temperature, this depends greatly on your setup. We have added a TEMP_TIMECORRECT variable that allows a "gradual" change of the temperature readout during the 1st 20 minutes after startup as the Teensy slowly warms up. This works in conjunction with the variable T_corrector that has a default of -4.5 degrees and is situated in bat_vars.h.

I am happy to help you resolve the issues you see but its unclear which code you have used, did you compile yourself or did you use one of the pre-compiled HEX filed Edwin and me have made available ?

regards
Cor
 
Thanks for the first time, I use the Teensybat_1.3 20210920 GPS TEMP.hex with the original setup without any changes. I connected the additional data line from the GPS RX to the Teensy TX1 pin 1. The GPS is still not recognized. I tested two different modules from ublox, Neo 6 and Neo 8. Both modules work perfectly and get the 3D fix in the u-center after a short time. Both are not recognized on the Teensybat 3.6 with firmware 1.3. With Update1.1dev both work.
 
Thanks for the first time, I use the Teensybat_1.3 20210920 GPS TEMP.hex with the original setup without any changes. I connected the additional data line from the GPS RX to the Teensy TX1 pin 1. The GPS is still not recognized. I tested two different modules from ublox, Neo 6 and Neo 8. Both modules work perfectly and get the 3D fix in the u-center after a short time. Both are not recognized on the Teensybat 3.6 with firmware 1.3. With Update1.1dev both work.

Hi Helge, I have only tested this setup with a Beitian 180 and 220, both of these work as expected not only on my machines but also with the other testers in our team.

Maybe you can compile the source yourself and enable the DEBUG to see where this goes wrong. We are using the beitian modules with 115200 baud serial rates.

Cor
 
It is strange the ublox gps receiver is not recognized.

I also have one ublox neo-8 receiver in one of my early detectors. (HGLTECH High Quality 8M M8N GPS Module)
This one alo has the antenna directly in the GPS-PCB, just like the BN180/220 receivers.

The ones with external antenna did pick up a lot of noise from the Teensy and fast i2s signals. Probably because the whole GPS receiver came quite close to the Teensy and the small devices with antenna on the PCB you can put the whole thing as far away from the Teensy as possible. It still seems shielding the Teensy helps a lot.

It is strange if the Teensybat still says GPS NOT Connected.
My ublox m8n works just fine. I do expect there stil is something wrong with the serial connection.
 
Thank you, I installed the Debug Hex and sent the new baud rate 115200, n, 8.1 to the GPS NEO 6 in the u-center. It has been recognized and shows coordinates. Autbaud showed 9600.
 
Hi Helge,

That means the GPS did not react to the request to change the baudrate from the teensybat software. But if this works fine than its a good solution. Thanks for reporting back !
I would have liked to see the DEBUG output when the device was still at 9600 baud. The software tries to set the baudrate to 115200 but if this fails we dont have communication.

Cor
 
The debug version is still installed and I still have a NEO 8 / 8M that didn't work either. But this has no USB connection, I have to install a UART to program it. It is also set to 9600 baud. Had used this to calibrate the receiver and frequency counter with exactly 10 MHz. How do I get the debug output ?, possibly connect to the PC with USB and run a serial monitor. I have a film with an infrared image of the lake with a view of Switzerland with lots of bats, about 9 MB in size and mp4. Can I upload the film here in the forum?
 
The debug version is still installed and I still have a NEO 8 / 8M that didn't work either. But this has no USB connection, I have to install a UART to program it. It is also set to 9600 baud. Had used this to calibrate the receiver and frequency counter with exactly 10 MHz. How do I get the debug output ?, possibly connect to the PC with USB and run a serial monitor. I have a film with an infrared image of the lake with a view of Switzerland with lots of bats, about 9 MB in size and mp4. Can I upload the film here in the forum?

Hi,

The debug will output on 19200 baud over serial, so you indeed need to connect a PC to the USB and look at a serial-monitor.

This forum is NOT ment to share/store images/sounds of bats, maybe you can provide a link to people that are interested where they can download the images ?

cheers
Cor
 
Last edited:
********** START DEBUGGER ************
NVRAM 0:1632599371
NVRAM 1:0
NVRAM 2:0
NVRAM 3:0
NVRAM 4:0
NVRAM 5:0
NVRAM 6:0
COMPILER INFORMATION
ARDUINO 10805
C++ 201402
CLIBCXX 20160919
Version 5.4.1 20160919 (release) [ARM/embedded-5-branch revision 240496]
F_CPU 180000000

MEMORY
STARTUP FREERAM 30748
SAMPLE_BUFFER 98304
GRANULAR_BUFFER 32768
AUDIO_MEMORY 71680
TOTAL USED RAM 202752
ENCODER PULLUPS DONE
AUDIOBOARD enabled
ANA1
ANA32639
TFT active
SET BACKLIGHT 250
SCHEME 0
schemename: Default
SETUP AUDIOMEM FREERAM 30748
AUDIOMEM sampleblocks 280
POST AUDIOMEM FREERAM 30748
Found valid EEPROM data
EEPROM loaded
SET BACKLIGHT 250
HI PASS 60
ACTIVE STAGE 0
SCHEME 0
schemename: Default
EEPROM LOADED
STARTUPSCREEN START
STARTUPSCREEN END
SDCARD FOUND
SDFAT
2.0.5-beta.1
CARD USED 0
CARD TOTAL 2020
countDirs_inroot
NO DIRS
check directories
GNSS: trying oldbaud 115200
SKIP 0
GNSS: trying all baudrates 9600
GNSS: trying all baudrates 19200
GNSS: trying all baudrates 38400
GNSS: trying all baudrates 57600
GNSS: trying all baudrates 115200
GNSS: trying all baudrates 230400
GNSS: trying all baudrates 460800
GPS not connected at 115200
Found 1 devices.
Parasite power is: OFF
Temp C: 22.75
LEFTBASEMENU 9
RIGHTBASEMENU 4
SETMENU0 13
SETMENU1 9
SETMENU2 6
SETMENU3 13
SETMENU_GPS 10
***SETUP AUDIO***
setSR SR 12
set OSC 45000
set FreqOsc Sine 7062.28
HI PASS 60
ACTIVE STAGE 0
setSR DETECTOR SampleRate: 281000.00
inMixer from (gain=1) Mic
outMixer from heterodyne
***SETUP GRANULAR***
CHANGE DETECTOR: TExpansion
outMixer from granular
CHANGE DETECTOR DONE
ANA1
ANA16448
FREERAM END OF SETUP 30196
UPDATE AUDIOMEM usage 9
GET DS TEMP
19:51:00Temp C 22.63
 
I have finished building my Bat Detector kit. Flashed the Teensy 4.1 with the software Teensybat41_1.3 202101009 GPS TEMP but the GPS is not recognised! GPS LED flashes!
Strangely enough, the time and date were correctly included in the setup during installation. Temperature is displayed.

Greetings
Jürgen
 
I have finished building my Bat Detector kit. Flashed the Teensy 4.1 with the software Teensybat41_1.3 202101009 GPS TEMP but the GPS is not recognised! GPS LED flashes!
Strangely enough, the time and date were correctly included in the setup during installation. Temperature is displayed.

Greetings
Jürgen

Hi Jurgen,

Did you compile yourself or downloaded a HEX (from where) ?

regards
Cor
 
Back
Top