Gas station without pumps

2014 January 14

College applications finished

Filed under: Uncategorized — gasstationwithoutpumps @ 20:21
Tags: , , , , ,

My son finished the last of his college application essays today—a letter of intent for the College of Creative Studies at UCSB.  UCSB is more of a safety school for him than a first-choice one, but they have a decent CS department, and the College of Creative Studies is a better honors program than the other UC campuses have.  It looks like that program provides enough flexibility in the general ed requirements that he would have relatively few courses to take that he did not choose for himself—certainly less than the rather specific laundry lists of UCSD colleges or UCB.

I had to bicycle down to the post office to mail paper copies of the application forms to the College of Creative Studies, because my son was running late for his afternoon appointment, and the forms really needed to be postmarked today.  It seemed a bit weird and old-fashioned to be sticking stamps on a big envelope and mailing it from the post office for a college application.  Of course, the College of Creative Studies is small enough that they can’t really afford to set up their own on-line application system, and UC is not about to modify their system to accommodate a small college on one campus.

Now that he has finally finished his essays, I’m hoping to get him to spend some time on two subjects he’s been neglecting: group theory and updating the data logger to work with the Freescale processors (along with lots of other upgrades requested on the bitbucket site).  I’ll have to tell the lab staff soon which processors the students will be buying for the spring quarter Applied Circuits course.  If the data logger is not working with the KL25Z boards, then we’ll have to continue using the Arduinos.  The Arduinos worked well enough last year, but we could run much higher sampling rates and higher resolution on the KL25Z boards.  I’m also wondering whether I should get a KL26Z board, which has 14-bit resolution for 3-axis acceleration measurements and 16-bit resolution for 3-axis magnetic measurements (the KL25Z board has only 12-bit resolution for 3-axis acceleration and no magnetometer).  Both boards have 48MHz ARM Cortex M0+ processors with 28kB of flash and 16kB of RAM, and use similar OpenSDA interfaces for downloading programs. The KL25Z is supported by free software from mbed.org, but the KL26Z does not seem to be (yet—they do support the KL46Z).

2013 July 20

Freedom KL25Z board

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 13:39
Tags: , ,

On Tuesday, 2013 July 16, I ordered Freescale’s new $13 KL25Z development board from Digi-Key as part number FRDM-KL25Z-ND, they shipped it within an hour and a half, and I got it on Thursday, 2013 July 18 (shipping charges were $3.43, but I had ordered a few other parts at the same time).

My KL25z board with a USB cable plugged into the SDA USB port.  This is the port used for downloading.  The other USB port is used for serial communication, mouse or key board emulation, and so forth.

My KL25z board with a USB cable plugged into the SDA USB port. This is the port used for downloading. The other USB port is used for serial communication, mouse or keyboard emulation, and so forth.

The board does not come with any headers, so I’ll need to buy a 2×6, 2 2×8, and a 2×10 female header to solder in.  These will add about $3.36  $5 to the cost of the board—more since I neglected to order them with the board and so will have to pay shipping again.   The headers would cost $2.05  $3.07 in hundreds, which would be the right quantity to buy if we used the boards in a lab course.  (I had the wrong female headers selected before—the 2×3, 2×4, and 2×5.) Adding headers would have added about $2.50 $4.50 to the cost of making the board (either adding a wave-soldering step or using more expensive surface-mount headers), so you can see why they left the connectors off in a $13 board.  Besides, for many applications, engineers would prefer to solder wires to the board, rather than using headers.

The lack of headers is a bit of a problem for using the boards as data acquisition devices in the Applied Circuits course, as the students have to be able to data acquisition in the first week, but we don’t get to soldering until later in the course.  I could make the KL25Z boards be an option, for those who already know how to solder.

The technique for downloading to the board is elegant: if you plug a USB cable into the SDA USB port on the board, the board looks like a flash drive to the computer.  Dragging a binary file to that drive causes the file to be loaded into the flash memory of the MKL25Z128VKL4 processor on the board.

Unfortunately, one thing that Freescale doesn’t tell you about the board is that they ship it with a bootloader  and flash-drive downloader written by PE Micro, and this firmware only works with Windows computers, not with Linux or Mac computers.  PE Micro claims that version 1.12 of their firmware fixes this terrible bug, but that doesn’t do much good if (like me) you are shipped a board with version 1.09 of the bootloader.

