Introduction: Build Your Own Smartphone

Picture of Build Your Own Smartphone

This tutorial brings you from start to finish in constructing your very own smartphone. You will start by 3D printing a case, then soldering printed circuit boards together, assembly, and finally installing a mobile OS onto your phone and using Python to make it yours. You can learn more about this project at hackaday.io/project/5083

Skills Required:

  • Basic Soldering
  • Familiarity with the Raspberry Pi

OR:

Lots of time and patience

Step 1: Gather Materials

Picture of Gather Materials

Before we begin, lets gather the components required for the build. You will need the following electronic components and PCBs:

  1. Raspberry Pi A+ 256MB
  2. Adafruit FONA uFL Version
  3. 3.5in PiTFT Assembled
  4. Raspberry Pi Camera 5MP
  5. Powerboost 500 Basic
  6. GSM Antenna
  7. 1W 8 ohm Metal Speaker
  8. USB Wifi Adapter
  9. Electret Microphone
  10. 1200mah Lithium Ion Battery
  11. 4-40 x 3/8in screws
  12. M2.5 x 5mm screws
  13. M2.5 x 20mm screws
  14. M2 x 5mm screws
  15. Slide Switch
  16. Wire

While waiting for your parts to ship, you can 3D print the enclosure.

Step 2: 3D Print the Enclosure

Picture of 3D Print the Enclosure

The smartphone consists of two 3D printed parts that make up the enclosure: The top and the bottom. Download the .stl files on thingiverse http://www.thingiverse.com/thing:752746. If you do not have access to a 3D printer, you can pay a company like Shapeways to do it for you. If you would like to customize the case to suit your needs, download the Solidworks files from my Github page.

I myself paid a company to do the 3D printing for me because I do not have the funds to buy one myself. If you would like more 3D printed projects from me, please vote for the tyfone in the 3D Printing contest. Thank you!

Step 3: Wire the Power Circuit

Picture of Wire the Power Circuit

Now lets start wiring everything together. In the Fritzing diagram, there is a Raspberry Pi. Instead of connecting to the Raspberry Pi, connect your wires to the 26 pin male header on the PiTFT. Now that we have that out of the way, lets start making connections.

  1. Connect "bat" on the Adafruit FONA to "bat" on the Power Boost.
  2. Solder a wire from GND on the FONA to GND on the Power Boost.
  3. Solder a wire from GND on the power boost to one terminal on a slide switch.
  4. Also connect the GND pin on the power boost to a ground pin on the PiTFT (Same Pinout as the first 26 pins on a Raspberry Pi, notice the arrow and "1" indicating pin 1, which is 3v3)
  5. Connect the 5V line on the Power Boost to a 5v pin on your PiTFT.
  6. Solder a wire from the middle terminal of your slide switch to the "EN" pin (Enable) on the Power Boost.
  7. Solder a wire from the "KEY" pin on the FONA to Pin 40 (GPIO 21) on the Raspberry Pi. (Changed on commit acd5c08)
  8. Place the PiTFT over your Raspberry Pi A+
  9. Double check your connections

WHILE TESTING, MAKE SURE YOU DO NOT PLUG IN A 5V MICRO USB. THE PI IS ALREADY BEING POWERED BY THE LITHIUM ION BATTERY

If you slide the slide switch the LEDs on the Power Boost should illuminate and the Raspberry Pi should power up. The PiTFT backlight should also turn on. If you have a PiTFT image on your Pi's SD card the screen should also boot up. Otherwise, it will just stay solid white, which is just fine for now. Most likely, no LEDs will illuminate on the FONA. To turn on the FONA, hold in the Key button on the device for two seconds or pull GPIO 18 on the Raspberry Pi high for two seconds. If you can power the Pi, TFT, and FONA from the battery and turn it all off from a switch, you are ready for the next step.

Step 4: Finish Wiring

Picture of Finish Wiring

