Monday, April 23, 2012

Steampunk Photo Cube Lamp

A little over a year ago a friend of mine saw This Instructable for the “Architectonic Photo Cube” and I offered to build it for her if she ordered the pictures printed to glass. That was not long after we had moved and what with life in general the pictures sat here for a year before I got around to putting them together. I decided to use brass fittings rather than the standard zinc plated and build a nice oak/brass base for the lamp. Since she had waited so long I spent some extra effort on the switch putting in a little knife switch to control the lamp and since it had a second position that would have been boring as just “still off” I put a Candle Flicker LED on the second position so that the lamp can be operated in either lamp mode, or candle mode.


Assembling the photo plates I did pretty much according to the instructable. They look really nice in brass. The corner braces that I got in brass were larger 2” than the ones called for in the instructable so my angle brackers are closer together in the middle a bit, but it wasn’t a problem and looks just as good.






The springs are completely decorative and serve no purpose other than decoration. I was thinking I’d have to wind some copper coils to make them look good against the brass, but I just bought a couple of packs of assorted springs at HD and they were enough to fit. I might have gotten shorter screws than these too as the whole thing is rather more spiky than it technically needs to be but it’s still a stylistic approach.

The base is cut from a piece of 3/4 oak with oak molding around the bottom piece and the top piece has a small routed ogee at the top. The bottom has a cutout under the top part to fit the electronics.


This is a 7 watt Phillips LEd bulb, but we ultimately went with a 3 watt one to just illuminate the photos without trying to actually cast light, it was a better look. The 10mm candle flicker LED is also visible in this picture as well as the brass shelf brackets that I used to hold the top in place. Since the angle brackets I used were 2” ones the tab from those brackets fits perfectly between the nuts on the bottom 2 screws and do an excellent job of holding it to the base but still allowing you to easily lift it off to turn around to show the other pictures.


The corners I used these brass corner brackets that are also just available at HD, they are supposed to go on the top of a box, but I thought they looked cool on the bottom of this where they sort of overhang the curve of the molding. Underneath them is just a regular stick on plastic non-slip foot thing to raise it up enough for the cord to get out.


The control system required some extra parts to make the knife switch safe, obviously you can’t put the 120v for the light through the knife switch. That black box there is a little 6v power supply that I just soldered to the power plug directly. That is that runs to the knife switch and powers the candle flicker LED. When the switch is in the other position it turns on a Solid State Relay that isolates the knife switch from the mains power needed for the LED bulb. I considered building a custom LED array to light it all from low voltage, but this offers more options for lighting and was actually much simpler.  The 6v power supply there is just slightly too tall to fit glued in there with a cover over the entire assembly so I made a cutout for it. I could have dremeled or notched the bottom of the plate to cover it completely but I had made enough sawdust at this point and needed to finish the product ;) There are no exposed high voltage wires inside there even if little fingers should turn the lamp over and poke around.



See how well the brass shelf supports fit between the angle bracket screws. Measuring for where to drill the holes was tricky as the offset of the shelf supports was 3/8” and my table saw has come out of alignment a bit so that piece wasn’t quite square and the routed profile meant getting a measurement to the actual edge was a pain. But it’s close enough to centered that it looks fine unless you attack it with a ruler.


The cord completes the steampunk/vintage feel of the thing. Ordered a spool of absolutely beautiful fabric woven wire from Sundial Wire.


In the dark my camera made it look more like a steampunk nuclear reactor ;)

Wednesday, April 18, 2012

Resurrecting a Dead MacBook Pro

Seeing as how I collect all expired things Apple I came into possession of a “dead” MacBook pro of the generation prior to the new unibody construction. It had suffered the all too common malady that befalls that model of a dead video system on the motherboard. Being so completely out of warranty the owner opted to buy a new one rather than get it fixed. It gathered dust on my shelf here till I decided that I really wanted another machine here to run some monitoring software in the background for things.

