* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download How (not) to Fry a Thermometer: Testing a slow monitoring and
Survey
Document related concepts
Index of electronics articles wikipedia , lookup
Resistive opto-isolator wikipedia , lookup
Switched-mode power supply wikipedia , lookup
Power electronics wikipedia , lookup
Opto-isolator wikipedia , lookup
Power MOSFET wikipedia , lookup
Surge protector wikipedia , lookup
Analog-to-digital converter wikipedia , lookup
Rectiverter wikipedia , lookup
UniPro protocol stack wikipedia , lookup
Telecommunications engineering wikipedia , lookup
Network analysis (electrical circuits) wikipedia , lookup
Transcript
How (not) to Fry a Thermometer: Testing a slow monitoring and recording system for the Double Chooz project Jim E. Black Faculty mentor: Dr. Glenn Horton-Smith Until recently, neutrinos were believed to have zero mass. Particles without mass travel at the speed of light, and they do not change between the source and the detector unless they interact with something in between. The recent discovery that one type of neutrino, such as an electron neutrino, can change into another type, like a muon neutrino, in midflight has fundamentally changed our understanding of these particles, and was a significant step in the ongoing quest to understand what the universe is made of, and the laws that govern it. The Double Chooz experiment [1] aims to refine our knowledge of these oscillations between different neutrino types, by analyzing the neutrinos that arrive at two detectors located at different distances from a nuclear power plant in Chooz, France. The primary advantage of the site is that one of the underground laboratories in which the neutrino detectors will be housed has already been built for a previous neutrino detection experiment. My project this summer was a small part of this undertaking. Since the temperature, humidity, magnetic fields, and other environmental variables could affect the workings of the neutrino detector and its associated electronics, we need a way to monitor and record them. My mentor, Dr. Glenn Horton-Smith, has proposed using 1-Wire devices from Dallas Semiconductor for the job [2]. These devices are inexpensive, and one can hook up many 1-Wire devices in parallel on just two wires. My task was to test a prototype of this slow monitoring and recording system. We plan to use more than the minimum two wires, to provide separate circuits for data and electrical power, increasing the speed and reliability of the network. Specifically, we currently plan to use CAT-5 cable. The orange-white, orange, blue-white, and blue conductors are being used for the data, data ground, power, and power ground lines, respectively. Data from each device will be recorded about once a minute in a POSTGRESQL [3] database. [2] Software installation and configuration For the first few days of the project, we searched for Linux drivers for the DS9490R USB-to-1-Wire adapter [4]. We were originally planning to use Dallas’s Java 1-Wire API, but had difficulty finding a version that worked with both a Linux operating system and a DS9490R adapter. We turned instead to Dallas’s 1-Wire Public Domain Kit [5]. When we first ran the test programs accompanying the software, we were greeted with an error: Error 119: libusbses.c line 178: Failed to set libusb configuration This error was traced to a permissions issue. The software needs permission to write to the USB port at /proc/bus/usb/xxx/yyy (where xxx is the number of the USB bus the adapter is plugged into, and yyy is a device number assigned when the adapter is connected, which can be determined with /sbin/lsusb). The solution was to use Hotplug to recognize the DS9490R adapter upon plugin by its product and vendor ID numbers (0x04fa and 0x2490, respectively) and run a script that gives non-root users permission to write to the device. Over the course of the summer, several disadvantages of the 1-Wire Public Domain Kit were found. It lacks high-level functions for reading and writing to specific devices, meaning that every time we want to add a new type of device to the network, someone has to look up the commands in the datasheet for the device, and write some new code to handle it. Fortunately, the commands are fairly simple, but writing code to detect and report all the errors that could happen can be time-consuming. In addition, the 1-Wire Public Domain Kit was poor at reporting errors; in particular, the search functions didn't report errors in searches. When there were transmission errors, the search functions would often report the same device twice without noticing that there was a problem. Finally, the 1-Wire PDK lacked the option to adjust the timing of the pulses created by the DS2490 chip inside the DS9490R. To add these functionalities, new code was written to replace the 1-Wire PDK, communicating with the DS9490R adapter via the libusb library [6]. Basic 1-Wire Network Operation In the simplest master-end interfaces for a 1-wire network, the data line is connected to a pulldown resistor in series with a 5-volt voltage source. To send a signal on the 1-wire network, a device draws current from the data line, and the voltage drop across the pulldown resistor causes the data line's voltage to decrease to nearly 0V. Zeros and ones are indicated with long and short low-voltage pulses, respectively. Generally, devices do not transmit unless instructed to do so by the master; the master creates a short "one" pulse, called a read slot, and the device extends the pulse if it is sending back a zero. Each 1-Wire device has a 64-bit serial number that enables the computer to address it individually. Communication usually consists of a long “reset” pulse, followed by a “presence” pulse from any devices that are on the network, followed by a command to select one of the devices by serial number, and last, commands specific to the device being addressed. The 1-Wire protocol also specifies a search algorithm that allows the master to identify the serial numbers of all devices on the network. [7] Figure 1 An illustration of the operation of a 1-Wire network. Shown in the graph of voltage versus time are a reset pulse, a presence pulse, and the beginning of a “Skip ROM” command (0xCC), which indicates that the commands that follow it apply to all devices. When there is a significant capacitance in parallel with the one-wire data line, either due to long cables, a large number of devices, or other parasitic capacitances, the rise and fall time of the pulses slows down. According to Dallas’s “Guidelines for Reliable 1-Wire Networks,” [8] each additional 1-Wire chip is equivalent to 0.5 meters of cable in its effects on network reliability, and 24 picofarads of capacitance is equivalent to 1 meter of cable. The specifications for the DS9490R adapter we are using indicate it should be reliable when the weight, meaning the total length of the wires connected to the network, plus the contribution of devices and other parasitic capacitances, be less than 300 meters [8, 9]. Tests with capacitors in parallel One of the first tests done was reading a DS18S20 thermometer [7] in parallel with capacitors of various values. The software in use at the time was a C program that called functions in the 1-Wire Public Domain Kit libraries. Up to 30 nF, the network worked correctly; in one test with 30 nF in parallel, the thermometer was read 197619 times over a 66-hour period, and no errors were detected. Between 34 and 35 nF, the network failed completely as thermometer stopped responding to read slots. The most notable difference in the waveform of the pulses as capacitance was added was that the voltage didn’t have time to get back up to 5 volts between a long “zero” pulse from the master and the next pulse. At 34.7 nF, the voltage was only rising up to between 1.7 and 1.8 volts. Most likely, when the voltage reached this level, the thermometer was unable to tell that a new pulse had begun, and thus failed to recognize commands from the master. Success Rate Rise of Voltage after Write-0 100% 90% 80% 70% 60% 50% 40% 30% 20% 10% 0% 0.00 10.00 20.00 30.00 40.00 50.00 Capacitance (nF) Figure 2 Results of tests of a DS18S20 thermometer in parallel with a capacitor. It should be noted that since the failure was caused by the device’s inability to interpret its commands, other types of devices will probably fail at higher or lower capacitances. It is believed that the DS2450 analog-to-digital converter fails at lower capacitances, but tests of the two devices under identical conditions, which would be needed to confirm this, have yet to be done. Preliminary tests showed that the choice of timing settings for the DS2490 USB-to-1-Wire bridge chip has a large effect on the capacitance at which devices fail. Tests with long data lines Connecting a long cable not only slows the rise and fall time of the pulses, but also causes some overshoot and ringing. Reflections from the other end of the cable are evident in the way the voltage rises in steps. If these problems are severe enough, they could cause the signal to be misread. Figure 3 Waveforms from the master writing zeros and ones, with and without an approximately 300meter cable connected. To see if the 1-Wire adapter really could read data from a device at the other end of 300 meters of cable, I spooled out 305 meters of CAT-5 cable along sidewalks, to the ledge above the book depository on the south side of Hale Library, where I left a 1-Wire thermometer overnight. Despite the slowed-down rise and fall times of the voltage, I was able to read the temperature from the opposite end of the cable, at a computer in Cardwell Hall, the physics building. The only errors were some power failures at about the time of the temperature spike (see Figure 4); it is likely that someone picked up the thermometer incorrectly at that time, and disturbed the power cables. Figure 4 Data from a thermometer at the library, at the other end of 305 meters of cable. Further tests with the approximately 300-meter-long cable were done inside, with the cable wrapped 15 ½ times around the room, hanging from the fluorescent lights. Aside from two thermometers that stopped working, networks involving only thermometers worked very well. In a three-day test with a DS18S20 thermometer at each end of the cable, 173271 temperatures were read from each thermometer, and no errors were reported (see Figure 5). Figure 5 Data from DS18S20 thermometers, one at each end of a 300-meter cable. To test how well the network would work the number of thermometers was increased, 19 DS18B20 thermometers [10] were connected in parallel on a breadboard for testing. One of the thermometers stopped working, so it was removed, leaving 18 thermometers. When the 18 thermometers were connected at a short distance from the computer, the network worked perfectly, even if the 300-meter-long cable, with two more thermometers and an analog-to-digital converter at the other end, was connected in parallel. However, when the breadboard full of thermometers was moved to the far end of the 300meter cable, there were a few errors. The problem was traced back to the resistance of the cable; specifically, when about 6 to 8 devices are performing an analog-to-digital conversion, the power consumed by the devices is high, a lot of current flows through both ground wires, and there is a voltage difference between ground at the far end of the cable and ground at the near end. This decreases the voltage difference sampled by the master and can turn ones into zeros. Fortunately, this is not likely to be a problem at Double Chooz. The cable lengths used there will be on the order of 10 to 40 meters, and since the devices will probably only be read about once a minute, they can perform conversions one at a time. In another test, the 300-meter cable was cut in half, and the breadboard with 18 thermometers was placed in the middle. In addition, there was a thermometer at the near end of the cable, and a thermometer and ADC at the far end of the cable. Each device was read 4124 times, and no transmission errors were detected. A test of a single DS18S20 thermometer over 610 meters of cable was done by sending the signal and the power for the thermometer through the cable twice, using the other four wires. As expected, the network failed; the thermometer did not respond to read slots. Thermometer Failures One of our most serious concerns came from two thermometer failures during the summer, one DS18S20 and one DS18B20. One of the thermometers (the DS18S20) failed in the middle of the night while being read. When it stopped working, it was connected to a 300-meter-long CAT-5 cable. At the far end of the cable was a thermometer and ADC, and at the near end was the thermometer that failed. Figure 6 shows how the near thermometer’s failure rate worsened as the night progressed. Eventually, the presence of the broken thermometer interfered with other devices. Oscilloscope traces of a “zero” pulse from each thermometer (Figure 7) show under good network conditions show that the damage to the thermometer is permanent. Figure 6 Progressive failure of a DS18S20 thermometer. Figure 7 Waveforms when a working and a broken thermometer attempt to signal back a zero. Given that at least one of the thermometers was damaged during communication, Dallas technical support suggested a possible mechanism, involving a feature of the DS2490 chip that speeds up the recharging of the data line during rising edges. When the voltage reaches a critical level between 0.25 and 1.1 volts, the DS2490 turns on a strong current to charge the line more quickly [9]. If the thermometer is writing a zero to the master, and due to noise on the data line, the voltage reaches the critical level, then a large amount of current can pass through the thermometer, possibly damaging it. This would explain why it was the thermometer at the near end of the cable that stopped working; the resistance of the long cable would have offered some protection to the thermometer at the far end. The solution suggested by Dallas technical support was to limit the current on the 1-Wire data line by adding a small resistor in series with the data line. The usual resistance recommended for short networks is 150 ohms; for larger networks, this may need to be reduced. A Zener diode in parallel was also suggested to limit the voltage. Long-term tests are needed to see whether this protection actually works, and how much resistance is sufficient. A different device, different transmission errors Preliminary tests indicate that even at the far end of the 300meter cable, the DS2450 analog-to-digital converter [11] can correctly report voltages applied to its input pins. When reading the voltage across a resistor that was in series with an LED connected to its 5-volt power supply (see Figure 8), the average voltage read by the ADC agreed with the average voltage read by a multimeter: 3.57 volts. There were fluctuations of 0.17 volts RMS in the voltage reported, mostly due to actual fluctuations in the power supply voltage, in particular, the power supply voltage drops when large currents are drawn. Switching the places of the resistor and LED reduced these fluctuations to 0.017 volts RMS; after adding a 10-nF capacitor between the power supply and Figure 8 ground, the fluctuation was reduced to 0.012 volts RMS (see Figure 9). It is unclear as of yet whether the addition of the capacitor improved the accuracy of the ADC or simply decreased the actual fluctuations in the voltage across the capacitor. Without capacitor With 10-nF capacitor 400 350 300 250 200 150 100 50 0 1.5 1.52 1.54 1.56 1.58 Voltage Measured (volts) Figure 9 Measurements of the voltage across an LED, with and without a 10-nF capacitor in parallel with the power supply. The current plan [2] calls for using the DS2450 ADC’s at Double Chooz to measure magnetic field values and other slow-moving data from analog sensors. Tests of the ADC in conjunction with a magnetometer were delayed due to difficulties getting a good connection between the solid-core CAT-5 cable and the circuit board, but preliminary tests have shown that the setup can detect a bar magnet when it is brought near the sensor. Although the ADC worked at the far end of the 300-meter cable, when the ADC was connected to the computer at the near end, in parallel with the cable, new transmission problems arose. In this configuration, the ADC does not show up in searches, but a thermometer on the same circuit board often does. It is possible that the ADC has a lower tolerance for noise on the line than the thermometers do. While the ADC did not show up in searches, sometimes it did respond to a “Skip ROM” command followed by a “CONVERT” command (see the descriptions of these commands in the DS2450 datasheet [11]). This was valuable because the response rate provides an indicator of how much changes to this network improve it. In many of the tests done with an ADC connected at the near end of the cable, there were errors in the search other than missing the ADC. The programs accompanying the 1Wire PDK failed to notice many of these errors; thus, in search results, they listed certain devices twice or not at all. It is often possible to determine that a search error occurred by analyzing the “discrepancy” bits returned by the DS2490 USB-to-1-Wire bridge chip [9], something the programs in the 1-Wire PDK did not do. A program that identifies errors this way will not report a device twice in searches. At first, it was suspected we were witnessing something warned about in Dallas’s “Guidelines for Reliable 1-Wire Networks”; networks with multiple long branches of cable perform poorly due to the impedance mismatch at the branch [8]. This view was supported by the fact that when the ADC was moved to the far end of the 300-meter cable, the search errors vanished. However, even when the cable to the ADC was shortened from 2½ meters to 5 centimeters, the ADC did not show up in searches. Shortening the cable did dramatically improve the number of responses to “Skip ROM” and “Convert” commands. The response rate improved from less than 1% to as much as 69%, depending on the timing settings of the DS2490. Terminating the cable with a 100-ohm resistor to avoid reflections was not helpful. In fact, because it constantly drained current from the 1-Wire data line, it held the voltage low, preventing any communication from occurring. The DS2490 chip reports a short. Resistances of up to 600 ohms caused the network to fail. At 667 ohms, the thermometer once again appeared in searches, but the ADC did not. Various other ideas were tried to make it possible to make an ADC at the near end of the cable appear in searches, including adding a 100-ohm or 200-ohm resistor in series with the cable branching off toward the ADC, putting a 1-kiloohm resistor between the 5-volt power supply and the data line to make the voltage rise faster during rising edges, adjusting the timing settings of the DS2490 chip, putting 15-ohm resistors in series with both the data line and the ground line coming out of the DS9490R adapter, and terminating the cable with a series combination of a 100-ohm resistor and 10-nF capacitor. None of these approaches were successful. What did allow the ADC at the near end to be found in searches was increasing the impedance contributed by the 300- meter cable, either by adding a 33-ohm or 50-ohm resistor in series, or by using a pair of wires in the CAT-5 cable that were not twisted around each other. Both of these solutions are inadvisable because they decrease the performance of the rest of the network. Timing settings of the DS2490 USB-to-1-Wire bridge chip One feature of the DS2490 chip is that the timing of the pulses it generates can be adjusted [9]. In Dallas’s “Guidelines for Reliable 1-Wire Networks,” [8] they discuss these settings in the context of a similar chip, the DS2480B. They note that the default settings are optimized for small networks, and recommend that the settings be adjusted for medium or larger networks: Pulldown Slew Rate: 1.37V/µs Write-One Low Time: 11µs Data Sample Offset/Recovery: 10µs Oscilloscope observations of the waveforms from the DS2490 chip we were using showed that the actual timing of the pulses varied markedly from the nominal values given in the datasheet [9]: Pulldown Time Code Nominal Measured 0 0.3 µs 0.3 µs 1 2.3 µs 2.0 µs 2 3.0 µs 2.6 µs 3 3.6 µs 3.15 µs 4 4.5 µs 3.85 µs 5 6.0 µs 5.2 µs 6 7.1 µs 6.0 µs 7 9.1 µs 7.6 µs Write-One Low Time Code Nominal Measured 0 8 µs 3.8 µs 1 9 µs 4.8 µs 2 10 µs 5.7 µs 3 11 µs 6.8 µs 4 12 µs 7.7 µs 5 13 µs 8.8 µs 6 14 µs 9.7 µs 7 15 µs 11.0 µs Write-Zero Recovery Time Code Nominal Measured 0 3 µs 10.5 µs 1 4 µs 12.5 µs 2 5 µs 14.5 µs 3 6 µs 16.5 µs 4 7 µs 18.5 µs 5 8 µs 21 µs 6 9 µs 26 µs 7 10 µs 30 µs It has yet to be determined what settings will work best for the networks at Double Chooz. However, extensive testing of different combinations of timing settings was done in an effort to reduce the transmission errors that occur when an ADC is connected to the computer in parallel with a 300-meter cable. The settings that worked the best were: Pulldown Slew Rate Code: 0 Write-One Low Time Code: 0 Data Sample Offset/Recovery Code: 0 It is unknown whether these settings are optimal for normal network operation. Further testing will provide better information about what settings work best. Conclusions and Future Work With the exception of the two thermometer failures, the DS18S20 and DS18B20 digital thermometers performed well with network lengths much longer than can be expected at Double Chooz. Yet to be tested is a network with a number of thermometers comparable to that expected: an estimated 84 thermometers and 172 analog-to-digital converters per lab. [2] The high failure rate of thermometers this summer could be a problem; if 2 out of 22 thermometers failed in two months of intermittent use, then with 168 thermometers in use, then we would expect to need to replace at least two thermometers each week. If it can be shown that resistors in series with the data line can prevent these failures, this will no longer be a concern. An extended test of many thermometers on a noisy but resistor-protected network is needed to verify this. The DS2450 analog-to-digital converters were not as resistant to data transmission problems as the thermometers, but the 300-meter-long cable used for most of the tests this summer is far longer than the 10 to 40-meter total cable lengths expected at Double Chooz. Tests with shorter cable lengths and more analog-to-digital converters are the next step in evaluating whether the proposal will work. Such tests will need to be done for every device we want to add to the network. Acknowledgements I would especially like to thank Dr. Glenn Horton-Smith, my mentor in this project, Dr. Larry Weaver and Dr. Kristan Corwin, who made the REU program at Kansas State University this year both educational and enjoyable, and the National Science Foundation, which funded the program. I am also grateful for the advice and assistance of many people in the KSU high-energy physics department, including Jasmine Foster, Dr. Tim Bolton, fellow REU student Ashley Wheeler, and others. References 1. "Double Chooz: A Search for the Neutrino Mixing Angle theta-13," F. Ardellier, et al, http://arxiv.org/abs/hep-ex/0606025/ 2. "Slow monitoring and recording system status summary", Glenn Horton-Smith, http://neutrino.phys.ksu.edu/~gahs/doublechooz/DC_SlowMRS/ 3. PostgreSQL website, http://www.postgresql.org/ 4. Data sheet for DS9490R, Dallas Semiconductor, http://datasheets.maxim-ic.com/en/ds/DS9490-DS9490R.pdf 5. "1-Wire Public Domain Kit," Dallas Semiconductor, http://www.maxim-ic.com/products/ibutton/software/1wire/wirekit.cfm 6. libusb project home, http://libusb.sourceforge.net/ 7. Data sheet for DS18S20, Dallas Semiconductor, http://datasheets.maxim-ic.com/en/ds/DS9490-DS9490R.pdf 8. "Guidelines for Reliable 1-Wire Networks", Dallas Semiconductor application note 148, http://www.maxim-ic.com/appnotes.cfm/appnote_number/148 9. Data sheet for DS2490, Dallas Semiconductor, http://datasheets.maxim-ic.com/en/ds/DS2490.pdf 10. Data sheet for DS18B20, Dallas Semiconductor, http://datasheets.maxim-ic.com/en/ds/DS18B20.pdf 11. Data sheet for DS2450, Dallas Semiconductor, http://datasheets.maxim-ic.com/en/ds/DS2450.pdf