A Compact Home-Made Raspberry Pi Tablet

June 28, 2017

A compact Raspberry Pi based tablet.

A compact Raspberry Pi based tablet.

Although a software developer by day and tech hobbyist by night, I’ve never been into buying every new gadget that comes out. I got my first smartphone in 2015, and have so far resisted getting onto the tablet bandwagon, perhaps because I’m often at or near a computer anyway, rendering a tablet redundant.

I recently got to try an Android tablet for a few days but found it too limiting due to the closed nature of most of the software available for it. Around the same time, I discovered the Raspberry Pi 3 and its matching 7″ touchscreen, and realized I could build a nice Linux tablet completely to my liking based on those, so that is what I set out to do.

Mine certainly isn’t the first Pi-based tablet, as Googling “Raspberry Pi Tablet” will reveal, but I believe it to be the smallest and lightest so far:

  • CPU: Raspberry Pi 3B with 1.2GHz quad core ARMv8 and 1Gb RAM
  • Storage: Lexar 32Gb micro-SD card
  • Display: 7″ 800×480 multi-touch capacitive touchscreen
  • Audio: On-board with 25mm speaker, and built-in USB with mic and earphone jacks
  • Ports: One external full-sized USB port, micro-USB port for charging
  • Operating System: Raspbian Jessie
  • Dimensions: 195 × 112 × 17.6 mm (7 11/16 × 4 3/8 × 11/16″)
  • Weight: 484 g (17.1 oz)
  • Battery: 6200mAh LiPoly, giving 4 to 12 hours battery life (6 hours watching YouTube)

To build such a compact device, I had to heavily modify the two major components and get creative about how to arrange them. This also necessitated a custom enclosure.

This project packs a lot of components into a very small package.

This project packs a lot of components into a very small package.

In contrast to most of my projects, I did not plan everything out in advance. I very much, “made it up as I went along”, and this article is as much about the journey as it is about the result. If you want to build a tablet like mine, consider this article a rough guide, as there are no complete plans. The photos are approximately in chronological order, although I did do some jumping back and forth between sub-tasks during the actual construction.

Components

The components used in this project are:

  • Raspberry Pi model 3B with a 32Gb SD card
  • Official Raspberry Pi 7″ touchscreen
  • Adafruit Powerboost 1000C charger and 3.7-to-5V converter
  • DS3231 temperature compensated real time clock
  • USB audio adapter
  • PAM8302-based mono class D amplifier
  • 25mm 8Ω speaker
  • Battery monitor and shutdown control circuit
  • 6200mAh Lithium-polymer battery
  • SPDT slide switch and 3 small pushbutton switches
  • USB and micro-USB ports

Trimming the Fat

The Raspberry Pi is very small, but not small enough to squeeze into such a tiny package. The combined thickness of the Pi and display when assembled as recommended is about 40mm (1 9/16″). I reduced this considerably by mounting the Pi beside the display controller instead of on top of it, and by removing a few unneeded large components from both the Pi and controller.

Raspberry Pi

The tablet would not make use of the wired Ethernet port nor the on- board USB ports, and since these both use a lot of space, I removed them.

The Ethernet and USB ports, and the GPIO header, consume a lot of vertical space.

The Ethernet and USB ports, and the GPIO header, consume a lot of vertical space.

I removed the Ethernet and USB ports by peeling off the metal shielding, cutting the plastic, and unsoldering the remaining pins.

I removed the Ethernet and USB ports by peeling off the metal shielding, cutting the plastic, and unsoldering the remaining pins.

Although the tablet makes extensive use of the GPIO pins, everything is hard-wired, so the space-consuming header was unnecessary.

All the GPIO pins except the ground pins were unsoldered. The ground pins were later clipped shorter.

All the GPIO pins except the ground pins were unsoldered. The ground pins were later clipped shorter.

Display

The display is designed for the Raspberry Pi to be stacked on top of the controller board, an arrangement that is about 40mm thick. Since I would be mounting the Pi adjacent to the controller, the tall standoffs could go. The USB power output port is also useless (it doesn’t even provide 5V when the display is powered from 5V), so I unsoldered it too.

The tall standoffs and the USB power-out port would not be needed.

The tall standoffs and the USB power-out port would not be needed.

I replaced the standoffs with M2.5x4mm screws, and unsoldered the USB port.

I replaced the standoffs with M2.5x4mm screws, and unsoldered the USB port.

The mounting tabs would interfere with the Pi on one side of the display controller and the battery on the other side, so I removed them. I first cut through each one at the centre with diagonal cutters, then bent it up slightly to cut the centre sections off of the sloped sections. The latter were then folded down flush with the metal plate.

The display mounting tabs were removed to free up interior space.

The display mounting tabs were removed to free up interior space.

The Case

With both the Pi and display controller thinned down, I experimented with various standoffs to see how close to the back of the display I could mount the Pi (still partially overlapping the controller). I eventually arrived at 16mm (5/8″) as the amount of interior space I would need to fit everything comfortably.

I decided that the overall width and height should be just a tiny bit bigger than the screen itself, just enough to protect the glass edges from impacts.

The case consists of three parts. The front is the touchscreen itself, the back is a piece of 0.8mm fiberglass (unclad circuit board material), and the two are separated by a 16mm thick frame.

To construct the frame, I began by building a jig on a piece of very flat plywood left over from another project.

The jig was constructed on a piece of very flat plywood. The wax paper is to prevent the frame from sticking to the jig.

The jig was constructed on a piece of very flat plywood. The wax paper is to prevent the frame from sticking to the jig.

The completed jig, ready to begin construction of the frame.

The completed jig, ready to begin construction of the frame.

I built the frame inside the jig from solid maple, cut into strips 16mm wide and 2.8mm thick (there is nothing special about the thickness; I just happened to have thin maple of this thickness on hand).

The frame is made from 16 x 2.8mm strips of solid maple.

The frame is made from 16 x 2.8mm strips of solid maple.

I butt glued the corners using aircraft grade epoxy.

I butt glued the corners using aircraft grade epoxy.

After the corner joints cured, excess epoxy was chiseled off, and the corners reinforced with triangular blocking.

After the corner joints cured, excess epoxy was chiseled off, and the corners reinforced with triangular blocking.

Test fitting the display onto the frame.

Test fitting the display onto the frame.

The corners were rounded to about an 8.5mm radius. To do this precisely and consistently, I built another jig to hold the frame, first for rough cutting on the bandsaw, and then sanding to shape with a sanding drum. I designed the jig to pivot around the centre of curvature.

I constructed another jig to hold the frame for rounding the corners, first by cutting them roughly to shape.

I constructed another jig to hold the frame for rounding the corners, first by cutting them roughly to shape.

A pivot on this jig allowed me to sand the corners to a precise radius.

A pivot on this jig allowed me to sand the corners to a precise radius.

The completed frame was remarkably sturdy, despite being held together only by small triangular blocks and epoxy in the corners (the stuff is strong enough to glue airplanes together). No additional bracing was needed, since the display and case back would provide the necessary structure to prevent the frame from flexing.

The completed frame, ready to have holes cut in it.

The completed frame, ready to have holes cut in it.

After rounding the corners, it is primarily the triangular blocking that holds them together.

After rounding the corners, it is primarily the triangular blocking that holds them together.

The display fits perfectly, with about 0.8mm of space all around.

The display fits perfectly, with about 0.8mm of space all around.

The case needs holes cut in it for the power switch, buttons, and various ports, but I deferred this until I knew exactly where all these parts would end up.

Attaching the Pi to the Display

I mounted the Raspeberry Pi face down on three standoffs cut from 5mm (3/32″) square maple blocks, each 8mm (5/16″) long. After fashioning the blocks, they were screwed to the board with M2.5x4mm screws, and then epoxied to the metal display back.

The 5 x 5 x 8mm maple blocks were drilled with a 2mm bit, and threaded using an M2.5 screw.

The 5 x 5 x 8mm maple blocks were drilled with a 2mm bit, and threaded using an M2.5 screw.

I screwed the blocks to the Raspberry Pi board to ensure they'd be positioned properly.

I screwed the blocks to the Raspberry Pi board to ensure they’d be positioned properly.

One block had to be notched to clear a ridge on the metal display back.

One block had to be notched to clear a ridge on the metal display back.

Once the epoxy had cured overnight, I unscrewed the Pi board.

Once the epoxy had cured overnight, I unscrewed the Pi board.

Because of the unusual mounting position of the Raspberry Pi relative to the display controller, I had to slightly trim the ribbon cable at the Pi end (so it could bend closer to the board), and fold it as shown below to connect it to the controller.

The display cable was trimmed and folded to suit the non-standard arrangement.

The display cable was trimmed and folded to suit the non-standard arrangement.

Positioning the Display in the Frame

To keep the display in the correct position in relation to the frame, I fashioned a series of spacer blocks to fit between the metal display back and the wooden frame. These were then epoxied to both the metal and the back of the glass, thus also preventing any display creep that some users of the touchscreen have experienced. Some of these spacers also double as mounting surfaces for other components.

One spacer has already been installed (left), and another is held by clamps (top) while the epoxy cures.

One spacer has already been installed (left), and another is held by clamps (top) while the epoxy cures.

Installing the spacers was done in the frame construction jig to keep everything positioned properly.

Installing the spacers was done in the frame construction jig to keep everything positioned properly.

All the Other Bits

Once the location of the two major components was cast in stone (or epoxy), I began to play around with the design and/or placement of the other parts.

Power Supply

My tablet is powered by a lithium-ion-polymer battery (whose size I did not choose until I was sure how much space would be left), feeding an Adafruit PowerBoost 1000C. This handy little board contains both a 3.7V-to-5V boost converter that can power the Pi and display, and a lithium ion charge controller. When an external power supply is plugged in, it provides power to both the charger and the system at the same time.

