- - made a delicious quiche from scratch
- - replaced the battery in an iPhone
- - replaced the screen in an iPhone
- - replaced the screen in an HTC Evo
- - dismantled, repaired, and remantled(?) the dishwasher
- - mocked up a pattern in Illustrator for an argyle patterned crochet hat
12.09.2012
Master of None
11.01.2011
Black Market iPhone Charger
Have you ever tried to charge your iPod or iPhone with something other than the included charging cable? Then you might have seen this dreaded message:
How does it know? What's special about the Apple USB charger? Doesn't the U in USB mean Universal? Well, yes it does. But for some reason Apple doesn't want just anyone making (or making money from) an iPod/iPhone charger. That's why recent versions of their products don't work with any old charger.
Well fuck them.
Actually, I really like Apple and their products, except for the "non user-serviceable" attitude they have. You can't swap your own battery. You can't modify the hardware in any way without voiding the warranty. Well, I never use warranties anyways.
So here's the deal. I needed a charger for my car. I already have a 5V power supply that is providing in excess of 1A. I just need to be able to put the iPhone into high amperage charging mode and trick it into thinking there is a legit Apple charger doing the charging. The way to do this is kind of sneaky.
USB has only 4 wires. Two for power (a 5V and a ground) and two for data (D- and D+). With any standard USB device, you should just be able to power it with the two power wires. You can leave the data wires unattached.
But with a newer Apple device, if there is nothing on the data wires, then nothing happens! It won't charge! The power is there on the power wires, but your stuck up little iPhone scoffs at it. It can tell that you are using a non-Apple charger because Apple chargers sneakily put a small charge on the data wires.
To fake an Apple-supported wall charger, put 2.0V on D- and 2.8V on D+. To fake an Apple-supported computer charger, put 2.0V on both the D- and D+ wires. The distinction here is that the wall-charger will draw a full amp or more, whereas the computer charger will only draw half an amp, to adhere to the USB spec.
So I went to Fry's to get some resistors and a female USB port and was in business.
Materials used
- 24 hour fitness membership card
- 2x 51K Ohm resistors
- 1x 47K Ohm resistor
- 1x 75K Ohm resistor
- solder
- electrical tape
- female port from a usb extender
- wire
Tools used
- drill
- soldering iron
- wire cutters/strippers
- voltmeter
- The Internet
First, I drew out a schematic. It's not very complex, but it was fun flashing back to high school AP physics!
Then I drilled a bunch of holes into my 24 hour fitness card and started soldering and taping. Here's the finished product:
This is now tucked away behind my dashboard, powering my iPhone every time I plug it in, without having to buy a special charging cable.
References:
USB connector pinout
iPhone dock connector pinout
Resistors on the D-/D+ USB pins for iPhone
MintyBoost! (provided much background information for these types of hacks)
MintyBoost! video teardown of charger
Resistor band color guide
Apple's own documentation regarding power through USB
10.24.2011
Arduino Development Challenges
Here is a snippet of code from a sample Arduino sketch I've been toying with:
TCCR2A = (TCCR2A | _BV(COM2A1)) & ~_BV(COM2A0);
TCCR2A &= ~(_BV(COM2B1) | _BV(COM2B0));
What... the... fuck? The only thing I remotely recognize are the operators - and even those are all scary and bit-wise. TCCR2A, _BV(), COM2A1... what are these things? They are certainly not defined anywhere in this sketch. Nor are they it defined in any of the manually linked files or libraries. To me, this exemplifies that the hardest part about learning an entirely new vertical system at once is not knowing at what level constructs live.
Now, I do know what this code is supposed to be doing. It's commented rather well, actually. And looking at it alongside the Arduino datasheet I can tell the what. But I need to know the how. It's like being able to understand pre-made sentences in a foreign language, but not being able to create your own. In order to form my own, I need to know what each part does.
TCCR2A
Let's start with what it is supposed to be doing. It's supposed to be setting the Compare Output Mode (COM) on Timer 2, by setting the appropriate COM bits in the TCCR2A register. The TCCR2A register, like many on the Arduino, is an 8 bit bitmask. It look like this:
TCCR2A
bit| name | explanation
---+--------+-------------------------
7 | COM2A1 | Compare Output Mode A
6 | COM2A0 | Compare Output Mode A
5 | COM2B1 | Compare Output Mode B
4 | COM2B0 | Compare Output Mode B
3 | - | reserved
2 | - | reserved
1 | WGM21 | Waveform Generation Mode
0 | WGM20 | Waveform Generation Mode
The first thing to understand is that the names of all the Arduino registers (TCCR2A, TCCR2B, and about 90 others) are global, read-write variables containing the bitmask value in the register. On bootup, when all the bits in TCCR2A are set to 0, the value of TCCR2A is B00000000 (that's Arduino shorthand for binary 0). And at any time in your sketch you can set TCCR2A = B01010101 or whatever you want. TCCR2A is defined as:
#define TCCR2A _SFR_MEM8(0xB0)
_BV()
_BV() is defined in sfr_defs.h:
#define _BV(bit) (1 << (bit))
OK, so bitwise-shift a 1 a certain number of positions to the left. I get it on a technical level, but it doesn't make sense to me yet on a conceptual level. Especially not knowing exactly what types of values are typically passed it (the name of the argument - bit - implies some meaning there...)
By the way, the accepted mnemonic is "Bit Value".
COM2A0 and the rest
The answer that took me the longest to grok was this: the names of the bits (COM2A1, COM2A0, etc.) are NOT defined variables for the values of those bits. They are instead constants which contain the bit's location relative to the byte in which they reside. In other words:
#define COM2B0 4
#define COM2B1 5
#define COM2A0 6
#define COM2A1 7
Putting it all together
Now back to the sample code I'm trying to understand:
TCCR2A = (TCCR2A | _BV(COM2A1)) & ~_BV(COM2A0);
TCCR2A &= ~(_BV(COM2B1) | _BV(COM2B0));
AHA! To set the COM2A1 bit to ON (what it actually does is unimportant to this post), you shift an 'ON' bit (a one) left by the correct number of positions (7) and then bitwise-or it onto the byte!
TCCR2A |= _BV(COM2A1) // turn ON the COM2A1 bit
And to set the COM2A0 bit to OFF, you start the same way (in this case shifting a one 6 bits to the left) but negate it and bitwise-and it onto the byte!
TCCR2A &= ~_BV(COM2A0) // turn OFF the COM2A0 bit
What a trip. I'm still trying to think of whether I like this notation or not. Most of the alternatives I can come up with each have their own faults. This method is at least fairly self-documenting once you know it.
References:
grep define /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/options/gcc-version/include/avr/iom328p.h | less
http://www.arcfn.com/2009/07/secrets-of-arduino-pwm.html
http://smacula.blogspot.com/2011/04/creating-variable-frequency-pwm-output.html
10.18.2011
Arduino - Day 1
All the Arduino came with is the board itself. (It was prebuilt; I didn't need to assemble/solder it together.) Luckily I have a box of electonic odds and ends to pick through.
First up, I found a USB A to B cable from who knows what - an old printer maybe. This is essential to powering the Arduino and being able to execute code on it.
Then I took apart a cheap headlamp (I think I bought a 3-pack for $10 at Home Depot during the great San Diego blackout of 2011). I was able to salvage 5 white LEDs, a few bits of wire, a momentary switch, and a possibly useful 3xAAA battery harness.
Lastly I found an old cell phone - we're talking an LG clamshell design from 2000 or so.
I've never taken apart this phone before, but I was able to take out the speaker and vibrating motor, identify which was which, and hook them up to an external power source without blowing them up.
I also have a handful of resistors, a few spools of wire, wire cutters, soldering iron and solder, and a multimeter. And who knows what else lying around in the closet that I can dissect tomorrow.
With these scavenged components, here's what I was able to do so far today:
- install Arduino IDE and test the board
- blink a single LED
- 5 LED array that flashes a static pattern (1-2-3-4-5-4-3-2-1-2-3-4-5-4-3-2-1...)
- 5 LED binary counter with button. When you click the button it increments the counter. When you hold the button it resets the counter.
- hook up the speaker and play an 8-bit "shave-and-a-haircut"
- button and speaker: click the button to hear a square wave, release for silence, hold the button to cycle up and down in frequency
- convert an audio file to 8bit 8k PCM unsigned wav, load it on the Arduino, and play it (!!!!)
- hook up the vibrating motor to the switch
These things feel like magic. I love being able to understand the whole process vertically: both the down and dirty electronics and the software. That I can hook up a bunch of wires, write a bunch of numbers to flash memory, press a button that I wired and have recognizeable sound come out of a speaker.... is invigorating.
I already know what big project I want to work towards and that's what is steering my exploration. But at this point, this tinkering process is such a good learning tool. Just today I've learned so much about the Processing language, the Arduino platform, electronics components and theory, and a few mac and unix goodies (ffmpeg conversion, editing and cat'ing a wav header onto a headerless chunk of wav data... ) This is fun :)
8.22.2011
Rocky's Wild Ride
Dearest OTR,
Congratulations on winning your tournament!
btw I stole your otter.
Please know that the last thing I want to do is harm a pretty little pink hair on her body. However, returning Rocky to safety will come at a price. I have 4 simple demands that will return Rocky to you in good health. Please take a picture of these demands and post them on this page to prove you are serious about her return. They are the following:
1) Have everyone on OTR friend request me.
2) A picture of Pumba wearing a dress. (Heels as well if you can find them in his size.)
3) Brett wearing the t-shirt that will be provided for him at the DUDE tournament on Saturday for no shorter length than one point.
4) Have K-Na perform a "K-Nasty rap" and post the Youtube link on this page. (Rocky will be returned faster if she looks ghetto. We're talking bandaid under the eye status.)
These are my demands. You have one week to complete. Once all photos and videos are posted on facebook, I will have Rocky the Otter dropped off at a specified location. I will send you a message of where and when. Thank you for your cooperation. Do not contact the authorities or Rocky gets it. - The Otter ThiefWe assume it's someone from our friendly rival San Diego team Milkshake. I immediately suspect Karen and Paul, with possible involvement from Lemos, Bunk, Tracey, Aiza, or Darin. There is an initial flurry of emails to our mailing list as we try to wrap our heads around what has happened, and try to get everyone to friend the proper page on facebook to satisfy the first demand.
So this time I go back, feed the dogs some ham (c'mon, we've all seen heist movies before), crawl in through the doggy door, and search their apartment. The stove is not a match, and there is no otter to be found.I have it on good authority that they are both at work today. and also, that their dogs are easily distracted by ham.
I have it on good authority that Karen also likes hamI giggle. Pebbles comes through with Karen's address. I can't get into her house, but I can peek in the windows and see her stove. She's clean. The whole team has been following my progress on the mailing list, and providing motivation and help. They've been emailing me addresses for these houses, offering to call people's workplace to make sure they are at work (and not at home). Now I have to head home and have to face facts that, again, I'm out of options.
Bunk has moved in the past couple months. Facebook pic might be his old one.I check the uploaded date on Bunk's house pictures. They were uploaded about a year ago. That means that if Bunk moved recently, the pictures I had been using for his place are way out of date. That means that he lives somewhere else now. That means.... that I almost broke into some random person's apartment earlier today. Wow.
I need a big favor ASAP. Do you know Bunk enough to text him and ask for his address so you can send him a postcard?Within 10 minutes I have Bunk's current address in PB. It's getting late in the afternoon. There's a party later that night that I know Bunk will be at, so the backup plan is to try to get his keys from him at the party and then go back to his house. But first, I want to try to get in there NOW.
8.16.2010
Time Machine backups over network share
Most pages that come up when google researching tell you to...
1) enable unsupported drives with
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
2) create a sparsebundle locally
3) copy it to your network share
...but forget the last crucial step:
In the root of the sparsebundle, create a file com.apple.TimeMachine.MachineID.plist containing:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.backupd.HostUUID</key>
<string>YOURUUIDHERE</string>
</dict>
</plist>
where YOURUUIDHERE is a string containing dashes which can be obtained from
> system_profiler | grep UUID
I could have saved myself a lot of hours of frustration if I could have found this link more easily. The bash script hosted there in particular works wonders. With this knowledge I was able to change an existing Time Machine backup's UUID to match that of my current machine and get into the backup to restore files. I can't explain how happy I am about that.
7.11.2010
Karma
I live in my car. I was robbed of thousands of dollars worth of stuff. I got a speeding ticket. I'm more and more frequently getting woken up at some ungodly hour and told to "move along".
A friend of mine said to me "You are so due for a good week".
Due? Karma? Nonsense. At least I hope its nonsense because otherwise I'm due for something horrible.
I live in San Diego, the city of constant 70 degree weather. I have a job that pays well and challenges me. Twice a week I get to do my two favorite things in the world (play ultimate and karaoke). I travel often. I had an amazing weekend at Potlatch. I have awesome hair. I meet interesting new people all the time. I have two coasts worth of friends who love me and care about me. I'm in great shape.
How awesome do I feel? How good do I have it? If I believed in karma, I'd be walking around in a helmet and a full body, flame retardant, protective suit.
With a parachute.