How to connect to a WEP network [SOLVED]

Hi everybody, I’ve bough a spark core kickstarter edition and now I decided to put it to work.
Once configured I was not able to connect to my wifi network protected with WEP.
I know: wep is a crappy security for wifi networks but I have access only to this one…

Well: I did a lot of research and tests, mostly following the online documentation found a this address: http://support.particle.io/hc/en-us/articles/202938790-Flashing-Green-Can-t-Connect-to-Wi-Fi

Nothing worked since looking for a solution inside this community I stumbled into a strange sentence: “WEP is a strange beast: some routers accept ascii or hex passwords”.

Hex passwords??? It can’t be true but IT WORKED! I converted my 13 character WEP password to 26 character hex string and now my spark core is nicely breathing in cyan!

You can convert your password using some online resources like: http://www.asciitohex.com/
Don’t forget to remove the trailing spaces; your hex password should like this one: 00112233445566778899AABBCCDD (without spaces).

Then, once converted, follow the guide to set your configuration via serial interface: particle serial wifi

Your core should blink in blue before to use “particle serial wifi”. You can also start the full configuration with “particle setup”.

Once the particle utility as for network, encryption and password, choose your network and select manually the WEP protection. Now you can copy and paste your hex password.

Hope this can help someone stuck like me on this silly problem.

Cheers!

4 Likes

Thanks for this posting. My WEP is known only by it’s hex password, so the conversion is not needed. But it’s good to know that using the hex password worked for you. Recent postings have suggested that a Broadcom bug was keeping this from working for the Photon.

Unfortunately, my Photon still won’t configure using the hex password. While the CLI says all is well and that Now we’ll connect, my Photon stays in Listening mode (blinking blue) and if I reset it, the led blinks green ad nauseam.

One possible clue is that particle list (when the led is blinking blue) shows no Photons. Shouldn’t mine show up?

Hi again @doctek

Sorry but particle list is a cloud command that lists are your devices that you have claimed. I don't think you have gotten your device on the cloud yet. If your device is breathing cyan, it will show up.

The doc is here:

https://docs.particle.io/reference/cli/#particle-list

Thanks for your helpful response! Sorry for the misunderstanding of the list command. I really appreciate you pointing me to the references section of the documents. Thanks!

I had something very similar to this last week. I finally did a few “Factory Resets”, and then upgraded my firmware. After that, it started connecting great as soon as I apply power. Good luck!

-Joe

Thank you for your input. This could be a helpful approach, but I would like a few more details.

When you say “something very similar”, how similar? Was it the same problem I’ve described?

How many “Factory Resets” did you do? Why did you do more than one?

How do you “upgrade firmware”? Was this on a Photon or a Core?

Sorry for the newbie questions, but I’m a newbie and the directions leave a lot to the imagination.

FWIW, my router is only type g, not n. I’m on channel 6.

All router topologies are backwards compatible, so the type and channel shouldn’t matter.

First question: Do you have MAC Address filtering enabled on your router? If you do, then turn that off and reboot your router, as it will prevent unknown devices from being issued an IP address, even if the password is correct.

I’m using a Core, but I’m also a newbie, so let’s work on this together.
Are you using a Mac or a PC?

I assume you’ve got the PARTICLE-CLI installed?

Is this a brand-new Photon, or has it ever connected somewhere else?

Have you logged into “the cloud” using both PARTICLE LOGIN and PARTICLE CLOUD LOGIN commands? (I don’t know if this helps, but it is reassuring to know that at least your account works!)

The reason I had to do multiple factory resets was that this was the only way I could get my device to connect. I’d factory reset, it would reboot and blink greenish-yellow, then I’d force the blue listening mode and perform a “PARTICLE SETUP” and it would work fine - until I removed the power, then it would go back to being a blinking brick again.

After two factory resets, I updated the firmware. The Core is slightly different from your Photon. My Core updates using a program called the “DFU-Utility” which I downloaded from a Particle link, with Core-specific binaries I got from GitHub. I do not believe tht this process applies for your chip: the Photon is supposed to automatically update itself over-the-air after you first connect.

So on to a few more questions:

Does your Wifi have a strong signal? Sorry, probably a basic question, but I have to ask!

I had better luck once I told it to use a specific network and 802.11G rather than having it scan the network for SSID’s. I live in a place with heavy Wifi traffic, so fewer options seemed safer to me :wink:

Have you ever tried a factory reset?
Source: https://docs.particle.io/guide/getting-started/modes/photon/#troubleshooting-modes

A factory reset isn’t anything to fear, and I’m hopeful it may fix your issue. After every failed setup attempt, I’d reboot, then perform another factory reset, so “start over from the beginning”.

Here is the process from that link. for a Photon, step by step:

Procedure:
The procedure is same as the one described above (DFU Mode), but in this case you should continue holding down the SETUP button until you see the device change from flashing yellow to flashing white. Then release the button. This will take about 10 seconds. The device should begin after the factory reset is complete.

To perform a factory reset:
Hold down BOTH buttons
Release only the RESET button, while holding down the SETUP button.
Wait for the LED to start flashing magenta, then yellow, then green (continue to hold the SETUP button)The LED will turn solid white (continue to hold the SETUP button)
Finally, the LED will turn blink white rapidly.
Release the SETUP button

Thanks for your extensive reply! I appreciate the effort you went to to do this and your cooperative spirit.

The point being that I don't have n, so 5GHz is not a problem.

I don't think I have anything that should keep out the Photon. Other devices have connected easily once I gave them the hex pass code. I've never encountered any problem in this regard nor have I ever adjusted my router.

I'm using a 64bit W7 PC machine. I'm eager to work together, but I'm still not clear exactly what problem you are having. Have you got your Core connected or not? I am using WEP with a hex digit password. Are you?

Yes. I followed the instructions and had no problem.

Brand new.

Yes. Login was no problem. I created an account and claimed my Photon (whatever that means exactly - is "claiming" explained somewhere?)

On initial setup my Photon blinked blue and I used the CLI/usb to do particle setup. This yielded a "WOOPS". Then I did particle serial wifi which allowed me to pick out my network and provide my hex password. The report of the exchange with the router shows no problems and says that the Photon will now connect. It doesn't. Just continues to blink blue until I hit reset and then blinks green (found wifi, trying to connect).

The Photon does not require a Factory Reset. I downloaded the newest code from GitHub and used DFU (as explained on GitHub) to do the update. I'm pretty sure this worked since my Photon no longer went to blinking green; it just blinked blue. I then did the steps described above with identical results (WOOPS, then just blinking blue until I hit reset). The only difference being that the green light is on almost (not quite) constantly after reset now. Perhaps a feature of the new firmware version?

6 feet from the router.

I specified the network to use also.

See discussion above. Factory Reset is discouraged for the Photon (there are posts about this) and is not necessary. DFU can reprogram the Photon.

Again, thank you for your thoughtful and thorough reply. Please tell me more about the exact problem you are seeing so we can compare.

My problem: My Core used to connect, but I put it on the shelf for nearly a year, as life got in the way. When I took it back out for my new project (A Sparkfun Photon weather shield) it wouldn’t connect. It turned out my Core was two firmware updates behind. Finally, after the 2nd update, I did a PARTICLE SETUP and it logged right in.

I don’t use a Hex passphrase, and my router is running WPA (Not WEP, sorry, that was a typo in my earlier post. WEP can be cracked in seconds now) And I could never get a connection using my chip and WPA2, even though my other computers are using it just fine. I also have my router security set to high, and no outside ports are open.

Is your network’s SSID being broadcast? Mine is. I don’t know if that has any bearing on your connection issue, but the more things you can easily try, the better chance you have of finding a solution.

One possible suggestion: Does your router support either multiple SSID’s or a “Guest Mode”? Most do,in order to create a “guest account” or a 2nd network for people you know, but also keep them out your main network, shared drives, etc. You can find that in your router’s wireless settings - Mine (Actiontec DSL) was in the “Wireless Settings - Multiple SSID” tab. Create a totally new SSID, with a different, non-Hex password. On my router, I can have four of these, all active at once. Once you have a 2nd SSID up and running, connect to it with a smartphone or some other device, just to prove it works before you try it with the Photon.

Let me know how this goes. Wising you great success!

Once more, thanks for your reply!

Looks like our situations are really not very similar, so I appreciate your willingness to help.

Yes, my SSID is broadcast.

Here are a couple of interesting details:

I use InSSIDer to look at networks in my neighborhood. Mine always shows up as nice and strong - as expected. I notice that when my Photon is in Listening mode, it shows up with an SSID: Photon-XXXX (my ID). It is an 802.11n type. Since my network is type 802.11g, is that a potential problem??

