Electronics - UCSD-E4E/AngryBirds GitHub Wiki
Hardware Documentation
I. Sensor Signal Conditioning Circuit
a. Purpose
The signal conditioning circuit (the purple PCB found within the enclosure) alters the signal from the piezo in order to make the signal useable for the BeagleBone Black (BBB). Piezo vibration sensors such as those used for this project output a voltage signal when the surface that they (or the surface they are placed against) vibrates. This signal typically oscillates between positive and negative values, although the magnitude, duration, and overall form of the signal varies. Generally, the magnitude observed in our application (placing the sensors flush against a glass pane) tends to be low (on the order of a few millivolts or less).
b. Constraints
i. Voltage Limitations of BeagleBone Black
The analog input pins for the BBB's ADC require that input voltage is limited to the range of 0-1.8V. Due to the lower voltage limit (0V), the negative components of the signal must be eliminated before the signal can be delivered to the BBB. Potential solutions include rectification, clipping, and shifting (adding a DC voltage component). Currently, our algorithm for detecting impacts is to trigger a detection when the signal's magnitude exceeds a threshold value. Observing the signal on an oscilloscope, it seems that for a given signal, the voltage peak of greatest magnitude may be either positive or negative, so to preserve all of the information in the signal, I opted for a full-wave rectifier. To comply with the upper voltage limit (1.8V), I implemented a clipper diode (actually three diodes soldered together in our prototypes) that clips voltage at 1.8V. This solution was used because I did not want to limit the amount of amplification. Even if I had chosen an amplifier gain in an attempt to avoid exceeding the limit, that method would not have guaranteed that the signal stay under 1.8V in the case of a sufficiently strong impact. ii. Signal Identification Algorithm One flaw of the threshold-exceeding detection algorithm is that strong vibrations from other sources can trigger a false positive "detection." Because we found that signals produced by impacts on the glass have a distinct and recognizable form (similar to an exponential decay envelope), we had originally considered a form of waveform- or wavelet-matching to identify signals. However, due to the complexity of such methods, we decided to use the simpler threshold-matching algorithm. Should the algorithm be changed, it will probably be necessary to change the signal conditioning circuit (perhaps to a level-shifting method).
c. Circuit Description
The signal conditioning circuit contains a non-inverting amplifier, followed by a precision full-wave rectifier. This design was chosen in order to increase the probability that a signal produced by an impact will exceed the threshold set in the software and, thus, be detected. The following points describe my reasons for choosing the specific components and values used in the circuit. • Op Amp o An LM324 quad op amp was chosen because it contains enough amplifiers for the circuit (3 op amps required), has low power consumption (essential for a long-term deployment), and is accessible (cheap and widely available). • Voltage Divider Resistors o Through some experimentation, I found that the output signal had less noise when larger resistance values were used for the voltage divider; 100kΩ resistors were large enough to keep noise to a satisfactory level, and they are abundant in the lab's supply. • Precision Rectifier Resistors o The resistors in a precision rectifier must have the same value R (except one, which must have the value R/2). Most precision rectifiers found online recommend R between 1kΩ and 100kΩ, with lower values being superior for high frequency or high speed. • Signal resistor o A 10kΩ resistor is connected in parallel with the piezo sensor. When it is not used, the voltage about which the signal oscillates tends to "drift," gradually and continuously moving to higher or lower values. • Bypass Capacitors o 103M capacitors are connected between each of the op amp's supplies and the "ground" created by the voltage divider. The value seemed sufficiently large to reduce noise when a battery was used as power, but I did not try many other capacitors. Larger capacitance might help to reduce the noise observed when powered by the BBB. • Diodes o 1N4148 diodes were used because of their availability. d. Potential Improvements i. Capacitor Values The values of the bypass capacitors C1 and C2 were chosen arbitrarily. While the nominal value (~0.01uF, given by capacitor code 103M) is sufficient to reduce most of the noise observed when the circuit is powered by a 9V battery, there is still a significant amount of noise on the output when power is supplied by any of the BBB's 5V outputs. Experimenting with different capacitor types and values may produce a solution for this. ii. Power Source While a 9V battery will supply suitable voltage and power levels for this circuit, its expected lifespan with ~7mA current draw is less than 150 hours. Some lab tests indicated that the battery may last longer (the voltage level did not decay as quickly as shown on battery datasheets), the battery will certainly not be able to power the circuit for 6 months. Preferably, the circuit would draw power from the BBB's 5V output. However, when tested in the lab, powering the circuit in this way resulted in significant noise levels (seemingly non-periodic, high-frequency oscillations observed on the circuit's output through an oscilloscope). Peak noise values could be as large as ±200 - ±500mV. If this noise problem can be solved, the BBB's power can be used as a more long-term source than a battery. iii. Clipper Diode In order to prevent the voltage from exceeding 1.8V, I implemented a clipper diode element. The 1N4148 diodes most available in the lab have a forward diode voltage measured to be roughly 0.6V, which is serendipitously 1/3 of the desired cutoff voltage, so I soldered three 1N4148 diodes together. However, using a single diode would be preferable if a single diode with a forward diode voltage of ≤1.8V is found. iv. Optimization Many of the component values were chosen more arbitrarily than I would have liked. Further experimentation could help in finding component values that perform better in their functions.
II. IR Remote
a. Purpose
Zoo workers clean the windows every morning during the system's active time. Since the modules will be mounted out of their reach, the IR remote will allow them to activate a 30-minute sleep mode before they begin to clean.
b. Circuit Description
• Sparkfun IR Transmitter Board Receives power and signal from the Arduino Pro Mini. Emits IR signal pattern through IR LED when triggered. • Arduino Pro Mini Contains the program to transmit the IR signal. Receives power through its Raw input from the batteries. Signal to initiate transmission is received through pin 11. Corresponding output signal to IR LED is sent through pin 10. • Tactile Button When pressed, sends Arduino a high signal to start IR transmission. High voltage is connected to one prong; both the wire to pin 11 and the pull-down resistor connect to the prong on the opposite side of the switch. • Pull-Down Resistor A pull-down resistor is used to ensure that Pin 11 is not floating when the switch is disconnected. Pull-down was chosen (as opposed to pull-up) because the pin's default reading should be low. The value (4.7kΩ) is a generic pull-down resistor value.
c. Potential Improvements
i. Switch
The remote requires two switches (one to supply power and one to initiate signal transmission). Currently, the remotes are wired with only one switch (the one that initiates signal transmission), so if both batteries are plugged in, the remote is on (and, therefore, consuming power, causing the batteries to drain rather quickly). Possible modifications to incorporate both switching functions:
- Add a switch In my opinion, adding an on/off switch would be troublesome for the workers. While it would provide the necessary function and be only a minor nuisance at most, I think that ideally, our system should be as nonintrusive as possible.
- Add another button While still requiring two interactions with the remote, pressing two buttons could be accomplished in a single motion. However, using a button to control power might require the button to be held for a longer period of time.
- Use a different button If a button that controls two switches can be found, then both the power and signal transmission may be able to be controlled with a single button press. However, it may be difficult to find such a button, and it may require holding the button down for a longer period of time. (Note: The tactile buttons currently in use will not work for this. Two prongs are shorted together on either side of the switch.)
- Transmit signal on startup The remote can be modified with the current hardware so that the button controls the power instead of the signal transmission. If this happens, then perhaps the Arduino can be programmed to transmit the signal on startup.
ii. FTDI Connector
The case for the IR remote will have a slot for the FTDI connection, so the FTDI wires to the Arduino should have a proper connector (and they should not stick out of the casing).
iii. Better Board
A PCB for the remotes would appear more presentable and be clearer to assemble (reducing the risk of mistakes).
III. Microcontroller Wiring
a. Connection Diagram and Description
Device to BeagleBone Black Connection Table Device Name Device Side BeagleBone Side
Signal Conditioning Circuit Sig Out + P9-33 Sig Out - P9-34 5V# P9-5 or 6, P9-7 or 8 GND# GND*
Indicator LED (Remember resistor) + P9-11 - GND* Logitech Webcam USB plug USB Host
RTC GND GND* 5V P9-5 or 6 SDA P9-20 SCL P9-19
3.3V Arduino Pro Mini P4 P8-10 RAW P9-8 GND GND* IR Receiver Vcc P9-7 * = GND pins: P9-1,2,43,44,45, or 46 P8-1 or 2
= Only connect if noise issue is solved. If noise issue is not solved, these points should be connected to a battery.
3.3V Arduino Pro Mini to IR Receiver Diode 3.3V Arduino Pro Mini IR Receiver Diode P2 Out GND GND