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
Lots of time and patience
Before we begin, lets gather the components required for the build. You will need the following electronic components and PCBs:
While waiting for your parts to ship, you can 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!
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.
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.
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.
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.
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.
If you are not in an area with T-Mobile coverage, any network with 2G GSM service will work just as well.
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:
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
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
2. Remove all app icons with the command:
sudo rm *
3. Go back with
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.
To test out your FONA, install minicom with the command:
sudo apt-get install minicom
sudo minicom -D /dev/ttyAMA0 -b 9600
You should get a serial terminal. If you type
you should get "OK" back. If you don't, check your connections. If you do, the FONA is ready for operation.
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:
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:
The script will calibrate the touchscreen to work with the new orientation.
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
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:
Extract the zip file with the command:
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
Now we can secure everything into the case completing the smartphone.
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.