Atmega-based PCB to control Cell Phone keypad. Can be programmed to perfom any phone operation (call, sms, photo, web)
sch - 320.04 kB - 06/16/2016 at 22:58
EAGLE board, with pullup for reset pin fixed
brd - 78.91 kB - 06/16/2016 at 22:58
Arduino code for the project
ino - 8.45 kB - 06/16/2016 at 22:55
So I'm not sure how but I managed to brick the atmega328p chip. Found an error in PCB - usbasp socket didn't have GND connected anywhere on the board. I guess the only reason it worked during programming is because I used power from usb2ftdi adapter from the same PC. But when I tried to play with being powered from phone battery and tried to program the chip at the same time - it went silent. I tried many things (like external oscilator), but nothing helped :(
I decided to unsolder the chip, after 3 days of different unsoldering tricks this little bastard gave up. He broke 3 legs and probably his neck too, but I got him out :)
Lesson learned: for testing/first board it's better to use a socket for a chip :)
Recently I was able to finally put everything together into a solid test.
I've figured out a Macro for sending a photo via email. If you wonder in the code it looks like
String PROG_sendphoto = "bbbbbbbb-mdddmmmdmm-dddmuuuumPPmPPP--mm";
I've coded the Atmega chip to execute this macro every 5 minutes (or so, 10000 cycles)
Here is how it looks like in my webmail where cloud telemetry forwards incoming emails
During this test I figured that phone battery could support roughly 30 hours of such activity (no surprise with sending something via 3G every 5 minutes), but I'm sure this could be extended when I remove a cell phone screen (I left it for debug and research purposes)
Also I discovered that email application in my phone (SE z530i) cannot send any emails once sent items is full of 30 emails (very strange :(). So I've also scheduled every half an hour a "delete all sent emails" macro.
Then I also realized that I need to know if phone is switched on or off, because sometimes I need to power-cycle it and it may not come back in a timely manner. Or I may decide that when battery is dieing the chip should turn phone off to save the energy and then switch it on regularly for short period of time (so, that I can find it via GSM carrier triangulation :))
OK, figured out the email part. Wasn't easy. I'm using Azure VM with dovecot as IMAP server and sendmail as smtp, without encryption - this is not secure, but I've prohibited any relaying and I'm using non-standard ports, and authentication. So, I think for my purpose of collecting telemetry solution is good - I run the VM when I need telemetry and stop it when I don't, Azure looks quite cheap even with external IP.
Plus I'll be able to check mail server logs to know if device tried to initiate a contact - something is not possible with public email servers.
Now I need to conenct something real, planning to add barometer, magnetometer, accelerometer and gyro (all via I2C conencted to the Atmega on the board), so that inertial coordinates of the device can be calculated. This is the first step - the next would be to calculate them on-board and send only coordinates, without GPS ;)
Now we have issues with the fact that we are trying to use an OLD phone :) certiificates for most encrypted places don't work. I either have to use non-secured places or install root certificate. Both ways are OK, but I guess non-secure place is more reliable - what if phone lost correct date and time settings - certificate could be still invalid althought everything is installed.
So, for email I'll probably use Yandex for devices (smtp-devices.yandex.com) which is not secured and for HTTP forms I'll setup my own server.
So, board is done and soldered and attached to a phone. Sony-Ericsson Z530I in my case, you can find used one for as low as 5$. I've attached everything to a polystyrol plate, just for stiffness, plus added a hole for VGA camera to test it too.
Here you can see SIM card inserted in the phone and cell phone battery connections soldered to wires. These wires then connected to a battery (read more about this at the end :))
Here is a view of a cell phone connected to a soldered oshpark board. You can see all 11 MOSFETs (10 for manipulating buttons matrix and 1 for triggering power-on/off button).
Here is a video of how it PERFECTLY! works :) as a tes I sent a text with Hackaday in russian to my phone, but camera manipulations, GPRS/Edge browser works, everything.
And here is how it looks on the serial port as Atmega chip provides feedback about "pressing" buttons (array pos - position of requested key in a buttons array, then it tells you the corresponding input and output MOSFETs triggered, their local Input/Output number and their arduino PIN number)
P.S. I spent so much time trying to understand why my phones are just switch off immediately after powering them with the SIM card attached. Purchased same models, tried different batteries, etc. To find that the problem is with length of wires from battery connector to the battery :) looks like only 10cm is OK without extra soldering in between. Here is how my floor looked while I was trying to find the solution
Will publish files shortly.
Soldered all components onto the Oshpark board (BTW, what a quality!)
Looks like I missed a pullup resistor for enabling Atmega328 reset pin being triggered by Serial DTR. Will add it to Oshpark files.
If you are seeing that your DIYArduino/Atmega is unresponsive via Serial although absolutely should work - check this pullup for PIn 1 on Atmega328, all pre-build Arduino boards should have it.
Everything else is looking good. I'm currently testing the board.
This is how it looks like in a working prototype mode.
This is a board of SonyEricsson Z530i with attached wires to rows and columns in the keypad matrix
You can read about keypad matrix more for example here
In order to reduce amoutn of MOSFETs I need to manipulate this matrix, I've decided I can use a single wire for all "columns". Because phone keypad chip already knows which column it listens to right now and the rest are silent at this particular moment, so they cannot interfere. That why a schematic for my MOSFETs is the following (In - input column, On - Output row):
Here are some picture of the back side fo the phone PCB (battery and charing wires are soldered)
Here is the prototype PCB with wires from phone going in and some supporting circuits such as battery power metering
Here is the other side of the PCB. Array of MOSFETs which are connected using resistors to the Atmega328PU pins. Atmega chip is bootloaded with firmware to use internal oscilator, so that I don't need to have a dedicated circuit for it.
I'm going to share Egale files for the integrated PCB when I test that it's working correctly.