Luckily there is a workaround, explained by MBED: do a bootloader download of the MBED flash-drive downloader using a Windows machine.  Thereafter you can do the drag-and-drop downloads of programs as intended, even from Linux and Mac computers.  The explanation by MBED is not completely clear, as it implies that you only have to do this if the BOOTLOADER does not appear as a flash drive on the Mac, but it seems to be necessary even with the BOOTLOADER visible.  Presumably, loading v 1.12 of the PE micro software would work also, but I haven’t tested that (and any company that releases 11 non-functional versions before testing on a Mac or Linux machine has lost all my confidence in their software development ability). I took the board into work yesterday and downloaded the MBED firmware using a Windows machine, and I now have no problem dragging and dropping software using my Mac.

The MBED system is an interesting tool chain for developing C/C++ software for ARM processors.  They provide an open-source software development kit (SDK) and a free online compiler and integrated development environment,which includes an online compiler, a version control system, easy import of libraries and example code, and easy public release of code to other users of the system.

The reason for this online compilation is  probably that the ARM RVDS 4.1 compiler they use is terribly expensive—ARM does not give a price, but uses the “get a quote” system, which almost always means that prices are astronomical.  If you have to ask, you can’t afford it.  Freescale also sells a development system called CodeWarrior, at various prices, including a free version.  But the free versions, at least, are only available as exe files for Windows, and so useless to me.

It should be possible to use the gnu gcc compiler for the ARM processors, but I’ve not investigated how to set it up for the KL25Z board.  My son is looking into this, as he does not like online compilers and idiosyncratic IDEs, preferring to use familiar editors, command lines, and Makefiles for his compilation (as I do).  If he gets the gnu compiler set up for the board we can export any libraries and programs from the online compiler to our own machine and use the gcc compiler.  We can also compare code size between the ARM compiler and the gcc compiler.  I suspect that the ARM compiler, whose code generator can be tailored more closely to the ARM architecture, produces smaller, faster code, but that is unlikely to matter in any of our applications.

One problem I see with the free toolchains for the KL25Z board, compared to the Arduino IDE, is that there is no equivalent of the Arduino serial monitor, so debugging a downloaded program may be difficult.  If we don’t find a serial monitor already written, my son or I may write one in Python (based on the serial communication stuff he wrote for the Arduino Data Logger).  The MBED site provides easy sharing of ARM code, but nothing for sharing code that lives on the host at the other end of a USB cable.

The MBED SDK provides an Application Programming Interface (API) that is at about the same level of abstraction as the Arduino API, so programming should be fairly easy.  I plan to do a little playing with the board this weekend, just using the on-board peripherals (capacitive touch-sensor slider, 3-axis accelerometer, 3-color LED, and USB port).  I can’t really do any work this weekend anyway, because campus had a power failure Friday night and the file servers I use won’t be rebooted until Monday.

[Update: 2:30 pm: I’m not going to be doing any development work on the KL25Z this weekend after all.  I had the device mounted as BOOTLOADER (to check the version number of the bootloader for this post), and accidentally dragged a file to it, downloading a file that overwrote the MBED program and rendering the device once again invisible to Macs (except for the destroy-only BOOTLOADER).  I’m going to have to wait until Monday to go back to work and reload the MBED program using a Windows box.

Until Freescale starts shipping the boards with a properly functioning bootloader, I’m afraid I can’t really recommend the boards.  Having to find a Windows machine every time I make a careless error like this is just too big an irritant.]

2013 July 2

Pressure sensor with air pump

I’ve been thinking of expanding the pressure sensor lab for the Applied Circuits Course to do something more than just measure breath pressure.  Perhaps something that conveys another physics or engineering concept.

One thing I thought of doing was measuring the back pressure and air flow on an aquarium air pump bubbling air into an aquarium. Looking at the tradeoff of flow-rate and back pressure would be a good characterization of an air pump (something I wish was clearly shown in advertisements for aquarium air pumps and air stones).  Measuring flow rate is a bit of a pain—about the best I could think of was to bubble air into an inverted soda bottle (or other known volume) and time it.

This would be a good physics experiment and might even make a decent middle-school product-science science fair project (using a cheap mechanical low-pressure gauge, rather than an electronic pressure sensor), but setting up tanks of water in an electronics lab is a logistic nightmare, and I don’t think I want to go there.

I can generate back pressure with just a simple clamp on the hose, though, and without a flow rate measurement we could do everything completely dry.

Setup for measuring the back pressure for an aquarium air pump (needs USB connection for data logger and power).

Setup for measuring the back pressure for an aquarium air pump (needs USB connection for data logger and power).

Using the Arduino data loggger my son wrote, I recorded the air pressure while adjusting the clamp (to get the y-axis scale correct, I had to use the estimated gain of the amplifier based on resistor sizes used in the amplifier).

The peak pressure, with the clamp sealing the hose shut, seems to be about 14.5 kPa (2.1psi).

The peak pressure, with the clamp sealing the hose shut, seems to be about 14.5 kPa (2.1psi).

I was interested in the fluctuation in the pressure, so I set the clamp to get about half the maximum back pressure, then recorded with the Arduino data logger set to its highest sampling frequency (1ms/sample).

The fluctuation in back pressure seems to have both a 60Hz and a 420Hz component.

The fluctuation in back pressure seems to have both a 60Hz and a 420Hz component with back pressure at about half maximum.

Because the Arduino data logger has trouble dealing with audio frequency signals, I decided to take another look at the signals using the Bitscope pocket analyzer.

The waveform for the pressure fluctuations from the AQT3001 air pump, with the backpressure about 7kPa (half the maximum).

The waveform for the pressure fluctuations from the AQT3001 air pump, with the back pressure about 7.5kPa (half the maximum).

One advantage of using the Bitscope is that it has FFT analysis:

Spectrum for the back pressure fluctuation.  One can see many of the multiples of 60Hz, with the particularly strong peak at 420Hz.

Spectrum for the back pressure fluctuation. One can see many of the multiples of 60Hz, with the particularly strong peak at 420Hz.

I was also interested in testing a Whisper40 air pump (a more powerful, but quieter, pump). When I clamped the hose shut for that air pump, the hi-gain output of the amplifier for the pressure sensor saturated, so I had to use the low gain output to determine the maximum pressure (24.8kPA, or about 3.6psi). The cheap Grafco clamp that I used is a bit hard to get complete shutoff with (I needed to adjust the position of the tubing and use pliers to turn the knob).  It is easy to get complete shutoff if the tube is folded over, but then modulation of less than complete shutoff is difficult.

The fluctuation in pressure shows a different waveform from the AQT3001:

The Whisper40 air pump, with the clamp set to get about half the maximum back pressure, produces a 60Hz sawtooth pressure waveform, without the strong 420Hz component seen from the AQT3001.

The Whisper40 air pump, with the clamp set to get a bit less than half the maximum back pressure, produces a 60Hz sawtooth pressure waveform, without the strong 420Hz component seen from the AQT3001. The peak-to-peak fluctuation in pressure seems to be largest around this back pressure. The 3kPa fluctuation is larger than for the AQT3001, but the pump seems quieter.

The main noise from the pump is not from the fluctuation in the pressure in the air hose, but radiation from the case of the pump. That noise seems to be least when the back pressure is about 1.1kPa (not at zero, surprisingly). The fluctuation is then all positive pressure, ranging from 0 to 2.2kPa and is nearly sinusoidal, with some 2nd and 3rd harmonic.

As the back pressure increases for the Whisper40, the 2nd, 3rd, and 4th harmonics get larger, but the 60Hz fundamental gets smaller. The 4th harmonic is maximized (with the 1st through 4th harmonics almost equal) at about 22.8kPa, above which all harmonics get smaller, until the air hose is completely pinched off and there is no pressure variation.

When driving the large airstone in our aquarium, the Whisper40 has a back pressure of about 7.50kPa (1.1psi) with a peak-to-peak fluctuation of about 2.6kPa.

I’m not sure whether this air-pump back-pressure experiment is worth adding to the pressure sensor lab.  If I decide to do it, we would need to get a dozen cheap air pumps.  The Tetra 77853 Whisper 40 air pump is $11.83 each from Amazon, but the smaller one for 10-gallon aquariums is only $6.88.  With 12 Ts and 12 clamps, this would cost about $108, which is not a significant cost for the lab.

2013 May 20

Arduino data logger at Global Physics Department

Filed under: Data acquisition — gasstationwithoutpumps @ 21:49
Tags: , , , ,

My son presented the Arduino Data Logger he wrote for my circuits class to the Global Physics Department on 2013 May 15.  The sessions are recorded, and the recording is available on the web (though you have to run Blackboard Collaborate through Java Web Start to play the recording).

I thought he did a pretty good job of presenting the features of the data logger.

Now that school is beginning to wind down, he’s started looking at making modifications to the data logger code again, and has updated it at https://bitbucket.org/abe_k/arduino-data-logger/

He’s down to only three classes now (US History, Physics, and Dinosaur Prom Improv), though he still has homework to catch up on in Dramatic Literature and his English class.  He’s still TAing for the Python class also.

