# Can not Connect to my cell phone Hotspot

**URL:** <https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877>\
**Category:** Troubleshooting\
**Created:** [April 7, 2016, 4:42pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877 "2016-04-07T16:42:06Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [April 9, 2016, 6:35pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877/21 "2016-04-09T18:35:13Z")

</div>

That is very odd, since the message would be independet of the WiFi connection.

What happens if you enter any other character? Do you get this displayed in your serial monitor?  
But just to be on the safe side you can add some other cases to which shoul connect

like this

```cpp
void loop()
{
  int c = Serial.read();
  switch (c)
  {
    case -1:
      // nothing to read, so ignore
      break;
    case '\r': // hit emter to connect
    case 'c': // or c
    case ' ': // or spacebar / blank
      Serial.println("Try to connect to cloud");
      Particle.connect();
      Serial.println("See cyan blinking?");
    default:
      Serial.write(c); // echo what we got
  }    
}

```

---

<div class="post-metadata">

**Author:** ![shiv](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/shiv/32/9531_2.png) [@shiv](https://community.particle.io/u/shiv)\
**Post date:** [April 9, 2016, 6:49pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877/22 "2016-04-09T18:49:12Z")

</div>

I actually did something similar but it never got the case. I tried with added space and ‘c’ but I still don’t see the “Try to connect to cloud” message in the serial.

On the other hand. I find if I turn hotspot on my phone, turn airplane mode on and off again, Reboot the phone, turn on hotspot, then reset the Photon it almost always connects and gets an IP Address. As a result I’m able to try the code snippets again and again.

What’s strange is that:

1. I get a different IP Address each time
2. On the phone I never see a device connected. When I connect my Surface to my phone for example, I see it appear on the phone instantly and I can see it’s IP address and MAC on the phone.

---

<div class="post-metadata">

**Author:** ![shiv](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/shiv/32/9531_2.png) [@shiv](https://community.particle.io/u/shiv)\
**Post date:** [April 9, 2016, 7:03pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877/23 "2016-04-09T19:03:58Z")

</div>

Holly crap!  
It connected.  
press Enter  
I got a blue led for a split second (2 breadths) and then it switched to flashing green  
Never see a “Try to connect” message in the terminal window, though

I did put a 1 second delay in the loop maybe that helps with capturing just one key press (I don’t know)

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [April 9, 2016, 7:10pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877/24 "2016-04-09T19:10:04Z")

</div>

> [@shiv](#):
>
> 1. I get a different IP Address each time

This happens with all my phones too. They seem to never hand out the same IP twice.

* * *

Try this sequence:

- Safe Mode
- flash above code
- clear WiFi credentials
- provide _ **only** _ phone hotspot credentials via serial monitor (press `w` and supply info)
- reset device once going to green
- try code above

I'm still very puzzled about the missing "Try to connect to cloud" message, since this has to happen.  
There is no need for a delay, since the device buffers 64 byte of serial input and will process one by one (unless you type faster than 10k characters per second 😉 )

---

<div class="post-metadata">

**Author:** ![shiv](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/shiv/32/9531_2.png) [@shiv](https://community.particle.io/u/shiv)\
**Post date:** [April 9, 2016, 7:14pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877/25 "2016-04-09T19:14:44Z")

</div>

I just edited my earlier post.  
I don’t ever see the “Try to connect to cloud” in the terminal window. So I’m guessing it never gets to the line, so the blue breathing LED may not be indicating connection to the cloud.

Is there a way to:

1. get the device to connect to the cloud using an IP Address (not sure if that’s what it’s doing already). I want to see if I
2. Specify and DNS the device can use (rather than use one from the phone).

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [April 9, 2016, 7:19pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877/26 "2016-04-09T19:19:16Z")

</div>

I’ve also edited my above post 😉

As it seems your WiFi is working, but the cloud connection not.  
So the next thing to test in between those two states is how good the WiFi actually works.  
For that reason I’ll just post you a simple `TCPServer` code which you can connect to via telnet.

```cpp
SYSTEM_MODE(SEMI_AUTOMATIC)

TCPClient client;
TCPServer server(79); // first try a safe port
//TCPServer server(5683); // later try the CoAP port for the cloud

void setup() {
  Serial.begin(115200);
  WiFi.on();
  WiFi.connect();
  waitUntil(WiFi.ready);

  server.begin();

  while(Serial.read() < 0) Particle.process();
  Serial.printlnf("SSID\t: %s" , (const char*)WiFi.SSID());
  Serial.printlnf("Local IP\t: %s", (const char*)WiFi.localIP().toString());
}

void loop() {
  char x;

  if(!client.connected())
  {
    client = server.available();
    if (client.connected())
    {
      client.printlnf(" Hi, I am Photon!\r\nHow can I serve you? (%s)", (const char*)client.remoteIP().toString());
    }
  }
  else
  {
    while(client.available())
    {
      switch(x = client.read())
      {
        case '?': // disconnect client
          client.println("Good Bye!");
          client.stop();
          break;
        case 'c': // hit c to connect
          Serial.println("Try to connect to cloud");
          Particle.connect();
          Serial.println("See cyan blinking?");
        default:
          Serial.write(x);
      }
    }
  }
}

```

- first press any key in serial monitor to get the server IP address
- the try `telnet <ip> 79`
- type in anything (not containing `?`, `c`) and hit ENTER to test transmission
- try c + ENTER to test cloud connection
- try ? + ENTER to close the telnet connection

If this works apart from cloud, then change the port number to 5683 and retest to test if the cloud port is blocked on your hotspot - if cloud already works, just the better 😉

---

<div class="post-metadata">

**Author:** ![shiv](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/shiv/32/9531_2.png) [@shiv](https://community.particle.io/u/shiv)\
**Post date:** [April 9, 2016, 7:54pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877/27 "2016-04-09T19:54:46Z")

</div>

On this one Photon, I have cleared credentials (setup down for 10 seconds).So the only credentials I have on there for my phone.

I’ll try the Safe mode step first and see

Here is something else I just tried. I used my wife’s phone’s hotspot. Again, the only credentials on the Photon are for that hotspot.  
Flashed code  
It connects without a problem  
Never see the “Try to connect to the cloud”.

So I tried flashing one of my other apps that works against the eclipse MQTT broker. This app works as expected when connected to WiFi router.

Cleared credentials  
Set credentials for Wife’s phone  
Flashed code  
Reset the device  
I see it connecting and connected to the phone. Phone also reports 1 guest connected (this phone doesn’t show IP or MAC)  
However, the app doesn’t actually work. Basically I can send it messages via the broker and it switches LED color. Doesn’t work. The device also sends message to a different topic on the broker. Never receive messages from the device either. Rebooted phone and device and tried all over again. No luck. That is the device is never actually getting on the Internet.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [April 9, 2016, 8:14pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877/28 "2016-04-09T20:14:21Z")

</div>

Are both phones going via the same provider/carrier?  
Can other Photons get online via these phones?

---

<div class="post-metadata">

**Author:** ![shiv](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/shiv/32/9531_2.png) [@shiv](https://community.particle.io/u/shiv)\
**Post date:** [April 9, 2016, 8:25pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877/29 "2016-04-09T20:25:28Z")

</div>

Tried the TCPServer code.  
For the first attempt I decided to use the Wifi router to ensure I’m using the app correctly.  
So I cleared credential and set credentials for the Wifi router.  
Flashed the code  
reset the device and started the serial monitor using CLI  
I see the device connected to my router (green breathing LED).  
Press any key does not seem to do anything. That is I don’t see the IP (or SSSID)

I jumped on to my router and I can see the device is connected, so I got the IP address from there and using telnet, I attempted to connect to it on port 79  
No luck there either.  
I’m looking at the code above but I can’t see what I’m missing

---

<div class="post-metadata">

**Author:** ![shiv](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/shiv/32/9531_2.png) [@shiv](https://community.particle.io/u/shiv)\
**Post date:** [April 9, 2016, 8:30pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877/30 "2016-04-09T20:30:29Z")

</div>

> Are both phones going via the same provider/carrier?  
> Can other Photons get online via these phones?

Yes, they use AT&T  
I use my Surface via my phone almost every day. I just tried connecting each phone to the other and browsing various websites. All works as expected.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [April 9, 2016, 8:49pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877/31 "2016-04-09T20:49:57Z")

</div>

> [@shiv](#):
>
> serial monitor using CLI

That explains some things 😉  
AFAIK CLI is only a _monitor_ which does just display serial output, but does not actually send things _to_ the device.  
Try PuTTY or any other duplex serial monitor - even Particel Dev Serial Monitor would do.

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [April 9, 2016, 8:58pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877/32 "2016-04-09T20:58:06Z")

</div>

By the way, I originally had the same misunderstanding with particle serial monitor. I kept wondering why my code wasn’t allowing me to hit a key to continue! It’s because it literally only monitors, and does not allow you to send.

---

<div class="post-metadata">

**Author:** ![shiv](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/shiv/32/9531_2.png) [@shiv](https://community.particle.io/u/shiv)\
**Post date:** [April 9, 2016, 8:59pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877/33 "2016-04-09T20:59:12Z")

</div>

Gosh, I feel really stupid! Ok, I’ll try the TCP code and the others again…

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [April 9, 2016, 9:14pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877/34 "2016-04-09T21:14:18Z")

</div>

There was a clue 😉

> [@ScruffR](#):
>
> What happens if you enter any other character? Do you get this displayed in your serial monitor?

---

<div class="post-metadata">

**Author:** ![shiv](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/shiv/32/9531_2.png) [@shiv](https://community.particle.io/u/shiv)\
**Post date:** [April 9, 2016, 9:22pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877/35 "2016-04-09T21:22:04Z")

</div>

Tried the original code (not the TCP Server code)  
Device connects to my phone  
I see the various messages in terminal program  
Press ‘c’ and I see the message as well as the blinking blue led (blinking, not breathing).  
Yay!  
Hmmrph…  
The see the led go to a dim blue (almost like it went into listen mode) for a split second. Then green flashing LED.

Tried the same with my wife’s phone (clearing credentials before). Same result.

Next I’ll try the TCP Server code with telnet

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [April 9, 2016, 9:49pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877/36 "2016-04-09T21:49:40Z")

</div>

Could you post a video of that sequence?

---

<div class="post-metadata">

**Author:** ![shiv](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/shiv/32/9531_2.png) [@shiv](https://community.particle.io/u/shiv)\
**Post date:** [April 9, 2016, 9:51pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877/37 "2016-04-09T21:51:28Z")

</div>

```
> Could you post a video of that sequence?

```

Ok, let me do that

---

<div class="post-metadata">

**Author:** ![shiv](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/shiv/32/9531_2.png) [@shiv](https://community.particle.io/u/shiv)\
**Post date:** [April 9, 2016, 10:39pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877/38 "2016-04-09T22:39:17Z")

</div>

Here is a link to the video showing the outcome of the original program  
[Photon Connecting via Cell Phone to Cloud and disconnecting](https://onedrive.live.com/redir?resid=2EF24A25F2DFC75A!125712&authkey=!AMpsyGrdAzA0CXY&ithint=video%2cMOV)

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [April 9, 2016, 11:00pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877/39 "2016-04-09T23:00:42Z")

</div>

I think I saw a short orange/red blip/burst there after the cyan, which would indicate a problem with the key exchange during cloud handshake.  
But the device connects fine when you are going through your router?

If not, you could try

```auto
particle keys doctor

```

to repair the keys, but if it does work with the router, the phone hotspot seems to interfere.

BTW: Did you give the TCPServer a go? This might also show if the connection is flaky which is especially problematic during key exchange.

---

<div class="post-metadata">

**Author:** ![shiv](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/shiv/32/9531_2.png) [@shiv](https://community.particle.io/u/shiv)\
**Post date:** [April 9, 2016, 11:05pm UTC](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877/40 "2016-04-09T23:05:21Z")

</div>

I don’t know if this makes a difference, but I’ve never used the Particle cloud except for the Web IDE and flashing my devices. I know the devices can get on the Internet via my router since everything I’m doing is Internet dependent. I mainly use [http://iot.eclipse.org](http://iot.eclipse.org) as my MQTT broker or I run Mosquito locally while developing/testing.

I tried the TCP server app. I had to get my desktop connected to the cell phones hotspot. I tried my wife’s cell phone first. And the program works as expected using port 79.

Now I’m going to try my cell phone also using port 79.

[Previous page](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877.md?page=1)

[Next page](https://community.particle.io/t/can-not-connect-to-my-cell-phone-hotspot/21877.md?page=3)
