Gas station without pumps

2016 February 8

New statistics game

Filed under: Uncategorized — gasstationwithoutpumps @ 19:56
Tags: , ,

http://guessthecorrelation.com/ is a game (with very retro graphics) to guess correlations from scatter plots. It is surprisingly difficult to do well, especially since Pearson’s r is so heavily dominated by the outliers, while our visual perception is more attuned to the group.

I’d like to thank Robert Jernigan for his post http://statpics.blogspot.com/2016/02/correlation-guessing.html that pointed me to the game.  (My current high score is 163.)

2016 February 7

Ultrasonic rangefinders arrived

Filed under: Data acquisition,freshman design seminar — gasstationwithoutpumps @ 21:41
Tags: ,

On 2016 Jan 27, I ordered 40kHz transmit/receive transducers from two companies, both through eBay:

Both companies shipped via ePacket with estimated delivery dates of Feb 5–Feb 27, and both packages arrived early on 2016 Feb 4.  On Friday I let students in the class have transmitter/receiver pairs for $1 a pair (7¢ cheaper than my average cost, but 4¢ more than if I had ordered only from the cheaper supplier).

I changed the test setup that I had in More testing for ultrasonic rangefinder to drive the transmitter directly from the Teensy board (using two output pins, so that I could drive ±3.3V), then immediately switch to recording from the microphone.  All the coding was done using the Arduino routines, not faster code that directly manipulated the registers, with one exception.  I did not use delayMicroseconds(), but wrote my own finer-grained delay routine, so that I could tune the 40kHz pulse (12.5µs half period) more precisely:

// delay for amount of time specified by loops (no-op loop)
void fine_time(long loops)
{
    for (int32_t fine_loops=loops; fine_loops>0; fine_loops--)
    {   asm("nop");
    }
}

I compiled for the Teensy 3.1 with “48MHz optimized”, as that gave me the best recording sampling rate. I tuned the number of loops for the delay by timing (with the micros() timer) 400 half-cycles of driving the output with the same code that would be used for the actual ping output. I adjusted the number of loops until I was as close as I could get (12.48µs using fine_time(135)).

I mounted the transmitter on one tripod and the microphone on another, so that I could record the direct sound from the transmitter without having to worry about getting multiple acoustic paths muddying the signal. I then recorded the bursts for a number of different excitation patterns.

Even with just a single 12.5µs pulse, the transmitter rings for a long time.

Even with just a single 12.5µs pulse, the transmitter rings for a long time.

Adding more half cycles, the transmitter output amplitude grows substantially:

As the number of half-cycles of excitation increases, the amplitude of the ping increases almost linearly, but the ringing does not last much longer.

As the number of half-cycles of excitation increases, the amplitude of the ping increases almost linearly, but the ringing does not last much longer.

I tried actively squelching the ringing, by driving the transmitter out of phase with the initial drive pulses:

After driving transmitter for 10 half-cycles, I waited 12.5µs with 0v across the transmitter, then drove it for another 6 half cycles. Because of the delay, the drive was now 180° out of phase with the original signal, and cancelled most of the ringing.

Unfortunately, there seems to be another mode of vibration excited, which is not cancelled by the out-of-phase driving.  This extra vibrational mode is coupled to the main mode, transferring the energy stored in it back to the main oscillation.  So even though the main mode is squelched, the ringing comes back, and the total length of the ringing is about the same, though the energy after the 10 half cycles that were driven is much less.

I also tried adjusting the squelch to 5 or 7 half cycles, instead of 6:

After driving transmitter for 10 half-cycles, I waited 12.5µs with 0v across the transmitter, then drove it for another 6 half cycles. Because of the delay, the drive was now 180° out of phase with the original signal, and cancelled most of the ringing.

After driving transmitter for 10 half-cycles, I waited 12.5µs with 0v across the transmitter, then drove it for another 6 half cycles. Because of the delay, the drive was now 180° out of phase with the original signal, and cancelled most of the ringing.

Using only 5 half cycles of squelching does not fully cancel the initial oscillation. Using 7 half cycles prolongs the secondary ringing.

Using only 5 half cycles of squelching does not fully cancel the initial oscillation. Using 7 half cycles prolongs the secondary ringing.

Although I played around with trying to squelch the secondary ringing with another delay and more out-of-phase pulses, I did not have much success. I could flatten it out a little, but only by prolonging the ringing. I might be able to do better if I adjusted the pulse widths as well as the delay between the driving ping and the squelch pulses, but I think I’m reaching the point of diminishing returns—especially since the details of ringing is likely to be unique to the specific part, not shared by different transmitters even from the same batch.

