[Music]
welcome back everyone it's fantastic to
see standing room only for our final
speaker it's a real treat having him
here who can say that they've built
their own iPhone our next speaker can
and not only did to build his own iPhone
he went down the rabbit hole and figured
out how to add the coveted headphone
jack back to the iPhone 7 a compelling
story he shared with us with the world
on his YouTube channel strange parts his
background is in software engineering
and he now describes himself among other
things as a nomadic hacker to guide us
through the unlimited parts market of
Shenzhen and the vast sourcing and
repair expertise of the people found
there please welcome to the Hackett a
super conference stage Scottie Allen
hi everybody
as as Mike said I've spent a bunch of
time in Shenzhen China on some amazing
adventures in the electronics markets
and the cellphone markets I've spent on
and off about the past two years there
and I'm gonna be talking about the two
projects that Mike mentioned building my
own iPhone from parts that I bought in
the markets and then adding a headphone
jack to an iPhone 7 and while I want to
talk specifically about what I did I
also want to give you a flavor of what
Shenzhen is like for hackers I really
consider it the the heart of the
electronics manufacturing world right
now
tons of consumer electronics are
assembled there it's very possible you
have a device that was made there a lot
of the iPhone and iPads had been
manufactured there though that's
starting to move around a little bit um
it's Shenzhen as a city is just across
the border from Hong Kong and it was the
first place that the Chinese government
experimented with the idea of capitalism
and opening itself up to the rest of the
world and so they created this special
economic zone in Shenzhen to to allow
sort of trade external trade and
allowing people to create businesses and
so what that's meant is incredible
growth from 1980 to 2015 Shenzhen went
from a sleepy fishing village of 30,000
people to a metropolis of 18 million and
so this is incredible and it means the
entire city is brand-new and nobody's
from there everybody's there to seek
their fortune it's just got this
incredible energy and this sort of
relentless force of progress this is the
part of the city where I typically stay
this is Fujian it's kind of smack in the
middle of the city it's downtown the
area in red here is hua Shan Bay which
is the area that has the wholesale
electronic markets it's about 10 to 20
big buildings and it's the largest
wholesale electronics markets in the
world um so I was there too
I
only came to explore the markets explore
the manufacturing scene understand what
that meant specifically for myself as a
hobbyist and I was hanging out with lots
of open-source Hardware hackers and we
were hanging out one night at Street
barbecue drinking beer and someone said
you know I've been walking through all
these cellphone parts markets and I see
all these screens and batteries and cell
phone parts I wonder if you could make
your own phone from parts that you
bought in the market and so this set set
me off on this amazing adventure to see
could I could I build my own phone and
so some of you may have seen the video
that I made about this adventure but for
those that haven't I want to give you
just a quick overview of what that
involves and it turns out you really
only need four main parts to make a to
make a cell phone um first you get back
which is just the shell the case these
are some sort of typical looking iPhone
cases they're aluminum with sort of
isolation lines of plastic that isolate
the antennas um you can also get
non-standard looking backs so this is a
lime-green aluminum iPhone back red ones
this red one was out before apples
making red one so you can also get stuff
that's very much Chinese aesthetics a
gold is very popular and will run you
about 20 bucks to get a new looking one
batteries are really easy to find here
we're testing to make sure that the
battery is still holding a charge and is
good on a custom battery tester they
cost about five dollars which should
make you really angry if you've ever
paid to replace your iPhone battery it
makes me really angry screens I actually
went to a screen repair booth to have
them actually go through the process
that they would go through to repair a
screen to show all of the lamination
steps so here we actually started with a
working screen and tore it apart because
I couldn't source a working LCD on short
order this is a custom built heater bed
with a vacuum that holds the glass down
they just take it like a piece of piano
wire and slice the optically clear
adhesive that holds the glass on the
front of the LCD this is one of my
favorite tools it's a soldering iron
with a razor blade attached to the front
and they're slicing off the polarizer
here's putting on the new polarizer on
the front of the LCD and then he's
peeling off the plastic that's on the
already applied optical clear adhesive
and then he's gonna press it in a heat
press here to press it down and get it
all aligned there are custom jigs for
each model of phone that you can buy in
the markets and then it's really
important to remove all the air bubbles
with a vacuum and it's very cleverly
named they put it under a vacuum with
moderate heat for a few minutes and then
so this is the front after the whole
stack up in front of the LCD done no
bubbles next they flipped it over and
replaced the backlight and we could have
done all of these steps from scratch if
I'd been able to source an LCD in time
they they do exist it was just a matter
of getting one from a factory here we're
soldering on he's stuttering on the
backlight power supply and then finally
he's putting on our tester phone the
tester phones are a normal iPhone
without the screen and said they have a
flex cable that wraps around to the
front then they can plug in any random
screen and finally we're testing he's
testing for um dead spots on the
digitizer so they do that by holding
down one of the icons until they all
wiggle moving the icon around if the
icon drops they've got a dead spot in
the digitizer
he's just proving to me that it works to
show that he's done a good job lastly
you need a logic board these are a few
logic boards here this is sort of like
the the logic or the motherboard for a
PC this is the most complex part in the
phone these ones have holes drilled in
them I'm gonna talk about that right now
but haha these are scrapped in the
markets you can pull parts off them
these are the most complex part it's
also the most expensive part it makes up
the bulk of the cost of the phone I
thought that maybe I would be able to
solder my own logic board because you
can actually
by bare boards in the markets that have
not been assembled yet this was really
my first foray into surface mount
soldering and these are Oh 100 fives and
I realized after a couple of weeks that
I might be over my head I still think
it's possible but I haven't gone down
that rabbit hole much further so instead
I went to one of the markets and I
bought a refurbished logic board and
here she's putting a sticker over one of
the covers over some of the chips just
so that I don't so that she can tell if
I've tampered with it because she gives
me the standard market three day
warranty on parts which allows me to
take this used repaired logic board home
test it in my own setup make sure that
everything works properly and if not I
can bring it back and she'll repair it
or accept it for a refund I actually had
to do that there was a the compass chip
wasn't working properly I brought it
back no questions asked no receipts no
contracts it's just a handshake deal
that's been my experience of how the
markets work and people have been very
legit with me um finally here's a very
fast version that was tumbling the phone
there's a you can see there's a bunch
more parts but it's all like pretty much
brackets and screws and a couple flex
connectors and cameras and stuff so it
turns out like the hardest part of this
whole thing was the fact that I don't
speak Chinese very well and so it made
it really hard to find these parts in
the markets and once I figured out how
sort of everything was laid out in the
markets and I figured out which bleeds
to go to and what parts I needed and
sort of how commerce in the markets
worked to do it again would take me
maybe a day or two it would take me an
afternoon to source the parts and you
know a few hours to put it together and
so and the question everybody asks is
well how much does it cost it cost about
three hundred bucks to make a success at
the time it's about half of what it cost
to buy it retail at the time which makes
sense I mean this is fundamentally at
the end of the day a used phone a lot of
these parts specifically the logic board
which is sort of the you know the brains
of the phone and the most expensive part
that almost undoubtedly came out of a
phone might have been repaired so the
costs kind of all add up this is not a
great way to get a
really cheap cell phone if you just want
a cheap iPhone and go buy a used one but
it's a super interesting project to
understand both how does this ecosystem
work but also like what's going on
inside the phone and really get hands-on
and so I started asking okay like I've
done this I made this video a few people
watched it and we're really excited
about it what can I do narrow with all
this stuff that I've learned I have all
this access to parts and I have all this
access to manufacturing and so I started
thinking about well what can I do about
modifying the phone and while this was
all going on I had gone to the Apple
store in Hong Kong and I bought an
iPhone 7 because I wanted a better
camera because I was shooting a lot of
the videos I shot in the markets I just
thought of my cell phone and I in that
sort of the hectic the hacktivists of
releasing this video and buying the
phone and everything I had forgotten
legitimately forgotten that it didn't
have a headphone jack and I was kind of
annoyed and then I thought I wonder if I
could add my own and I didn't really
know but I figured that jen-jen was
probably the best place in the world to
try so this is what I originally thought
it was gonna look like I thought there's
no way I'm gonna be able to add this
headphone jack to the inside of the
phone so these are some of my initial
sketches I I just thought I was gonna
like make a new aluminum case like I
thought oh I'm you know I'll model this
case with all the like right screw bits
and whatnot and I'll take it to you know
one of the CNC mill places which are
cheap and quick they'll be able to mail
me a new case with this like bump on the
back to hold the the jack and then
whatever other electronics I need uh but
I didn't really want to crack open the
nice iPhone that I had just gotten from
the Hong Kong Apple store so I went and
got a used phone from the markets that
had been refurbished and I cracked it
open and I was I was like on camera
recording as I'm cracking this thing
open and I was fully prepared to say
into the camera see there's no space in
this phone like they put this part in
this in the space where the headphone
jack would be and then I cracked it open
and I started poking and I started
removing things and I realized that I
couldn't actually say that that what was
in that corner was just like a piece of
plastic and it just held down a connect
it didn't actually seem to be necessary
and so this is me on camera taking a 6s
Jack I'm going I think with a little bit
of shaving this down and moving a few
things around I think I could actually
just fit this Jack inside the phone and
so that like made this whole project a
lot more ambitious because now it was no
longer can I add a jack but can I add a
Jack inside the original case so the
first step was was to take a step back
and say okay like how can I get this to
work electrically uh you know ignoring
the mechanical piece um
I naively thought when I started that
maybe I would just find like a vestigial
audio connection from like the 6s audio
traces that came down into that bottom
flex connector from the logic board that
no such luck like of course they had
fully removed them I did not find that
so I figured I would go and get a bunch
of the headphone adapters that are the
Lightning 2 headphone adapter that you
get with your phone and here's me in the
in the Shenzhen Apple store asking for a
bunch of those they were very confused
as to why I wanted to buy like three and
five at a time and the plan was just to
wire these up to the back of the
Lightning jack I should also point out
there are a bunch of copies of these
lightning adapters that are much cheaper
that you can buy in the markets I tried
all of those I tried every one I could
get my hands on they're all crappy they
they all don't work and so I ended up
having to get the real ones um and so
the the plan was to like solder this to
the back of the Lightning jack and then
just sort of you know act as though it
had been plugged in but the problem with
that was that lightning it turns out is
is really a point-to-point protocol and
you can't have multiple things connected
to the same Lightning jack and I still
needed to be able to like charge the
phone and you know potentially
occasionally plug it into iTunes and
stuff so so I tried they have their
various like splitters Lightning
splitters which are really for the the
problem of like being able to listen to
music and charge your phone at the same
time um I tried them all in the markets
this is the only one that actually
worked
consistent
liyan well for all the features and then
the one from Belkin which Apple sells in
their stores um but I bought these and
crack them open and the boards inside
were huge there were just no way I was
gonna fit that into the phone and there
was tons of unlabeled chips and I wasn't
even able to reverse them and I thought
okay like that's not a path to success
here so um just to take a step back and
talk a little bit about what I know
about lightning that I've discovered in
the process this is the diagram of the
Lightning jack from Wikipedia it's
actually not fully accurate but there
are a couple things that are you
accurate on here and are worth pointing
out in my experiments I have never seen
anything happen with pin six through
eight I've never seen any signals on
there it's all one through five one is
ground five is the charge voltage when
you're charging the phone
four is used for setup when something is
first plugged into the jack and then two
and three actually run what looks like
USB to me once the connection is
established um but the first thing I
needed to do was just to be able to
start like sniffing that signal with a
logic analyzer or on Cilla scope and so
I needed a way to just hook up to that
electrically and this is what I first
started doing this is the back this is
the connector for the Lightning jack the
backside of it and I spent about ten
days learning how to do this this is
thirty AAG kynar and I'm soldering it on
to the back of each pin this was
excruciating I ended up having to buy
you know a reasonably decent binocular
microscope which was totally it's one of
the best tools I've ever purchased it
was like 300 bucks including the camera
in the markets it's no brand name but I
mean I've worked out with the seller
she's on Aliexpress now so I'll be
announcing how to get one of those if
you're interested microscopes are
awesome turns out this was kind of a
fool's errand because I later discovered
on one 688 which is like the Chinese
side of Tao bow or of Ali Ali Baba these
which are PCB pass-through adapters for
lightning so it's a PCB
on the end there and then there's a jack
on the other side and then the pads in
the middle allow you to tap signals you
can just solder on some like jsg
connectors and get access to that and so
I did that I used these a ton in this
project they were great they're like 2
bucks apiece and fantastic um this is a
trace of what it looks like on pin 4
when you first connect so so the blue
signal is when it drops low the phone to
text that something's been plugged in
and it starts sending sdq which is like
a a proprietary ti1 wire protocol it
starts streaming that out pin 4 and it
looks like to me that's sort of how it
initially figures out like what the heck
was plugged in and how do I talk to it
and then it switches over to usb on pins
2 & 3 however how does it detect when
something is first plugged in it turns
out that this is not an 8-pin connector
it's actually a 10 pin connector and the
two rectangles on either side are two
little prongs that touch the shield on
the the metal part of the Lightning
connector and those any-any plug for a
for a lightning cable shorts the the the
shielding to ground on pin 1 and so the
phone
it looks like sends out a little voltage
every I don't know 10 milliseconds I
think on those pins and when that's
shorted to ground then it sort of goes
through its initialization sequence that
took me several weeks to figure out I
could not figure out why all of the hand
wiring that I was doing what didn't seem
to be doing anything nothing would
connect and you have to you have to deal
with those shield pins um so the
question was like how can I switch this
right so the idea was I want to connect
the headphone adapter to the phone when
nothing is plugged into the jack and
then when something is plugged into the
jack I want to switch over and just have
the phone and talk to that so a friend
in Shenzhen recommended I look at USB
switch I see
and it turns out these are awesome and
they're super cheap and they can totally
switch lightning and USB so this is just
a like four pole double throw switch so
there's normally connected four pins
normally open four pins and then the
common lines they connect you with
bi-directional the in line is what
controls the switch when it's low it
connects the normal normally closed and
when it's high normally open um it also
has an enable/disable line which is
super useful that will disconnect
everything and I'll explain why that's
super important again the pins 2 & 4 2
through 4 and shield or the only pins
that matter so I only needed a 4-pole
switch I didn't need to worry about the
the charging pin or 6 through 8 which
don't seem to be used at least for audio
and and even like syncing to iTunes so
the next problem was to figure out how
can I detect when something is connected
and disconnected and I first started
trying to look for those pulses that the
phone was sending out but they were so
short and such low voltage that seemed
kind of to be a hard task
so um another friend suggested that I
might just try pulling that shield up
high with like a really high value
resistor I use the 1 megaohm resistor
pulled it high to 3 volts and so then
when something is is plugged in and that
shorted to ground that drops low and so
I just took that directly up to the to
the switch after the in input that
switches the switch and that worked
great but it wasn't reliable like one
time out of five one time out of ten
you'd unplugged the cable and it it
wouldn't the the phone wouldn't realize
that the the headphone adapter was now
plugged in it just would would say that
there wasn't anything plugged in and I
think that's because the switch is
actually so fast that the phone never
realized that anything had been
disconnected it just thought the
previous thing was still connected so I
added to one shot timers each for a
hundred milliseconds one fires when
something is connected and one fires
when something is disconnected and those
drive that disabled pin that
enable/disable pin
through an or gate and that totally
fixed it it's super reliable now so this
is what the first prototype looked like
it's super ugly I was having a really
hard time soldering the headphone
adapter board down to my circuit board
it's that blue thing in the upper corner
and then there's one down here so it's
super ugly but I sort of gradually
evolved how I was doing that but now the
question was okay like this works
electrically but it totally doesn't fit
in the phone and so you know the
question was what do I do there
and the answer was a flexible circuit
board FPC and I totally never done that
before I was really intimidated by it it
turns out it's totally not hard I had
heard that people referred to FBC as
origami circuits so I figured well why
not pay for prototype this I went and
got a $30 inkjet printer and I just
started printing versions out and that
really allowed me to narrow in the like
mechanical sizes and sort of mechanical
fit because this thing had to like a
wrap around a lot of components and
there were a lot of constraints on where
things needed to be and so I did
probably 20 versions of these I'm just
printing them out laminating with
packing tape to get them to be the right
thickness and stiffness and then just
you know continually like assembling and
disassembling that part of the phone to
get everything to fit and then once I
had a pretty locked in physical shape of
the board outline then I started routing
my components into that and had just
enough room in the end for for
everything to fit um and then it was
time to send it off to the the FPC
Factory and have them make it there are
factories everywhere in Shenzhen this is
not VF PC factory but this is what they
typically look like big sort of ugly
concrete buildings but the cool part is
that you can get just about anything
made and even in small tiny this is what
I got back this is actually the fourth
version but they all kind of looked like
this this is still in panels so if
you're not familiar with FPC it's very
similar to you know a rigid normal rigid
board but instead of having
fr4 fiberglass in the middle it has like
a Kapton tape type plastic right high
heat plastic it's the same same type of
plastic and kept on tape so this is what
they start with so this is going to the
factory I got them to let me film this
is what they start with it's a piece of
that plastic with copper on either side
they first take that and they do it in
stacks of like 10 put it in a drilling
machine and drill all the holes so these
are typically ganged heads of five next
to each other and then in front or all
the different size drill bits the thing
can automatically switch drill bit sizes
next it goes into a copper H bath to
etch the VL holes to connect traces on
one side of the board with the other
side of the board
this room is super smelly it's super
sort of toxic and hard to breathe in
there next one goes into the edge
unfortunately I wasn't able to take
video inside the room where they expose
the design on to the copper um to do the
sort of resist mask for the for that
acid etching but these are the machines
that do the acid etching and actually if
I can see where it comes up there's a
window here that window in the back is
where they they expose them and this
this conveyor belt machine actually runs
between the two rooms they feed it in on
one side where it's controlled lighting
and comes outside and this is a mixture
of there's some FPC in here and then
that's rigid there next they put on the
solder mask for rigid solder mask is
like a liquid but for for FPC it's
actually just kept on tape and they
stamp it out on a on a stamping mill
with a steel die and then they literally
just stick it on by hand with like a
sticker next it goes into silkscreen
this is just like self-draining t-shirts
it's totally manual they just align it
by hand so it's raining out and put on
drying rags you got an alert that I was
supposed to back up my machine and
knowing
we'll get back here we go
and then lastly they do electrical test
on it make sure that everything should
that should connect does and that things
that shouldn't connect don't these are
like bed of nails test jigs that are
custom to each board that have little
pogo pins that that touch all of the
pads and they make a new one for every
board design so these were just two the
ones that they were like using
frequently
they had like the rooms and rooms filled
with these lots and lots of sort of
tools made for each board like three to
four tools per board so this is what I
got back and I needed to disorder it
myself
or I didn't solder myself I did not use
a solder stencil which I totally would
next time but it actually turned out
it's fairly doable with just like a
syringe and then pushing the solder
paste around with your tweezers I didn't
have too much trouble this is actually
my first time doing surface mount and I
kind of go into the deep end these are
point six millimeter BGA's oh four oh
twos it turned out not to be too bad
with the microscope on just you know
just use a hot air rework gun there is
kind of a magic to FPC which is that you
can expect BGA's from the other side
because it's clear which is kind of cool
this is soldering down the headphone
adapter just with 30-odd kynar this kind
of got more gnarly and like was harder
to repeat I didn't have that much
problem with the actual like surface
mount parts but I had a lot of problems
with all of this stuff of like using
30-odd Kiner do you random wire hookups
and like weird sandwiching of things um
this is what it looked like in the end I
ended up having to add a lot of Kapton
tape and UV curable solder mask to deal
with shorting issues because the thing
that comes down on the top of that you
can see it in the corner is the screen
and there's like this steel backing
plate on the screen and that was
shorting everything out on the board
which took me awhile to figure out so
while all of this is happening I'm sort
of having to work through how am I going
to modify the case and like all of the
mechanical side of this so I started out
by go
into one of the back alleys behind the
markets and buying used i phone backs as
sort of cannon fodder for for the dremel
and then later the CNC mill you can buy
these in stacks of ten they're like two
bucks apiece
in sort of various quality so this gave
me a lot of chances to sort of get the
mechanical side of things right I
started with just a hand Dremel just
making her super rough hole I basically
carved out all over the material in that
corner I thought I could get away with
and then kept going and what I ended up
with was super rough but it sort of
allowed me to to push things around and
figure out okay like how is this gonna
work but I was really very satisfied
with how that looked so my friend Nick
he's a mechanical engineer in Shenzhen
he had just bought a decent Desktop CNC
mill and he's done a lot of mechanical
work that has required CNC milling but
had never really run a CNC mill himself
so we spent a lot of time just trying to
figure out how to how to work with
machine how to work with mach3 and that
kind of thing but just if you're curious
this whole setup that we're looking at
here including the PC and the pirated
copy of Mach 3 is about a grand u.s. in
the markets we thought how hard could it
be to drill a hole I thought maybe it
would take an evening ended up taking us
a number of of late nights and a couple
would just turn into a couple
all-nighters to get this right
one of things we learned is that
fixtures are just super key you and CNC
milling we ended up using blocks of
nylon that I bought on Taobao just to
make our own fixtures to really clamp
this thing to prevent vibration and to
enable repeatability so that we could
run multiple backs through the exact
same process and sort of dial in because
the tolerances that I wanted to sort of
get everything to fit we're of the like
0.1 millimeter range which is like the
thickness of paper and and so you know
particularly my vertical tolerances
we're kind of in that range this is the
fixture we made for the headphone jacks
the
i phone 5 headphone jack and nick
designed this cool little jig and then
we wanted to mill off the front of the
jack so that it fit nicely in the hole
that we had um this is actually a failed
run where he managed to mill off one of
the contacts as well which is kind of
frustrating but we were able to dial
that in pretty well the tolerances of
this setup ended up for the mill ended
up being like sub-point 1 millimeter
which was really awesome and a lot of
skip that wall really fan and nice um
and then it was time to put it together
this this was a really frustrating part
of the project I thought this whole
project would take me a month and by
this point I was like three and a half
months in through three months in and I
was having problems with vertical space
and so there were things pressing on the
back of the LCD which was causing this
crazy banding and and I was ruining LCDs
just left and right um and so I had to
figure out like how do I just remove
more material to get that vertical
spacing and again we're talking about
like fractions of a millimeter here so I
started like removing material this is
the shield that goes on the back of the
display and so I started just carving
that off I just basically took the
dremel to everything I could this is me
under the microscope drilling off the
top of the 30-odd are I don't think
you're supposed to do this but it did
work there must be a better way to
solder these boards down to the FPC but
I haven't found it and in the end like
that part of the project was kind of
anticlimactic because like eventually I
just removed enough stuff and I stopped
breaking screens and and the result was
a working phone I have I have I'll do a
little brief demo here I don't know if
you can hear this but
that's a working headphone jack
and so the question is like what now
where do we go from here I've learned a
lot in this project and I thought I
would just pass on a few my sort of
takeaways and you know where I think as
a community of hackers people could go
with this and some takeaways that I'd
like you to take on um
or at least internally so uh so the
first is that this this scheme of
switching lightning is not applicable
just for headphone adapters like you
could do this with anything that plugs
into the Lightning jack and so this
scheme could be for instance usable to
put like a micro SD card on an iPhone
software support is a different story
but like yeah using these USB switching
chips they're cheap they're easy to work
with like this scheme will work on this
this design is open-source it's on
github but more broadly I think there's
this unnatural fear of phones they're
really just small computers and I don't
understand why we're not modifying them
in the same way that people are like
modding desktop computers you you can
run them entirely outside of a case
this is an iPhone success that literally
has just a battery a logic board in the
screen and that's really all you need
I'm starting it up with tweezers here
instead of the button like you just
short two pins and it starts up and you
don't even really need a battery you can
get the connectors that plug into the
proprietary battery connector in the
markets at least so it definitely would
encourage people to not be afraid of
this stuff like it's yes it's small yes
it's a little bit fragile but it's not
that bad
um and then the last thing is like if
you haven't done FBC before if you
haven't done flexible circuit boards
they're really not that hard they're not
there's not anything magic to doing them
you can make paper prototypes the design
really isn't any different than making
rigid boards like if you can make a
bridge board you can make a FPC they're
a bit more expensive I was paying like
75 bucks a run for samples which I guess
doesn't sound that expensive for what
people pay for boards here it's a little
bit expensive in China and then the last
thing is come to Schengen it's amazing
it's like visiting the future it's this
crazy Blade Runner future
yeah thank you
if you'd like to hear more about my
adventures or you'd like to watch my
videos these are ways you can get in
touch with me and feel free to find me
afterwards I have the phone with me
I have sample PCBs in various states of
assembly and I have some stickers so
thank you very much