Actually there are no real reasons why one should build a (mobile-)phone by himself. Especially as the simplest phone costs actually less than doing it yourself. Nevertheless, learning is very important aspect of the assembly process. Furthermore, walking around with a self-built phone sounds just very awesome idea.
Most of us have our own mobile phone, so do I. After building the T-gameBoY I was looking new challenges and thought I should make myself a phone. Clearly I’m not able to achieve the smartphone functionality, but calling and maybe additionally sending SMS-s would be good enough.
Step 1: Planning
With Google search I found perfectly suitable example from Matt Richardson (MR). His design is very nice and interesting, additionally he mentioned few possible problem areas.
Next to his design are two alternatives from Adafruit.com. One uses a Raspberry Pi and the second one an Arduino as the bases. The phone unit itself is the same for both. Adafruit design is simple to build and looks very attractive with the touch screen. Nevertheless, there is almost nothing to do with building. It's more about buying the components and then fast assembly. This sounded too simple for me.
Enough about that and let's focus on the device itself. I used MR design as an inspiration and focused on the Adafruit Arduino model.
GSM cellular module
The most important component, the GSM cellular module, the one used by MR is difficult to acquire and expensive. The Adafruit design uses an alternative module (SIM800L) and I was looking what I could do with that. Soon I found that I could buy this module from eBay with very reasonable price without having to do almost any soldering. My aim was not avoiding soldering, but to reduce the time consuming soldering work.
Adafruit uses the same SIM800L chip and later for my surprise I was able to use their code directly without any modifications.
The module works in 850/900/1800/1900MHz systems, allows FM radio and much more. The radio was not important for me, but maybe in the future I could make use from that. Important features as calling, receiving and sending SMS are covered, that's actually enough.
As an extra bonus the bought module had already an antenna included. On the other side of the module board is a SIM card slot, making again my life easier (reducing the small and time consuming soldering work).
Speaker “+” (SpkP) and “-” (SpkN) are connected directly with the SIM800L. Similarly, the microphone. “Ring” pin is going low when a call is coming in. “Net” is for the antenna, but that is already on the board, thus leave empty. “Vbat2” is for the battery “+” connection. “GND”- ground from the Arduino and the battery “-“. “RST_sim800”, “RXD” and “TXD” are connected with the Arduino. “DTR”- don’t know the use, thus I left open.
The cellular module works with 2G network. It’s important that your SIM card supports that. As I have heard some service providers don’t provide it anymore or in the very near future. SIM800 uses “mini SIM” size.
MR mentions that the Nokia LCD screen broke down quite easily. At the same time, I was not very fond of the LED screen he used, thus I went similarly with the Nokia LCD.
After some research I assume MR had problems with the Nokia screen as he was using too high voltage. It’s said by Sparkfun that resistors should be used if 5V signals are used. Supply voltage should in every case be 3.3V. MR used 5V.
One should use (copied from Sparkfun) 10kΩ resistors between SCLK (CLK), DN (DIN), D/C (DC), and RST pins and a 1kΩ resistor between SCE (CS) pin. For the backlight minimum 330Ω is recommended. Different symbols are used for the same pins: SCLK=CLK; DN=DIN; D/C=DC; SCE=CS.
The screen requires 3.3V, thus a DC-DC converter is added for that purpose. All the pins are connected with the Arduino, which operates with 5V. In order to increase the screen lifetime resistors are added between the pins (look the schematics: “Hand1_R4 – R8”).
The buttons arrangement is like very many old school button telephones have. This design looked very reasonable.
The keyboard uses 16 buttons. In order to use all the buttons one needs a huge microcontroller or a little more advanced keyboard.
By using a voltage divider technology, the keyboard could be achieved by using only one analog pin.
Step 2: Breadboard- Buttons
Making a keyboard and utilizing a voltage divider for that is relatively simple and one could calculate everyting easily. The voltage divider can be seen in the schematics. The principle is very simple, but the actual raw_data values (voltage) that should indicate different button pressing are slightly different from the theoretical calculations.
In theory one could use only the calculations, but I found it’s more accurate to measure with the final system the voltage with each button and accordingly adjust the script. Obviously that means one has to adjust the script every time the system is changing. On the contrary that doesn’t happen often.
The calculated and measured raw_data values are shown in the following table and figure. As can be seen there is a relatively large deviation, especially on the lower voltage levels. The used resistors were with 5% accuracy making the outcome relatively varying.
Step 3: Breadboard- Micro Controller
The phone brain was planned to be made wait an Arduino Pro-Micro. That is a cheap, but powerful enough for this application. This board has many benefits as it can be connected with a computer directly through a USB cable. This simplifies the code updates and charging the battery, as there is already a micro-USB port.
Reality is often not so simple and it wasn’t compatible with the SIM800L. I don’t know why, but somehow it wasn’t working although there was a physical connection. I had to replace the Pro-Micro with a regular Arduino UNO and everything was working again.
Arduino connection schema is attached. Although UNO was used in the final design the connection pins are the same except D14-D16 (but I didn’t use them anyway).
Step 4: Breadboard- Screen
As mentioned a Nokia 5110 screen was used.
Screen pin 7 is controlling the backlight. By applying 3.3V on this pin the backlight is turning on. I bought several screens from eBay (different suppliers) and one was different. It required that the pin needs to be grounded in order to turn on the backlight. The screen had already resistors on it, thus the series resistor (Hand1_R3) was not needed. On the breadboard was that easy to adjust, but I discovered that after ordering the PCB, thus little annoying.
Step 5: Bradboard- Power Management
I used a LiPo battery for the power. The battery voltage is used directly with the cellular module (SIM800L). The cellular module may require up to 2A power and its operating voltage is 3.7-4.2V, exactly as the battery.
For the breadboard version I didn’t use any sophisticated battery charging system. I used a regular 18650 LiPo battery and connected it directly with the SIM800L.
The Arduino UNO was powered with the USB cable.
The screen 3.3V can be driven directly from the UNO, thus no need additional elements.
Step 6: Bradboard- Software
Most of the programs I wrote myself, thus they are not very well made, slow and lacking functionality. Still, one could always improve that.
For the keyboard I found a nice description from OtakuSanel. I modified his code a lot, but the base is from him. To test the keyboard, if the raw values are correct I have attached the file (T-keyBoardTest1.ino).
The simple program for communicating with the SIM800L can be taken from adafruit (FONAtest under the examples). You may need to adjust the pins. From Adafruit FONA you need to download the libraries. In this step the screen is unnecessary and the all the communication is made over serial port.
The simple calling program is here too (T-mobile_OnlyCalling.ino). The code is adjusted for me, thus it’s not very easy to understand.
Step 7: Breadboard MobilePhone
The first test system I built as a prototype for the keyboard, then the SIM800L and finally all with the screen. I wanted to be sure that I could communicate with everything and that the components fit together before ordering the PCB. In several other occasions I have tried to skip the breadboard step and ended buying double PCBs while the first design had errors on it.
Step 8: PCB Prototype
After having the breadboard version up and running I immediately made a PCB design. Several things that I didn’t fully test nor anticipated at the beginning made the outcome not as smooth as I was hoping, but in the end I was able to get my mobile working. In the following I will address all the difficulties I found after assembling the PCB.
As already mentioned I wanted to use Pro-Micro as the controller. In my previous projects Pro-Micro and UNO were completely compatible with each other and I didn’t have any problems what so ever. Therefore, I didn’t make any special tests with Pro-Micro before having the PCB.
When the PCBs arrived I was very excited, soldered the battery, Pro-Micro and SIM800 and tried to run it. No connection. I controlled with multimeter and everything seemed ok, I made separate test on a breadboard and the same, no connection…
I decided that I will use an UNO instead and had no problems, although I needed to solder lots of wires between the Pro-Micro holes and the UNO.
The controller was not the only problem I had.
My idea was to boost the battery voltage (3.7-4V to 5.0V) with a RT9261A chip. This chip itself can’t handle large currents. Therefore, it controls a small BJT-NPN switch. The NPN gate voltage is filtered through a resistor and a capacitor. The values are directly from the datasheet.
The booster worked well without load, when I attached a minimum 0.1mA load the voltage dropped immediately to the battery voltage. The booster was not able to do its job. Luckily I had made a spot to use a ready-made booster (again from eBay). This booster was working well, but had a problem- the output voltage is 5.2V. Not really an issue, but I will come back to it in the button section.
The booster caused another problem that I wasn’t really thinking before. It had a high frequency noise. As long the board is on the table it’s not a problem, but while calling I was able to hear it little too much. I should find a higher frequency one.
For the screen one needs 3.3V. This voltage is made with a DC-DC converter PAM2305 (“Hand1_VoltReg1”). Again very simple device and it requires only an inductor (“Hand1_L2”) to operate. The capacitor “Hand1_C3” is for the voltage stability.
The buttons were working fine with the breadboard version. I was hoping the same with the PCB, but it wasn’t so simple. First, since connections were different the voltage references were changed. I had to adjust the raw values in the script. Not really a big surprise.
I did these raw value adjustments while the UNO was connected to the computer. With the cable everything was working like it should. Immediately after I removed the cable the buttons were not working at all. Why? I was asking myself.
Very interesting problem. My boost converter has 5.2V as an output, but the UNO reference is until 5.0V. Therefore, the last two button voltages were already out of the measured scale (both had raw value 1023). With other buttons I was able to make another correction round and then they were again working, but I wasn’t able to use “*” and “#” button. Actually not really a problem, but still something to think about for the next time.
When one looks the schema from Adafruit or MR then there is always a filter for the microphone and the speaker. Understanding why a filter could be useful I was not really thinking much and just copied it. The both are almost identical, thus I thought this is the way.
After assembling the PCB, I noticed immediately that something is strange with the speaker. It wasn’t really working. After I removed the filter everything was working again. Some controlling what was wrong I noticed an open connection and that caused the difficulties. At least this I could say was directly my mistake and should have noticed it.
So yes, the design without filters seems to work good enough, thus for the beginning no need to worry about that.
The “Ring” pin of SIM800L can be used for a buzzer to alarm you if a message is coming in. The pin will be naturally high as long there are no messages. That means a PNP transistor can be used. I did that, but again it didn’t really work and I had to disconnect it. I’m not really fond of a buzzer noise anyway, thus it wasn’t a real loss for me.
The main program is the same as before, but the raw values for the buttons should be changed. The main issues with the code is connected with the main code loop. I was planning that when I press button “A” then everything is canceled- if a call is coming in or I’m calling out or when I have number written everything is back to the zero stage. In reality it wasn’t really working so and to cancel or end a call I needed to turn off the power. A small software issue.
In order to measure the button voltages here is another sketch, this time the values are shown on the 5110 screen.
Step 9: Summary
Despite my design had several mistakes and surprises I was able to modify everything so that in the end the calling worked. Now back to the PCB drawing and code writing.
Some other projects and pictures: drTonis