Next steps will involve amplifying the tuned receiver module, rather than using an untuned microphone.  I expect that I’ll get cleaner signals (perhaps not needing digital filtering), but that ringing will be an even bigger problem, since both the transmitter and the receiver will ring.

Another male professor behaving badly

Filed under: Uncategorized — gasstationwithoutpumps @ 15:51
Tags:

It seems that yet another prominent scientist has been caught behaving badly—this one hit a little closer to home for our students, as the professor was not “safely” in another field, but was one whose lab they might have joined as a postdoc:

A prominent molecular biologist at the University of Chicago has resigned after a university recommendation that he be fired for violating the school’s sexual misconduct policy. His resignation comes amid calls for universities to be more transparent about sexual harassment in their science departments, where women account for only one-quarter of senior faculty jobs.

The professor, Jason Lieb, 43, made unwelcome sexual advances to several female graduate students at an off-campus retreat of the molecular biosciences division, according to a university investigation letter obtained by The New York Times, and engaged in sexual activity with a student who was “incapacitated due to alcohol and therefore could not consent.”

Source: Chicago Professor Resigns Amid Sexual Misconduct Investigation – The New York Times

As I’m sure most of my readers know, sexual harassment is not mostly about sex, but about power and the abuse of power, which is why most universities now have regulations prohibiting even “consensual” sex between faculty and their students.  Sometimes the rules seem to be written in an overly puritanical way (apparently prohibiting any sort of romance between anyone who might at sometime in the future have some sort of professional relationship), but the intent is clear—those who have power over others because of their professional relationship should not be allowed to abuse that power for sexual favors, even if the victim seems willing.

In a post about sexual harassment, Dan Graur points out

In summary, Big Money that comes from Big Science allows people the “opportunity” to exercise power over subordinates in the form of sexual harassment. Of course, the majority of them do not take take advantage of this “opportunity,” but a few do.

In recent years, all the people in the academia who were exposed as sexual predators and were protected teeth and nails by their academic institutions were either Big Money/Big Science people or athletes who bring even more money to their university than Big Money/Big Science people.

The only person who in recent times was dealt with in an expeditious manner was an English professor from the University of California Riverside. Some people think that in this case “the system worked.” I don’t know the circumstances, but the fact that he is gay and an English professor, who does not bring millions to the university, makes me doubt that “the system worked.”

Luckily Dan Graur was only partly right in his assessment here—Jason Lieb was passed from institution to institution for a while, with unproven charges against him, but U. of Chicago did the right thing finally when there was strong evidence of his misbehavior and did not sweep his sins under the rug, as has been too commonly done in the past with him and with others.

I have no intention of ever sexually harassing anyone, nor of cheating on my wife, so I’ve not paid a lot of attention to the nuances of the rules about harassment and sexual assault, but I’ve often wondered how one distinguishes between sexual harassers and clueless dudes in love.  Is it a matter of intent? of the reaction of the victim/loved one? Of the existence of a power differential?

In the case of faculty/student relations, the definition is usually based on the power differential, which makes for fairly simple, clear rules, but for student-student harassment the definitions must be different, as there is usually little difference in power.  The basic notion driving the law and adjudication of sexual harassment cases appears to be “consent”, whose legal definition appears to have changed over the years.  Right now in California, there is a big push to change the culture of students to affirmative consent—”yes means yes”, so that any sex without explicit consent of all parties is considered sexual assault.  This change has required a considerable social shift from 40 years ago, when it was considered shameful for women to give more than subtle indications of consent.

If the new rules include a matching shift in what people consider polite behavior, it will be a great benefit for shy and socially awkward individuals, who could not accurately read the subtle signals of 40 years ago (which were already much clearer than those of 100 years ago).   No longer will well-meaning but socially inept kids blunder on reading subtle signals and be accused of major crimes though procedures that give them little in the way of due process. It will still be difficult for shy kids to ask for consent, but at least the answers should now be comprehensible.

I’m a little worried, though, that rules of politeness have shifted more slowly than the legal definitions, and shy kids will simply be cut out entirely—increasing their isolation in a society that already regards shyness and introversion as flaws that need to be eliminated (look at the almost universal insistence on group work and team spirit in schools).

I’ve also wondered about the “incapacitated due to alcohol and therefore could not consent” standard.  I’ve never drunk enough to be so incapacitated—I drink only enough to get a mild buzz and slight lowering of inhibitions—so I’m not sure how young people are supposed to distinguish between someone in that state (which many seek in order to lower inhibitions enough to have sex) and someone who is too drunk to consent—particularly if they are somewhat (or very) drunk themselves. Extreme cases are easy—someone who is passed out, vomiting, or incapable of coherent speech is obviously too drunk to consent—but drunkenness is not a binary phenomenon—it is a continuum.  There will always be a grey region where some will claim “too drunk” and others “not that drunk”, and I expect that many of the sexual assault cases under the “yes means yes” rule will hinge on this sort of judgement.

