Arduin o Phone Arduino Powered Diy Cellphone
Arduin o Phone Arduino Powered Diy Cellphone
Guide Contents 2
Overview 3
Parts and Prep 6
Learn all about it! 7
Wire & Test FONA shield 8
Test TFT Shield 9
Arduin-o-Phone Sketch 10
A tour of the code 10
Setup code 10
The main Loop() 12
https://learn.adafruit.com/arduin-o-phone-arduino-powered-diy-
© Adafruit Industries Page 2 of 15
cellphone
Overview
Apple, Schmapple! Make your own phone with an Arduino & Adafruit FONA shield. This project will
show you how you can use the FONA shield and a TFT shield stacked on top to make a touch-
screen phone that you can program yourself.
https://learn.adafruit.com/arduin-o-phone-arduino-powered-diy-
© Adafruit Industries Page 3 of 15
cellphone
Using Adafruit's great libraries, you can make your own touch-screen dialer in 200 lines of code.
Extend it yourself, or keep it simple. Design your own interface or code up a custom app, right from
the Arduino IDE
OK sure, you can't check your facebook on the Arduin-o-Phone, but maybe that's not such a bad
idea?
https://learn.adafruit.com/arduin-o-phone-arduino-powered-diy-
© Adafruit Industries Page 4 of 15
cellphone
https://learn.adafruit.com/arduin-o-phone-arduino-powered-diy-
© Adafruit Industries Page 5 of 15
cellphone
Parts and Prep
This project doesn't need a ton of parts, and there's some flexibility based on whether you want to
use a headset or speaker&mic.
https://learn.adafruit.com/arduin-o-phone-arduino-powered-diy-
© Adafruit Industries Page 6 of 15
cellphone
Then you can either go with speaker + mic for 'hold it up and talk' style
or
You'll also need a microUSB cable, soldering iron and solder, and possibly some wire or other
basic electronic components!
https://learn.adafruit.com/arduin-o-phone-arduino-powered-diy-
© Adafruit Industries Page 7 of 15
cellphone
Wire & Test FONA shield
OK now you're ready to put it together. Most of the soldering happens on the FONA shield. Don't
forget to solder it with stacking headers!
Attach the Mini Metal Speaker to the SPKR pins by soldering the + wire to the + pad, and
same with the - wire
Attach the Wired Electret Microphone to the MIC pins by soldering the red wire to + and
black wire to -
Solder the Vibrating Motor Disc to the Buzzer pins by soldering the red wire to the + pad,
and the black wire to -
Plug the Lipoly battery into the JST connector, and switch the slide switch to CHRG
Insert the SIM card
Carefully plug the GSM antenna into the uFL connector, it should snap on nicely
Plug the shield onto the Arduino and connect the Arduino to your computer
OK now go through the FONA test to make sure your FONA can get onto the cellular network,
make phone calls, etc:
https://learn.adafruit.com/arduin-o-phone-arduino-powered-diy-
© Adafruit Industries Page 8 of 15
cellphone
Go through the Arduino FONA shield
test
http://adafru.it/fdV
Once that works, plug the 2.8" TFT shield on top and run the touch-paint tutorial to make sure
you've got the display and touch capability working
https://learn.adafruit.com/arduin-o-phone-arduino-powered-diy-
© Adafruit Industries Page 9 of 15
cellphone
Arduin-o-Phone Sketch
Now you're ready to upload the Arduin-o-phone sketch. Visit the github repository
(http://adafru.it/fdW)for the full code history and details, or simply download by clicking this link:
Setup code
In the setup() code we start by initializing the screen first, before the FONA, so that we can display
the status updates
https://learn.adafruit.com/arduin-o-phone-arduino-powered-diy-
© Adafruit Industries Page 10 of 15
cellphone
void setup() {
Serial.begin(9600);
Serial.println("Arduin-o-Phone!");
We then create 15 buttons using the Adafruit_GFX_Button helper. These make nice rounded
rectangle buttons with the text centered. The buttons don't have any sort of touch 'knowledge' but
its handy to have a shortcut to drawing a button!
We use the BUTTON_X, _Y, _SPACING #defines we made to define the size of the buttons and
the spacing.
// create buttons
for (uint8_t row=0; row<5; row++) {
for (uint8_t col=0; col<3; col++) {
buttons[col + row*3].initButton(&tft, BUTTON_X+col*(BUTTON_W+BUTTON_SPACING_X),
BUTTON_Y+row*(BUTTON_H+BUTTON_SPACING_Y), // x, y, w, h, outline, fill, text
BUTTON_W, BUTTON_H, ILI9341_WHITE, buttoncolors[col+row*3], ILI9341_WHITE,
buttonlabels[col + row*3], BUTTON_TEXTSIZE);
buttons[col + row*3].drawButton();
}
}
Now that the screen is drawn, we can check on the FONA, resetting it and turning on the external
audio port. We print the status of the FONA module code to a little bar of text under the number
textfield, using the status() helper function
https://learn.adafruit.com/arduin-o-phone-arduino-powered-diy-
© Adafruit Industries Page 11 of 15
cellphone
// create 'text field'
tft.drawRect(TEXT_X, TEXT_Y, TEXT_W, TEXT_H, ILI9341_WHITE);
We start by checking for touch presses on the screen, and scaling the presses so they align with
the 240x320 size of the display
https://learn.adafruit.com/arduin-o-phone-arduino-powered-diy-
© Adafruit Industries Page 12 of 15
cellphone
void loop(void) {
TS_Point p;
if (ts.bufferSize()) {
p = ts.getPoint();
} else {
// this is our way of tracking touch 'release'!
p.x = p.y = p.z = -1;
}
next, we can use that press location to ask the buttons if that point is inside the bounds of the
outline, if so we tell the button it is being pressed
The Adafruit_GFX_Button object keeps track of whether it was just pressed or just released which
is handy so we can only perform an action when it is first pressed or released. For example, if it
was just pressed, redraw it so its 'inverted' colors, easy to tell it was pressed
https://learn.adafruit.com/arduin-o-phone-arduino-powered-diy-
© Adafruit Industries Page 13 of 15
cellphone
// now we can ask the buttons if their state has changed
for (uint8_t b=0; b<15; b++) {
if (buttons[b].justReleased()) {
// Serial.print("Released: "); Serial.println(b);
buttons[b].drawButton(); // draw normal
}
if (buttons[b].justPressed()) {
buttons[b].drawButton(true); // draw invert!
Now we can perform actions based on the presses. If its button #3-15, its one of the number or * #
buttons, we can add that to the text field array
In case we make a typo, the CLR button will let you delete a character
textfield[textfield_i] = 0;
if (textfield > 0) {
textfield_i--;
textfield[textfield_i] = ' ';
}
}
Now that those buttons are taken care of, we should redraw the text field, because it may have
more or fewer characters
https://learn.adafruit.com/arduin-o-phone-arduino-powered-diy-
© Adafruit Industries Page 14 of 15
cellphone
// update the current text field
Serial.println(textfield);
tft.setCursor(TEXT_X + 2, TEXT_Y+10);
tft.setTextColor(TEXT_TCOLOR, ILI9341_BLACK);
tft.setTextSize(TEXT_TSIZE);
tft.print(textfield);
Button #2 is END and you can always just tell the FONA to hang up
Button #0 is SEND so you can tell the FONA to call whatever is in that text field
fona.callPhone(textfield);
}
Finally, we have a delay here to keep the UI button pressing handling from being too 'fast'
delay(100); // UI debouncing
}
}
}