The way the problem manifests is that the screen turns on at reboot and you see the grey apple display that usually precedes loading. The aspect ratio is off though, the apple is stretched side to side. If you see that then you know that as soon as the OS is loaded the screen will go dark. You cannot make the internal display nor the external DVI port support a monitor after that.

Being very clever, I thought, I purchased one of the USB/DVI adaptors that advertise Mac driver support. The one I’ve got is as “HIS MultiView II” that I purchased from newegg for just over $50. A small price to pay if it got this machine working again. The display driver worked great on my main machine in testing. Now all I had to do was get the old Mac booted again, which is patently refused to do.

I had discarded the battery for it at some point, most macbooks will boot without a battery but I read other accounts that said it sometimes just wont come to life without a battery. I ordered it a $27 replacement one from eBay.

In the meantime it occurred to me that the motherboard battery might be dead too and that might be while it refused to boot. Removing the motherboard battery on this model isn’t that hard, just have to remove the DVD drive and it’s right under there. I tested it at 2.8v which is low, but not dead. It was old though so I ordered a replacement (not an apple replacement, but just the 2032 liion coin cell with solder tabs. so it only cost $5 not $35 with the apple connector, I will salvage the connector from the old one when it arrives) but being impatient I connected my bench supply to the battery connections to try to power up the macbook with that and see if it would wake up, it refused to boot that way either.

The new main battery arrived and the machine booted right up. Even without the motherboard battery installed. Firstly I booted it into target disk mode, and then setup my wifes older generation unibody mac to boot from it’s drive. that way I could run updates on it, install the drivers for the USB video device and make sure that screen sharing was on so that if it was totally dark and nothing working I could still connect to it and control it.

When that was done I connected the USB device and rebooted it as itself and it all came up fine. And it ALL came up fine, even the internal video. The USb video worked fine too, but the internal was working. Run more updates, reboot, video still working. Install OS update, run all updates, reboot half a dozen times and each time the internal video kept working.

It’s possible it’s just messing with me and at the next reboot the internal video will die again, or it’s possible that not having a motherboard battery does something to it, or it’s possible that the install of the USB video drivers did something to it. But for the moment it’s working and that makes me happy. When the replacement mother board battery arrives I’ll install it and see if things change.

update: half a dozen more restarts later and the internal video continues to work. I’ve updated it to lion and run all the other updates since and it just keeps working.

update again (5/2/12) alas, good things cannot last forever and this morning it refused to wake from sleep. Upon restart it was dark again.  However, I plugged in the USB adaptor and that is working fine. It does really work the processor pretty hard though so the fan is blasting at high speed while I watch the stock charts, I’ll need to get it a fan to sit on.

Tuesday, April 17, 2012

IRS regulation scandal clearly demonstrates the problem

This is a blog about things that I make, but I’ve recently become aware of an example of how governmental regulation leads to monopolies that harm the public so perfect that I feel the need to write about it.

This is a truism:

“If you give the government the power to regulate a thing, that regulation is then for sale to the highest bidder, always and without exception.”


The current action at the IRS shows how this works. The only reason that you and I even know about it is that there is a real legal problem with their writing their own regulation. They aren’t granted the power to regulate themselves so it opens the possibility of their actions being stopped by lawsuit. We might also see congress grant them that right and then all bets are off. It’s going to be very interesting to watch.

Here’s whats happened as best as I understand it: H&R Block went to the IRS and “helped” them to come up with the idea that tax preparers need more education and oversight. Well.. nothing obviously wrong with that, our tax system is the most complicated part of our entire government and it’s actually impossible to file your taxes properly, any 2 auditors will come up with 2 different amounts that you actually owe. So the more training the better.

The consequences of this are that the independent tax preparer, of which there are around 100k in the US give or take, needs to take classes regularly and take tests to prove they are able to actually do your taxes. The cost of doing this, of course, is passed on to you when you hire them. Well thats OK you think, it is protecting me from people that don’t know how to do my taxes! The cost of preparing your taxes will more than double because of this.