On an individual basis, it is probably best never to get so drunk that consent (and determination of others’ consent) is impossible, but drunken youth is baked into our culture—whatever we set up to reduce sexual assault and punish transgressions should not fall apart or become massively unjust  in the presence of alcohol.

2016 February 4

Kitchen lighting

Filed under: Data acquisition — gasstationwithoutpumps @ 19:43
Tags: , , , ,

My wife has been unhappy with the lighting in the kitchen for many years now, so I finally got around to designing a new lighting solution for the kitchen and hiring  a contractor to install it.  We previously had rather ugly fluorescent tube fixtures over the stove and over the sink. The over-sink lighting looked like it was done in the 60s and had 2 20-watt tubes; the stove lighting was a replacement in the 1980s and had 2 40-watt tubes.  The lighting on the countertops was never very good, and nothing illuminated the interior of the cabinets.

My wife thought that can lights in the ceiling might be a good solution, but I didn’t care for putting that many holes in the already poor insulation, nor for the very high price of can lights. Instead, I proposed a series of little LED pucks along the series—the sort of puck lights that are usually used for spot illumination under kitchen cabinets.

LED pucks are available in a wide range of prices, and I tried out three different ones to see which gave the best light and looked least offensive.  Then I didn’t buy more of those, because the lighting store wanted $40 per puck, not including the non-standard connectors needed for wiring it up.  Those pucks claimed to have 240 lumens output, and I wanted about 3500 lumens for the kitchen, which would have meant 15 pucks ($600).

Instead I went with a cheaper set that was easier to wire up but only had 165 lumens per puck, needing 22 pucks. I bought 8 sets of 3 LED pucks from TorchStar through Amazon for a total of about $240.  I printed a bunch of circles the same diameter of the pucks and laid them out on the ceiling, adjusting the spacing and the distance from the walls to avoid shadows. After we’d lived with the paper circles for a week, I called in my favorite contractor to install the pucks. (Of course, the labor charges for patching the old holes in the ceiling from the previous lights, repainting, installing the new lights, and replacing the wooden soffit panel where one light was removed far exceeded the cost of parts.)

 

There are 11 pucks on each side of the narrow kitchen, lined up across from each other.

There are 11 pucks on each side of the narrow kitchen, lined up across from each other.

I did not use the power supplies that came with the pucks, which are only adequate to power 3 or 4 pucks each, and which seem to be very cheaply made (and likely unreliable).  The provided power supplies take 2.5W for lighting one puck, 4.5W for 2 pucks, and 0.3W when not providing any power.

I replaced the power supplies with 2 MeanWell SGA40U12-P1J 12V power supplies each on a separate wall switch and each powering 11 LED pucks.  MeanWell claims an efficiency of 86.5% for the power supplies on their data sheet and considers these supplies “high reliability” supplies. Each power supply takes 21.7W  with a 48% power factor, according to my KillAWatt meter. A 48% power factor is pretty low, but seems common for small switched power supplies—larger supplies often have power factor over 0.9, but that requires more expensive circuitry. The 21.7W/11 pucks means that each puck accounts for 1.97W from the AC supply.

Each puck supposedly puts out 165 lm with 3000°K color, for a total illumination of 3630 lm for the kitchen, which I find a bit too bright, but which my wife finds about right—she’d like the light to be a bit yellower, though. I couldn’t find 2700°K LED pucks that were well made at a reasonable price, so we had to go with these 3000°K lights, which are OK, but not as soothing as 2700°K lights.

If the rated light output is correct, then we’re getting 83.6 lm/W, which is a pretty good efficiency—according to Epistar, these would be their premium chips (120 lm/W), not their standard chips (100 lm/W), if the system efficiency is over 80 lm/W.  (Of course, I’m having to trust TorchStar about how bright the chips are—I don’t have a calibrated illuminance meter.)

The pucks each have  18 Epistar 3528 SMD chips—in 6 chains of 3 LEDs each with a 150Ω current-limiting resistor on each chain. I was interested in characterizing the I vs. V curve for the pucks, and (with a little computation) for the individual SMD chips.

I measured the voltage and current at a number of operating points by hand with a cheap DT-9205A multimeter, and set up a circuit for measuring the current and voltage using a Teensy board and PteroDAQ.

The first circuit I tried was not successful—the LED puck would not turn all the way off! I looked at the waveforms for the voltage and for the current with PteroDAQ, and determined that there was 60Hz pulsing when the LED was supposed to be off. I think that I had a ground loop problem among the three power supplies that was amplified by the bipolar transistor.