Also, what is the implication of the Photon putting out an SSID? Why does it do that?

There is an "open" network in my neighborhood, but it's signal is very weak. It is of type 802.11n. I tried configuring my Photon to connect to it. Now I get a definite blinking green led. I guess the green I've seen before really is solid, even though I can get to Listening mode from it.

Finally, using the "v" command from RealTerm yields 0.4.4, as expected since I updated my firmware. It's comforting to know that the process worked!

I'll give some thought to changing my router configuration, although that really shouldn't be necessary.

Thanks again for your help.

There should be no problem with the Photon using 802.11n and your router using 11g. My router only does g as well.

I’m guessing that the Photon puts out an SSID so the Particle app in your smartphone can communicate with it back through your router?

Congrats on the firmware upgrade. That made all the difference in the world for me.

I’m running out of things things to suggest that you try. Perhaps you can enable and examine your router log? Other than that, could you attempt to connect using a different open network somewhere (i.e. Starbucks, McDonalds, Panara) if you have a laptop?

Sorry, really scraping the bottom of the barrel here, other than Particle’s tech support. Someone has to have seen this before. Being sent a defective chip isn’t outside the realm of the possible.

-Joe

Update: This afternoon I was able to try connecting to a WAP2 network (using a password). Worked perfectly! Breathing cyan like a champ and showing up as “claimed” when I claimed it.

So looks like I just have to wait for a fix to the WEP / Hex password problem. Someday, I hope.

Just digging into the firmware (month-old LATEST, but nothing’s changed with regards to this since then). Looking at the code for setting WEP credentials. . .here’s the code from hal/src/core/wlan_hal.c:

  case WLAN_SEC_WEP://WEP
    {
        char buf[32];

        // Get WEP key from string, needs converting
        passwordLen = passwordLen / 2;
        char byteStr[3];
        byteStr[2] = '\0';
        memset(buf, 0, sizeof (buf));
        unsigned i;
        for (i = 0; i < passwordLen; i++)
        { // Basic loop to convert text-based WEP key to byte array, can definitely be improved
            byteStr[0] = password[2 * i];
            byteStr[1] = password[(2 * i) + 1];
            buf[i] = strtoul(byteStr, NULL, 16);
        }
        password = buf;

     wlan_profile_index = wlan_add_profile(WLAN_SEC_WEP,    // Security type
        (unsigned char *)ssid,                                // SSID
        ssidLen,                                              // SSID length
        NULL,                                                 // BSSID
        1,                                                    // Priority
        passwordLen,                                          // KEY length
        0,                                                    // KEY index
        0,
        (unsigned char *)password,                            // KEY
        0);

      break;
    }
```
OK, I see what's going on with "passwordLen = passwordLen / 2" (memo: two ways to optimize that are "passwordLen /= 2" or "passwordLen >> 1").  But it's interesting to me that the WEP routine is different from the others.

Also, I wonder if anyone's gotten their Core to connect to a WPA network?  If you select WPA, it looks like the firmware will try to connect with WPA2 anyway.  I'm not a WiFi expert, but it is interesting to note:

case WLAN_SEC_WPA://WPA
case WLAN_SEC_WPA2://WPA2
{
wlan_profile_index = wlan_add_profile(WLAN_SEC_WPA2, // Security type
(unsigned char *)ssid, // SSID
ssidLen, // SSID length
NULL, // BSSID
1, // Priority
0x18, // PairwiseCipher
0x1e, // GroupCipher
2, // KEY management
(unsigned char *)password, // KEY
passwordLen); // KEY length

  break;

I can't find <code>wlan_add_profile</code> in the firmware, so assume it's part of TI's proprietary library.  But it's interesting that the function arguments are quite different between WEP and WPA2?  Or is that why it isn't working?
2 Likes

As I can see from the code you posted, the WEP password is expected to be always in hex format, unlikely from the other kinds of encryption. Btw does not explain why sometimes also specifying an hex password, the core/particle does not connect.

Then I suggest an @admin to submit a change request to the official documentation.

1 Like

this is being reviewed for official submission into the documentation.

Feel free to make a pull request of make an issue of it on our repo for the docs here:

thanks @roglio and @WebDust21!!!

-Corey

3 Likes

On the photon, the WEP password has to be specified with an index, and in hex. Details at

Nov 2018 update. Using Hex for the password works. If you don’t know hex, use text to hex converter. It works too. Thanks for the recommendation.