Now that power connection are done, we can continue on to wiring up the UART to the Raspberry Pi, the speakers, and the microphone. Lets get started.

  1. Solder the 8 ohm speaker to "spk +" and "spk -" on the FONA. The polarity doesn't matter.
  2. Solder the red wire on the electret microphone to the Mic + pin on the FONA.
  3. Solder the black wire on the electret microphone to the Mic - pin on the FONA.
  4. Connect the "RI" (Ring indicator) pin on the Adafruit FONA to pin 7 (GPIO 4) on the PiTFT.
  5. Connect TX on the FONA to pin 10 (RX) on the PiTFT.
  6. Solder RX on the FONA to pin 8 (TX) on the PiTFT.
  7. Solder Vio on the FONA to bat, also on the FONA. If you want, you could also use a 3v3 line on the Raspberry Pi.
  8. Snap the uFL antenna onto the uFL connector on the FONA.
  9. Double check your connections.

If you power everything on now, it should behave the same as it did in the last step. In the next step, we will be setting up the FONA by adding a SIM card making it capable of communicating over a cellular network.

Step 5: Add SIM Card

Picture of Add SIM Card

Now that the wiring is complete, we can add a SIM card to make it possible for the FONA to communicate over a cellular network. The FONA uses 2G data networks, like T-Mobile. The FONA does not work with 3G or 4G networks. AT&T is planning to shut down their 2G network in 2016, so we will be using a T-Mobile SIM card activation kit. The FONA uses a standard SIM card, so a Micro or Nano SIM cards will not fit. Once you have a card, activate it by following the steps at t-mobile.com/activate. When you are done, insert the card into your FONA and power everything on. If the red LED on the FONA is blinking every 3 seconds, your FONA is connected to a cellular network! In the next step, we will setup the software to get your Raspberry Pi communicating with the FONA.

More info on T-Mobile's networks can be found here

If you are not in an area with T-Mobile coverage, any network with 2G GSM service will work just as well.

Step 6: Setup SD Card

Picture of Setup SD Card

Now that you have all the hardware wired up, we can setup the Raspberry Pi to communicate with it. Start by flashing the latest version of the PiTFT OS onto a micro SD card for your Raspberry Pi. You will want to use the latest PiTFT image, which can be downloaded here. Install the image to the SD card by following these instructions. Once your SD card is prepared, insert it into your Pi and power it on. You should get the raspi-config utility on your PiTFT. It may be small but it will do for now. There are a few things you must set up it raspi-config:

  1. Expand filesystem is a must.
  2. Enable Camera
  3. Disable serial port. This is so the Raspberry Pi can communicate with the FONA
  4. Enable SSH. This is essential because the A+ only has one USB port.

End setup and reboot your Pi.

By typing startx the Raspberry Pi will enter LXDE on the PiTFT. To enter LXDE over the HDMI port type

FRAMEBUFFER=/dev/fb0 startx

Step 7: Setup WiFi and Clear Desktop

Picture of Setup WiFi and Clear Desktop

Your phone will not have a keyboard, so in order to access a command line you will have to setup WiFi and use ssh. In the desktop, put in your network information using Wifi Config. Shutdown the Raspberry Pi and insert a Wifi dongle. If you are still unable to connect via ssh, try using a USB hub to get going. More info on setting up WiFi can be found here. Once you are connected over SSH, you can clear the Desktop icons and remove the taskbar to make your phone look more professional. The steps below are not necessary and may not work in later versions of Raspbian.

1. Change to the desktop directory with the command

cd Desktop

2. Remove all app icons with the command:

sudo rm * 

3. Go back with

cd  /home/pi

4. Open the lxsession file with the command:

sudo nano /etc/xdg/lxsession/LXDE/autostart

5. Comment out the line "@lxpanel --profile LXDE"

6. Save and exit the file.

Step 8: Finish Software Installation

Test FONA

To test out your FONA, install minicom with the command:

sudo apt-get install minicom

Then run:

sudo minicom -D /dev/ttyAMA0 -b 9600

You should get a serial terminal. If you type

AT

you should get "OK" back. If you don't, check your connections. If you do, the FONA is ready for operation.

Rotate Screen

You may have noticed the text on the PiTFT is sideways and not in the orientation for a phone. Lets change that with the command:

sudo nano /etc/modprobe.d/adafruit.conf

In the file, change the "rotate" parameter to 180.

Finally, to get the Pi to automatically boot to LXDE on the PiTFT, follow this step in the adafruit guide:

https://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi/extras#boot-to-x-windows-on-pitft

Calibrate Touchscreen

Start X and see if the touchscreen is working properly. If the mouse is not in the correct spot when you tap, you will need to calibrate the touchscreen. Run this command to do so:

sudo adafruit-pitft-touch-cal

The script will calibrate the touchscreen to work with the new orientation.

Install Camera Software

Now lets install the software used to take pictures with the Raspberry Pi camera. First type:

sudo apt-get install python-pip

Install picamera with:

sudo pip install picamera

Step 9: Install TYOS

Picture of Install TYOS

TYOS is the mobile operating system (Technically, a modified version of Raspbian is the OS, and TYOS is just a GUI overlay) used to give your phone the capability to send and receive SMS messages, and make calls. To download TYOS run the command:

wget https://github.com/spadgenske/tyos/archive/0.5.6.zip

Extract the zip file with the command:

unzip 0.5.6

Finally rename it with:

mv TYOS-0.5.6 tyos

To start up TYOS, run the command:

sudo python /home/pi/tyos/src/main.py 

In TYOS, make a call and send a text message to make sure everything works. Once everything is working perfectly, we can set up TYOS to start on boot so no ssh is required.

Type sudo nano /etc/rc.local to get into the configuration file. At the bottom, right before the "exit 0" line, add a line saying the following:

sudo python /home/pi/tyos/src/main.py --power

The --power tag turns on the FONA. Without it TYOS assumes the FONA is on.

Change the background with the command:

sudo mv tyos/graphics/desktop-background.png /etc/alternatives/desktop-background

Make sure you do not include .png at the end of the line.

Now reboot your Pi. TYOS should startup on boot!

UPDATE 5/23/16: TYOS 0.5.6

Step 10: Putting Everything Together

Picture of Putting Everything Together

Now we can secure everything into the case completing the smartphone.

  1. Using some hot glue, glue the speaker and the microphone it the their slots.
  2. Using the M2 screws, screw in the Raspberry Pi camera. Route the ribbon cable so it is out of the way of any other electronics.
  3. Using M2.5 screws, screw the Raspberry Pi A+ with SD card and USB Wifi down into the case.
  4. Connect the Pi camera ribbon cable to the Pi with the blue facing the camera.
  5. Also using M2.5 screws, screw the FONA SIM card up into the case.
  6. Organise the wiring making sure it does not interfere with any of the other electronics.
  7. Wrap the Power Boost in electrical tape to prevent a short.
  8. Sandwich the Power Boost and battery between the Raspberry Pi and PiTFT.
  9. Hot glue the slide switch into the switch slot on the top part of the case.
  10. Using 4-40 screws, screw the top and bottom halves of the case together.
  11. Test everything out.

Congratulations! You have just built your own smartphone! If you don't like the phone to be called "tytelli" just change the logo in /home/pi/tyos/graphics/logo.png to whatever you wish.

Comments

NiOb made it! (author)2016-03-30

very nice, trying to get it going with a new rpi3
lots of issues but im getting to it slowly...

i can do everything in minicom using AT-commands but in tyos ive a lot of issues, cant sent SMS or place a call. e.g. i can type sms but send buttom doesnt do anything. touchscreen does not work properly (even after calibrating it), but i enabaled mousepointer so i can select/type things. crashes when im receiving a new sms or phonecalls.
Will continues testing/ bugfixing once ive got the hardware in a propper case, just flying around right now, not a good idea on the long run ;)

made a new phonecase for too, will post the stl-files on thingiverse once they are ready and tested. For power im using a single LiIon-Cell 26650 5Ah.

LinuxHippy (author)NiOb2017-08-01

I like your design for the RPI 3 version of this case-the battery compartment is nice along with the big battery capacity. How did u get the cylindrical 26650 battery wired into the Fona?

NiOb (author)LinuxHippy2017-11-18

i used copper tape a bit of wire and two brass screws and nuts.
soldered the wire to the brass nuts and to the copper tape.

NiOb (author)LinuxHippy2017-08-02

I useed soem copper tape for - and a brass screw on top for +
and wired it to a voltage regulator via on/off switch

LinuxHippy (author)NiOb2017-08-02