The first circuit I tried was not successful—the LED puck would not turn all the way off! I looked at the waveforms for the voltage and the current with PteroDAQ, and determined that there was 60Hz pulsing when the LED was supposed to be off. I think that I had a ground loop problem among the three power supplies that was amplified by the bipolar transistor.

My second attempt used the transistor in a different amplifier configuration:

Here the emitter voltage follows the base voltage, and I had no problems with ground loops—there is no voltage gain from the NPN transistor, just current gain.

Here the emitter voltage follows the base voltage, and I had no problems with ground loops—there is no voltage gain from the NPN transistor, just current gain.

I did have to play around with the voltage swing on the function generator, as the base current was larger than I expected and the 50Ω output impedance of the function generator did seem to matter. I changed the 20Ω resistor to different values to get different current ranges—from 0.5Ω (which resulted in data too noisy to be useful) to 10kΩ.

Here are the I vs. V curves for the puck as a whole:

On a log scale, the different ranges of measurement for the different current sense resistors can be clearly seen. I cut off the low-voltage end of each set of measurements, where the noise got to be too large.

On a log scale, the different ranges of measurement for the different current sense resistors can be clearly seen. I cut off the low-voltage end of each set of measurements, where the noise got to be too large.

On a linear scale, the difference between the hand-held multimeter and PteroDAQ measurements is visible, and the roughly linear increase in current with voltage over a threshold is also clear.

On a linear scale, the difference between the hand-held multimeter and PteroDAQ measurements is visible, and the roughly linear increase in current with voltage over a threshold is also clear.

I can rescale these plots to remove the effects of the serial and parallel connections and of the 150Ω current-limiting resistors, to get an approximate average I-vs-V plot for a single Epistar SMD chip:

The operating point for these chips on the puck is 24mA, which means that the chips must be the "premium" Epistar line, which goes up to 30mA. To get 30mA, we'd need 2.93V, making these chips 88mW chips.

The operating point for these chips on the puck is 24mA, which means that the chips must be the “premium” Epistar line, which goes up to 30mA. To get 30mA, we’d need 2.93V, making these chips 88mW chips.

 

Going back to the puck as a whole, at 12V the current would be about 139mA, for a power of  1.66W, which means that the power supply is operating at an efficiency of about 84%, slightly lower than the rated 86.5%. But the current-limiting resistors are causing a voltage drop of about 3.475V, so the puck is only 71% efficient.  The combined efficiency of the electronics is about 60%.  If the 165 lm output of the puck is correct, then the individual chips would be putting out about 140 lm/W, which is pretty impressive—I suspect that the 165lm is a slight exaggeration, as it is difficult for the customer to measure and complain about.

 

2016 February 3

OS 10.11.3 takes forever to install

Filed under: freshman design seminar — gasstationwithoutpumps @ 20:28
Tags: , , ,

I decided to upgrade the household iMac to 10.11.3 (from 10.8, I think), but not because 10.11 offered any valuable new features.  In fact, just the opposite—a student in my freshman design seminar was having trouble getting PteroDAQ to work on 10.11.3, and I need to debug the problem.

It took well over an hour to download the upgrade—6.9Gbytes!  All the text in Wikipedia could be transmitted in about 9GBytes.  What junk is Apple loading my computer with? Sometimes I long for the days when the operating system fit on a 700kB floppy disk.

After downloading, it supposedly takes about half an hour to install (I’m still waiting for that to finish). [Update: after over half an hour, I went to check on it, and it now claims 45 minutes remaining.] I don’t know how much fussing I’ll need to do to get the new OS working—there always seems to be something broken on each new upgrade of the system.  All that time, before I can even look at what they broke/changed in OS 10.11 to make PteroDAQ not work.

Because the Arduino software was able to download to the board, but PteroDAQ was not then able to see the board, I suspect that port listing method has changed, and PteroDAQ code will need to be updated to do something different in OS 10.11 than in the earlier Mac OS versions (there is already very different code for Mac, Linux, and Windows, which share almost nothing in how to list the USB ports—we may need two different Mac code versions).

I was able to solve one student’s problems with the Arduino system losing track of ports, by suggesting he update from 10.11 to 10.11.3.  It seems like the 10.11 release had a new USB stack, which Apple’s was beta-testing on live customers rather than spending the time to do their own QA.  (This didn’t use to be such a problem with Mac releases, but has always been a problem with iOS releases—it seems that bad software engineering practice is driving out good at Apple.)  I checked, and the student having trouble with PteroDAQ did have 10.11.3, so the problem is not so easily resolved as the Arduino problem was.

Next Page »

The Rubric Theme. Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 335 other followers

%d bloggers like this: