KAPULA - The Thermal Smartphone

An open source, open hardware thermal camera smartphone project
for freshman engineering students

Similar projects worth following
I teach electronics at Tampere University of Technology. I have always believed in the utmost importance of personal enthusiasm in the learning process and to kindle the spark we have presented our students a voluntary freshman course on which they build something extraordinary. This year, the project was a wooden smartphone with a thermal camera.

The phone has been designed with the ease of build in mind. The precoated 2-sided pcb is exposed, developed, etched, sized, cleaned, flux coated and drilled, the components soldered, the software flashed and the phone encased by the students. The initial software provides basic functionality (making and answering calls, viewing the thermal image, taking thermal snapshots and sending them as MMS messages) to start with, and is easily expandable to push enthusiastic students to extend it on their own. The phone hardware also has some extra functionality available only through additional (yet quite simple) programming.

The first proto-prototypes of the KAPULA (Finnish for 'a block of wood') were based on the LPC1768 MBED and this is evident in both the hardware and the software. The software development is still in the MBED cloud IDE and the software is provided as a packaged MBED project in the files section. The MBED infrastructure is only minimally used, to expose the beauty and power of direct hardware control to the students. Usually, of course, one should primarily use ready built objects for a number of reasons, but here is a chance to peak under the hood.

The hardware is based on the LPC1768 Cortex M3 ARM, the FLIR Lepton thermal camera, a SimCom SIM900D GSM module and a DX ILI9341/XPT2046 touch display. In addition, the system contains a microphone, a speaker, an accelerometer, a pinch of discrete components, and connectors for USB, microSIM, debug, and the display. Some of these are not used at all (the accelerometer and the SD card interface at the display board) and some are gravely underutilized (the USB connection) by the default software. This is by design to prod the students forward with easily attainable goals. The MBED libraries are the key, here.

The main user interface is a point-and-click image (courtesy of my daughter) showing that makers do not need to settle for established concepts, when building things of their own. While the system extension hints for the students are to expand the functionality of this interface, I'd rather see someone to come up with a totally different one from ground up. The hardware is actually quite capable and the software already documents the interfaces nicely.

The phone software as a zipped, exported MBED project. Possibly compilable on other environments, too. The course name is Funtronics, hence the project name.

Zip Archive - 573.85 kB - 03/17/2016 at 10:20



Simple .bin to .hex converter for Windows 7. Should work for files up to 4GB. Usage: bin2hex64 <source> <destination>

octet-stream - 429.00 kB - 03/16/2016 at 14:35



Source for the .bin to .hex converter

plain - 1.66 kB - 03/16/2016 at 14:16



Eagle layout

brd - 404.83 kB - 03/10/2016 at 14:00



Eagle schematic

sch - 1.00 MB - 03/10/2016 at 13:59