Here’s the interesting bit though, H&R Block suggests to the IRS that well... if you’re supervised by a CPA then you don’t need to do this. This is the kicker, the dreaded “Grandfather clause” that exempts the monopolistic company that sponsored the legislation from it’s effects. This will eliminate the competitiveness of virtually every independent tax preparer without costing the big corporate ones another dime. Their prices can stay the same while they have effectively doubled the overhead for everyone not affiliated with one of the corporations.

This is truly a classic example of how this is done in every other agency. We begin with the idea that we need to regulate something to protect us and instead it gives the government the power to sell monopolies to the highest bidder. There is not a single agency, no matter how sacred to you, that is immune to this. The Coal and Oil magnates supported the EPA and the NRC in order that nuclear power could be regulated to the point where it cannot compete with them, all the while getting their own emissions of radiation up their smoke stacks classified as “naturally occurring” and therefore not subject to regulation. BRILLIANT! (factoid for another post: the amount of uranium that goes into the air as particulate emissions from coal plants in the US is greater than the total amount of uranium mined for use in our powerplants each year, but nobody is scared to death of dying from that, even though they actually DO)

Three letter agencies began because we wanted to do good are now used for evil. This happens ALL the time. If you see abuse by a monopoly or enormous corporation that there is no competition for (hello health care insurance) it’s because that company has been allowed to draft it’s own regulation and exempt itself so that nobody can challenge it. Why would ANYBODY buy health care insurance with the power they have over you if you didn’t have to? No, you’d search around until you found one that covered you for the amounts and the things that concern you. The reason you can’t do this is because the government doesn’t allow just any insurance company to go into this business. The health insurance problem in this country was caused by government regulation in the first place, adding thousands more pages of it in the form of price fixing will not solve it. (while our government seems to have failed jr high school civics class I remember the chapter on governmental price fixing and how it’s always a failure leading to higher prices or lack of availability hurting the very people it was supposed to protect.)

When someone calls for the downsizing of the EPA or the FDA they are not trying to leave you out in the cold to be victimized by hugely powerful corporations. They are trying to save you from that, that is where you already are because of the actions of those groups. The solution is to scale back, or remove entirely the governments power to regulate some things.

Or my personal favorite, a constitutional amendment that says “NO GRANDFATHER CLAUSES” if a law is important enough to pass it is important enough to apply to everyone equally. Nobody gets a pass.

And now back to making stuff, there will be no comments on this post, teh intertubes are full of angry people.

Saturday, April 14, 2012

how NOT to update the paths to files in your iTunes library

learn from my mistakes...

I have many kids movies and tv shows in my iTunes library for playing on the apple tv and the iPads for the kids to watch on car trips and such. Years ago I moved it to a portable external drive. I recently outgrew that drive and purchased a new, shiny 1.5TB firewire 2 drive. I copied all the original ones over and then was faced with the problem of how to get iTunes to realize that all the moves had moved. I only ever stored movies on the external drive, all my music and other things I keep internal to the macbook.

You can do this easily enough by just turning on and off the checkbox in the preferences for when to copy items into the itunes folder. Turn it off when dragging in a movie and back on for everything else. For purchased movies you have to move them in the finder and then delete and re-add them from iTunes, which is more steps but I dont purchase movies that often so it’s hardly a handicap.

But then you can’t just copy they whole iTunes library from one device to another, you need to be able to move parts of it around and there doesn’t seem to be a way to batch change the paths.

When I undertook the exercise I thought that I would just delete them all from the database and then drag them back in from the external drive and re-organize them. This is what I SHOULD have done. Instead I went searching around the internet and found other people in similar situations that had edited the iTunes.xml file that stores the information. I opened this up in BBEdit and was able to see all the old paths and easily do a replace to put in the path to the new drive.

However, iTunes doesn’t normally read that XML file, it normally uses a binary database file in the same folder that ends with “.its” and so you have to delete that to force it to rebuild it with the new path information. I did this and restarted iTunes (after making backups of course, which come to think of it I should have just immediately put back)

iTunes chewed on that for quite some time and then it all came up and the movies played from the new drive fine. I didn’t immediately notice all the other things that had gotten broken.

iTunes no longer knew about any of my iOS apps, it wanted to downloaded purchased items from my phone and proceded to do so for ALL the apps I had ever purchased. It has also lost all my podcast subscriptions which I will be rebuilding next.

So when searching for info on how to move portions of your iTunes folder, think twice before deleting the its file and making it rebuild it from the XML as it appears that not all the information is actually stored in the xml file.

Not a disaster as things go, nothing was actually lost, just making more work for myself by trying to reduce the work for myself ;) Which is pretty par for the course on a normal day!

MORE INFO as of 4/16: Got tired of trying to get everything back and restored backups of my iTunes library. Spent quite a bit of time investigating applescript methods of updating some of the location paths before I discovered that iTunes actually has built in ability to fix this itself. After locating one of the moved files it asks you if you’d like to use that new location to try to find others. Never noticed that before ;) And it did find all the other moved files on the new disk. So we’re all back to normal now and while I’ll never get those hours wasted back I have a much deeper understanding of iTunes applescript dictionary now which I’m sure will come in handy someday.

Wednesday, April 11, 2012

EMSL Alpha Clock and XTension

I finished this terrific kit a while ago and wrote a blog post about connecting it’s serial port to an xBee radio. I meant to post code snippets and instructions but got mired up after using some of the other digital IO on the xbee for LED’s I evidently hosed something up on the breakout board. I’ve got it sorted out again so here’s the rest.

This is the wonderful Alpha Clock 5 from evilmadscience.com:


the fun part about those gigantic LED displays is that they are alpha numeric, and the clock has a serial port to which you can send text.


You could connect to this in many ways, bit I chose to use an xBee radio since I am working on support for them in XTension at the moment. The serial ports on the xBee as well as control of the IO are available to apple script in XTension and makes for easy wireless displays. The board I originally used was the plain one from sparkfun, no components other than the sockets for the xBee that bring them out to easier to manage solder pads. I must have overheated the pin to a socket or filled one with solder or shorted them internally or something as it stopped delivering any power at all to the xBee at some point while I was adding the extra display LEDs. I have now replaced it with an xBee breakout from adafruit that is working wonderfully. It also properly handles level shifting the serial port which is at 3v level from the xBee and 5v level on the clock board. I’m not sure if this is really all that important or not, SOME of the xBee documentation talks about the serial lines being 5v tolerant, but others demand that it’s vital. In any case I’ve got that working now and it has an on board 3v regulator so I was able to simplify the internal wiring and reduce some of the extra clutter of wires. (the clock throughout all this mucking about with the xBee continued to tell the time wonderfully and accurately ;)



There is the xBee on it’s new adafruit breakout board. For the serial to send messages to the clock only 3 connections are necessary. 5v, gnd and tx from the xBee connected to rx on the clock. Extra solder points for all those things are already on the clock board making it even easier.


the red black and blue wires are all thats necessary to turn it into a remote display to XTension. But now you’ve got all these unused pins on the xBee that are just going to waste! I plan to use this in the bedroom for a subtle display of alarm or other status during the night while not being too obtrusive. The clock already displays zone alarm info for me from XTension, but I wanted some bright LED’s to get my attention to various things. I added 3 bright colored led’s and one candle flicker led so that I could remote control an electric candle next to the clock just for fun ;)


The LED’s were just solder art, no boards or anything, grounds of the 3 extra bright ones are tied together and the Vcc sides have resisters under the heatshrink for the 3.3 volts that comes out of the xBee. The larger flicker led is on a long twisted pair of wire wrap wire so that it can more easily be snuck up to the candle I plan to drop it into.


Once back together I just mounted the xBee to the bottom of the case where it is quite happy to receive signals from the computer upstairs.


The LED’s I just hot glued to the back center of the case so that they would not be visible but would wall wash the wall when turned on.


There’s the clock where it lives on a shelf in my bedroom displaying an alarm zone message, and you can see the little wire running up to the candle. 


The RED alert LED while displaying the time.


The green LED and the candle flicker LED are on in this pic.

In XTension the serial port for each xBee radio is brought out to a local TCP port on the computer to which anything can connect. For myself I’m using applescripts inside of XTension that can be run in response to motion or alarm zone changes. The clock is quite capable of displaying scrolling messages if you handle that on the sender side, but I’m not bothering with that yet, sitting there while a long message scrolls across is not really conducive to getting a quick but of info about activity around the house. Though I may do something soon with a button that causes it to show outdoor temperature and perhaps scroll a short display of weather forecast.

In XTension I created a DIY interface to connect to the serial port and give me access to send data to the clock. The DIY interface is called “bedroom clock” so that I can talk to it by name elsewhere. In my Attachments Script I created some handlers to call to send messages or clear the clock. Here’s the snippet for sending a message to the clock and then having it clear after a certain amount of time:

on WriteToBedroomClock(TheMessage, TheTimeout)
--send the command init string
send data bytes {"&hFF"} interface "bedroom clock"
set s to PadClockString(TheMessage) & "     "
send data "A0" interface "bedroom clock"
send data s interface "bedroom clock"
try
suspend event “Clear Bedroom Clock" for TheTimeout
on error
execute script “Clear Bedroom Clock" in TheTimeout
end try
end WriteToBedroomClock



on PadClockString(TheString)
set w to (TheString as string)
repeat
if (count of w) is less than 5 then
set w to w & " "
else
return w
end if
end repeat
end PadClockString

You can make the call to WriteToBedroomClock( “ALARM”, 5) from anywhere else in the program or externally from anything else via a tell app block. This does not validate that only 5 characters are sent, but if fewer are sent it properly pads them out, the second parameter is the timeout or how long to show the message before it returns to showing the time.

You’ll also need to create a global script called “Clear Bedroom Clock” for this to call after the timeout period. Something like this:

send data bytes {"&hff"} interface "bedroom clock"
send data "MT          " interface "bedroom clock"


thats all thats necessary to make the Alpha Clock display messages, but it has other features as well. Here is some rather odd code to set the time from AppleScript, you have to get a unix date number which turns out to be harder in AppleScript than I imagined. There is no simple way to get the underlying date as a raw number! I searched around until I found someone who had done so by coercing it first through miles and then to a number. Go figure.

  set theNumber to (((current date) - (date ("1/1/1970")) - (time to GMT)) - (4 * hours)) as miles as string


  write log "unix date is: " & theNumber
  send data bytes {"&hFF"} interface "bedroom clock"
  send data "ST" & theNumber interface "bedroom clock"
  write log "bedroom time set"

Create that in a global script and run it whenever necessary, I run it nightly but the clock is very accurate thanks to that chronodot. Notice the end of that first line in that script -(4 * hours) I had to add as that was how many hours off the time was after running the script. I think that (time to GMT) may not be working correctly either because my computer has something setup goofy or perhaps it just doesn’t work I dont know but be prepared to change that as necessary to make it set the proper time in your zone.

More info on the serial protocol for talking to the alpha clock 5 is available on the evil mad science wiki.

Next project will be connecting up this touch sensor so that a gentle brush to the top of the clock displays temperature and weather info :)



.code { background:#f5f8fa; background-repeat:no-repeat; border: solid #5C7B90; border-width: 1px 1px 1px 20px; color: #000000; font: 13px 'Courier New', Courier, monospace; line-height: 16px; margin: 10px 0 10px 10px; max-height: 200px; min-height: 16px; overflow: auto; padding: 28px 10px 10px; width: 90%; } .code:hover { background-repeat:no-repeat; }