On Thursday and Friday this week, he’ll be taking the AP Computer Science test and the AP Physics C: Electricity and Magnetism test.  He’s having to take both tests in the “make-up” time slot, because we couldn’t get any local high school to agree to proctor the tests for him during the regular testing time.  Eventually his consultant teacher convinced the AP coordinator to let her proctor the tests, but by then it was too late to register for anything but the makeup tests. We’re way behind schedule on the physics class, so he’s just going to read the rest of the physics book without working any problems before Friday’s exam—we’ll finish the book in a more leisurely fashion after the exam. He won’t be as prepared for the physics exam as I had hoped, but at least the CS exam looks pretty easy to him.

One thing I didn’t realize is that schools can charge homeschoolers whatever the market will bear for proctoring the tests:

  • Depending on the reasons for late testing, schools may be charged an additional fee ($40 per exam), part or all of which the school may ask students to pay. Students eligible for the College Board fee reduction will not be charged the $40-per-exam late-testing fee, regardless of their reason for testing late.
  • Schools administering exams to homeschooled students or students from other schools may negotiate a higher fee to recover the additional proctoring and administration costs.

[ http://professionals.collegeboard.com/testing/ap/about/fees ]

We’re paying $145 per exam (not just the $89 standard fee and the $40 late fee), but I’m glad he gets to take the exams at all this year.

Tomorrow he and I are doing another campus tour—this time at Stanford. He managed to get an appointment with a faculty member, but we noticed that the faculty member is scheduled to be teaching a class at the time of the appointment—I wonder what is going to happen with that. I’ll report on the visit later this week.

2013 February 21

Sampling lab went ok

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 21:14
Tags: , , , , ,

Today’s sampling and aliasing lab was one I expected to go fairly quickly, but it took longer than I thought.  The students had two design tasks and then a bunch of observations. The design tasks were supposed to have been easy ones that they did as a prelab, but everyone took a bit longer than I thought, and some really struggled with them.

The first design task was to design a high-pass filter to do level shifting of a signal from a signal generator (the signal generator is capable of being set to center at a voltage other than 0v, but I needed students to practice level shifting before they do the class-D audio amplifier and the EKG labs).  I gave them a very low corner frequency (0.03Hz).  Students didn’t have trouble with the RC time constant (mostly), but they did have trouble with the notion of using a voltage divider as a Thévenin equivalent of a resistor to the desired center voltage, though we had just done that yesterday in class in analyzing the do-now problems.  I think that they all got it in the end, but I’ll definitely have to consider including some sort of level-shifting question on the quiz.

They looked at the signal output from the high-pass filter using the scope (to make sure that the voltage range was appropriate), then hooked it up to the Arduino and ran the DataLogger code.  I had them run the signal into two pins, with one sampling at 40Hz or 50Hz and the other at 1/5 that (8Hz or 10Hz), and then look at various frequencies.  I may have to specify some specific frequencies for them to look at next year, since they tended to pick simple multiples of 1Hz, which does not reveal some of the interesting beat patterns that you get at 4.9Hz and 5.1Hz.  The DataLogger code worked quite well for this application, though one student managed to tickle an error message by leaving the down-sampling field blank (it should probably default to 1 in that case, rather than reporting an error).  One could do all the visualization with a purely software simulation lab, but the students learned a fair amount by designing and wiring the RC filters, as well as getting more experience with the oscilloscopes and function generator.

The second design task was to design a low-pass filter with a corner frequency of 4Hz.  For this one, most of them chose to do a 2.5v virtual ground with an op-amp circuit, though there was no need, since the capacitor blocks any DC and so could have been connected directly to ground. Using a virtual ground actually makes it harder to use the electrolytic capacitors without reverse biasing them.  This may get to be important in the LC filter for the class-D amplifier, so I’ll probably have to talk about proper biasing of electrolytic capacitors in class.

I did do the strobe demo at the beginning of lab time, but it was not as good a demo as I had hoped to do.  I’ll have to think of ways to improve it for next year.  Problems included that the strobe light was not bright enough (you can’t turn off all the lights in the lab) and that the spinning paper propeller did not have an adjustable speed, so I couldn’t match the propeller to the strobe (just the strobe to the propeller).  Perhaps I need to choose a better moving object next year, where the strobe light will have a more obvious relationship to the sampling of sine waves in the rest of the lab.

Tomorrow I’ll need to start teaching about instrumentation amps, and get the students to choose lab partners to work with over the weekend, so that they can come in with questions on Monday, since the first instrumentation amp lab is likely to cause them problems.

 

 

Next Page »