First Tenet design package: Writer's Brick
28 Jan 2023
projects: writerdeckbuilds: tenet
tags: rpi sharp-memory solar
This computer is the first prototype of my Tenet project: a low-power, daylight- readable, solar-rechargeable PDA.
Ok, so I don’t actually write on it. But I do call it a Brick.
This guide is rather long, but rather than split it into multiple blog posts, I’ve decided to keep it all together for clarity or something. Anyway, please bear with me and also this might be useful:
Table of Contents
- Table of Contents
- Introduction
- Components
- Wiring Diagrams
- Software Setup
- Enclosure Assembly
- What’s Next?
Introduction
Obviously it isn’t quite something you can carry in your pocket, and it’s quite unweildy in a handbag. But it’s my first attempt, and I was focusing on the interior design, making sure the parts all nested together very compactly.
I suppose I was hell-bent on using the 2.7" SHARP Memory Display, and I don’t like the look of a lot of unused space on the front face. Those two constraints set the maximum width and height dimensions of the enclosure, and my job was to make sure the depth wasn’t too…much. Mixed results there.
This tripod is actually just barely able to hold it up. The battery is very heavy, and the placement of the tripod mount is not under the center of gravity!
So, what does this little guy offer?
On the left side we have the USB and Ethernet ports of the Raspberry Pi, as well as some charging-indicator LEDs and small toggle-switch for controlling the charging.
On the right side are two thin slots for Pi camera and display cables, a slot for the SD card, and a tiny hole for the Pi’s drive activity LED to shine through.
We also have the main power switch, a USB-C port and a 5-10V DC port, either of which will charge the battery.
On the top are more ports available from the Pi: audio, (2) micro-HDMI, and one USB-C. The USB-C is worth noting because it will directly power the Pi. Plugging power into this port will not charge the battery!
Components
This computer has 6 main components:
- (1) enclosure. I made my own CAD model, and 3d-printed it at home. I can provide you with the stl files I used but…are you sure? I mean, look at this awful cube of a computer.
- (1) 3.7V Lithium Ion Battery Pack. The one I’m using is Adafruit’s 6600mAh model, but any of their 3.7V line would work just as well.
- (1) Adafruit Universal USB / DC / Solar Lithium Ion/Polymer charger. This board manages power to and from the battery, and offers some pins for things like indicator LEDs or controlling the charge mode.
- (1) Raspberry Pi. I’m using a 4 Model B.
- (1) Adafruit SHARP Memory Display Breakout. This is a 2.7" monochrome display with 400x240 pixels. It has no integral light, but it is daylight-readable, and (my favorite) it is very low power.
- (1) solar panel! The one in my pictures is a Voltaic P126 2W panel from—you guessed it—Adafruit!
Wiring Diagrams
Display
The most challenging part of putting this together was figuring out exactly how to connect the SHARP display to the Pi such that the driver software could write data to it. It took a little forensics and a constant reminder that the constants in the software are pin number, not GPIO number. Anyway, have a diagram:
- Pi pin 16 (
GPIO23
) connects to SHARPCS
. - Pi pin 17 (
3V3
) connects to SHARP3V3
. - Pi pin 18 (
GPIO24
) connects to SHARPDISP
. - Pi pin 19 (
MOSI
) connects to SHARPDI
. - Pi pin 20 (
GND
) connects to SHARPGND
. - Pi pin 22 (
GPIO25
) connects to SHARPEIN
. - Pi pin 23 (
SCLK
) connects to SHARPCLK
.
Power
The power board from Adafruit has some pins available, which I wanted to learn how to use. I could have just connected the Pi to the “Load Out” port (with a toggle switch in the 5V line), but I thought I could provide the user with some more interface to the power circuitry.
Note: In the above diagram, the black wires on the breadboard carry OUT
voltage, between 3V and 4.4V.
The CE
pin is for “charge enable”. I wired this through a toggle switch to the
OUT
pin (which stays between 3 and 4.4V). When the switch is closed, the CE
pin is pulled “high”, which disables charging. This could be useful to the user
in a situation where the solar power available is not enough to both power the
computer and charge the battery.
The PGOOD
pin is for “Power Good Status”, and will be a ground when a valid
power source is connected. This means that connecting OUT
to the voltage side
of an LED and PGOOD
to the ground side will result in the LED turning on when
external power is connected to the board.
The CHG
pin is for “Charge Status”. Similar to the PGOOD
pin, this will be a
ground when the battery is charging. I connected the OUT
voltage line to a
10kΩ resistor, through a red LED to the CHG
pin.
What all this means:
- When the green LED is on, there’s a good external power source connected.
- When the red LED is on, the battery is charging.
- The switch controls whether or not the battery will charge, when the board is connected to power.
Software Setup
The SHARP Memory Display Breakout communicates using SPI (Serial Peripheral Interface), which is not a protocol that Raspberry Pi knows how to use for our display data.
In order to make this transition, we need a piece of software that knows both how to read the Raspberry Pi’s display buffer and how to write to the SHARP display over SPI.
We’re going to download an application and a service file from someone’s GitHub repository. I know, you wouldn’t download a pizza, but you can and should download free and open-source software to make an awful little chonker of a tty calculator.
The application is going to run at system startup (that’s what the service file does), and while it’s running it’s going to copy pixels from the Raspberry Pi’s regular display buffer onto the SHARP display over SPI. It will do this quite fast, maybe not as fast as a standard HDMI monitor, but still fast enough for our purposes.
These steps are essentially a rewrite of hra1129’s guide on GitHub.
1. Flashing and getting situated
First, start by flashing an SD card with Raspbian (terminal mode, not desktop mode).
Connect the Pi to an HDMI monitor, a keyboard, and to the SHARP display breakout. Plug in the SD card. Then, connect power.
2. Libraries
We need to install some libraries that our custom software requires:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install pulseaudio libpulse-dev python3-pip python3-pil pigpiod
$ git clone https://github.com/bitbank2/ArmbianIO.git
$ cd ArmbianIO/
$ make
$ sudo reboot
3. Boot Configuration
Next, we need to make sure the Pi has a usable SPI bus, and that it will still render display data even when it doesn’t detect an HDMI monitor:
$ sudo nano /boot/config.txt
Use the arrow keys to navigate through the file, and make sure the following settings are correct. Note that the original config file may have these commented-out, or set to different values:
framebuffer_width=400
framebuffer_height=240
hdmi_force_hotplug=1
hdmi_group=2
hdmi_mode=85
#dtoverlay=vc4-kms-v3d
dtparam=spi=on
When you’re finished, press Ctrl+x
to exit, y
to save the file before
exiting, and Enter
to save the file with the same filename.
For reference, here is the entire config.txt my pi is running, and here is the one hra1129 recommends.
4. System Service
Copy hra1129’s sharpikeebo_lcd
application from the
sharpikeebo_lcd folder
to your Pi.
$ wget "https://github.com/hra1129/ShaRPIKeebo-customize-for-japanese/raw/main/sharp_memory_display/sharpikeebo_lcd/sharpikeebo_lcd"
...
Saving to: 'sharpikeebo_lcd'
...
Copy the application into its place of honor:
$ sudo cp ~/sharpikeebo_lcd /usr/local/bin/
Create a service file:
$ sudo nano /etc/systemd/system/sharpikeebo_lcd.service
It should have the following contents:
[Unit]
Description=sharpikeebo_lcd
Requires=pigpiod.service
After=pigpiod.service
[Service]
ExecStart=/usr/local/bin/sharpikeebo_lcd -noblink -invert --
Type=simple
Restart=on-failure
[Install]
WantedBy=default.target
(If you don’t like the boot splash screen saying “morpheans sharpikeebo”, you
can turn that off by modifying line 7 of the service file to
ExecStart=/usr/local/bin/sharpikeebo_lcd -noblink -invert -nosplash --
)
When you’re finished writing the service file, press Ctrl+x
to exit, y
to
save the file before exiting, and Enter
to save the file with the same filename.
Modify the application and the service file to make sure they’re runnable:
$ sudo chmod 755 /usr/local/bin/sharpikeebo_lcd
$ sudo chmod 755 /etc/systemd/system/sharpikeebo_lcd.service
Enable and start the service!
$ sudo systemctl enable sharpikeebo_lcd
Created symlink /etc/systemd/system/default.target.wants/sharpikeebo_lcd.service -> /etc/systemd/system/sharpikeebo_lcd.service.
$ sudo systemctl start sharpikeebo_lcd
Your SHARP display should now be mirroring everything that’s on the HDMI monitor. And, if you unplug the HDMI monitor, it should continue to work!
5. Readability
I did not find the default font to be very readable, especially at such a small size.
I looked through the /usr/share/consolefonts/
directory (which is large.
less
is your friend here. Try ls /usr/share/consolefonts/ | less
and use the
up and down arrows to scroll, or f
and b
to page forward and back, respectively.
Press q
to exit less
.).
I tried out a few alternatives with
setfont /usr/share/consolefonts/FILE.psf.gz
, and once I found one I liked I
wrote it into the console setup by running
$ sudo nano /etc/default/console-setup
I changed it so it read
...
FONTFACE="Terminus"
FONTSIZE="8x14"
...
When you’re finished, press Ctrl+x
to exit, y
to save the file before
exiting, and Enter
to save the file with the same filename.
This was the font face and size for all of the photos in this post, although now that I’ve used it some I realize I should probably bump up the size a little…
Enclosure Assembly
Ok, so for whatever reason you are ignoring my warnings and you want a Brick of your own. I can’t stop you.
The STL and gcode files are here. The CAD files that generated these STLs are here. These files are free for you to use, copy and modify, so long as you understand they come with no warranty of any kind, and I am not liable for any claim or damages. For more legalese, please read the license.
With that out of the way, I can tell you how to put this together.
Printing
I sliced these STL files on PrusaSlicer. I believe I used default settings for my printer and filament, and set the print resolution to 0.15mm.
I printed the parts on a Prusa i3 Mk3S+ with Prusa Polymers Vanilla White PLA.
Parts
Aside from the main components, you will need the following parts for the build.
For the enclosure, and in general:
- an assortment of M2.5 socket head cap screws:
- (2) 25mm
- (2) 20mm
- (2) 16mm
- (6 or 7) 4mm
And these parts for the power circuit:
- (1) 1x2 socket header
- (2) socket crimps
- (2) JST PH 2-pin 100m cables
- (1) toggle switch. The one I used is from Digi-Key.
- (1) JST PH 2-pin SMT Right Angle Breakout
- some hookup wire
And these parts for the display jumper:
- (1) 1x8 socket header
- (1) 2x5 socket header
- some flat ribbon cable, with 7 wires
- (14) socket crimps (for crimping onto the ribbon cable)
If you are going to attempt the extra credit, you will also want:
- (1) slide switch. The one I used is from Digi-Key. It’s possible this particular one is poor quality though, so be warned.
- (1) 5mm green LED
- (1) 5mm red LED
- (1) 10kΩ resistor
- some bakelite perfboard (or any prototyping board)
- some 2mm pitch plug headers
- (1) 1x4 socket header
- (4) socket crimps
- hookup wire
Tools & Consumables
- crimping tool for jumper wires
- soldering iron (and probably some solder removal tools too: copper braid or solder-sucker)
- solder (and flux)
- tweezers
- spudgers
- 2mm hex screwdriver
- a silver Sharpie
- hot glue gun
- some kapton tape, just in case
- sanity (not sure if this is a tool or a consumable tbh)
Steps
As you complete this assembly, make sure you do tests along the way. It can be demoralizing to put something all the way together, try to turn it on and it won’t go. I’ll try to leave notes about good times to do a boot test.
Display Layer
Start with the SHARP display, and its header pins. Bend the pins 90 degrees and clip the one on the end. Then solder the pins onto the display.
Optional: put some kapton tape over the components on the back of the display. We don’t want the jumper wires accidentally shorting on them.
Finagle the screen into place, and screw it down.
The next task is to build the cable that will go from the display to the Pi.
On the 2x5 header, put a marking on the middle pin of one side. Also mark one end of the 1x8 header.
Then, after crimping sockets onto the ends of the ribbon cable, slot the sockets into the headers. The order here is very particular, and must match the display wiring diagram above.
Plug the 2x5 header into the Pi such that the mark lines up with pin 20 (GND
).
The power cord plugged into the Pi in this photo is next.
Take one of the JST PH 2-pin 100m cables, and crimp a socket on the end of each wire. Then slot them into the 1x2 header. Plug it into the Pi on pins 2 and 4 as shown above.
Line up the Pi with the display enclosure and plug the 1x8 header into the SHARP display. Make sure the Pi’s power cable is routed around the outside and underneath the Pi.
Put the Pi in place on the display enclosure.
Note: This would be a great time to do a boot test! Plug the Pi into its own power supply
Power Distribution Layer
This section contains the Extra Credit. We’ll get into that soon but for now, start with the toggle switch, the other JST PH 2-pin 100m cable, the JST PH 2-pin SMT Right Angle Breakout, and your hot glue.
Assemble the toggle switch on the “power” enclosure. Solder it to the right angle breakout and the 2-pin cable as shown, and hot-glue the right angle breakout to the enclosure.
Then, grab the solar charger circuit board and two or three 4mm M2.5 screws. Screw the board to the “frame” enclosure, making sure to leave the outside corner un-screwed.
Extra Credit: charging indication and control
This part uses the slide switch, 2 LEDs, resistor, and proto-board, as well as the 1x4 header, header plugs, hookup wire, etc.
Make yours look like the picture! Or, really, make it look better than the picture, please, if you can. You will have to drill a hole in the side of the enclosure for the slide switch.
Also, refer to the power wiring diagram to see how everything should connect.
Oh, and if you’re hot-gluing things in place, take care not to put too much hot glue inside the slide switch. That will make it difficult to slide later.
The solar charger board gets some hookup wires soldered to it, with a 1x4 header crimped and slotted onto the ends.
Putting it all together
The frame enclosure fits onto the power enclosure.
Connect the power switch JST cable to the solar charger board.
If you did the extra credit, wire up the solar charger board to your LEDs and switch.
Plug the Pi power cable into the right angle breakout you hot-glued onto the power enclosure.
Note: This would be a great time to do a boot test! Plug a USB-C into the solar charger board and flip the power switch!
Before you align these enclosures, take note of the channel cut into the corner of the power enclosure. You want the Pi’s power cable to route in this channel. If it doesn’t, it could get pinched under the Pi’s GPIO solder pins, and short-circuit the power, potentially doing damage to your Pi!
Also, take a moment to remove the SD card from the Pi. Aligning these enclosures will be easier without that in the way.
Line up all three enclosures, and secure them with two 16mm M2.5 screws in the middle set of holes.
Reinsert the Pi’s SD card, if you removed it earlier.
Note: For this part you should use insulated tweezers, or plastic spudgers!
Carefully thread the battery’s JST plug into its place on the solar board. Try to avoid short-circuiting anything.
Place the battery on top of the aligned enclosures, and bring in the battery enclosure!
This has to “hook” onto the power switch, and the battery is a snug fit into it. Just be gentle and you’ll do fine.
Screw the battery enclosure on with two 25mm M2.5 screws on the right (power switch side) and two 20mm M2.5 screws on the left (USB/ethernet side).
Don’t screw these screws all the way in! Basically, as you screw them in watch the side of the Brick. After the screw is in far enough you will start to see a gap form between layers of the enclosure. This means you’ve screwed too far. Back the screw out so the gap disappears, and call it good enough!
Hopefully you’ve arrived here with your sanity intact. Plug in a keyboard and a tripod shoe, and boot it up. Hooray, you have your very own Brick! Try not to throw it.
What’s Next?
So I mentioned at the beginning of this that I don’t actually use this Brick for writing. The thing is…this display is really really small! It’s not quite the package design I envision for Tenet, so the bad news is that I will likely be taking this apart and sorting the pieces back into my hardware drawers.
The good news, though, is very good. I have plans to build a pentagonal slab laptop! Well, a truncated pentagonal slab laptop. truncapentaslabtop?
This is the next package design for Tenet, and will incorporate a keyboard and a solar panel right into the enclosure itself! Maybe even a thermal receipt printer, if I can coax 9V out of these lithium batteries.
Other open questions about the new design are the display and the power.
Will a 4.4" SHARP Memory display work, given that it has a lower-resolution than its 2.7" sibling?
Can I modify the software to drive two of them side by side?
Will the solar charger circuit accept multiple battery packs?
Stay tuned to find out!