Connect Electron to internet over USB on Mac

Hey everyone I ran out of cellular data on my Electron. I am attempting to continue to code/control the device while plugged into USB on my Mac computer. It appears as thought I have the device connected, however I cannot get it to connect to the internet over USB (Cyan light). As of now I have a blinking green light. Can anyone help?

The USB connection can only be used for configuration, debugging, and uploading firmware to the device. It cannot be used for the Internet connection.

The only way for an Electron to connect to the cloud is by cellular, which requires an activated SIM card. When the SIM card has reached its data limit, it goes into a deactivated state until you increase the limit or the next billing cycle.

When a SIM card is deactivated it won’t ever get past blinking green.

1 Like

That’s why it’s often useful to have a Photon to develop on, as the code is (mostly) interchangeable, but doesn’t consume cellular data. for development purposes, you could also use a 3rd party SIM (like your phone’s SIM card).
If you don’t need a connection in your program (for testing purposes), try flashing over USB? (You should flash over USB regardless to save data anyhow, if the device is physically accessible).

1 Like

Seems like a missed opportunity for dev here. Thanks for getting back to me guys.

Mostly interchangeable. I tried the Photon as a dev tool thing and really had issues. I quite honestly would not recommend serious development for the Electron by using a Photon as a surrogate. There are a few places where the firmware is/was substantially different in implementation.

==================================

Unless you’re pushing a ton of data, it’s hard to use over a couple MB per mo on an Electron as long as you’re pushing firmware via the USB. The local IDE plus some Python scripts really help with this.

As far as running out of data, can’t you just up the MB limit on the control panel? Extra MB are $0.40/ea so it’s not like this is financially debilitating.

Would you mind elaborating on that? Other than the connectivity parts, the base firmware should be the same. It’d be good to know if there are problematic areas in there so they can be looked at.

1 Like

Granted, there are some differences between WiFi and Cellular devices

  • WiFi communicates via TCP, Cellular via UDP
  • need for UDP hole punching on cellular devices
  • communication between controller and radio module via dedicated bus vs. serial
  • blocking communication with the cellular module
  • lack of extra pins and interfaces
  • …

But most stuff that is not touching on these specific differences should be simple to test and port.
One thing that I usually do to keep it one codebase for both is this

#if (PLATFORM_ID == PLATFORM_ELECTRON_PRODUCTION)
  #define RADIO Cellular
  // optional
  const uint32_t radioTimeout = 300000;
#else
  #define RADIO WiFi
  // optional
  const uint32_t radioTimeout = 60000;
#endif

which then allows me to write code like this, without needing to distinguish any further

  RADIO.on();
  RADIO.connect();
  waitFor(RADIO.connected, radioTimeout);

Recently Particle also changed the behaviour of WiFi.RSSI() to match the behaviour of Cellular.RSSI() to reduce the need for differentiating between the two calls in code.
If you can point out some more areas where unification would make sense, Particle is always open.

1 Like

II think there has been some improvements, but I was not able to port code from one to the other when I tried it back in the 0.4.X days. The EEPROM library was one major sticking point.

===========

The real issue is data usage during development. That used to be an issue on the Electron because it had a very chatty protocol during connection. (The extra data costs were still just a few bucks so no big deal.)

What I have seen since 0.6.X is that cellular/network connections are now MUCH more efficient both in power and data and one typically won’t use tons data as long as one is pushing firmware over USB. So, that really removes the need to develop on anything but the actual Electron hardware now.

I’m certainly biased by experience, but I don’t see too many practical instances of AC wall wart-tethered Electrons, and I don’t see a lot of practical Electron use cases where one would not have to control the radio in order to manage battery life, so one might as well just be on the actual hardware.

=========

The other thing I’ll add is that at least in the past, the firmware releases have not exactly paralleled each other in the past. One can’t expect every feature/bug to exactly be the same between the Photon and Electron. This isn’t a criticism of Particle, it’s just reality.

I feel it increases the level of difficulty to develop on one and port to the other. I wouldn’t recommend this unless you had a product where this type of portability was an actual requirement. Buying a few dollars in data is likely faster and cheaper.

1 Like