How to copy contacts from one SIM card to another

How to copy contacts from one SIM card to another

This is based on a true story. Imagine that you have to move your contacts from one SIM card to another. There is an app for this, isn't it? That is... unless your phone is not a smartphone, but an old mobile phone made by a small Finish company that has been taken over by a software editor a few years ago. Unfortunately the new owner company has decided to support only the very latest models. There isn't any official software available to retrieve your contacts on this phone anymore. So you are getting ready to copy all your contacts by hand, one by one... But wait a minute...

Bad luck...
Bad luck...


If you have a YoctoHub-GSM, then there is a solution: the Yoctopuce API can run many standard AT commands, including those used to handle contacts on a SIM card. In our case, the easiest solution is to use the Yoctopuce Command line library.

The YoctoHub-GSM coming to rescue
The YoctoHub-GSM coming to rescue


To perform the transfer, put the SIM card with the contacts to copy in the YoctoHub. Connect the Hub to your computer using a USB cable and, just to be sure, set the hub in "Disable IP connectivity" mode, then enter the PIN code. When this is done, you are ready use the YCellular utility from the Yoctopuce command line library. The AT command to retrieve SIM contacts is "+CPBR". For instance, to retrieve contacts 1 to 99, type:

C:\>ycellular any _AT +CPBR=1,99 OK: YHUBGSM1-5D645.cellular._AT = +CPBR: 1,"+3221285435",145,"Tintin" +CPBR: 2,"+3221287854",145,"Cpt Haddock" +CPBR: 3,"+3221285745",145,"Pr Tournesol" +CPBR: 4,"+3221535533",145,"Dupont" +CPBR: 5,"+3221535533",145,"Dupond" +CPBR: 6,"+3221286571",145,"Boucherie Sanzot" +CPBR: 7,"+3221568994",145,"S. Lampion" +CPBR: 8,"+3938583722",145,"Bianca" OK


The list follows the format +CPBR: index,phone number,encoding,name.

To write a contact in a SIM card, you just have to use the AT command +CPBW= followed by the contact information following the same format. Make sure to quote the double-quotes using backslashs. So for instance, to write the phone number of Tintin at index 1 of the SIM, type:

C:\>ycellular any _AT "+CPBW=1,\"+3221285435\",145,\"Tintin\"" OK: YHUBGSM1-5D645.cellular._AT = OK


So you can easily reinject a contact list in another SIM. You just need to write a small script using the output of the first command. You can even take the opportunity to make a quick cleanup :-)

ycellular any _AT "+CPBW=1,\"+3221285435\",145,\"Tintin\"" ycellular any _AT "+CPBW=2,\"+3221287854\",145,\"Cpt Haddock\"" ycellular any _AT "+CPBW=3,\"+3221285745\",145,\"Pr Tournesol\"" ycellular any _AT "+CPBW=4,\"+3221535533\",145,\"Dupont\"" ycellular any _AT "+CPBW=5,\"+3221535533\",145,\"Dupond\"" ycellular any _AT "+CPBW=6,\"+3221286571\",145,\"Boucherie Sanzot\"" ycellular any _AT "+CPBW=7,\"+3938583722\",145,\"Bianca\""


Now you can put the new SIM in your phone, and here you go! A hopeless problem solved in minutes without even installing any driver...

Add a comment No comment yet Back to blog












Yoctopuce, get your stuff connected.