Close-up of the postage stamp sized Adafruit PowerBoost 1000C. I cut the outlined trace.

Close-up of the postage stamp sized Adafruit PowerBoost 1000C. I cut the outlined trace.

I made a few small modification to the PowerBoost 1000C. As shown in the photo above, I cut the trace to 200kΩ pull-up resistor R13 for compatibility with my shutdown control circuit (described later). This and the other changes are detailed in the modified schematic below:

Modified PowerBoost 1000C schematic detailing the modifications I made.

Modified PowerBoost 1000C schematic detailing the modifications I made.

Due to the confined space with minimal airflow in which the PowerBoost 1000C would be installed, I decided to attach heatsinks to the charging and voltage conversion chips. I made these from thin aluminum sheet, filed the bottom surface flat, and fastened them to the chips with a mixture of epoxy and heatsink compound.

I attached homemade heat sinks to the charging and power conversion chips. The orange and green wires are to allow the Pi to monitor charging status.

I attached homemade heat sinks to the charging and power conversion chips. The orange and green wires are to allow the Pi to monitor charging status.

The bottoms of the heat sinks were filed flat before mounting with a mixture of epoxy and heatsink compound.

The bottoms of the heat sinks were filed flat before mounting with a mixture of epoxy and heatsink compound.

Function Buttons

I wanted to have a few (three seemed about right) physical buttons on the tablet to access operations that might sometimes be awkward to perform using the touchscreen, such as bringing the on-screen keyboard to the foreground or maximizing a window. The switches for these buttons were salvaged from a non-working mouse I pulled out of the hardware recycling bin at work.

Three buttons salvaged from an old mouse were mounted on a small piece of stripboard.

Three buttons salvaged from an old mouse were mounted on a small piece of stripboard.

Three wires lead to GPIO pins on the Pi, and the fourth black wire connects to ground.

Three wires lead to GPIO pins on the Pi, and the fourth black wire connects to ground.

I epoxied small maple mounting brackets to both ends of the button assembly.

I epoxied small maple mounting brackets to both ends of the button assembly.

To make the actual buttons, I cut the legs of several old (1970s?) transistors I had in my junk drawer, epoxied them to cardboard from the back of a pad of paper, and then used a hole punch to create nice round buttons with a flange at the bottom.

The buttons themselves were made from old transistors, epoxied to cardboard.

The buttons themselves were made from old transistors, epoxied to cardboard.

USB Audio and Realtime Clock

The Pi’s built-in audio is not very good (approximately 11 bits resolution, with poor high frequency response), so I added an aftermarket USB audio adapter for use with earbuds or external speakers. The USB audio also allows for use of a microphone.

I removed the adapter from its case and replaced the USB plug with wires that would be soldered directly to the USB pads on the Raspberry Pi board. I also unsoldered and resoldered the two jacks, which were surface mounted despite the fact that both the jacks and the board were configured for through-hole mounting (which is more secure for something that undergoes repeated physical stress).

I removed the USB audio adapter from its case, and replaced the USB connector with wires.

I removed the USB audio adapter from its case, and replaced the USB connector with wires.

The Pi does not have an on-board real-time clock (RTC, really the only thing that it’s missing), so I purchased an external RTC module on eBay. The one I received uses a DS3231 RTC chip, which is identical to the (more common?) DS1307, but features a temperature-compensated crystal oscillator for better long term accuracy. The module is designed to plug directly into the Pi’s GPIO pins, but since I removed the pins, I also removed the socket from the module and replaced it with wires.

Like the audio adapter, the DS3231 real-time clock's connector was removed and replaced with individual wires (only 4 of the 5 connector pins are actually used).

Like the audio adapter, the DS3231 real-time clock’s connector was removed and replaced with individual wires (only 4 of the 5 connector pins are actually used).

Shutdown Controller and Battery Monitor

The PowerBoost 1000C has an enable input, EN, which if pulled low, will turn off the 5V output and put the entire device into a very low power mode. Unfortunately, doing this will not allow the Raspberry Pi to shut down properly. Requiring the user, even though it’s just me, to perform a proper shutdown seemed error prone.

The PowerBoost also has a low-battery warning output (LBO) which can be used to signal the Pi that the battery is almost dead. However, I wanted more precise battery information so that I could display a state-of-charge indication just like an off-the-shelf tablet would have.

To address both of these problems, I designed a small circuit containing both a shutdown controller and a battery voltage monitor.

Schematic of the shutdown controller and battery monitor. The blue area is the off-board power switch.

Schematic of the shutdown controller and battery monitor. The blue area is the off-board power switch.

The shutdown circuit consists of DPDT power switch S1, R8, R9, and C1. When the power switch is turned on, C1 quickly charges through S1A and R8, bringing the EN output high and turning on the PowerBoost 1000C after about 0.1 seconds. When S1A is opened (i.e. S1 off), C1 slowly discharges through R9, and after about 20 seconds, reaches a low enough voltage to turn the PowerBoost off. This time delay circuit is the reason why pull-up resistor R13 had to be disconnected on the PowerBoost. With it present, C1 can only discharge to about 4.2V.

When S1 is switched off, S1B will also immediately pull GPIO pin 40 (physical pin number) low through D2, signalling the Pi that power loss is imminent. A daemon monitoring this pin can then initiate a shutdown.

The circuit consisting of Z1A and Z1B, the two voltage comparators of an LM393 dual comparator IC, comprises the battery voltage monitor. Z1B, R1 through R5, and C2 form a triangle wave oscillator oscillating at approximately 100Hz, with low and high peaks at 1.87V and 3.33V respectively. This triangle wave is then compared against a fraction (0.689) of the battery voltage by Z1A, which outputs a rectangular wave with duty cycle varying from 0% when the battery is at or below 2.72V, to 100% when the battery is at or above 4.83V. This is fed to GPIO pin 38, where the duty cycle is monitored by the daemon.

The PowerBoost’s low battery output (LBO) is connected through D1 to GPIO pin 36 to warn the Pi, via the daemon, that a critical battery situation has been reached and that it should drop everything and shut down immediately.

As has become my custom for one-of-a-kind analog circuits, I constructed this on a small piece of stripboard. In the photo above right, there are two electrolytic capacitors, 10µF each and wired in parallel to give 20µF. I would have used a single 22µF capacitor if I’d had a small enough one on hand.

Completing the Case

I began by attaching all the display-mounted parts that would require matching holes in the case frame.

The micro-USB charging port (top) was screwed to a frame spacer, and the full-sized USB port (right) was epoxied to another spacer.

The micro-USB charging port (top) was screwed to a frame spacer, and the full-sized USB port (right) was epoxied to another spacer.

The complete button switch assembly was epoxied to the metal display back, with a piece of thin cardboard ensuring the correct spacing from the frame.

The complete button switch assembly was epoxied to the metal display back, with a piece of thin cardboard ensuring the correct spacing from the frame.

Making Holes in the Frame

The next step was to make all the necessary holes. I laid out all the remaining parts needing holes, and carefully measured and marked their locations on the outside of the frame. At the same time, I also marked the locations for the screws that would hold the frame to the display.

Round holes were made using successively larger drill bits so as not to splinter the wood. I made the rectangular holes by drilling a series of round holes, chiseling out most of the remaining material, and finishing the shape with small files and sanding blocks.

The Back Cover

I made the back cover out of a piece of 0.8mm (1/32″) unclad fiberglass circuit board material. I traced around the display directly onto the material and then cut it to size. The straight edges were cut by repeatedly scoring and then snapping the board, and I then rounded the corners by hand, cutting them roughly with tin snips and then sanding them to shape.

The cover is held in place by eight M2.5x4mm screws, countersunk into the cover as far as possible.

I cut the back from a sheet of 0.8mm (1/32") fiberglass board.

I cut the back from a sheet of 0.8mm (1/32″) fiberglass board.

5x5x10mm mounting blocks were glued to the inside of the frame, flush with the back.

5x5x10mm mounting blocks were glued to the inside of the frame, flush with the back.

With the translucent back taped in place, I drilled through it at the centre of each mounting block.

With the translucent back taped in place, I drilled through it at the centre of each mounting block.

Each screw hole was carefully countersunk by hand using a 4.2mm drill bit.

Each screw hole was carefully countersunk by hand using a 4.2mm drill bit.

The mounting blocks are visible here. The one marked * is attached to the display, not the frame, and also takes a screw to fasten the frame to the display.

The mounting blocks are visible here. The one marked * is attached to the display, not the frame, and also takes a screw to fasten the frame to the display.

Finishing the Frame

I debated with myself for a long time how I wanted to finish the frame. I considered a natural wood finish, glossy black, and metallic silver. Small defects in the wood that occurred while drilling the holes and were repaired with filler ruled out the natural finish, and I finally settled on the slightly retro look of silver.

The first two coats of finish were HobbyPoxy Fast Fill, almost all sanded off after each coat.

The first two coats of finish were HobbyPoxy Fast Fill, almost all sanded off after each coat.

Before spraying the silver coats, I stained all the holes black and plugged them so they wouldn't fill with paint.

Before spraying the silver coats, I stained all the holes black and plugged them so they wouldn’t fill with paint.

After two coats of Krylon Brilliant Silver and two coats of Clear Gloss, you can't tell it's wood any more.

After two coats of Krylon Brilliant Silver and two coats of Clear Gloss, you can’t tell it’s wood any more.

Component Installation and Wiring

At this point, all the parts were completed. All that remained was to put everything together. The two USB ports and the button switch assembly were already attached to the display, but the PowerBoost 1000C, shutdown controller and battery monitor, USB audio adapter, power switch, real time clock, and battery all still needed to be installed.

The USB audio adapter is a friction fit. The block, visible under the mid-right side of the adapter, prevents it from moving when a cable is plugged in.

The USB audio adapter is a friction fit. The block, visible under the mid-right side of the adapter, prevents it from moving when a cable is plugged in.

Like the audio adapter, I inserted the buttons from inside the frame before lowering the frame onto the back of the display.

Like the audio adapter, I inserted the buttons from inside the frame before lowering the frame onto the back of the display.

I forgot to take a picture specifically of the PowerBoost 1000C installation. It sits on a small platform in the top-left corner, held in place by one screw, and a small peg to prevent it from rotating. It is visible in several of the pictures below.

Two layers of electrical tape over the metal ridge serve as insulation, and a piece of auto side moulding mounting tape will hold the shutdown controller and battery monitor in place.

Two layers of electrical tape over the metal ridge serve as insulation, and a piece of auto side moulding mounting tape will hold the shutdown controller and battery monitor in place.

The shutdown controller and battery monitor after installation.

The shutdown controller and battery monitor after installation.

I also neglected to photograph the power switch, which is visible in the wiring photos further below. The switch is a simple DPDT slide switch, with a rather long handle, from my parts collection. Two 3mm thick blocks were epoxied to its mounting ears. These block then take M2.5x4mm screws from the outside of the frame.

After all of the above components were in place, I began wiring them together, since later components would make access difficult. I then installed the Raspberry Pi and completed most of the remaining wiring.

Completed wiring between the PowerBoost 1000C, shutdown controller and battery monitor, power switch, and charging port.

Completed wiring between the PowerBoost 1000C, shutdown controller and battery monitor, power switch, and charging port.

With the Raspberry Pi installed, I completed the power, USB, and GPIO wiring. The real time clock has also been installed and connected (bottom right side of the Pi).

With the Raspberry Pi installed, I completed the power, USB, and GPIO wiring. The real time clock has also been installed and connected (bottom right side of the Pi).

Instead of a fancy Fritzing diagram as seems to be popular for Raspberry Pi and other projects, I hand drew and then followed the wiring diagram below. The parts are obviously not to scale, but are drawn in their approximate relative locations.

Hand drawn wiring diagram for my Raspberry Pi tablet.

Hand drawn wiring diagram for my Raspberry Pi tablet.

More Work on the Case Back

Once all the components (except the battery) were in place, I could mark where I planned to install the speaker and amplifier, drill holes for the speaker and for cooling, and then finish the outside of the case back.

With all the components in place, I marked and drilled the locations of the speaker and cooling openings and marked where the amplifier would go.

With all the components in place, I marked and drilled the locations of the speaker and cooling openings and marked where the amplifier would go.

The outside of the back cover was sprayed with two coats of VHT Nite-Shades transparent black headlight paint.

The outside of the back cover was sprayed with two coats of VHT Nite-Shades transparent black headlight paint.

Battery Installation

I had ordered the battery from a seller on eBay as soon as I knew how much space I would have, but after three months, it still had not arrived. I contacted the seller, and he shipped a replacement by a faster method, which arrived in just over a week.

The 9x60x90mm 6200mAh battery came with very thin (about 28AWG) wire leads.

The 9x60x90mm 6200mAh battery came with very thin (about 28AWG) wire leads.

I used double sided automotive moulding mounting tape to hold the battery in place.

I used double sided automotive moulding mounting tape to hold the battery in place.

I cut the supplied leads as short as possible to minimize resistive losses, and spliced them to the tablet's power leads.

I cut the supplied leads as short as possible to minimize resistive losses, and spliced them to the tablet’s power leads.

Internal Amplifier and Speaker

Although the primary audio output of the tablet is via the USB audio adapter, I wanted to have a built-in speaker for applications like an alarm clock, or watching a YouTube video with a friend. I used a tiny and very thin 2.5W (overkill) class D amplifier, and an equally small 8Ω speaker.

The amplifier was fastened to the inside back cover with mounting tape, and the speaker with its supplied adhesive ring.

The amplifier was fastened to the inside back cover with mounting tape, and the speaker with its supplied adhesive ring.

The left and right channels were combined by a pair of 220Ω resistors wired to the Pi's audio jack test points.

Stereo to mono mixer.

Since there is only one speaker and a mono amplifier, I mixed the left and right audio channels together using a pair of 220Ω resistors soldered to the Pi’s audio jack test points, and fed the resulting signal into the amp. Click on the image to the right to see a close-up of the connections to the Raspberry Pi board.

To avoid damaging the speaker, which can’t handle even close to 2.5W, I turned the amplifier’s physical volume control to zero, played a maximally loud recording at full volume, and then turned the amp up to just below the point where the speaker started to sound unhappy. This ensures that nothing I play through the speaker in the future can damage it, even if I watch Star Trek: Into Darkness on my tablet.

All Done!

After screwing the back cover on, the tablet was done!

The completed tablet showing the on-screen keyboard and system monitor utility.

The completed tablet showing the on-screen keyboard and system monitor utility.

Because of the transparent black finish (and the cooling holes), the internal LEDs are visible.

Because of the transparent black finish (and the cooling holes), the internal LEDs are visible.

I made a hardcover case for my tablet, which will be the subject of another article.

I made a hardcover case for my tablet, which will be the subject of another article.

Software

My tablet runs Raspbian Jessie, which although a great Linux distro, needs a few additions to be a viable OS for a tablet. I added several pieces of software, some open source, and some that I wrote myself (also open source). I started development of the software early in the project so that I had something to do while waiting for various parts to arrive (I powered the tablet from an external 6600mAh lithium ion battery for a few months).

xvkbd

A tablet needs an on-screen keyboard (although I also use it with a Logitech K380 Bluetooth keyboard for tasks requiring a lot of typing). I tried a few alternatives, including matchbox, but found them not to my liking. I eventually settled on xvkbd, customized via the ~/.Xresources file.

The customized xvkbd virtual keyboard.

The customized xvkbd virtual keyboard.

twofing

Raspbian treats the touchscreen the same way as a one-button mouse, so common gestures like dragging to scroll or long pressing for a right- click do not work (except in Chromium, which supports these directly). The excellent twofing utility solves all these issues by implementing two-finger gestures for right clicking, horizontal and vertical scrolling, and zooming.

Pi Tablet Daemon

In the construction notes, I’ve made reference to a daemon which monitors various bits (literally) of the hardware. The daemon, named pitabd, is written in C and is launched from /etc/rc.local (at some point I may take the time to configure it properly as a service). It performs the following functions, once per millisecond unless otherwise noted:

  • checks for a shutdown signal from the power switch and initiates a proper shutdown.
  • monitors the three buttons and performs the corresponding actions:
    • bring keyboard (short press) or dashboard (long press) to front
    • increase brightness by 1/8 (short press) or to maximum (long press)
    • toggle foreground application between normal and maximized (short press) or full screen (long press)
  • monitors commands from the dashboard (every 5 seconds):
    • enable/disable screen dimming on idle when on battery power
    • enable/disable USB and Ethernet ports
    • enable/disable Wi-Fi and Bluetooth
  • power monitoring:
    • status of PowerBoost 1000C charging and charge-completed indicators
    • battery voltage
    • estimate of energy remaining
    • information is written to a tiny RAM disk for display by dashboard
  • monitors X11 idle time (at varying intervals depending on need):
    • dims display to half of selected brightness after 2 minutes of inactivity
    • turns off backlight completely after 5 minutes
  • monitors PowerBoost 1000C LBO and performs an immediate shutdown if triggered.

The daemon makes use of the following libraries and utilities:

  • bcm2835 – low level GPIO library used to monitor buttons, voltage, etc.
  • libxss and xscreensaver – allows the daemon to monitor user idle time
  • wmctrl – command line utility used by the daemon to resize windows

I’ve made the source code for the Pi Tablet Daemon available under the GNU General Public License at github.com/svorkoetter/PiTabDaemon.

Pi Tablet Dashboard

The dashboard lets the user monitor and control power usage.

The dashboard lets the user monitor and control power usage.

The dashboard is a small graphical utility that is launched from ~/.config/lxsession/LXDE-pi/autostart to display the current state of the system, and to allow the user to adjust some settings. It is written using FreePascal and Lazarus (an open source Delphi-like RAD environment). The dashboard performs the following functions:

  • displays system status:
    • battery voltage
    • estimated energy remaining
    • CPU/GPU temperature
  • lets user adjust power saving settings:
    • dim display when idle on battery power
    • enable external USB and audio (and the unused Ethernet port)
    • enable Wi-Fi and Bluetooth
  • displays concise information in its taskbar icon:
    • energy remaining both as a gauge and a number
    • gauge blinks at 2Hz when energy is below 5%
    • blinking lightning bolt at 1Hz indicates charging is in progress
    • solid lightning bolt indicates charging is complete

I’ve made the source code for the Pi Tablet Dashboard available under the GNU General Public License at github.com/svorkoetter/PiTabDashboard.

Conclusion

Well, it’s been a long build and a long article. I spent about three months of evenings building this tablet, slowed down from time to time by having to wait for parts to arrive. It has pulled together several of my interests, including electronics, software development, wood working, and just plain tinkering.

The end result is a tablet that is somewhat comparable to commercial offerings in many ways, but is a full blown portable Linux system of about the same power as my travel laptop (and will likely replace said laptop).

With a compact Bluetooth keyboard, the tablet makes a viable laptop replacement for travel.

With a compact Bluetooth keyboard, the tablet makes a viable laptop replacement for travel.

This project wouldn’t have been possible without that great little computer and display from the Raspberry Pi foundation, as well as the many add-on bits produced by third parties. And of course, it would have gone nowhere without the huge amount of free software out there, including but not limited to Raspbian (GNU Linux) itself, FreePascal and Lazarus, xvkbd, twofing, and countless other packages that make Linux complete. Without these, I would have been reinventing a lot of wheels.

Related Articles

If you've found this article useful, you may also be interested in:

45 Comments

  1. Michael Horne
    July 14, 2017

    What a tremendous account of a fantastic build. I want one 🙂

  2. Dillon Nichols
    July 14, 2017

    Amazing attention to detail. Awesome project.

  3. Adam Paul Sommer
    July 14, 2017

    Thanks for posting such great details of the steps. Been thinking about a Raspberry Pi laptop build for a while, and this is very inspiring.

    Thanks again!

  4. fred
    July 15, 2017

    What an inspiring labour of love! The stripping down unused parts thing gave me ideas for my own projects.

  5. Andy from Workshopshed
    July 15, 2017

    Hey Stefan, what a great project. An excellent combination of electronics, software, woodwork and more.

  6. Chris Barbieri
    July 15, 2017

    Fantastic! I especially love the pushbuttons made from old transistors. I too am a woodworker hobbyist and in this day of 3D- printed parts, it is nice to see wood being used.

  7. Kirk Adair
    July 15, 2017

    Very nice, very good use of space

  8. AndyJ
    July 15, 2017

    In appearance, it reminds me of a very basic metal-cased Android tablet I had a number of years ago. In ability, it’s in another league. Congratulations!

    I realise I could go hunt the price for each component listed, but ignoring the huge amount of time put into this, do you have an idea the costs involved?

  9. Stefan Vorkoetter
    July 15, 2017

    Hi Andy: I didn’t really keep track, but it was definitely more than I could have bought a tablet for. Probably somewhere in the $250 to $300 (Cdn) ballpark. Of course, some of the things I bought, like paints, I only used a tiny portion of on this project, and will use on other projects too.

  10. Bob Murphy
    July 15, 2017

    WOW! An intense, elegant, creative labor of love and ingenuity. This has so many good ideas in it I’m going to save it to savor. Congratulations to you, Stefan.

  11. FipS
    July 15, 2017

    Very nicely put together! I wouldn’t expect such a compact build when using standard components, great job. The wooden frame is also very nice. I’m building something similar based on Raspberry PI Zero W, but without a display, just a very portable wireless mini server, which can serve as a backend for my mobile/tablet on go.

  12. JP
    July 15, 2017

    Contratulations Stefany,very nice. An excelent work that include wood, software programme, electronic services nand art.

  13. Stéphane
    July 16, 2017

    Brilliant!

  14. William H B Mawhinney
    July 16, 2017

    Excellent article!!

  15. Freire
    July 16, 2017

    Congratulations, one of the best and thorough project for Raspberry Pi.

  16. George V
    July 17, 2017

    Excellent work, very detailed, much appreciated for sharing the know how

  17. Xiblack
    July 17, 2017

    Thorough article, detailed explanation and excellent results.
    Thank you for sharing your work. It has practical usages for many pieces of hardware, software and diy stuffs.
    Love the final look of your tablet.

  18. H. Kamran
    July 17, 2017

    You could have used a Raspberry Pi Zero W. They are small, powerful, plus has wireless capabillites. The only difference is that is has a mini-USB for OTG support, and it has a camera port only. But you probably could have found a way to use the mini-HDMI port with the Raspberry Pi Foundation’s Display…

  19. Stefan Vorkoetter
    July 17, 2017

    The Pi Zero W hadn’t been announced yet when I started, and I don’t think it’s trivial to convert HDMI to what the display is expecting. I’d probably need a Pi-3-sized converter board.

  20. Brian
    July 18, 2017

    Does the tablet work in portrait and landscape mode?

  21. Zander
    July 18, 2017

    May I suggest writing an LXPanel plugin for quick access to battery levels?

  22. Stefan Vorkoetter
    July 18, 2017

    I haven’t tried it in portrait mode, but I don’t see why it wouldn’t. It would just be a matter of setting lcd_rotate in the /boot/config.txt file.

  23. Stefan Vorkoetter
    July 18, 2017

    I could do that (after figuring out how), but the dashboard app I wrote already gives that information in its taskbar icon anyway, so all it would do is save a tiny bit of real estate on the taskbar.

  24. John
    July 20, 2017

    Wonderful Stefan! It has inspired me to have a go at something similar. Thanks for sharing.

  25. Nayan
    July 22, 2017

    Hi stefan,

    I’m also working on similar to this tablet and also using pi 3 , 7inch touchscreen display & powerboost 1000c but what I’m facing is that when i bootup the pi it restarts again & again coz the o/p voltage drops to 4.5V. I’m sure you also face this problem while making this tablet. Any suggestions about this problem??

    It will be a great help for me!

    Thanks

  26. Stefan Vorkoetter
    July 22, 2017

    Hi Nayan,

    The only time I had a problem was when the battery leads were too long and thin and could not supply enough current to the PowerBoost 1000C to maintain the desired output voltage under load. The leads should be short and/or thick.

    Also, if the problem happens with the adapter connected, make sure the adapter can provide 5V at 2.5A. When the adapter is connected, it both powers the Pi, and charges the battery.

  27. Forrest Dee Jeffcoat
    July 22, 2017

    My hardiest compliments upon your admirable accomplishments; and my sincere admiration.
    Not the least, I’ve thoroughly enjoyed the ‘trip’ you’ve
    shared in your adventure extent!
    My best of wishes toward your next adventure!
    A tip of the old Hatlo hat, as it were and Bon Voyage!
    (wouldn’t have an open berth, perhaps, would you?)
    Jeff

  28. Juris Perkons
    July 23, 2017

    Super inspiring. I am electronics engineer and hobbyist, so, project like this gives me tons of emotions, thoughts, and gives dopamine dose to brain. Thank You a Big One.

  29. kenC
    July 23, 2017

    This is Engineering Art. Not only fully functional but a classy silky style achieved from a lot of extra thought/effort resulting in a very professional and desirable piece of technology. It was a bit like observing someone modelling a new sports cars but there it is made out of some easy mouldable material. This is more a designer at work wearing an engineer’s hat and working with the hands of a craftsman. Should have a flash motif on the side! Perhaps….Ultimate_Pi.

    Great stuff.

  30. Javier Garcia
    July 23, 2017

    I want one!!! Lovely, nice, neat and sleek!!!

  31. Nayan
    July 25, 2017

    Hi Stefan,

    Thanks for the reply!

    After connecting the wall adapter to PB 1000c the o/p voltage drops . while on battery the o/p voltage remains 5.01V. Kindly suggest

  32. Stefan Vorkoetter
    July 25, 2017

    It sounds like your wall adapter is inadequate. What is the rated output current of the adapter?

  33. Nayan
    July 25, 2017

    ok. my wall adapter is 5V 2A.

    https://forums.adafruit.com/viewtopic.php?f=19&t=120685

    I suggest u to read my conversation with adafruit guy, he is saying that PB 1000c is not suitable to powerup pi3 & 7″ display.

  34. Andrew
    July 25, 2017

    Fantastic build, thanks for sharing!
    Quick question, where did find your 6200mAh Lithium-polymer battery? I’m having trouble finding one.

  35. Stefan Vorkoetter
    July 25, 2017

    Nayan, I will go participate in that conversation. The adapter should be adequate, although 5.2V at 2.5A would be better.

  36. Stefan Vorkoetter
    July 25, 2017

    Andrew, search for “906090 battery” on eBay.

  37. MAthieu BC
    July 25, 2017

    Great and really good job. A true step-by-step tutorial for raspberry and linux lover that love a freedom tablet. Because of this great tutorial, many people will have more software and true programming capability with the tablet instead to use an Intel computer for Android apps.

  38. Nayan
    July 26, 2017

    yes u r ryt stefan!

    I unplugged the battery from PB 1000c and power only by wall adapter the volts I measured from BAT pin was flicking b/w 4.67V – 5.01V which causes reboot of pi3 & display.

  39. Stefan Vorkoetter
    July 26, 2017

    Oh oh. You should never run a PB1000C without the battery attached, as it will likely be damaged.

  40. Mark F
    July 28, 2017

    Fantastic job. I love to see the work of a craftsman. Thank you.

  41. Ben S
    August 03, 2017

    Thanks for sharing your building adventure. Outstanding work! Super cool!

  42. MarkyD
    August 10, 2017

    What an awesome achievement, very impressive. Whats more impressive is that you have taken the time to document this is such a detailed and extensive manner. You have inspired me and I am sure others. Big thank you!

  43. Wolfgang
    August 18, 2017

    Since I am currently working on my own Pi-Tablet -like device, this is a really great inspiration. Thank you for sharing!

  44. JohnP
    September 10, 2017

    Great job – very inspiring. It appears you are a pilot, and so am I, so I was wondering if you have done anything with a PI ADS-B receiver? If so, have you published the information?

    Thank You!

  45. Stefan Vorkoetter
    September 10, 2017

    No, I haven’t done anything aviation related with the Pi (yet).

Leave a Comment

Want to see your picture next to your comments on this site and others? Visit gravatar.com to register your own globally recognized avatar.

Buy Stefan a coffee! If you've found this article
useful, consider leaving a donation to help support
stefanv.com

Disclaimer: Although every effort has been made to ensure accuracy and reliability, the information on this web page is presented without warranty of any kind, and Stefan Vorkoetter assumes no liability for direct or consequential damages caused by its use. It is up to you, the reader, to determine the suitability of, and assume responsibility for, the use of this information. Links to Amazon.com merchandise are provided in association with Amazon.com. Links to eBay searches are provided in association with the eBay partner network.

Copyright: All materials on this web site, including the text, images, and mark-up, are Copyright © 2017 by Stefan Vorkoetter unless otherwise noted. All rights reserved. Unauthorized duplication prohibited. You may link to this site or pages within it, but you may not link directly to images on this site, and you may not copy any material from this site to another web site or other publication without express written permission. You may make copies for your own personal use.