_                _                ____            _           _   
| |    __ _ _ __ | |_ ___  _ __   |  _ \ _ __ ___ (_) ___  ___| |_ 
| |   / _` | '_ \| __/ _ \| '_ \  | |_) | '__/ _ \| |/ _ \/ __| __|
| |__| (_| | |_) | || (_) | |_) | |  __/| | | (_) | |  __/ (__| |_ 
|_____\__,_| .__/ \__\___/| .__/  |_|   |_|  \___// |\___|\___|\__|
           |_|            |_|                   |__/               

I made a laptop from scratch, and it worked. My idea was just to put a SOC board
like a Raspberry Pi, a Beaglebone Black or maybe even a very small motherboard
into a wooden case that I had already made, and wire it up to a display and
keyboard. It was nowhere near that simple. It ended up taking six months.


 _  _              _         __  __      _
| || |_____ __ __ | |_ ___  |  \/  |__ _| |_____   __ _
| __ / _ \ V  V / |  _/ _ \ | |\/| / _` | / / -_) / _` |
|_||_\___/\_/\_/   \__\___/ |_|  |_\__,_|_\_\___| \__,_|
 _              _
| |   __ _ _ __| |_ ___ _ __
| |__/ _` | '_ \  _/ _ \ '_ \
|____\__,_| .__/\__\___/ .__/
          |_|          |_|

This is how you should do it, not how I did it.

Bill of Materials:
- Raspberry Pi 3 or other SOC board (~$30)
- LVDS to HDMI converter board ($20-$30)
- new panel or laptop for parts (~$30-$200)
- portable phone charger (AKA USB battery) (~$10)
- at least 1 boost converter (~$15)
- 60% (or full-size for a large laptop) keyboard ($20-$100)
- voltage regulators ($20)
- wood or thick sheet metal and paint ($10-$100)
- epoxy ($5-$10)
- at least 1 12V power supply (for charging) ($15)
- 2-10 18650 batteries (more for better battery life) ($10-$40)
- quick disconnects ($10-$20)
- fuses and fuse holders ($20-$30)
Total: $215-$620

If you are going to do this project, read over this walkthrough, whatever
resources you can find online about the compatibility of your components, then
this walkthrough again. Once you are sure you know everything that might happen,
order all the parts (preferably not from China. China < Taiwan < Korea < Japan <
USA in terms of reliability). Keep a list of which parts you have ordered, which
parts have arrived, and where they all are. That will make things go faster
because you will be able to order replacements faster and find things faster.

You don't need to do the following steps in order, but it will make things
easier if you do them one after another in this specific order.

Step one: Power Supply

