Configuring the ArduBat
Now things get interesting...
|Now we need to begin working with the Arduino
UNO board. I won't go into how to write programs, or
how to use the Arduino software to load sketches.
There are better web resources for those types of
information. I will continue on expecting that you have
mastered the basics of working with the Arduino
environment. As a reminder, the official Arduino
website is at: www.arduino.cc
In order to configure the ArduBat, you need to have an idea of what input/output pins are used for the various parts of your project. For the purpose of these pages, I will use my personal configuration notes, as they will likely be the same or similar to what you will do down the line. Below is the Pinout Map that I developed for my ArduBat project. I am using an Adafruit # 1141 data logging shield, as well as the ArduBat shield. I am also using several analog sensors, and a bistable latching relay, but these aren't as important for the initial configuration of the ArduBat. In the list you can see there are 6 analog data pins, and 14 digital data pins. On the pinout map I have used colors to group the way the pins are being used.
|All of the pins in red
are needed by the Arduino board and operating
system, so these shouldn't be used ( unless you know what
you are doing :-) .
The pins in green are defined and used on the Adafruit data logger card, and should also be reserved. Even if you use a different shield down the road, the D10 through D13 pins will still be used by the SD card library to access the SD card.
The orange pins are the ones that are important to configuring the ArduBat. These are the pin allocations that I recommend for the LED, Push-button, and bat call connections. These are also the pins that are defined in the various sketches ( programs ) that I will have on this web site.
The pins in black are the analog data pins that I intend to use down the road for more data collection options. For now, we can ignore these.
|So, to configure the ArduBat, we need to
wire the LEDs and push-buttons to the digital pins we
have mapped out. In the picture to the right, you can see
these wired connections. I have used color coded wiring
to make it easier to follow. All of the configuration
wiring is done on the bottom of the ArduBat
The Green LED ( A ) to digital pin 5 : the Yellow LED ( B )to digital pin 6 : the Red LED ( C ) to digital pin 7 : the F1 push-button to digital pin 8 : the F2 push-button to digital pin 9.
The Bat Call connection for digital pin 2 was made during the initial construction phase when we inserted the jumper wires on the top of the circuit board.
|The next step is to stack the ArduBat onto
the Arduino UNO ( rev 3 ) board, and connect it
to the computer that is running the Arduino
You will also need to supply 12 volts to the Arduino external power connector. This provides the power for the bat detector circuit on the ArduBat shield. ( You should have already placed jumpers for VIN, and the digital pin 2 to Bat Call interface connection. )
Download, compile, and load the Demo / Test Sketch ( ABDemo.ino ).
When you press and hold the F1 push-button, the Green LED should light. When you press and hold the F2 push-button, the Red LED should light. When you jingle keys closely in front of the transducer, the Yellow LED should flash. And, when you press the RST push-button, the Red and Green LED's will reset to off.
If all of these tests worked, congratulations. Your ArduBat is almost ready to go.
Setting the ArduBat Sensitivity...
|At this point in the construction of the ArduBat,
it is still a bit deaf. Only the first stage sensitivity
/ gain has been set. In the next steps we need to set the
gain of the second stage. This procedure will determine
the final sensitivity of the entire bat detector circuit.
To be able to hear what we are doing, we need to temporarily be able to connect an earphone to the Monitor output, near the transducer, of the ArduBat.
|I use a 2 pin header strip section as a plug. Simply
wire the earphone to the shorter pins, and separate the
longer pins just a bit. If you get the spacing correct,
you can simply connect the earphone by lightly pressing
the header "plug" into the monitor pads on the
Of course you can also solder the wires of the earphone to the Monitor pads if you want the earphone to be connected permanently ... but I find that the earphone is usually not necessary for most projects.
|It is important to consider the environment that the Simple Bat Detector circuit is in with the ArduBat configuration. Electrical noise will be transmitted to it from the digital circuits below it, as well as via the power connections ( including the AC wall-wart supply, if used ) . So to set up the best test conditions I recommend using the ArduBat, stacked with the Arduino ... running the demo sketch, as above. The ArduBat should be connected to the computer with the USB connector, and should have a 12 volt wall-wart power supply plugged in to the Arduino power connector. ( Without 12 volts to the Arduino, the bat detector circuits are not powered !! ) This situation maximizes the static background noise from the computer and power sources, yet simulates the actual digital noise during a bat pulse sampling period ... when we really need the bat detector circuit to be clean and clear of interference. And note ... contrary to the picture below, stretch out the earphone cord and keep it away from the transducer to avoid feedback oscillation while you are testing !!|
|With the above conditions met, run the demo program
and press either the F1 or F2 buttons to illuminate an
Softly bend the leads of a 150 ohm resistor, and gently plug it in to the pads for the second stage gain resistor on the ArduBat board ( marked with a *** ) ... see the circled area of the picture to the left.
Now, brush your fingers together and see that the sound is picked up at least a foot away from the transducer ... this indicates good sensitivity. Is the circuit quiet when you are not rubbing your fingers ?? Good, then you are set.
If there is noise or oscillation when you are not rubbing your fingers, you may have to reduce the gain ... repeat the process with the next larger resistor ... 220 ohms and then 470 ohms etc. When you find the smallest value resistor that gives you the best sensitivity, with no noise, then you can solder it on to the circuit board, and the ArduBat configuration is complete.
|I find that 150 ohms works very well for
the transducer and detuning coil listed in the parts list.
In actual use, many of the ArduBat projects you
build will likely run disconnected from the computer, or
on a battery instead of a wall-wart. So the real world
applications should be quieter, as far as electrical
noise is concerned. Still, when you do run more complex
programs, you will undoubtedly hear all sorts of noise
from the bat detector circuit when program loops are
toggling I/O pins, activating relays, writing or reading
files from SD cards, etc. This is fine ... as long as the
noise goes away when the Bat Pulse sampling
routines are running. This adds a bit of a challenge to
your programming ... writing code that is quiet :-)
At this point there are several options... learning more about the Demo Sketch, looking at a logging application, or maybe troubleshooting a problem with your ArduBat ... in any case, you now have a fully functional ArduBat shield, and you are ready to experiment. Good luck with your project !
Tony Messina - Las Vegas, Nevada - email: T-Rex@ix.netcom.com