I subscribe to the Hackaday newsletter, and the most recent newsletter had a project that piqued my interest: the Spellbook. I don't know why it stood out to me, but it caught my attention. I guess I've always been interested in the idea of building my own laptop, and must have been in the right frame of mind for it right now. This is all a thought experiment for now, and it'll probably go nowhere, but I wrote down four questions:
Could I replace the back panel with a solar panel?
Could I replace the RPi with a RISCV board, like a HiFive1? Or maybe an alternative board, like a Feather M4?
Could I find a laptop/netbook size/grade eInk display?
Could you write a custom operating system for it in Rust? This one’s a long shot, but it would be a lot of fun.
This post is kind of a rambling writeup of my initial research into answering these questions.
Ideally, I could go through much of the day without needing to do much charging, and let the solar panel soak up what it can.
- 3.7v 2500mAh - I think I'd have to do a 2x2 to get enough power for the Pi, and it'd only last ~90 minutes at full discharge.
- 3.7V 6600mAh - I could put a pair of these in parallel to get 7.4V, but they'd be limited to 3h at full draw.
- 5V 10Ah USB battery pack - another option, but it'd take up more space.
Whatever I do for the battery, I'd need to integrate the solar panel, the battery charging, and have some sort of battery level and status indicator available (e.g. the I2C fuel gauges).
As for panels, Adafruit stocks this 6V 9W panel - it's underpowered but would work for the batteries. At 10" x 8.8", it'd be mean a larger case, but it's still not too bad.
I immediately wondered if I could use my HiFive1 RISCV board for this. My initial instincts say no, because I think it might be too constrained. It does have WiFi onboard, which is nice, but there are severe storage and RAM constraints:
- the 32M storage constraint could probably be overcome by calling out to SPI flash storage or an SD card, but it's still tight.
- the 16K of RAM is probably the deal breaker.
This brings up the question of how much memory do I actually need?
I don't have much experience with graphics, so let's consider my featherlib OLED graphics file. Ballparking a few numbers and lumping in some dependencies, it comes to
- 2,250 lines of C++
- 260 lines of C
- 1,074 lines of header files
- The static archives compile to a total of 77,376 bytes, or about 76K.
This isn't terribly accurate but gives me somewhere to start thinking about this. Also, my graphics library is tiny and deals with direct drawing and a very small text buffer. I'll talk later about some graphics thoughts, but this will get to be much larger. The Adafruit M4 Feather has 192K of memory, but I suspect even that's going to be pushing it. I think NetBSD recommends a bare minimum of 8M of memory.
So, if I define what I want for hardware, I'm going to say my bare minimums are (and I'm really just reaching into thin air here):
- 32M of memory
- 32M of storage (I could maybe make this work)
- wireless networking (not an ethernet drop to be found at my house)
I was thinking of the STM32 as a first pass, maybe without graphics at first. It doesn't have onboard networking though, and that will be a real pain to get working.
I guess candidate boards fall into two categories:
- "Real" embedded, like the Feathers - heavily memory constrained.
- Linux-capable boards, like Beaglebones or Raspberry Pis. I was looking at the RISCV unleashed, but the price point doesn't make sense for a toy project like this.
I guess I've had it in my head that I'm going to use ARM (or MIPS or RISCV), but maybe Intel would work. I have a vague aversion to that, though.
The Raspberry Pi Zero W might be promising; it doesn't seem to come with the high power requirements. I've also done no research into the GPU, but considering my display replacement, I might not need to worry too much about that. I also have a Khadas VIM2 board that might work.
A real bonus would be putting a LoRa-capable radio (like an RFM95) into the system so I could interact with my gizmos and whatsits directly. More radios are not going to help battery life.
I really want a laptop with an eInk display. As long as I'm making my own laptop, I'm going to put an eInk display in it. Well, if I can find one. There's a lot of small (2.7 inch and smaller) displays on the market, or there's options like
- the 7.5" WaveShare 640x384 display
- the 7.4" Pervasive Displays 480x800 display
- the 12.2" Pervasive Displays 960x768 display
Not a lot of great options.
I get asked a lot why I want an eInk display, so it's worth discussing. There's really three reasons:
- eInk displays have a lower power draw than traditional displays, or at least that's what I think.
- The reading experience is better - and as a programmer, I spend a lot of time reading.
- It's easier to see the display outside.
I'm pretty aware that this isn't so useful in the general sense; it won't work if you want colour or pictures and so forth. What I want is a focused tool for computing that helps me avoid distractions and encourage slow, thoughtful work over flailing against code. At the same time, I want to think about how interactive explorations would work with this kind of system.
As hope that this would work, the eInk display on my Sony Paper works pretty well - I can take notes, and it's not really that much slower than my Raspberry Pi 3 hooked to an external monitor. I guess the question that this raises is whether that will make it additionally slower or if it means the delay won't matter so much. It might end up kind of like being on a graphical 9600 baud serial console. We'll see (maybe).
The operating system
Of course, if you're going to build a bespoke laptop, why not do away with the burning dumpster fire that is Linux? Since all the cool kids are writing Rust these days, I figure that's what I should write it in (actually, I've been needing a good reason to learn it for a while). I thought about Fuchsia, but it's heavily Google-centric, the GUI doesn't work, and also I didn't write it (kidding - not kidding).
The starting point is Phil Opperman's Writing an OS in Rust (Second Edition) blog series. There's lots of Rust targets for various platforms too, including the ATSAMD51 that the Feathers use and RISCV. What I see as the two interesting questions (the first much less interesting than the second) are
- What is the bare-minimum usable set of software so I can move development onto the hardware?
- What does an eInk-oriented windowing system look like?
A bare minimum userspace
Without putting too much thought into it, and I'm sure I'm missing things, I think I'd need
- An editor. I'm thinking something like mg.
- A programming environment. I'm probably not going to get Rust hosted on it anytime soon, but a Scheme-like Lisp and/or a Forth are definite candidates.
- I hate to say this, but a web browser - text only support is fine, but it'll probably be necessary for looking up docs. I'm not keen to build this.
- A simple text shell (more ash than bash) with basic binutils analogues.
- A simple graphical shell (like a window-manager analogue).
It'd be nice to have lots more things (like a PDF viewer, git, and SSH), but I think I could get by with these. I'm not going to be aiming for something necessarily posix-y, but some of the things from the Unix world would be nice.
An eInk-centric world
More interestingly, how does one interact with an eInk-based system? Typing things into the Kindle is an exercise in frustration, so how could the interface be designed for programming?
This is a lot, but it's admittedly only barely scratching surface. I haven't really talked about other ideas for this, like how to do TPMs right for my use cases, or about my user seeding ideas (how could you basically mirror the laptop's storage and config to the cloud so the specific hardware instance e.g. make it more spime-like) but if I did that, I wouldn't get any sleep.
Also, admittedly, this probably won't get built; but it sure has been fun to think about. I'm going to keep tinkering around with an OS in Rust, though, if only for kicks. This is a more long-form collection of notes than what I've started on are.na, but I'll probably keep adding notes there, too.