To make a power supply, you are going to need two boost converters, two 5V
regulators and a 12V regulator (assuming you have a 12V panel and your other
parts are 5V (except for your batteries). Optionally, you can use car fuses
(I used 1A and 2A, but other values might make more sense) to make sure the
batteries don't explode or catch fire if the battery pack is shorted
accidentally, a part gets plugged in wrong, or a part is faulty.

Get out your phone charger. It should be a charging/regulation circuit hooked
up to an 18650 or two. If it's not, you got the wrong kind of charger.  You want
one that looks like it has an 18650 or two inside of it, and has a mini/microUSB
input for charging, and a USB type A for discharging (or better yet, 5V barrel
jacks, which usually tolerate higher amperage). It's good for it to have a power
button for emergencies.

Open your charger up. Take out the batteries, and remember where they connected
to. Store those batteries somewhere where they won't get mixed up with the 
batteries going in your laptop.

It is important that all your 18650s are all from the same batch (either stolen
from the same battery pack or from the same shipment), though not as important
as if you were going to wire them in series. Not all 18650s charge to the same
voltage, so in extreme circumstances one battery could be so worn out that it
won't ever get up to the charging voltage, then will overheat and catch fire.
Batteries from the same batch will be very similar in the voltage that they will
charge to.

Start by testing all of your 18650s. Make sure they all charge and discharge.
Mark which side is positive and which is negative, because it's not always easy
to tell. Put them at about half capacity, so they are harder to break by
excessive charging or discharging.

Wire all those batteries in parallel. You can solder your batteries together if
they have nickel strips on them, but if they don't you will need to weld some
nickel strips on yourself. You might break some batteries. Don't charge or
discharge the batteries too much when soldering, or you will reduce the battery
life. Watch out for electric shocks, especially considering that soldering irons
are conductive. Some people have had better luck with welding the batteries than
soldering them. You might want to use quick disconnects so that you can easily
disconnect batteries to test or replace them. Another good idea would be to put
a fuse in series with each battery so that if one fails so that it becomes a
short, it doesn't bring all the other batteries down with it, though this might
be a bit overkill if you don't have a bunch of batteries, and you can just put
a fuse in for a group of batteries (e.g. a battery pack made out of one group of
six batteries would have one fuse).

Next, we wire up our battery array to the phone charger where the batteries
were. The phone charger will provide some charging circuitry. It should have
protection and voltage regulation circuitry, but it depends on the quality of
the charger. Doing it this way is better than using a BMS because it's hard to
find decent BMSs, but USB battery packs are plentiful. In addition, fuses let
you know which batteries have gone bad, and don't make the whole power supply
go bad if just one battery has stopped working. A BMS won't tell you why the
whole thing has failed when just one battery has stopped working.

Once the charger has some batteries in it, plug stuff in and see if it works.
Be careful not to let anything touch the exposed metal. If it all works, seal it
up. Some people suggest using hot glue to keep the batteries together, but I
found that using just tape (duct tape or electrical tape) will work well enough.
You need to make sure that the casing for the batteries isn't too think or the
batteries will overheat more easily due to the extra insulation and it will be
harder to get them out when something goes wrong. Try not to cover any status
lights.

Wire some quick disconnects to the output end of your battery system because
a dinky USB connector might not be enough, though you shouldn't directly wire
to the charger board because you will need to cut power in an emergency. Don't
take off the existing USB sockets just in case you still need to use them. Wire
on some extra leads, and then you can do whatever you want. It's better to
solder one set of disconnects facing one way and the other set the other way so
that you can't get them backwards.

At this point you have 5V, but your panel probably needs 12V to run. The way to
turn 5V into 12V is with a boost converter. Wire the input of your boost
converter to the quick disconnects you just put on. Wire the output to your 12V
(or whatever your panel runs on) voltage regulator. If your regulator is a
through-hole part, it might be a bit too flimsy just soldered on to your boost
converter. You're also going to want to put some capacitors in. Here's an
example diagram for how you can wire it:

                          +----------------+
5Vin---f->m disconnects---|(+in)     (+out)|-----+---Regulator---+---12Vout
                          |                |     |       |       |
                          | Boost Converter| Capacitor   |   Capacitor
                          |                |     |       |       |
0Vin---m->f disconnects---|(-in)     (-out)|-----+-------+-------+----0Vout
                          +----------------+

You don't want to use only a boost converter because the output voltage will be
choppy, which is known to cause headaches. A regulator will give you a perfectly
consistant voltage. You should use whatever types of capacitors your voltage
regulator recommends in the datasheet or manual. If your voltage regulator does
not have documentation (usually found online as a pdf), you did not get a very
nice one. That shouldn't be a problem though, as they are usually standard, and
you should be able to copy from a name-brand component's datasheet.

Wire the display controller to the display, THEN the power to the display
controller. If the fragile display has the low voltage logic pins touch the high
voltage backlight pins when it's plugged in, your LCD will break. That is why
the power needs to be disconnected when the display is plugged in.

Turn the power on. If the backlight comes on, you did everything right.
Disconnect power.

Plug in your peripherals. You could use a USB keyboard or buy a replacement
keyboard off ebay and make a controller for it using an arduino (should only
take a weekend; pester me for a tutorial if I haven't already written one). Turn
on power. Test. Turn off power. Now that you know all your electronics work,
it's time to make a case for them.

Making laptop cases is an art, not a science. You can do it however you like,
assuming your parts are secure in the sense that they won't fall out, and in the
sense that they won't be damaged. That's all the case needs to do.

What worked for me is a wood box, but the walls needed to be at least a quarter
inch for it to be strong (I wanted to be able to accidentally drop the thing
down the stairs). Another idea would be to 3D-print a case, though you might
need a big printer. You could mill one or laser cut one out of the material of
your choice. You could even weld one together out of metal. One cool idea would
be to fold some sheet metal into a case, epoxy it together, and paint it with
automotive paint. If you do it right, then you wouldn't be able to notice the
metal was folded. These are all just suggestions. You can do it any way you
like.

If you follow my instructions, send me an email and tell me how it turns out.
Pictures and details would both be good.

__      ___         _     ___   ___  _    _
\ \    / / |_  __ _| |_  |_ _| |   \(_)__| |
 \ \/\/ /| ' \/ _` |  _|  | |  | |) | / _` |
  \_/\_/ |_||_\__,_|\__| |___| |___/|_\__,_|

WARNING: This is not what I would do if I were to do it again. This is what I
did to make the laptop I have now, including my mistakes. You can skip it if you
are short on time.

Total Purchased Parts (rounded to the nearest $5):
- Bananapi M3 SOC board ($80)
- Raspberry Pi 3 (~$30)
- 5 or 6 eDP to HDMI converter boards ($250-$300)
- 5 13.3" 1080p IPS eDP panels ($250)
- 3 Battery Management Systems (~$40)
- 5 Buck converters (~$15)
- 60% Mechanical Keyboard ($80) (already had)
- ~30 Voltage Regulators (5V and 12V) ($20)
- Wood (already had)
- Glue (already had)
- 5 12V power supplies ($15)
- 6 18650 batteries (already had) (would have cost ~$20)
- quick disconnects ($10-$20)
- ~500 Fuses (I only needed a few.) ($20)
Total: ~$815

I bought many things that didn't work, weren't reliable, or I had to buy twice.
Included below are only the things that ended up in the final laptop.
Simplified Bill of Materials (rounded to the nearest $5):
- Raspberry Pi 3 (~$30)
- eDP to HDMI converter board ($50)
- panel ($50)
- Battery Management System (~$10)
- 5 Buck converters (~$15)
- 60% Mechanical Keyboard ($80) (already had)
- ~30 Voltage Regulators (5V and 12V) ($20)
- Wood (already had)
- Glue (already had)
- 5 12V power supplies ($15)
- quick disconnects (~$15)
- 6 18650 batteries (already had) (would have cost ~$20)
Total: ~$305

I happened to have a college admissions essay written about this very project
just lying around, so I copy-pasted it below to save work. I corrected a few
errors I didn't catch before I sent it off to colleges, but none of them were
major (e.g. inconsistent tense and inspecific pronouns).

Over my gap year, I arbitrarily decided to build a laptop from scratch. I
started by ordering a screen and a system on a chip (SoC) board. My plan was to
connect the SoC board to the screen and a power supply. Once it started to work,
I made a hinged wooden case to put it in. The power supply was the hardest part
of the laptop since I couldn't find any off-the-shelf parts.

The power supply was the most important part, considering that failures can
result in fire and electrical shocks. I started by removing the battery cells
from a broken laptop. The existing regulation circuitry was soldered to the
motherboard, so I couldn't practically remove it. Instead, I made the mistake
of designing my own regulation circuitry.

I ordered some buck converters, charging ports (both plugs and sockets),
automotive fuses, fuse holders and a battery stabilizer. There were six (model
18650) battery cells from the laptop battery. I soldered three groups of battery
cells together in series (end-to-end), each group of cells consisting of two
cells wired in parallel (side-by-side). This arrangement outputted a constant
twelve volts, the amount required to power the display. I hooked the array up to
a battery stabilizer, which kept the three groups of two cells at the same
voltage, preventing overcharging. In series with the stabilizer, I soldered a
switch I had laying around to the battery, to disconnect the battery in case of
an emergency, like fire. I soldered a charging socket to the battery stabilizer
(for power) in series with a three amp fuse (so nothing would short). Finally, I
soldered a two amp fuse between the positive end of the battery and the load, so
nothing would let out smoke. I was very thorough, but to this day I worry that I
might not have been thorough enough.

It was time to hook up the display to test the power supply, but I had nothing
to plug it into. The display used eDP, but the SoC board used HDMI, so I ordered
a HDMI-to-eDP converter, and waited a month for it to arrive. I plugged the
board into my new power supply, turned it on, plugged the display in, and
nothing happened. The light on the converter was on, so the display must have
been broken, so I returned it and got a new one. The next time, I plugged the
display in, plugged the power in, then turned it on. I saw "No Input." It
worked! I disconnected the display, and plugged it in again. There was a violent
spark, and the display stopped working. Believe it or not, it took me two more
displays to figure out that the power for the backlight (12V) was shorting to
the data pins (3.3V), which broke the displays whenever I jiggled the cable.

That was the issue with the first three displays, but with the last display I
tested, it overvolted on its own. I suspect that it was the flimsy cable, but it
also could be that there was a voltage spike from the batteries that the display
couldn't handle, which would be the fault of my power supply's design. I should
have expected nothing more from a fifty dollar panel and a fifty dollar driver
board. If I were to do it again, I would skip the converter altogether, even if
I would have to spend more on a directly compatible display, or just use an LVDS
display. In other words, don't order cheap stuff from China. You will pay more
in the long run.

But, there was a deeper lesson. Building a computer has almost nothing to do
with engineering. Ordering parts alone took me five times as long as putting the
thing together. I spent more time returning items than designing the thing. The
post is slow, expensive, and more important than engineering.