Decided to abandon plans for portrait-oriented all-in-one design since the portrait-orientation for the LCD on a Pi actually just leaves most of the screen unusable.
Designed and fabricated screen housing; installed screen into it. Still not connected to the keyboard or Pi at all.
Created mounting bracket for Pi and LCD adapter board; one central rectangle with arms reaching out to the main corner screws.
This design did not leave clearance for the Pi's USB ports, and the arms were thin and flimsy. The M2.5 screws I have are long enough to secure the LCD adapter board, but they don't reach to the Pi itself, so only the header pins are holding the Pi in place.
Constructed second revision of the mounting bracket with more clearance for the Pi and less flimsy arms.
Still had a few mm of a clearance problem with the Pi's ethernet port, but was able to make it work. Noticed that the inner M2.5 screw holes are slightly too close together, but the Pi and adapter can still be mounted.
Used two pieces of bent wire to attach the screen to the keyboard.
This turned out to be stronger than I expected; I was worried it wouldn't really hold up when moved around and jostled. Apart from requiring an AC adapter to operate, I'm pretty satisfied with this design. I'm able to take it with me around the house. My first pass of the wire attachment is difficult to remove once installed tho, and I'd prefer it if it were easy to snap on and off.
Disassembled the screen casing to remove the screen protector film. Upon reassembly, the screen went dead, and the FPC connector piece on the adapter board snapped off. The display can be brought back to life by applying pressure to a specific point on the ribbon, but it raises questions about the suitability of LVDS for this project; if it can't last more than a day, it may be better to switch to HDMI despite the higher power consumption and complexity.
Cut a replacement screen case in Oak ply with the M2.5 screw holes at the correct distance. Using wood revealed that the bracket design was backwards, which isn't noticeable in acrylic.
Discovered that braiding a USB cable is a terrible idea and will make it stop working.
Elecrow 5-inch HDMI Pi screen arrived. Designed a new back plate to accommodate the new screen which holds the Pi much more tightly. New setup works fine, but without a battery it's not mobile. This back plate doesn't have any mounts for the battery or charger. The new screen design necessitated a wire mount of a slightly different shape.
Lithium ion polymer battery and charging circuit arrived. Went to a local store and picked up a nylon strap. Replacing the thicker spacer with a thin spacer on one of my keyboards, I was able to slip the nylon strap between the spacer and the bottom plate after punching a few holes in it.
Having the strap and being mobile made the lack of a battery even more noticeable, so I cut a new back plate to allow the battery to be attached. Put a couple 2.5M screw holes (thanks Adafruit) near the screen's switch, added a cut out to expose the 5V in and GND pins on the display PCB, and added a couple slots to loop a rubber band thru a bit lower down.
The rubber band seems to work holding the battery in place. But having the battery adapter board near the screen switch was a mistake; it's an awkward position especially when using the device while it's charging. I'm not sure what to do about the 2.5M screws for the battery board as adding the nuts I have might cause a short. I need to find a shorter USB cable for the keyboard. Having to disconnect the JST cord of the battery and reconnect to power on is kind of lame too,
But ... it works!
Battery life with a 2500 mAh battery is between 15 and 20 minutes. That's after replacing the Pi 3 (which draws 1.5A) with a Pi 2 which only takes ~700 ma. This is not going to fly.
I had a realization that the setup with the Pi is really never going to be as sturdy, efficient, or cost-effective as repurposing an existing Android device for the Deck. As much as I hate Android, it's hard to ignore the incredible amount of work that's gone into perfecting those particular things that have been such a pain to integrate into the Pi: the battery, charger, and screen.
Using an Android device would mean benefiting from economies of scale. The Samsung Galaxy S5 has a rotten OS on it, but they produced tens of millions of the things, and they got pretty good at it. It's got twice the RAM of the Pi, a much sharper screen, and the battery charging process just works perfectly.
Did some research on PostmarketOS, which looks really appealing, apart from the Alpine bit. It's still a ways away from being usable, but the idea of the whole project being ideologically driven to reduce waste and allow repurposing of devices that would otherwise be destined for the dump strikes a chord. Going to keep an eye on it. Support for the S5 is good except for the wifi; looks like the best support might be for the S4. CPU is a bit slower than the S5, but it's competitive in most other aspects.
Anyway, I cut a case for my S5 that uses an OTG cable, and it looks pretty good. Feels a lot less like pieces might fall off at any second. Didn't get much of a chance to use it. Needs further evaluation.
Made several case modifications including holes for the front and back camera and home button, and internal clearance for the power button and the volume buttons. You still can't press these with the case on, but at least you can attach the case without them being stuck down. Wanted to add a gap to allow headphones to be plugged in, but this would make it so the middle two layers are very weak, with only a handful of millimeters holding top and bottom together.
Tried to cut the case, but it was too hot in the lab, and the laser cutter ran its cooling cycle for hours before I gave up.
Played with the device for a few hours to do IRC and some light browsing. Initial impressions are more positive than I expected. I have a very poor impression of Android, but Termux is very good. There are a handful of complaints (control keys don't always work, and I can't full-screen it for some reason) but they're comparatively minor.
The biggest problem right now is that there's no way to charge it without unplugging the keyboard. Going to look into whether I can bring in voltage to the controller or if I need to try a Y-splitter type USB cable.
Also thinking about adding a support layer underneath to keep the wire from bending away down. That would let me cut the ends lower so the sharp points would keep away from the thumbs.
I spent the entire morning working from a coffee shop with nothing but my regular mobile device and my Atreus Deck. I took some video calls on my normal device but spent most of the morning pair programming with a co-worker using tmate.
For the most part I was able to get everything done that I needed. Everything I did ran inside the tmate session on my laptop sitting on my desk at home, and in that session I used wee-slack to keep up with work chat and ERC inside Emacs for non-work conversations (including with friends on Google hangouts using bitlbee). The go-jira command line tool helped me keep up with tickets at work. I was able to open GitHub pull requests using the hub tool, and I could comment on whole pull requests using email, but unfortunately I haven't found a solution for commenting on pull requests line-by-line without resorting to the browser. I had written a tool for checking CircleCI build status from Emacs a few months ago, and that came in handy.
I replaced the stock Samsung OS with LineageOS. This was a major improvement; it fixed a number of keyboard bugs and allowed me to lock the screen in portrait orientation instead of having it flap around every time I stood up.
One thing that's happened a couple times is a simultaneous reboot, which put the device into "safe mode". This is annoying, but the annoyance is compounded by the fact that the power button is not reachable without basically disassembling the whole thing. There doesn't appear to be a software-only way of rebooting and getting out of safe mode.
One theory is that the battery coming loose is what causes it to reboot into safe mode. I'm running with the mobile device's back cover off in order to make it fit better with the camera protrusion, but there's room for the battery to wiggle a bit. I've taped some bubble wrap onto the battery to keep it in place better; we'll see if we have any more safe mode trouble now.
Update: locking the battery in place fixed this.
Installing LineageOS with all the fiddly bootloader bits is a pain in the neck, but I've documented the process and covered the pitfalls that I ran into; hopefully there aren't too many I missed. But it makes the 2005-era Debian installer look usable and polished by comparison.
I've done another version of the case, this time in mirrored acrylic; it looks extremely sharp. The few modifications include a wider volume button gap to prevent it from triggering when it's inserted in the case and a front-facing camera hole which lines up better with the actual camera.
This time around I used acorn nuts for on the screws, which allows for much more flexibility; you can tighten them all the way, but they'll still hold in a much looser position too. I used 20mm M3 screws. A couple washers on the bottom two screws might help because there's a gap in the plates which is filled by the bracket wire in the top screws.
But at this point I'm very close to being comfortable enough with this to start offering kits to a handful of intrepid beta testers. The only piece that remains is the charging. I got a combo OTG/charge cable on eBay, but it only charges the client device, not the host. So I found one on AliExpress that claims to be able to charge the host, but it's taking its sweet time crossing the Pacific. It is very curious that no one in the US will sell me a device which does charge and OTG simultaneously; I hope there is not some reason in the USB spec that prevents this from working well.
Headed to the OlyMEGA maker space to work on it a bit. My first OTG hub came in the mail, so I brought it with me; it has 2 USB female ports, a USB micro female port for charging, and a USB micro male for connecting to the mobile host. Unfortunately it can only provide charge to the client devices, not to the host. But it might provide good parts for constructing my own Y-split charging cable.
Another option I considered was wiring the USB micro female power port directly to 5V and GND of the keyboard's controller. Unfortunately while this can power the keyboard just fine, the mobile host won't accept power on this bus. According to what I've read about OTG this is can be done by connecting a resistor between the ID and GND pin of the micro cable going to the host. But the ID pin isn't populated on the cable I've got, so this will probably require doing some splicing.
I cut a couple "washer" rings out of the galvanized iron wire to put around the bottom two screws, and they stabilize things nicely.
The OTG/charging hub arrived in the mail. It has a switch which lets you change between "charge mode" and "data mode", but there is no way to select both at the same time. I strongly suspect that there is no spec-compliant way to do both at the same time, because the people who created this device would much rather have left the switch out to save costs. The fact that they didn't strongly suggests to me that it can't be done.
However, it's still possible that there's a device-specific way to do this. Since we're limiting our scope to just the Galaxy S5, we could take advantage of implementation details in the charging circuit that wouldn't work across all devices.
There's also the route of using wireless Qi charging and leaving USB out of it completely. This strikes me as a bit tacky; it adds a fair bit to the cost and doesn't charge very quickly, but as an option it's better than nothing. I've ordered a Qi adapter for the S5 to give it a shot. (edit: canceled this order before it was shipped)
Came to the belated realization that the port on the Galaxy S5 is not a standard micro-USB 2.0 port but a micro-USB 3.0 superspeed port. This means it has two pairs of pins for power input.
Placed an order for one of these cables to see if it will do the trick.
I did find someone who made the exact cable I'm looking for but they stopped producing them, so they're only available for $70+ on ebay. This makes me a bit more optimistic about what I want being possible, but it does mention that it's only compatible with a handful of Samsung tablets.
But I'm really hoping the wide superspeed cable can do the trick, because it seems like that would be a lot simpler. I'd still need to stock much shorter USB A<->micro B cables along with a superspeed, but that's not too tricky.
My superspeed cable arrived. It has two male full-size USB connectors on it; the short one is for data and the long one is for power. The power one works fine, but of course I can't plug the data one into the Atreus.
I tried splicing a micro-USB male connector onto a female full-size one I got from my broken hub earlier, but it doesn't detect the keyboard. Of course, I realized later this is because it's missing the connection on the id pin which tells the device to go into host mode instead of attempting to be a client. Starting to think this can't be done without a custom cable, since for some reason no one makes these.
I ordered some solderable USB plugs and sockets to try to build a cable which supports charging while in host mode. According to this stackoverflow post you can do it if you ground the id pin with a 36.5 kΩ resistor. I started to build such a cable, but the plugs are very small, and so I decided to cut scope a bit and try building a standard resistorless OTG cable first.
I got one that works, but it doesn't look very good. I have some serious reservations about its durability in the long run.
The soldered USB cable I've constructed is just too unreliable; any solder joints I can make with my iron at that size aren't going to last. My last ditch effort is to wire a lipoly charger directly into the battery. It's easy to run the device with the back case off, and I know the battery can accept a charge directly to those terminals because that's how the aftermarket Qi charger works. As long as the Qi charger operates the same way a regular lipoly charger does (overcharge protection, etc) I ought to be in good shape.
Will give this a try when I get home, as I'm currently traveling. If it doesn't work, well, I've been using the deck without being able to charge with the keyboard plugged in, so I could always just proceed with that design. But I'd rather not.
I hooked up my USB LiPoly charger directly into the battery terminals using some copper wire.
It actually works pretty well! But a chance conversation pointed me to the fact that this is not actually how the Qi charger works. There's a separate connector which accepts 5V directly in and doesn't rely on an external charging circuit! Apart from being simpler to construct, this is also safer, because the phone's onboard charging circuit has access to the battery's internal thermresistor. An external charger can prevent overcharging based on the voltage, but without access to the thermresistor it can't detect overheating situations, while the internal charger can.
So this looks to be just about perfect if I can wire that into a female USB micro port; luckily I threw a few of those into my cart on my last Adafruit order. I'm constructing another wooden case with a gap for the battery, so I'm currently waiting for the wood finish to dry on that one; then I'll wire that port into that Qi connector.
I placed some orders for some OTG cables and more charging ports, so I think I'm ready to pull the trigger and start accepting orders. The rest of the parts I can either source locally or already have a good supply of on hand.
The main thing left now is documenting the assembly process. I've got a basic writeup, but I need to add in photos and edit for clarity.