Miscellaneous, Rants

Unlock Your Huawei E160

Safaricom's Huawei E160 USB modem
Safaricom’s Huawei E160 USB modem

I use a Safaricom-branded Huawei E160 USB modem to connect to the Internet over 3G from my apartment in Westlands. It works great but Safaricom has locked the device so it only works on their network—an anti-consumer move they probably learned from the likes of AT&T. We have four different mobile providers in Kenya, each one of which sells their own custom-branded Huawei modems. The other providers are small fries compared to Safaricom, but they love to play catch up so they’ve locked their modems too. Wanna browse on Zain? Buy a Zain modem! Thanks for nothing…

The good thing is that there’s a booming modem unlocking industry on the Internet, but you have to be a Google ninja to wade through all the garbage results. After some creative Googling I got to the bottom of this “unlock your modem” stuff; I learned that it’s free and trivial to do, which is why I hate to see so many people getting burned by some shady “entrepreneurs” who are making a lot of money from this “service.” I unlocked my Huawei E160 in about five minutes on my Linux machine, and within another two I was browsing the net with a Zain SIM card from the Safaricom modem.

Note: I did it on Linux because I like Linux, but there’s nothing about Linux which makes it a “magical modem unlocker.” It’s true, Windows sucks, but you can do this perfectly well on Windows too (but I don’t know how, so do some creative Googling of your own).

Are you ready? All we have to do is generate an unlock code based on your modem’s IMEI, then send ONE AT command to the modem. It’s not rocket science…

Here We Go!

  1. Make sure the SIM card in the modem is the one from the provider (mine is Safaricom), then plug the modem in
  2. Generate an unlock code, two options:
    • Web-based generator (put your 15-digit IMEI at the end): http://bb5.at/huawei.php?imei=351596037539337
    • Another web-based calculator: http://a-zgsm.com/huawei.php
    • Much cooler, a python script: huawei-unlock.py
  3. Send the code to the modem over serial. Here’s a quite literal step-by-step guide:
    1. Start up minicom: sudo minicom -s
    2. Navigate to “Serial port setup” and press Enter
    3. Press A to set the location of your device (mine, on Ubuntu 10.04, was /dev/ttyUSB1)
    4. Press Enter, then Enter again to go back to the main screen
    5. Press Exit to leave setup and initialize the modem
    6. Enter AT^CARDLOCK="50122162" (using the unlock code you generated earlier) and press Enter
    7. You should see “OK”, after which point you can quit minicom by pressing CTRL-A Z Q. If you don’t see “OK” just hold off for a second and re-read the instructions, because you don’t get an infinite amount of tries for this! After 5–10 failed attempts your modem may be permanently locked to the provider who sold the modem to you…

You’re welcome, now go help out one of your fellow countrymen. Just remember, I didn’t spend all this time writing this just out so you could go rip some poor sucker off.

Also, do yourself a favor and go read Dogbert’s blog, because he’s the one who wrote the Python unlock code generator and there are a lot of great links on his site. Beyond that, I can’t remember what other resources I used… I guess they all got lost in the whirlwind aftermath of my Google kung-fu.

Update (November 27, 2011)

For what it’s worth, I’ve tested this procedure on the Swisscom-branded Huawei E1762 as well, and it’s still working. On this device you most likely want to use /dev/ttyUSB2, as this is the DIAG port for interacting with the modem. Here’s how it worked:



^CARDLOCK: 2,10,0

The first command (AT^U2DIAG=276) resets the modem to factory settings. The last command simply lists the status of the device’s lock, where a “1” in the first spot would mean it’s locked. Here are a few good references for more information on working with AT commands and serial devices:

34 Comments to “Unlock Your Huawei E160”

  1. Cassandra

    You did it!!!! Fantastic!!! Now my Swisscom modem can transform itself from being a ridiculously overpriced internet solution to a versatile (yet still ridiculously overpriced) internet solution!

  2. Roho Nono

    Hii ni ngumu sana, nilifikiria python ni nyoka inaonekana i thought wrong. Nikikuja Kenya naweza kukutafuta unisaidie ku unlock modem yangu? Am serious, i am not very computer literate. Nitakununulia chapati skate na madodo as payment (ask your watchiee what that means) !

  3. Chikita

    I also heard someone say they used their YU line on their safaricom modem a couple of times. Thanks for that info; trust me,it is of great use to many.

    1. Alan Author

      I definitely don’t mind, man. This information should be public anyways :). I hate to see the common mwananchi getting taken advantage of!

  4. Mike

    Thanks mate.

    Unlocked my modem in Australia before leaving for Zambia with VSO for two years.

    No worries with an Aussie ‘3’ branded modem with MTN Zambia now!

    1. Alan Author


      Were you prompted for a security code? Generate an unlock code with one of the methods described above and that’s all you need.


  5. RAJA

    could you please show me a step by step process of unlockin.
    i got the unlock key but then do i need a software to unlock the key.is Minicom-s the software i need to succesfully unlock the modem and whre can i get it.

  6. John Mugambi

    thanx so much for the info.i used the web based calculator to get the code but when i try to connect this message appears ‘you must enter a registred network’. i have tried to create a new profile in vain coz i cant save the settings(‘user settings failed’) is all appears all the time.
    kindly assist.note the safaricom has no problem registering.

  7. Codes

    I like this, I was looking for a way to free myself and found just that. It works, thanks so much Alan for the true open spirit of information sharing. In the same spirit if someone has issues figuring out or making it work I can help, at no cost

  8. Alex

    Fantastic, thanks! Workehuad perfectly on a Huawei E153. Now if only I could find a way to send USSD codes. Any ideas? AT+CUSD=1,”code”,15 doesn’t seem to work on the E153, but works perfectly with the E220 and E160. The E1551 needs 7-bit decoding, but that’s easy enough to handle with this: http://webeve.de/~cwh/huawei-ussd.pl

    The E153 seems to be a different beast altogether and doesn’t work with either solution; I don’t have access to Windows and need to refill my account via ussd. I guess the trusty Nokia 1200 will handle that for the time being….

  9. jim

    eish! the new airtel E153u-2 is tough to break. does anyone know how to get it to ask for the unlock code? i need help desperately.

    1. Alan Author


      I haven’t tried the new Airtel modems, are you sure they’re Huawei? I noticed the other day that Safaricom now has some cheap ZTE ones… that might be a whole new can of worms. For what it’s worth, the dude responsible for writing the unlock-code-generating script lists that it should work for the E153… is this “E153u-2” a new model? Anyways, check here, from the source: http://dogber1.blogspot.com/2010/03/unlocker-for-huawei-modems.html

  10. Collinsi

    How about the orange modem, mine is a
    ZTE model AC2726.
    How can you unlock this? These modems don’t seem to have the IMEI number anywhere, so what to do!!!

    Any help will be appreciated.


  11. jim

    thenx alot buddy.
    its definitely a huawei. (atleast thats wot it says on the back). and yes,its a new model. its one of those they were offering a few weeks ago at 1750/=. (still wish i hadn’t wasted money). this thing is totally irritating. its super-slow and it keeps disconnecting. today i actually updated my anti-virus software at 1kbps. i need to get this thing unlocked. btw, with number portability, can i transfer to another network, using my airtel sim to surf using safcom without having to unlock my modem? thenx again

    1. Alex


      Alan’s instructions worked perfectly for me on a Huawei E153u-1 (Tigo) in Tanzania. I rotate between Airtel, Vodacom, and Tigo SIM cards in the same modem (all up or down at various times).

      If you’re on Windows instead of *NIX, try removing your SIM card and opening the dialing software that came bundled with the modem. It may prompt you for an unlock code; or you can put in the other sim card and try to connect. Whether (or when) it asks for an unlock code really depends on the software – there may even be something in one of the configuration settings. It’s hard to know for sure.

      If that fails, try to find a way to issue AT-commands directly to the modem – I’m not sure what the current Windows equivalent is to minicom.

      I’m on linux myself – for me, the E153u-1’s interface is on /dev/ttyUSB0.

      Hope this helps,

  12. mehdi

    i could nt enter code.i use e 1550 telenor sweden.

    » Unlock: AT^CARDLOCK=”36711865″
    » Flash: 34455741
    tnx for help

  13. Watitwa

    Can the cracked dude get me into CDMA/EVDO network YU, ZAIN, ORANGE are too damn slow at 2G speeds, maybe 3G+. I rather get my stuff pap at 7.2 mbps than waiting whole evening at 128kbps that is even overated!

    1. Alan Author

      It’s not cracked… it’s just SIM unlocked. If the modem supports it and the network supports it then yes, you’ll go fast.

  14. nomit

    nway my sister and i have the new safaricom modems that don’t ask for the unlock code like the old ones. please help me unlock with windows
    E160 351596036931899
    E173 356576044597127.


  15. Awesome share. Wanted to move to safcom’s new service without buying a new modem. Works like a charm and easy too. Thanks a lot. God bless you (so u may continue making awesome posts and nuch more :)

Comments are closed.