PiPhone – A Raspberry Pi based Smartphone

IMG_0872cHere’s my latest DIY project, a smartphone based on a Raspberry Pi. It’s called – wait for it – the PiPhone. It makes use an Adafruit touchscreen interface and a Sim900 GSM/GPRS module to make phone calls. It’s more of a proof of concept to see what could be done with a relatively small form factor with off-the-shelf (cheap) components. I don’t expect everyone to be rushing out to build this one, but I had great fun in doing it, as it builds quite nicely on my previous projects, especially the Lapse Pi, a touchscreen time-lapse controller, and uses most of the same hardware.

What makes this different from the Timelapse controller is the addition of a a SIM900 GSM module, which is connected via UART to the Raspberry Pi. Also, I got myself a LiPo battery that would fit nicely between the TFT screen and the Raspberry Pi, so it could be used standalone, without any wires hanging off it whatsoever. Here’s the finished PiPhone.

IMG_0872d

 

Also shown in the above pic is the touchscreen interface I developed for the purpose of this project. It’s a numeric keypad, with a display of the number to dial at the top, and a phone icon at the bottom to make or hang up the call.

 

Here’s a demo of the PiPhone in action.


And do please subscribe to my channel, I regularly put up other cool projects! 🙂

Once we turn the unit over, we can see the main communications module, which is a Sim900 GSM/GPRS module. This allow us to send standard AT commands to it to make calls, hang up, send texts, data etc. Overall a very clever module. Towards the bottom of the white PCB, you can see the SIM Card, which allows the module to associate with my local GSM network, and it’s using a regular prepaid SIM card, bought in my local phone store for €10. Below the GSM module, you can see the on.off switch and a DC-DC converter, which converts the 3.7volts from the LiPoly battery to 5volts needed by everything else. The DC-DC converter is from eBay from a UK seller. It was more expensive than I’d like to have paid, but It was the last piece of the puzzle, and I didn’t want to wait the typical 3 weeks from China. IMG_0868b The following image gives a better view of the LiPo battery. It’s from Adafruit (http://www.adafruit.com/products/328), which fits nicely between the TFT and the Pi. The only problem with this setup is heat. It gets a bit warm around the CPU if you leave the unit switched on for several minutes, as there’s very little air circulation. With a small fan circulating the air around it, I was able to leave it on for extended periods during development, and it was cool to the touch. Also, the 6 pin header on the GSM module sticks out a bit, so I though about de-soldering the  header and soldering the wires directly onto the PCB. That would prevent the connector sticking out so much, and would sit better when placed on a flat surface. IMG_0867b And the other side view, showing the foam-core board seperating the GSM module from the Raspberry Pi. I chose a nice thich piece to ensure no electrical connections between them. Oh, and a couple of well placed cable-ties was all that was needed to hold everything together. 🙂 IMG_0869b And one last pic showing the Adafruit TFT on top. IMG_0866b   I presented this to my local FAbLab the night before the publication of this blog article, and one question from the audience stood out: “Do you have to pay for credit?”. That certainly made me think, and we had a good giggle at that. Yes, you still have to pay for credit in the usual way, purchase a SIM card from a local service provider. This is not going to get you free calls! Nice try though! 🙂 Costs:

As you can see from the cost of the components, you’d be FAR better off going into your local phone store and picking up a normal smartphone, but hey, where’s the fun in that. I got a great kick out of the first phone call I made with this thing. And it wont’s stay in one piece for long, I’ll be using those parts for other projects very soon!

Software Code is available on GitHub. All the instructions are there, and links on what to do to install the PiTFT, etc.

–update Nov 2016 — Touch Screen Issue Solution– 
I’ve had a few reports of the touchscreen not working. Thanks to DongHyun Lee from Malasya that found a solution in his case, which was down to the version of PyGame provided with Rasbian Jessie. Later versions of SDL (pygame) such as 2.x or 1.2.15-10 have some serious incompatibilities with touchscreens in a pygame app. So he downgraded to version 1.2. When I wrote this article, I was using Raspbian Wheezy, whereas users now are probably using Raspbian Jessie.
Have a look at the following page: https://learn.adafruit.com/adafruit-2-4-pitft-hat-with-resistive-touchscreen-mini-kit/pitft-pygame-tips
–end update

Circuits None. 🙂  It’s all made from off the shelf components.

About the Author: By day I’m a senior software engineer. In my spare time, I take pictures, and play with gadgets and technology.
Google Plus: https://plus.google.com/u/0/103494825025710742625/posts
Twitter: https://twitter.com/climberhunt @climberhunt
Facebook: https://www.facebook.com/davidhuntphotography

Be sure to check out my other Raspberry Pi related articles, and if you like, you can subscribe by entering your email address at the top right of the page. 🙂 Code is now available at https://github.com/climberhunt/PiPhone Note: There’s now a guide on learn.adafruit.com with new diagrams and information on building your own PiPhone: https://learn.adafruit.com/piphone-a-raspberry-pi-based-cellphone



Other Related Posts:

236 thoughts on “PiPhone – A Raspberry Pi based Smartphone”

  1. Pingback: Raspberry Pi
    1. If you turn off the hardware you’re not using, and put the CPU to sleep a lot, whenever nothing needs calculating for that particular millisecond, you could get days I should think, on standby. It’s what ordinary phones do.

      You could wake up, say, every quarter-second to check the touch screen, if you can’t get it on an interrupt. Microcontrollers often have lots of power-saving features. A phone spends nearly all it’s time waiting for input from the user, or data from the network.

      That’s the key to battery life in portable products: Be switched off 99% of the time. There’s probably a lot on the web about using Raspis on batteries, and squeezing out the most currrent. The GSM / GPRS module might also have power saving options.

      1. Do you have a tutorial for setting up that kind of 99%-off standby mode? I’d like to use it in my Raspberry Pi project.

        I put a Pi inside an iPod shell, and I use it as a pocket-sized USB host.
        http://peterburk.dyndns.org/pipod

        Instead of a boost converter I used a PCB from a power bank, so I can easily recharge it from microUSB. (Version 1 was pickpocketed on Hainan Airlines from Brussels to Beijing. I now made version 2, but I can’t post photos, because it’s a prototype Pi motherboard I acquired last year while working for the Pi manufacturer, Egoman, in China). Email me if you have questions ;-).

        I want to add an LCD to my new iPod Video-sized model, but there’s no space inside the case for my Nokia 3310 screen.

        In the current form though, powering up is slow, and a sleep mode would be perfect. Let me know if you’ve got a good tutorial for that!

        1. Have you researched sleep modes on the Raspberry Pi at all? I’d be really interested to see what’s out there.It would be really useful for the PiPhone. Currently it’s on full all the time.

          1. Actually a cursory look round tells me the Pi has NO power-saving hardware. It’s either up and running, or off!

            http://www.raspberrypi.org/forums/viewtopic.php?f=29&t=19253

            Is a discussion mentioning underclocking the main chip, which reduces power but not much. That page links to

            http://www.bitwizard.nl/wiki/index.php?title=Reducing_power_consumption_of_a_raspberry_Pi

            Which mentions replacing the Pi’s linear regulator with a more efficient one. The first page I mention, says it’s the network chip that takes most of the power, and it’s possible to remove that, as described in another link from the first link I gave.

            So in this case, the chip just wasn’t designed for battery operation. It’s a shame cos many ARM-based chips have lots of power-management functions, just not this one.

            It’s a shame. Still, there’s plenty of other ARM-based dev boards out there, with Linux support and with power-management. Perhaps one of those would be a decent replacement for the Pi, if you wanted to make a more practical phone. Which would of course be very very cool! Texas Instruments do a few dev boards, very cheap, for their MSP series ARM controllers.

            Probably a bit more work than I originally imagined, in getting power management down. There’s no fundamental electronic reason why it can’t be done, just the Pi is the wrong choice of brains. 8-bit Atmel chips would also drive the phone-module well enough, but of course you’d miss out on most of the power for applications, and the existing software base.

          2. Oh, also might mention, that the Model A Pi doesn’t have the network chip included like the Model B, so that would draw less current to start with. There’s also some other bits and pieces missing, which all helps.

  2. Pingback: Faweiz Blog
      1. Python… hmm…Amazing, and i thought python cant do stuff like that, you made my mind go “How stupid of me”.
        Do upload the code. I would like to see it.
        Best Regards and wishes for your future projects 🙂

        1. Python already did stuff like that and even more. There was (somewhere around 2008-9 AFAIR) complete, functioning phone software for Openmoko Neo Freerunner called PyNeo which had its UI and services written almost exclusively in Python. Later, the freesmartphone.org had its first reference implementation of API done in Python, together with example GUI for it called Zhone. SHR distribution uses some Python apps for it’s core utils here and there.

          Actually, there’s nothing special about Python here, you can rewrite all of this stuff into almost any other programming language. For instance, there’s also a phone UI for FSO written in Emacs Lisp, called fso-el. With proper platform, only your imagination sets the limits.

          1. right. you say ´functioning´ – my friend phil hands supported the openmoko by buying one. unfortunately the team who were employed on that project bit off more than they could chew, and used completely the wrong technology. what they should have done is what david has done: release a development phone that was capable of receiving and making phone calls, and perhaps sending and receiving sms messages. they could have done this by installing X11 and making an appropriate ´skin´ for the xgnokii application, or they could have installed gphone and they would have reached an all-important milestone of having phone calls and sms within only a few days of effort.

            instead they chose to develop an entire runtime environment, using the god-forsaken system known as d-bus. they created so many notifications in this system – without communicating properly within the team – that not only were notifications often completely lost, but also they had notifications which sent more d-bus notifications which in some cases went recursive and overloaded the system in unrecoverable ways except a power-cycle.

            … but the worst thing was that due to all this context-switching, the processor was unable to cope. in general, ARM processors are not hardware-optimised for multi-processing, they are optimised for low power. so in the ARM9 for example if you context switch the *ENTIRE* 1st level cache is thrown away!

            so when a phone call came in, the sheer quantity of d-bus messaging was so great that the phone CPU on the OpenMoko was too busy to handle the screen and even the keyboard responses from X11. which, as anyone familiar with X11 will know, is *also* a client-server architecture meaning that there is yet *another* set of context-switching to contend with.

            the upshot was that you literally could not answer a phone call within a reasonable amount of time.

            basically although i am a huge fan of python it *is* necessary to take into consideration that it is an interpreted language with a speed *between* 1% and 99% that of c *depending on circumstances*, so whenever considering using it for real-time purposes on resource-constrained devices you had better keep it really *really* simple.

          2. I can relate to what you described, but over last five years that I’ve been using my Freerunner (and I still do it even today!) the situation was changing many times for the better. While Freerunner is still an overwhelmingly underpowered piece of hardware, also due to poor hw choices like Glamo (thankfully we now have more modern projects like GTA04 and Neo900), in the end it turned out that it was manageable to provide a nicely working environment out of very powerful and flexible building blocks. And my inner hacker that enjoys playing with phone source code, maybe even just to beat the boredom in tram and using on screen keyboard, is really thankful for it 😛

          3. yes. the GTA04 by dr schaller with the 1 ghz OMAP is definitely enough, even to cope with the mess that is d-bus. it was just such a pity that they spent so much money on the GTA01 to *not* get it right… at the time

        1. AmRood,
          Once you do the ‘git clone’ on your Raspberry Pi, you’ll end up with a PiPhone directory. If you ‘cd’ into that directory, you’ll see the piphone.py script which is the script that runs the GUI.
          Regards,
          Dave.

  3. I’d like to see where you can get a smartphone for under $158 that doesn’t have a contract (i.e. where you pay back the cost of the phone over time).

    1. That was my thought. In Canada, I checked Koodo for prepaid phones, there’s an LG-A341 for $100, but it is hardly a smartphone.

      1. yes… but the neat thing here is that unlike any off-the-shelf prepaid phones you can easily customise the software to create an any-level-of-intelligence-of-your-choice phone. personally i would create a dumb-phone with it 🙂 phone calls. sms. nothing else!

    2. @Tom West: I paid $42 for an Alcatel Onetouch Evolve on Amazon a few months ago. It’s locked to T-Mobile, but until I activate it, there’s no additional cost, and even then the cost would be just the standard monthly access prices anyone pays. I imagine it’s a loss leader for T-Mobile, but little did they know that I do my own development and I’ll use it for its processing, display, and WiFi in an embedded project and I’ll never activate it. Mwaahahahaha.

    1. the RPI needs needs 700mA and best is to use 1A or more … so if you use Arduino, perhaps it could work . (i believe it requires even less juice ?)

      1. Well, not really. A device with proper power management, for instance, Openmoko Neo Freerunner, takes around 2mA while suspended and around 200mA during active usage, buuuuut… power consumption from the modem is generally low, but it can spike for a short time to even around 2A, for instance when connecting to BTS with very weak signal. 1A is probably enough to make it work most of the time, but make it less and you’re asking for trouble. That’s why you usually want to connect the modem directly to the power supply.

  4. Amazing project! I would love to do this build. I’ll check back here for more like it :)keep building cool stuff. Also the heat, I imagine that’s coming primarily from the battery? (you may have mentioned that) if you repositioned the battery and screen to go above the board you might be able to case fit it and it shouldn’t be much larger than your average smart phones. Just a thought, love the project 🙂

  5. I was going to try to do this so it is cool that some one else thought of the same thing and actually did it and made it work. Now I can use your work as a base to work from if I ever get around to actually do it 🙂 Thank you.

  6. That is amazing. You did an excellent job on this, I love it.
    Please do share the code! 🙂 Would love to make this!

  7. For better software, you can try freesmartphone.org middleware (with Zhone, SHR or Aurora as its GUI), QtMoko or maybe PyNeo. It’s all free software and given that your module uses basic AT commandset, it should more or less work out of box on your “device” and instantly give you full telephony, messaging and networking support.

  8. Very nice thing!
    Is it possible to change the IMEI of GSM module? It would be good feature in the contemporary world, where a danger often comes from the state…

    1. No, and IMEI changing in order to achieve anonymity is pointless anyway, especially when using a module that’s rarely used otherwise (think about ‘modem fingerprinting’, not even mentioning behavioral analysis etc…)

      For the best you can get from the phone regarding openness and anonymity, take a look at Neo900 – http://neo900.org

    1. Do it yourself! It’s just a project that’s like taken straight from basic engineering class, just like thousands of students do every semester to pass. Put few things together and you’re ready to go! It will be even easier for you, as you have a guide posted above 😉

        1. It’s easy to write some basic software by yourself, just like the author of this post did. If you don’t want to, there is a lot of ready software to make any GNU/Linux based device (with a proper modem of course) functioning as a phone – like FSO, SHR etc. I have mentioned it already in some other comment.

          And honestly, if you’re not interested in programming for a device like that, you definitely don’t want it. It has basically no practical value besides of learning. If it did, you would see more people talking to their homemade phones on the street, because it’s not hard to do, especially when platforms like Arduino or Raspberry Pi are that popular.

          1. I have the concept of electronics and can ride it very easy but I do not know any programming language: (

  9. Why did not you use a Model A Raspberry Pi ?
    It would drain less battery as you don’t need Ethernet port I think.

      1. Can’t you disable the Ethernet hardware if you don’t want to use it? It’s connected via USB, and USB has power management from the host-side. Just a matter of software / drivers. MIGHT be as simple as sending some bytes to the right address, depends on the OS it runs.

  10. Hi David,
    I saw the link on Slashdot. I just wanted to add that, yes, I would also love to see your Python code. No need to fix it up first; the Many Eyes can spritz it up as the market dictates. Actually as a security professional, I would be delighted to review from an appsec perspective and propose some strengthening.
    This is so much more exciting to me than Android ever was… honestly.

  11. Great!!! I would love to see faces of police officers when you take this phone to make a call on the airport 🙂

  12. TOT Innovationสนใจต่อยอดนวัตกรรมกล้องนิรภัยรีโมทระยะไกล โครงการฝากบ้านไว้กับตำรวจ สนใจติดต่อกลับที่ 081 3633910 THANK YOU

  13. TOT Innovationสนใจต่อยอดนวัตกรรมกล้องนิรภัยรีโมทระยะไกล โครงการฝากบ้านไว้กับตำรวจ สนใจติดต่อกลับที่ 081 3633910 THANK YOU SO MUCH

  14. This is amazing… maybe i should use it to replace my hard bricked samsung..

    Also.. what Os is it using? im guessing Raspbian?

    The cool thing about this phone is its impossible to hard-brick!

    1. I have another question… Can you make a tutorial video?
      and Where can I find the Cables and switches?(Or what exactly are they)

      1. I made the cables. The switch can probably be recycled from old equipment, or purchased from your friendly local electronics store. 🙂

    1. There are 4 wires used on the GSM module, Gnd, +5v, Tx and Rx, which connect to Gnd, +5v, Rx and Tx on the Raspberry Pi GPIO header.

  15. Pingback: iphonote.com
  16. Wow,
    I was thinking about possibility to create really simple but reliable phone for visually impaired users so the phone would have simple hi-contrast UI with full voice output for all menu functions, calls and SMS – both reading received ones and also during writing.

    There are various solutions for smartphones but it is mostly not simple and the voice output is not as reliable. Many visually impaired would appreciate even something like Nokia 3310 but with full voice support 🙂 This could be a nice start for such projects.

    thanks for sharing

  17. Pingback: MojAndroid.sk
  18. Pingback: TabeladeCarros.net
  19. Pingback: KATHING
  20. Pingback: Connecting Thing
  21. Pingback: AppNewser
  22. Pingback: Tech News
  23. Pingback: Smartphone4me
  24. Pingback: Developer-Blog
  25. Pingback: webguide.net
  26. Pingback: crawlDirectorycom
  27. Pingback: geekville.com
  28. Pingback: Computer-web.nl
  29. Pingback: infoscape.com
  30. Pingback: daily1.com
  31. Pingback: AkimoLux.com
  32. Pingback: TechCrunch
  33. Pingback: Gizmodo Australia
  34. Pingback: Standard News
  35. Pingback: PiPhone Project
  36. Pingback: All that All
  37. Pingback: netgueko
  38. Pingback: Блог Imena.UA
  39. Pingback: Stuff
  40. Pingback: Androidmag.de
  41. Pingback: TechCabal
  42. Pingback: ITMoldova
  43. Pingback: EZiWireless
  44. Pingback: Wicked Geeks
  45. Pingback: FGR* Blog
  46. You’ve made a cell phone, how much doing would it require to make a cell repeater, and have a closed cell network that could be implemented on the cheap? Even one repeater could service a house? and several, a neighborhood? Maybe it would require different hardware. Just thinking out loud.

  47. Pingback: Raspberry PiPod
  48. Forgive me for saying this but isnt this just a knockoff of the arduino one thats been out ages? If i remember rightly there was a. Lotmore functionality on it to, wats next, slap a 7.5″ lcd and call it a PiPad or Pindle?

  49. Pingback: DERBSELLICON
  50. Hi I’m a Korean student, and i’m a senior in Pukyong national university.

    I’ve seen article about Piphone, and I got interest about it. So I’m going to try make it by myself. But there is problem, which we are using different method from most of countries, which are CDMA, WCDMA. If I use SIM900 GPRS/GSM module that you used in blog, I’ll meet problem that I can’t make a call because of different frequency. There isn’t CDMA/WCDMA module in online shop. I wonder there is shop where I can buy CDMA/WCDMA module for Piphone. And if I change module is it possible I can use your cording and same stuffs such as battery, converter? I’m crazy about Pi-phone now and I want to make it and with this chance, I hope to know about Raspberry Pi.

    1. From the description of the SIM900 module: “SIM5215 The SIM5215 series is a Multi-Band WCDMA/GSM/GPRS/EDGE module solution which supports WCDMA 384kbps for data transfer.”

Comments are closed.