Bhone - Part 1

B(ensley P)hone - Arduino Phone

Basic build is complete, can receive, initiate and terminate audio calls, monitor signal strength and BER. This main missing features are a call duration timer and DTMF in call.

Rough Diagram

Picture

It's lacking a case, that is the next step. Also need to test the maximum battery life length and look at reducing the power consuption (initial idle test done, 36 hours of idle battery life!).

Bill of Materials

Project Code - Beta 0.1 - Written in IDE version 1.6.1

Arduino Duemilanove (ATmega328) - Main microcontroller

Telit GE863-GPS Shield - Main GSM & GPS shield from HW Kitchen controlled via serial (their support guys were great as I had a DOA unit first time, I got an upgrade for my troubles)

16x2 LCD - 2 rows of 16 standard ASCII chars screen, non-descript generic model

4x4 membrane keypad - Non-descript generic keypad, no specific model 

NXP PCF8574AP - i2c I/O expander, purchased 5 from eBay for £2 or £3 inc postage

TECKNET iEP390 -  DC5v/1A 9000mAh USB battery pack, pretty cheap on Amazon

BensleyGSM - Custom build I made of the HWKitchen GSM library to save memory

Keypad_I2C - Library by Joe Young to use 3x4 or 4x4 keypads using an i2c expander

The total cost of all parts above was about £160 (although I had most of them already so that cost in practice was less).

 

Bensley-GSM Library

I have stripped the HWK GSM library to the bare minimum required for this project and added in two methods of my own:

void ATCommandWithResp(char const *at_command) - This method is for sending any AT command (or any string really) from the serial interface between the Arduino and the GSM controller to manually run any command outside of those defined within the HWK library and return the results to the serial connection between the Arduino and your PC/IDE.

void GetSignal() - This method gets the signal strength and BER and copies it back into a global string (char array).

 

Memory Saving

Given that the ATmega328 has only 2KBs of SRAM but 30KBs of  flash memory, this project is tight on SRAM and plentiful in flash memory so various trade-off's and design changes have been made to free more SRAM at the cost of flash memory. First a custom copy of the GSM library from HW-Kitchen has been used and stripped down to the minimum requirements for this project.

Compile of BareMinimum with native Arduino IDE GSM library (http://www.arduino.cc/en/Reference/GSM):

Sketch uses 11,164 bytes (36%) of program storage space. Maximum is 30,720 bytes.
Global variables use 785 bytes (38%) of dynamic memory, leaving 1,263 bytes for local variables. Maximum is 2,048 bytes



Compile of BareMinimum with full Hardware Kitchen GSM library (https://code.google.com/p/gsm-playground/, Release8_for_GSM_GPS_IDE1.0.1Plus). Saves 1%~ (25 bytes) SRAM, 29% flash memory:


Sketch uses 2,232 bytes (7%) of program storage space. Maximum is 30,720 bytes.
Global variables use 760 bytes (37%) of dynamic memory, leaving 1,288 bytes for local variables. Maximum is 2,048 bytes



Compile of BareMinimum with Bensley-GSM library. Saves a further 17%~ (344 bytes) SRAM, adds %1 flash memory:

Sketch uses 2,482 bytes (8%) of program storage space. Maximum is 30,720 bytes.
Global variables use 416 bytes (20%) of dynamic memory, leaving 1,632 bytes for local variables. Maximum is 2,048 bytes.

A reasonable amount of the 2KB SRAM was saved by putting char arrays into program memory (circa 18%). Using Bensley-GSM from above with the full program code and the savings below a total saving of 35%~ (720 bytes) was made:

Initial Compile:

Sketch uses 14,774 bytes (48%) of program storage space. Maximum is 30,720 bytes.
Global variables use 1,728 bytes (84%) of dynamic memory, leaving 320 bytes for local variables. Maximum is 2,048 bytes.
Low memory available, stability problems may occur.



5%~ (94 bytes) saved using F() with lcd.print():

Sketch uses 14,854 bytes (48%) of program storage space. Maximum is 30,720 bytes.
Global variables use 1,634 bytes (79%) of dynamic memory, leaving 414 bytes for local variables. Maximum is 2,048 bytes.
Low memory available, stability problems may occur



8%~ (164 bytes) saved moving AT commands to PROGMEM:

Sketch uses 15,312 bytes (49%) of program storage space. Maximum is 30,720 bytes.
Global variables use 1,470 bytes (71%) of dynamic memory, leaving 578 bytes for local variables. Maximum is 2,048 bytes.



5%~ (118 bytes) saved moving boot debug messages to PROGMEM:

Sketch uses 15,478 bytes (50%) of program storage space. Maximum is 30,720 bytes.
Global variables use 1,352 bytes (66%) of dynamic memory, leaving 696 bytes for local variables. Maximum is 2,048 bytes.