[Solved]- Electron unable to handshake when plugged into breadboard

Thanks for the info @BDub!

In my case it was with 3G Electrons and a rigid PCB antenna. I didn’t try the experiment with plugging just one side in and my particular project is over now so maybe one of the others on this thread could try it?

Hi @BDub,

Alright so my electron connects if I have D0 side plugged in and A0 dangling freely but not the other way around. It is 3G electron and looks like rigid PCB antenna (taoglas).

Does that mean it has a hardware issue? I hope not because I had it imported to Pakistan and payed around $100 in customs duty :frowning: I am not sure if I have to pay this again for the replacement.

Thanks

Interesting info! Thanks for doing this testing. In the past I've tried to narrow down which pin might be responsible. Power pins seem likely if there is some antenna effect of the breadboard rows and possibly stray capacitance between those rows.

Since your particular board seems sensitive on the A0 side, we have VIN and GND over there. Do you have any of those female to male or female to female jumpers that you can attach to the header pins? What happens if you connect one to VIN with the electron completely out of the breadboard? Also try GND on that side. Then try both and run the wires next to each other (simulating stray capacitance of the breadboard between these connections)... but don't connect VIN to GND electrically of course :smile: You can try other pins as well, but I don't see those having as much of an impact on the modem's ability to connect to cellular.

Hopefully that will yield some results. It might be interesting to know what frequency the electron is using because this might play into things as well. Do you have the U260 or U270? Any idea what your local carrier frequency is?

You can try to set the band used to only one of the two available for your modem. Then you can see if that affects the outcome of previous tests. setting the bands should be done in SEMI_AUTOMATIC or MANUAL mode before telling the modem to connect. When done with this testing, it's recommended to set the bands back to factory defaults: https://docs.particle.io/reference/firmware/electron/#setbandselect-

Here's a helper app for band select:

You'll want to be able to program your electron locally over USB for bandselect in case you select a band that absolutely won't make a connection.

I've not been able to get to the bottom of this before... so I'm hoping with your help we can figure out what might be the root cause with this issue.

5 Likes

Thanks @BDub for detailed set of instructions. The board is sitting at my office desk. I will surely perform these steps first thing in the morning after arriving at office :slight_smile: and report back to you.

Thanks once again.

3 Likes

@noumanh let us know if it works!

All right I performed the tests as suggested. My device is u270. Here are the results

1- Jumper on VIN -> Electron connected
2- Jumper on GND -> Electron connected
3- Jumper on VIN & GND -> Electron connected

Then I used the app sketch you mentioned and set the band to 900. It connected fine. I ran the tests again

BAND 900
1- Jumper on VIN -> Electron connected
2- Jumper on GND -> Electron connected
3- Jumper on VIN & GND -> Electron connected

Here is a link to test setup when electron was connecting. Showing this to make sure that I performed the tests correctly. It is with jumpers connected to both VIN and GND.

And then I went back to change the band. Now a funny thing happened here. In available bands it was showing 900, 1800 So I chose 1800. The app said it is invalid. I issued get command and now it showed available bands: 900, 2100.
I then chose 2100. It never connected, kept blinking green. I switched to 900, still kept blinking green. I reverted to factory default which shows 900, 2100 but still it is not connecting. Blinking green continuously.

I flash a different app every time after switching bands to check connectivity since band selection app does not attempt to connect to cell network.

I am totally lost here, my device is not connecting to network even without breadboard now :slight_smile: I tried setting 1800 band that I saw previously but now it says its an invalid band. I clearly remember using 900 band and connecting without any problems and performing tests. But now, no matter which ever band I chose it keeps on blinking green.

1 Like

My specs: Electron 2G with Taoglas PCB antenna running firmware version 0.5.3

I am having a similar problem, however it does not appear to be only the breadboard that is giving me problems.

I have tried everything from a firmware perspective to remedy the problem (see the post I started on my saga yesterday) so I definitely have ruled out some sort of firmware or application related problem.

I am able to get my Electron to connect to the network occasionally. Sometimes it remains connected for hours upon hours on end, sometimes it can’t connect at all (mind you this is without moving the breadboard or the Electron… sometimes it just works for some reason).

I did some of the experimenting suggested above as far as trying to plug in different sides of the Electron to the breadboard to see if that influenced things. It would appear to me that when the A0 side of the Electron is plugged in, it is less likely to establish an internet connection, though it is not a 100% correlation (sometimes it still manages to connect).

I have also tried different antennas, which don’t seem to be any better or worse (still batting about 10% on my connection attempts whether using stock antenna or others I had lying around).

I tried the band select code that @BDub posted above, but I am unable to get any of the bands to work. I actually modified the code because it wasn’t working for me (the set bands portion specifically). I also changed the code so that you can attempt to connect or disconnect from Particle Cloud. Unfortunately, it appears that particle.connect() blocks the main application loop() from executing once it has been called, so this results in the Electron simply attempting to connect to the cloud forever (unsuccessfully). To get around this, I enabled system threading with SYSTEM_THREAD(ENABLED); so that the main loop() keeps executing while the Electron is trying to connect to the Particle Cloud. I enable a timer once the connection attempt begins. When the timer times out, I pass that info to the loop via timeoutFlag and attempt to abort the particle.connect() attempt with particle.disconnect() and Cellular.off(). This doesn’t work however… it would appear that once particle.connect() is called, it blocks all other core functions (i.e. particle.disconnect() ) from executing.

At the very least, this code will avoid others@noumanh having to flash a separate app to see if the new selected band works.

#include "application.h"

SYSTEM_THREAD(ENABLED);
SYSTEM_MODE(SEMI_AUTOMATIC);


// ALL_LEVEL, TRACE_LEVEL, DEBUG_LEVEL, INFO_LEVEL, WARN_LEVEL, ERROR_LEVEL, PANIC_LEVEL, NO_LOG_LEVEL
//SerialDebugOutput debugOutput(9600, ALL_LEVEL);



long timeout = 30000;  //Set connection timeout to 20 seconds
bool timeoutFlag = false;
bool connectFlag = false;
bool connectErrorFlag = false;

void setConnectFlags(){
  if(connectFlag==TRUE) timeoutFlag=TRUE;
}

Timer myTimer(timeout, setConnectFlags);

void waitForEnter() {
  WITH_LOCK(Serial){
    while (!Serial.available()) {
        Particle.process();
        Serial.print("Press ENTER\r"); // prints in place over and over
        delay(1000);
    }
    while (Serial.available()) Serial.read(); // Flush the input buffer
  }
}

void setup()
{
    Serial.begin(9600);
    waitForEnter();

    Serial.println("Running in SEMI_AUTOMATIC mode, cellular modem is OFF at boot, not connecting to the cloud."
                    "\r\nIf you select a band that never connects, press the RESET button and change the band.\r\n");

    Serial.println("Press a key to run a command:"
                "\r\n[O|o] to turn the cellular modem ON|OFF"
                "\r\n[g|s] get|set bands info"
                "\r\n[c|d] connect | disconnect from Particle Cloud");

    pinMode(D7, OUTPUT); //Use Electron on-board LED to indicate if connection attempt has failed
}

/* This function loops forever --------------------------------------------*/
void loop()
{
    if(connectErrorFlag == true){
      digitalWrite(D7, HIGH);
      delay(100);
      digitalWrite(D7, LOW);
      delay(100);
    }

    WITH_LOCK(Serial){

      if(timeoutFlag==TRUE){
        timeoutFlag = FALSE;
        myTimer.stop();
        if(Particle.connected()==FALSE){
          Serial.println("Connection attempt timed out!");
          connectErrorFlag = TRUE;
          Serial.println("Aborting connection attempt!");
          Particle.disconnect();
          Serial.println("Turning off the modem!");
          Cellular.off();
        }
        else{
          Serial.println("Successfully connected to Particle Cloud!");
          connectFlag = true;
        }
      }

      if (Serial.available() > 0)
      {
          char c = Serial.read();
          if (c == 'g') {
              CellularBand band_avail;
              if (Cellular.getBandAvailable(band_avail)) {
                  Serial.print("Available bands: ");
                  for (int x=0; x<band_avail.count; x++) {
                      Serial.printf("%d", band_avail.band[x]);
                      if (x+1<band_avail.count) Serial.printf(",");
                  }
                  Serial.println();
                  Serial.println(band_avail); // repeated to show printable
              }
              else {
                  Serial.printlnf("Bands available not retrieved from the modem!");
              }
              CellularBand band_sel;
              if (Cellular.getBandSelect(band_sel)) {
                  Serial.print("Selected bands: ");
                  for (int x=0; x<band_sel.count; x++) {
                      Serial.printf("%d", band_sel.band[x]);
                      if (x+1<band_sel.count) Serial.printf(",");
                  }
                  Serial.println();
                  Serial.println(band_sel); // repeated to show printable
              }
              else {
                  Serial.printlnf("Bands selected not retrieved from the modem!");
              }
          }
          else if (c == 's') {
              Serial.print("Enter one or more comma delimited bands in MHz (0 will set back to factory defaults,"
                          "\r\nPress ESC to cancel the operation): ");
              int done = false;
              String band = "";
              bool gotInput = FALSE;
              while (Serial.available()) Serial.read(); //Flush the serial buffer
              while (!done) {
                  if (Serial.available() > 0) {
                      gotInput = TRUE;
                      char c = Serial.read();
                      if (c == '\r') {
                          done = true;
                          Serial.println();
                      }
                      else if (c == 27) { // ESC
                          band = "";
                          done = true;
                          Serial.println("\r\nBand select cancelled!");
                      }
                      else {
                          band += c;
                          Serial.print(c); // echo
                      }
                  }
                  else if(gotInput==TRUE){
                    Serial.println("You must have finished entering your input...");
                    done = true;
                    delay(100);
                  }
                  Particle.process();
              }
              if(band != "") {
                  if (Cellular.setBandSelect(band.c_str())) {
                      Serial.printlnf("%s band(s) set! Value will be saved in NVM when powering off modem.", band.c_str());
                  }
                  else {
                      Serial.printlnf("%s band(s) not valid!", band.c_str());
                  }
              }
          }
          else if (c == '1') {
              Serial.println("Setting bands to 850");
              CellularBand band_sel;
              band_sel.band[0] = BAND_850;
              band_sel.count = 1;
              if (Cellular.setBandSelect(band_sel)) {
                  Serial.print(band_sel);
                  Serial.println(" band(s) set! Value will be saved in NVM when powering off modem.");
              }
              else {
                  Serial.print(band_sel);
                  Serial.println(" band(s) not valid!");
              }
          }
          else if (c == '2') {
              Serial.println("Setting bands to 1900");
              CellularBand band_sel;
              band_sel.band[0] = BAND_900;
              band_sel.count = 1;
              if (Cellular.setBandSelect(band_sel)) {
                  Serial.print(band_sel);
                  Serial.println(" band(s) set! Value will be saved in NVM when powering off modem.");
              }
              else {
                  Serial.print(band_sel);
                  Serial.println(" band(s) not valid!");
              }
          }
          else if (c == '3') {
              Serial.println("Setting bands to 850,1900");
              CellularBand band_sel;
              band_sel.band[0] = (MDM_Band)850;
              band_sel.band[1] = (MDM_Band)1800;
              band_sel.band[2] = (MDM_Band)3400; // forcing a bad value, still gets rejected
              band_sel.band[3] = BAND_2100;
              band_sel.count = 4;
              if (Cellular.setBandSelect(band_sel)) {
                  Serial.print(band_sel);
                  Serial.println(" band(s) set! Value will be saved in NVM when powering off modem.");
              }
              else {
                  Serial.print(band_sel);
                  Serial.println(" band(s) not valid!");
              }
          }
          else if (c == '4') {
              Serial.println("Setting bands to Factory Defaults!");
              CellularBand band_sel;
              band_sel.band[0] = BAND_DEFAULT;
              band_sel.count = 1;
              if (Cellular.setBandSelect(band_sel)) {
                  Serial.println("Factory defaults set! Value will be saved in NVM when powering off modem.");
              }
              else {
                  Serial.println("Factory defaults not set!");
              }
          }
          else if (c == 'O') {
              Serial.println("Turning on the modem!");
              Cellular.on();
          }
          else if (c == 'o') {
              Serial.println("Turning off the modem!");
              Cellular.off();
          }
          else if (c == 'c') {
              Serial.println("Trying to connect to the Particle Cloud!");
              connectFlag = true;
              connectErrorFlag = false;
              timeoutFlag = false;
              myTimer.start();
              Particle.connect();
          }
          else if (c == 'd') {
              Serial.println("Trying to disconnect to the Particle Cloud!");
              Particle.disconnect();
          }
          while (Serial.available()) Serial.read(); // Flush the input buffer
      }
    }


}
1 Like

Hi @jaza_tom thanks for sharing the code. The only problem my device had was that it was not connecting when mounted on breadboard. Otherwise it worked flawlessly. I used it on Asset Tracker Shield and it performed as expected. Its only today after running band select app that it stopped connecting to network.No matter what I do it is not connecting now. I have copied modem logs using tinker debug app. I would share it with @BDub if he needs it to see whats going on because it is not making any sense to me :smile:

No problem, it would appear after running the usb trouleshooting app and the tinker troubleshooting app that my Electron 2G is unable to find a cell tower to connect to… I just keep getting

+CREG 2, 0 (i.e. modem not connected to network, looking for a GSM operator)

Well, 2G is getting phased out over time.

You could try moving the Electron to another area that might have better 2G service.

Hi @BDub, any ideas why my electron stopped connecting to network after using the band switching app? I am extremely frustrated now because its not of any use at all. Your feedback will be much appreciated.

Thanks

Yea, we ended up ordering another 3G as my colleague doesn’t seem to be experiencing any difficulties in connectivity.

The only bummer about the 3G (besides price being $20 per unit higher) is that each type only works in a portion of the world whereas the 2G has “global coverage” which would be quite handy for us as we develop our product.

3G electrons have a 2G fallback. So wouldn’t it work regardless of the region?

Providing that part of the world still has 2G networks running.
So going for a US 3G Electron might work outside of US, but rest of world 3G will also not work in the US :wink:

1 Like

Hi @jaza_tom, I think I found what was causing this weird behavior with my electron. It has a u270 3G radio with 2G fallback. For each mode 2 frequency bands are available; 2G (900MHz, 1800MHz), 3G(900MHz, 2100MHz). As I mentioned that I remember seeing Available Bands set to 900, 1800 when I first used band switch app but later it only showed 900,2100 and then it never connected, continuous green blinking. This means that somehow my electron switched from 2G to 3G mode.The partner operator for Particle SIM here in Pakistan has 2G(900 MHz) and LTE/4G(1800 MHz). As my board does not support LTE, so the only option I was left with was to switch my electron back to 2G mode so that it starts showing Available Bands as 900, 1800. Cellular APIs only allow to set a band from available bands but I needed to change available bands first, i.e. getting my board in the right mode. To do that I used Cellular.command() method to execute AT commands on the radio to change it’s mode to 2G.

Cellular.command("AT+URAT=1,0\r\n")

This command sets the radio in dual mode (2G and 3G) but prefers 2G when both are available. Since the partner operator does not offer 3G, I took the liberty to prefer 2G. You can find more details about AT commands here

AT Commands Manual

After doing this, the band switch app now showed 900,1800 as available bands. I selected both using Cellular.setBandSelect() method and now my electron connects just fine. I don’t, however, know the reason why it flipped from 2G to 3G mode in the first place when I first used band switch app.

4 Likes

Just to clarify, that the connectivity problem that I resolved was secondary where my device refused to connect completely while I was performing different test advised by @BDub to resolve primary problem of electron not connecting when mounted on breadboard. I can confirm that my electron is now in the same state where it would connect fine standalone but not when mounted on breadboard. So we are back to square one :frowning: @BDub asked to do some tests and I did but then I have not heard anything from him or Particle in general especially when these test caused another issue that took around 3 days of my time to fix. I am sure if somebody from Particle had intervened and told me what was the cause of this weird behavior, it would have saved a lot of time.

Can anyone from Particle please update me on way forward? Please note that lot of beginners chose electron because of its out of box connectivity to the cloud so that they won’t have to face a steep learning curve into the world of electronics. But when these devices are so unstable it kills the whole purpose of smooth transitioning. When beginners like us have to go through so much core internal details just to get the device connected and talking to the cloud then I don’t see the value here. I have forgotten about all the exciting IOT stuff I could do using these devices and have become too consumed in figuring out how to connect.

Hello Everyone,

I am finally happy to say that my electron is now connecting perfectly and breathing cyan even when mounted on breadboard. It was all down to particle SIM and partner network operator here in Pakistan not talking to each other in an ideal manner. I simply used a local SIM from another network with best coverage in Pakistan and it just worked like there was never a problem. @RobMeades I think it was exactly what we discussed earlier. If connectivity between Particle SIM and the partner network is weak (could be for many reasons and not just the signal strength), then the board will not connect in noisy environments (mounted on shields or breadboards). Thank you all for your valuable time and excellent tips. This made it possible after all. I am a happy customer now and can finally focus on all the exciting stuff :slight_smile:

Would it be ok if I mark this thread as SOLVED ?

4 Likes

Good stuff. As you say, there can be problems with global roaming SIMs, the worst one being that you can register on a network but never get a data connection and from that there’s no recovery (unless the Particle software is able to catch this case and switch the modem to manual network selection mode then chose a network with which it knows there is a data roaming agreement, all of which is quite complex). A local SIM won’t have this problem as it won’t roam to other networks.

I’m glad you’re up and working now.

2 Likes

Hello, I’m having a similar problem, my electron (usually) connects while standalone (previous problems with sim contacts notwithstanding), but does not when plugged into the breadboard. This is a recent development, I have previously been able to connect, flash and run code while plugged into the breadboard, the change I think happened while trying to work out an I2C connection with a sensor.

I have done the testing suggested with the Vin and Grd pins, but the connection works fine with either or both of them connected to the breadboard.

As the electron has previously worked fine over the network and on the breadboard, I don’t see how the problem could be to do with network strength or the particular board. Is it maybe possible that it is a continuance of my previous problem with the sim card not having particularly good contacts? If so I don’t really know how to solve it - I was working on something to provide even pressure on the sim card while on the breadboard, but this is not particularly effective at present.

I am in the UK, on a 2G electron. I was trying to connect an Adafruit TSL2591 light sensor via an I2C bus. I’m pretty sure the wiring was mostly correct, although I am not entirely sure of whether I need to use pull-up resistors for the clock and data line.

@BDub @bko sorry for the tag, I don’t know if being marked solved would make people less likely to see the new post.