OK, so voltage regulator wired to fona jst input?

NiOb (author)LinuxHippy2017-08-03

yes if i recall correctly and i used a 3way switch (on/off/charge) because the fona can charge the LiPo

LinuxHippy (author)LinuxHippy2017-08-02

By voltage regulator do u mean the power boost board?

trisimix (author)NiOb2017-09-17

did you ever get it working for pi3 b

NiOb (author)trisimix2017-11-18

yes, i used a pi3

LinuxHippy (author)NiOb2017-05-09

I am building this project using a raspberry pi 3 and larger battery like u did. Did u ever post the case files anywhere?

NiOb (author)LinuxHippy2017-07-11

sorry, im not very often here, yes i put them on github

https://github.com/helmarw/PiFona

you can find my my version of the TYOS there too

https://github.com/helmarw/TYOS

trisimix (author)NiOb2017-09-25

Hi can you post links to your parts, I want to use your case but I cant find your battery

LinuxHippy (author)trisimix2017-09-26

I didn't design the rpi3 case. That's NiOb but the case would hold cylindrical 26650 battery. Look at his post as directions for what he did with copper tape and screw. My fona broke thanks to the cheap plastic used to hold Sim card-phones use all metal slots for Sim card.

trisimix (author)LinuxHippy2017-09-28

Thank you this helped me figure it out I wasn't familiar with battery sizes, now I'm trying to program a gpio switch that causes the backlight and peripherals to disable/enable.

LinuxHippy (author)NiOb2017-07-13

Thanks for putting the case files on github for the rpi3!

https://github.com/helmarw/PiFona

Are v1 and v2 of the backside for the same parts and just more screw holes in v2?

NiOb (author)LinuxHippy2017-08-01

v1 is a bit simpler (easier to print), in v2 you can better mount the camera

have fun ;)

patrick.taylor.351 (author)2017-01-16

Very cool project! Would this be able to work with the Pi Zero? Smaller
size and better battery life is what I'm thinking. Also wondering about
using the 3G FONA? (I need UMTS support for my cell provider)

Did the zero work for you, I tried a 3 and it dies way to fast so Im ordering a zero w

The 3G Fona will work but you will need to change the software as it uses different AT commands.

The Life Hacker (author)Mach_52017-04-26

Can you create the software for the Instructable community?

cheesypig (author)2017-07-04

Would you recommend this as a first project?

bloodybaconguy (author)cheesypig2017-09-21

probably not.retro pi or noobs well be better

bloodybaconguy (author)2017-09-16

can i watch youtube or brouse things like bing?

trisimix (author)bloodybaconguy2017-09-17

with a raspberry pi yes, with the tyos gui no. Youll have to code it in or make your own gui

bloodybaconguy (author)trisimix2017-09-21

thanks I've been wanting to make saving my money to 100 or 150$

trisimix (author)2017-09-17

So I've got everything working, except now I cant send text or make phone calls, loading messages from memory gives an error.

trisimix (author)trisimix2017-09-17

ohhhh it's because I have AT&T

joshbeaker (author)2017-09-03

Hey, I am in the process of trying to build this and have hit a wall, I cannot get the fona to power on. Here is my wiring, everything looks okay right?

https://imgur.com/a/Op0Jl

salpolletta (author)2017-08-06

My 8 year old son and I are building this as an ambitious first project, which I'm hoping will provoke a continued interest. We've got it assembled, but are getting errors running TYOS. They're not all consistent, but generally related to the FONA.

The minicom "AT" test works and we get the slow-blinking LED that indicates connectivity to T-Mobile, but we often see "Error Comunicating with FONA" followed by a trace having something to do with reading/writing to the serial port. Other times we do get Connected, but get read/write related errors later on - or an "index out of range" error following 'AT+CCLK?', which again seems FONA-related.

We've checked the wiring a few times, and it looks right with solid connections. However, I did have a "beginner's soldering" experience with one of the connections on the FONA, which resulted in having to clear solder out of a through-hole. Could I have overheated and damaged the FONA? Any other tips?

Also an issue, though not sure if it's at all related to the above: we can't consistently SSH to the Raspberry Pi, and when we can the sessions don't last long.