View all 13 files

  • 1
    Step 1

    Building the KAPULA is quite straightforward. For the pcb, Bungard or similar 1.6 mm double sided, photoresist coated FR4 board is recommended. The 10 mil traces and spacings are thin enough to be spoiled by a stray speck of dust if self sprayed photoresist is used. In a laminar hood, maybe, but still... why? Changing the board material or thickness will detune the antenna, but in practice that is insignificant. The vias are gigantic to enable drilling with a wide variety of bits (we use 0.6 mm (24 mil)), the display connector holes should be drilled with 0.8 mm - 0.95 mm (31 mil - 37 mil) bits. The debug connector and microphone holes do not need to be drilled at all. Since most builders, including us, don't have access to through-hole-copper, almost all of the vias need to be fitted with copper wires soldered on both sides.

    Sticking the wires to the cardboard below

    A few of the vias (like the one underneath the processor) are there only to let Eagle flood the copper to open areas. Do not wire the holes shown in red in the map below.

  • 2
    Step 2

    The components are most sensibly soldered starting from the processor and finishing with the Lepton. The functionality of the system can be tested without the Lepton and a mistake will be much less costly (... at least to the University. Did I mention the course is free for the students). For the processor the recommended method of soldering is drowning the pins in solder and then removing the surplus with a wick (see this excellent tutorial). This consistently results in better outcome than individually trying to solder the pins. Once more verify the orientation of the processor before soldering, as the LPC1768 has an unusual pin numbering and marking scheme... The crystal leads double as vias, so they should be soldered on both sides.

    The bottom of the microSIM holder needs to be isolated from the ground plane underneath by a piece of Kapton tape. Position the tape exactly next to the pins, turn around and cut to size with a scalpel along the holder edges. Then clear the mechanical mounting pads on the sides, these are necessary to keep the SIM card in place. Given the proximity of the GSM antenna it was felt that a solid piece of copper is necessary there and later observations seemed to support that assumption.

    The display header can be either directly soldered to its place, or a female connector can be fitted in between. The latter results in a phone that is a couple of millimeters thicker (150 mils, maybe), but has superior tweakability. The phone battery is placed between the GSM module and the display and if there ever is a need to replace it, that is obviously impossible with the display in place (unless the battery has longer wires - also a valid option). The battery needs wires to be soldered to its terminals and this should be done with minimal heating. Fortunately most battery terminals are gold plated and instantly wet from the solder. All exposed battery pads, wires etc should be insulated with tape, epoxy or hot melt glue. Consider the battery a loaded gun when fitting the wires to the correct holes (battery pinouts vary) not letting them touch anything else. An optional piece of two-sided tape will secure the battery to the GSM module nicely.

    The display will benefit from additional shielding underneath with grounded copper tape (first plastic tape, of course) to reflect most of the antenna radiation. Otherwise some disturbances in the image can be seen. The SD card holder provides a perfect grounding point, being large and planar. Originally the antenna didn't have an attenuator circuit and the unshielded display occasionally crashed during the initial GSM burst! So did the processor without the filtering circuit on the reset line. The antenna seems simpler than it is, this design was a result of several iteration rounds and provides decent response even with nearby enclosure, hands and skull. The radiation pattern is not yet measured.

    A pin header can be temporarily soldered to the debug connector. The pinout matches an FTDI cable with the exception of pins 2 (reset) and 6 (boot), which need pushbuttons to gnd (notice the two missing pins in the adapter). To reset the ARM the reset button is pressed, to flash it the boot button is pressed, the reset pressed, the reset released and the boot released. To actually download the new software, FlashMagic is used. The MBED .bin can be converted to the necessary .hex with the bin2hex64 utility in the files section. I cannot believe that google didn't find a bin2hex that would work both with files larger than 64 kB and in 64-bit Windows 7.

  • 3
    Step 3

    The GSM module needs a firmware update if MMS messaging is desired. The original firmware supports HTTP (and TCP in general), so sending pictures can easily be accomplished with it also, but not directly to other phones. The enhanced firmware supports MMS and HTTPS, although we have not tried the latter yet. All in all, the GSM communications seems to be a somewhat murky subject, with multiple cryptic ('bearer profile', say what now?) layers of functionality. The phone software contains a working solution for MMS, but that was a lot of (guess)work. At least it seems to be essential to close the API layers successfully and in correct order afterwards. Also, sending MMS messages seems to be insanely expensive compared to anything modern.

    It is easier to update the module before it is soldered to the board. For that, one needs to solder wires to pins 1 (debug_rx), 2 (debug_tx), 12 (powerkey), 37 (gnd) and 38 (3.3 V). Contrary to the SIM900D documentation, it seems not to be possible to update the firmware through the main UART. Powerkey should be connected to gnd via a pushbutton (or improvise with a breadboard) and the rest to a standard 3.3 V FTDI cable in obvious order. In the image the header pinout complies with the debug adapter, the reset button connecting to the powerkey signal.

    If the module is already on the pcb, wires can be connected to 1, 2 and any ground, connected to the FTDI cable and power provided by the phone battery. If the boot switch is pressed within one second after the reset is released, the software switches to GSM firmware update mode mirroring the state of the boot switch to the powerkey.

    The firmware upgrading application and instructions, and the enhanced firmware are just a click away. That repository appears to depend on user uploads, so be sure to scan what you get.

View all 3 instructions

Enjoy this project?



Jantteri wrote 04/26/2016 at 10:58 point

What kind of budget  the BOM requires? Cool platform.

  Are you sure? yes | no

Karri Palovuori wrote 04/27/2016 at 07:45 point

The costs are dominated by the Lepton, of course, which is something like $ 175, the GSM module is around $ 20, the processor and display $ 10 each. The odds and ends are maybe another $ 25. So the realistic total could be around $ 250.

  Are you sure? yes | no

maartenva wrote 04/26/2016 at 09:16 point

is it possible just to use it as a thermal camera and not install the GSM module?

  Are you sure? yes | no

Karri Palovuori wrote 04/27/2016 at 07:50 point

By hardware, absolutely. By current software, probably... never tested this but if my memory serves me correctly, in that case the phone would try to boot the missing module on the background without any noticeable or ill effects.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates