My house is crammed with computers, but only two of them (mine and Mrs Username's) are connected to the internet. Which means the kids always want to use them to play games.
The basement is wired, so last night I finally got around to hooking one up. It's got some version of Windows on there and already has a network card, so it should be easy, right? Drivers?? I don't even know what the card is! Not to mention the fact that I'm not too comfortable putting a Windows machine on the internet.
Then I get a crazy idea: I'll make it dual boot Ubuntu1! Takes me 45 minutes to download the latest disc, i.e. less time than it would have to identify, locate, download and install a NIC driver. Completely easy to install: Other than the fact that I had to adjust a slider to say how much room to leave for the existing Windows partition, I didn't have to tell it anything at all. It even got on the internet all by itself to download updates.
The question is: Is making my kids dual boot into Linux to play games child abuse or child undangerment? Either way, it certainly builds character.
1Actually, Xubuntu, because this is an older machine. I considered Edubuntu, but I think I'll go with the small, fast one and then add kid-oriented packages.
I've never been completely happy with my temperature logger. It's a bit fragile in the sense that if anything at all goes wrong, and there's no way to tell that at the time, I lose the entire run. I lost a run Memorial Day weekend.
Instead of storing the measurements on the Arduino, I'd like to instantly beam them onto my computer far inside the safety of the house. That way I can track things realtime as well as be assured that I have them. Coincidentally, for my birthday, I got both another Arduino1 and Making Things Talk.
The book describes a great number of schemes to make microcontrollers talk to each other and to computers. You can use wireless networking, bluetooth, XBee, etc (I have only the vaguest notion what some of these are). Naturally the easiest protocols require the most expensive hardware. I only need one way, slow communication, so I got a simple RF module.
Claim:
It works just like a serial port! Just connect the transmitter to the TX pin and the receiver to the RX pin! It Just Works(tm)!
Reality:
No.
Perhaps my unit was faulty. I found many tutorials and guides across the internets and while results varies, I can't ever really say it worked. I did see data appear for a short time, but mainly what I saw was noise. Or nothing at all, which is even less explicable.
Last night I had a brainwave. Or brainstorm. Something happened to my brain and it resulted in an idea. Why not use a wireless laptop as the go between? The kids have these OLPC dealies. The laptop has a USB port and does WiFi. I have a WiFi router (specifically purchased, used, to work with these laptops). About 30 minutes and 10 lines of Python later, I was reading values from /dev/ttyUSB0 and sending them out over a socket to my desktop to another 15 minutes and 20 lines of Python.
The guts of the entire scheme are already there. But with so much success so fast, I'd like to add features. For instance, instant graphing of values on both ends. A protocol so that the laptop knows if there's been an error and can tell me, out in the field. When I have more than one sensor, I'll need a way to indicate which sensor had what value. It'll be like a complete Science Sensing Station!
1If you are at all interested in robots, sensors, controlling stuff with computers, electronics or just plain messing around, I highly recommend the Arduino. That SparkFun item is all you need, assuming you have a USB port (and possibly a cable). Well....you may also need some external electronics, depending on what you want to do. LEDs, resistors, motors, etc.
Once I abandoned the dead end of heat-formed acrylic, the ideas for cold-forming have been coming thick and fast. Here's the result of the squeezer configuration.
First, the squeezer itself:
Closeup of squeezing mechanism:
Result:
Closeup of accuracy:
Soo....yeah. That works. The squeezer is a bit overbuilt. I could go with 2x2s or even smaller next time. And one bolt every couple feet instead of every 6 inches. Other minor improvements. Those may never be made, though, since I had a real brainstorm on an extremely simple way to accomplish the same thing. More on that another time, though. I'm going to use this for my next experiment.
Last you heard I'd come up with an incredibly complex system for getting a perfect parabolic wood form that still failed to make a good parabolic mirror. I actually tried tweaking a couple variables after that. The main thing I realized was that the mating surfaces of the form don't press perpendicularly, which means there's a shear force on the mirror between them. As a padding and semi-lubrication, I put in some strips of silicone baking sheet but to no avail.
So I decided to abandon the heat-forming idea altogether. At this point, even if it worked I'd still have major problems implementing anything at a larger scale. Instead, I'm going with a cold, mechanical system based on the working-extremely-well nail system.
The first stab at a mechanical forming system looked like this:
The idea is that you just wind on some wingnuts to raise the tension and adjust the shape. And that actually worked pretty well to get the shape, modulo this being a first stab prototype. But the focus wasn't all that much better.
Finally, one might even say AT LONG LAST, the light dawned. I turned the mirror around and actually looked at it, searching for the distortions. Huh, they are right around those big holes I drill...OMG. The plexiglass just can't take the stress of the drill! I'm distorting the area around the hole! The oven is probably distorting the whole schmiel! That's why the nail version works so well. I'm just bending, not drilling or melting. What I need is some way of shaping into a parabola as non-destructively as possible. (I realize how obvious this sounds, but I didn't hear any Internet Geniuses suggesting it to me at the time, so bite me.)
Kind of fiddling around with it, I found that I didn't really need to shape the main body, so to speak, of the curve. Just pressing on the ends gave me a pretty good parabola. So, Mechanical Parabolic Mirror System Mark II:
Now winding on the wingnuts transmits compression to make the shape you want. I'm pretty sure that doesn't make a perfect parabola (I think it's actually a cubic curve, based on my skimming of some beam bending equations) but it's pretty damn close. Maybe not so close at full size, we'll see. If it needs more adjustment at larger sizes, I can add some tension non-destructively.
I just realized I've never done a post on Stirling engines. How can that be?? Stirling engines are so, so awesome.
Stirlings are a member of the class called "hot air engines". As a group, hot air engines work by exploiting the expansion and compression of a gas when it is alternately heated and cooled. There's a good explanation/animation here.
(That particular engine is a "true" Stirling because of those green cross-hatches. That's a "regenerator" that vastly improves efficiency. However, most people call all generic hot air engines, regenerator or not, "Stirlings".)
Stirling engines are awesome for a lot of reasons, but one of the best reasons is that you can use any source of heat. This isn't an internal combustion engine that can use only one type of fuel that's later impossible to wean away from. This is an external combustion engine. You could use natural gas or wood or ethanol or solar energy or geothermal energy. In fact, some satellites/probes use Stirlings to convert nuclear energy to electricity. That's right, Stirling engines in spaaaaace.
Anyway, back to Earth and me. Because Stirlings are so simple and efficient, you can make even a really crappy one run fairly well. They are very common first projects in machine tool classes, for instance, whereas building an IC engine from scratch would be...challenging for a beginner. However, I'm not even at the level of machine tool student, so even that option isn't open to me.
Fortunately, lots of people have been coming up with plans for engines that don't require machining. A few years ago, I tried one that used water-based pistons but I couldn't get it to run. I really have no idea what the problem was, probably multiple things. More recently, I found some "plans" for a test tube Stirling. It took me a while to actually get it going, because it turns out that glass syringes are incredibly finely made and also very rare nowadays. I actually had to buy one on ebay as an antique!
I think the functioning is clear enough to explain itself. (Note: This is technically not a Stirling since I have no regenerator, although I could stuff a bit of steel wool in there to fix that.)
After viewing the video again, actually that might not be so clear. Here's what is happening:
Candle heats air inside left end of test tube.
Air expands, pushing "piston" up.
Marbles roll to the left, displacing the air to the right.
Air cools down, contracting.
Pulling piston down and causing marbles to roll right.
A lot of things, many of them new to me, went into this project. We have "regular" programming, "device" programming, a communication protocol, stepper motor control, motor mounting, power supply design and the mathematics of drawing an optimal line on a pixelated display. Some comments on each.
Mounting
I originally thought this was going to be the hardest part. "The rest is just sitting at my computer desk and either typing or handling tiny pieces of electronics" was my opinion. In fact, I just cut a couple spacers and then improvised mounting plates from....I don't know what that stuff is. It's like countertop covering. In any case, this part took maybe 45 minutes. It helps that one vital component of the mount is masking tape.
Connecting the steppers to the knobs went through some iterations. The motors had gears on the ends, but of course the EAS isn't geared. I tried various ways of coupling one to the other, but wasn't satisfied. (This turned out to be a power supply problem, which I talk about below, but I didn't know that at the time.) In the end I managed to remove the gears--they are just press fit, so you can knock them off with a nailset and a hammer. The shafts of both motors and the EAS were almost all the same size, which in turn was just a tiny bit bigger than the internal diameter of some plastic tubing. I just cut a short length as a sleeve and voila.
Stepper Motor Control
Physical Computing was invaluable. In fact, reading about how to control a stepper was what gave me the original idea of controlling an EAS1. (The guts of that section are online.) I originally tried to do the entire thing with totally generic components, i.e. plain transistors, but I soon gave that up. I unbent enough to use 2 dual H-bridges. Still generic, but you can't get them at Radio Shack (but what CAN you get at Radio Shack?). This compacts the wiring and anyway the motors need more current than a regular transistor can switch.
If this were a real product, I would definitely build/buy a stepper control board. Finer control isn't an issue, but sweet mother of crap this thing is loud. I think a board can ramp the amperage up and down to give a smoother movement that won't shake the house down.
"Device" Programming
The Arduino libraries include an object-oriented Stepper control library, but it wasn't really suited to what I was doing. The most basic fact it cared about was the RPM. The most basic fact I cared about was how many steps to take. So I wrote my own SingleStepper library. That makes me sound alphanerdy, but seriously, it was just a matter of copying and tweaking the existing library.
Another reason for writing my own was that the Stepper lib left the current on even when the motor wasn't turning. That's great if you need the torque to stay on, but non-great if you have a limited budget of amperage. So my library also turns the power on only long enough to move the motor, then turns it back off.
Communication Protocol
The stock Arduino serial comm library only supports reading a byte at a time. WTF ARDUINO ? Naturally I need to send coordinates larger than 255. The solution is conceptually not too difficult: Send a two-byte int a byte at a time and reassemble on the other end. This actually took a couple days to implement, though, because Python (on the other end of the wire) isn't geared towards working with binary data and then there's the question of negative numbers, twos complement, endianness, etc.
Also, in the case where a lot of coordinates are being generated very quickly, the internal buffer can overflow and the EAS goes haywire. So each coordinate has to be ACKed by the controller before the next is sent.
Line Drawing
Here's another place where I didn't go 100% from my own bootstraps. I actually did start deriving this myself, but soon realized that there were going to be special cases and stuff and I wasn't interested in debugging those. Instead, I just adapted a classic algorithm. I didn't use any of the optimizations on that page, since they are more for a digital display than position control. I did make one optimization of my own, though, which was to not move each motor a single step at a time if I could take 5 steps with one and then 1 with the other.
Theoretically, one could turn both motors on at the same time but at different rates to draw diagonal lines. But even if I had the electric power to do that it's just too hard to attempt.
"Regular" Programming
This is so dead simple that it's really not that interesting, but just for completeness: Generate a series of coordinates (either by hand typing in your own or using some equation) and send them out the serial port.
Actually, I should explain that a bit. I chose to implement this as a display-like device. You give it a coordinate pair X,Y and it moves there. The Arduino handles everything after being handed the values. So for instance the sine wave is being calculated as a series of points in Python on my computer and then sent over to the microcontroller for plotting.
Power Supply
Of these all, the one that I figured out last was the power. The EAS isn't really made with computer control in mind. The controls are surprisingly sticky. At first I thought the coupling between motor and EAS was slipping, but I eventually eliminated that. The power supply I bought is rated up to 1.5A, but only puts out 5V, so the motors only drew about 700mA. Turns out that wasn't quite enough to consistently turn the knobs. By bypassing the power supply, I was able to feed 1A directly to each motor (one at a time) and that was enough.
It may still be a little short, though, because I still get the occasional glitch. But I don't have a wall wart that puts out more than an amp at more than 8V.
Cost
The steppers I got out of a broken inkjet printer. (I really lucked out on that, I later realized. Two other inkjets I disassembled had steppers but they were tiny.) I already had the mounting stuff and the Arduino, as well as wires, resistors, etc. I had to buy the H-bridges, the power supply, a heatsink and some power resistors. That probably adds up to $20 or $25. But I can and will reuse it all, especially the power supply, which was the most expensive single purchase.
Oh yeah, and I had to buy an EAS. But one of my design goals (as well as an instruction from my seven year old) was to not alter it beyond being used by humans afterwards. So I consider that a capital investment as well.
1Gave me the idea, but I wasn't actually spurred to do anything until I saw the EAS clock. The auto-erase functionality of the clock would be really nice to have, but I'd like to point out that the ability to draw curves is even nicer.
Per request, here's a closeup of a diagonal line. You can't see the "pixels".
That said, you actually can see the "pixels" in some curves. I think that's because of the (mathemetical) stepping involved in going from floating math to integer.
I was half-heartedly shooting for 40 during the last few weeks, knowing I wouldn't make it. But I came pretty close and in the final weeks I doubled my average rate. Also, the Official Tally is based on a moving average, so my last actual weigh-ins have been at or close to exactly 40 lbs. All in all, not at all disappointing.
My original goal was 60 lbs, with a caveat that I may want to go 10 beyond that when I get there (I'm not sure I believe the BMI chart). So I've still got 6 to 9 months ahead of me at this rate. Perhaps by Christmas? Then again, I'm actually chowing on Easter candy as I type this...
I didn't realize until just now how much as happened since the last update.
The final picture in that post shows the problem. Imperfect focus. My theory was that the parallel parabola issue preventing full closing of the two halves of the form. When I tried it, the halves definitely did fit better, but the resulting mirror acted the same. The next possible culprit was Shaky Hands Syndrome. You can't freehand a perfect cut on a bandsaw, even following a line.
So I came up with an elaborate procedure that would let us use a router.
I'm not going to describe every little nuance of this thing, because seriously, it is much more complicated than it looks. I'm just going to point out the main idea.
If you recall, when I hold the mirror in place with nails it works great. So my theory was that constraining a springy object was making it closely approximate a parabola. So I took another springy object (the tan stick thing on top of the paper) and bent it to fit a parabola printed on paper. Then we used that as a guide for a router.
When I clamped the mirror into the form, it looked really good. There was not a single gap anywhere. But the result is indistinguishable from the freehand versions.
To my eye, the star pattern of the imperfect version looks like it is coming from short sections that aren't agreeing with each other. Like a faceted mirror. That would be easy to explain from a freehand form, but this latest version destroys that theory, at least as far as the form is concerned.
Yesterday I realized that uneven bending could be the result of uneven heating. Maybe some areas of the mirror aren't quite getting up to temperature. I was going to heat the entire thing up by another 10 degrees, but I accidentally broke the form. (Uh oh...it could also be shrinkage or other heat-deformation. I might be doomed.)
Also, I just realized that bending acrylic must be a technique used in industry (and art?). I should google around to see what I find. (I did that before I started, but more from the point of view of parabolas and less from the point of view of general acrylic forming.) (Update: Heh. Sounds like this guy had the exact same problem I'm having, 40 years ago. (picture caption, 2nd paragraph))
It's also possible I'm being a perfectionist. I'm going to have a 1/2" copper pipe running where the focus is. As long as all the energy hits the pipe, it isn't vital that it be pinpoint focus. Still, it's annoying that a thrown-together-in-5-minutes nail version performs so much better. It seems like I must be missing some really simple thing.
I actually do have an entirely different approach in the back of my mind. No oven needed at all...
Not only do I work in the basement of my building and not only are there lots of computers (and thus lots of AC) but one of the AC vents is right above my desk. Oh and of course I sit still all day. So I get cold hands. More specifically, I get a cold mouse hand.
The obvious1 solution to this problem is a heated mouse. Google can tell you this isn't a new idea but google can't tell you where to actually buy one. The only place that sold them is now dead and in any case seems to have been a scam. People didn't get their shipments or they did but the contents either failed to work as heaters or failed to work as mice.
But this can't be complicated. USB is a powered connection, meaning that a mouse can get power from the computer. If it can draw enough, it can run a tiny heater. As a matter of fact, the USB spec says that a device can draw up to 500mA at 5V, which is 2.5 watts. That's not a lot of heat, but if you were holding it literally in the palm of your hand I thought it might be enough to ward off pneumonia.
USB optical mouse and resistance wire from hair dryer.
Entire inside of optical mouse, USB cable unplugged from board. Red/black are power, don't mess with the other wires (data).
(I really should have photographed this entire build, but I was feeling my way through and didn't want to waste time with a bunch of dead ends.)
The first thing was to get a USB optical mouse. USB for the power, optical to have plenty of space inside. I had one lying around. Then I needed a way to turn electricity to heat. Resistance wire out of a trashed hair dryer turned out to be perfect. Around 3" of wire (coiled length), coated with liquid insulation, provides ~20 ohms of resistance. That draws about 250mA, providing around 125mW of heat. (I stayed well below the spec just in case, plus the mouse itself needs 100mA, according to the label.)
The rest was just a bunch of boring details. How to keep the heater wire inside the mouse. How to attach the power to the coil. How to get the mouse back together. Thinking about safety. Like, am I going to burn down the building? I don't think so...
Does it work? I've got it plugged in right now and it's working great. Works fine as a mouse (didn't even have to reboot, even though I switched from PS/2 to USB) and as a heater (I switched because my hand was cold and now I'm comfy).
I'd say the only problem is that the heat is applied more towards the palm when it needs to be more towards the fingers. It works as-is, but maybe I could uncoil the resistance wire and spread it out a little more around the inside of the mouse to hit all the areas.