PS: In raspbi-config we left the serial port enabled, as otherwise we can't even run minicom as /dev/ttyAMA0 is not found.

LinuxHippy (author)2017-08-03

This is a terrific project, Ty. Got a question for u. U said not to plug in the pi to power since it has a battery now but if we plug a battery into the power boost and then plug a wall charger into the fona will the battery charge?

LinuxHippy (author)2017-07-25

Well, I have all the soldering done to my RPI3 and I'm using a 2500 mah battery. Those are the only changes. I'm still working on getting the fona working with the RPI3. It uses /dev/ttyS0 for the serial interface. I think the BT is on /dev/ttyAMA0. I was able to get the fona working as a screen using

screen /dev/ttyS0 115200 after enabling the serial port in raspi-config and then delete/comment console=serial0,115200 in /boot/cmdline.txt and reboot. However I still can't get it to work in minicom so I imagine TYOS will have problems with the RPI3 and need some minor changes.

The RPI3 also has problems with the tft screen rotating.

LinuxHippy (author)2017-07-17

I used 24 AWG solid wire for this and it works so far but is probably largest wire for these boards. Hopefully it will be flexible enough to cram into a case. What gauge wire was used for this?

LinuxHippy (author)2017-07-16

I don't know if 2G networks are still around so this might just be a 128 GB super pocket PC, but so far all works to soldering the power switch on. The diagram around the switch is different then what is written for the green wire. Put the green wire on the middle prong so that the power turns off after it does a halt (slide the power switch when all done)
This is a really neat project even without the phone part. I'm using a RPI 3 and the touchscreen seems to work OK with it using adafruit's modifications. I haven't tried the TYOS yet.

CarolB149 (author)2017-06-15

Does not work.

BenjaminK79 (author)CarolB1492017-06-19

What do you mean

OnurhanReyiz (author)2017-05-24

Phone companies hate him! Click to find out why.

BenjaminK79 (author)2017-05-17

I can probably just use the rpi3 right?

BenjaminK79 (author)BenjaminK792017-05-17

and another comment:

is there some way (while also using rpi3) to make this phone 3G capablile without ordering anything from the network company, such as the T mobile kit thing?

BenjaminK79 (author)BenjaminK792017-05-17

if so how would I?

tang08 (author)2017-05-10

Hi, I am planning to build one. I am learning JAVA and would like to develope it using JAVA. I build this same model and develop it in JAVA?

MatthaiSI (author)2016-10-05

Will it work with RaspberryPi 3? What are required modifications in that case?

Mach_5 (author)MatthaiSI2016-10-05

The software and hardware are 100% compatible with the Raspberry Pi 3 but it would require a complete case redesign.

MatthaiSI (author)Mach_52016-10-05

So if I understand, GPIO wiring is the same?

The Pi 3 has 40 GPIO. Technically, yes.

theschnack1 (author)2016-12-28

Cheers. I'm getting 'permission denied' as response from github upon the wget command to grab the latest zip version (0.5.6). I'll check back later today / tomorrow and looking forward to building this with my 12 yr old son for science fair!

Try downloading it from GitHub's site on a computer connected to the Internet, and then move it to the Raspberry Pi.

theschnack1 (author)theschnack12016-12-28

We're doing the basics with David Hunt's PiPhone, then belatedly stumbled on yours. Looks like the project provides some better options (not to mention more recent updates). Thanks in advance.

CamdenE2 (author)2017-02-25

I know this comment may or may not seem stupid, but would I have to go to my service provider and get this registered/added to my monthly bill?

The Life Hacker (author)CamdenE22017-04-26

@CamdenE2 Yes, you would. The only not to, is by using a prepaid plan.

CarolB149 (author)2017-03-21

I am using a fona 3g and when I run sudo python /home/pi/tyos/src/main.py it just stays still. I went through every .py file and the AT commands seem to be the same except for the self trasnmit one. I appreciate your help.

About This Instructable

430,568views

1,672favorites

License:

Bio: Aspiring entrepreneur teaching myself engineering
More by Mach_5:TyroBot: DIY Humanoid Robot$20 Portable Raspberry Pi Game ConsoleBuild your own Home Automation and Monitoring System
Add instructable to: