We have recently bought some M2M SIMs from one Cellular provider. They asked the domains that should be white-listed for our SIMs. These SIMs connect only to the white-listed domains.
We had given our custom domain (where our cloud engine is hosted) to them for whitelisting, however the Electron is unable to connect using these SIMs. I tried following the instruction on setup.particle.io so that the Particle has the correct APN details. However, I am stuck at the second screen of the instruction. The LED is blinking green and never going to Cyan.
Do we need to give Particle’s domain/subdomain also for whitelisting? Does Electron always connect to the Particle cloud?
I have tried other consumer SIMs which connect fine.
For a quick answer before someone else can get into it more detailed… I believe you are running into the same issue as if you were ruining long blocking code. The cloud functionality isn’t being serviced. If you want to run your code without the cloud, I believe you need to use another system mode, i.e.:
SYSTEM_THREADING(ENABLED)
SYSTEM_MODE(MANUAL or SEMI_AUTOMATIC)
Or, add the particle servers to the whitelist and guarantee connectivity.
@ninjatill Thank you for your response.
At the setup.particle.io, we do not flash any firmware of our own. Particle.io provides a firmware, which feeds the APN information into the Electron.
Further, I also tried running my custom code with SYSTEM_MODE(SEMI_AUTOMATIC); setting and then calling Particle.connect();. This also doesn’t work.
If you want to use the default firmware (called Tinker) then it will try to connect to the Particle cloud. If you write your own firmware, you can do whatever you want, just start in the right startup mode and avoid using the Particle cloud functions in you code and it will never try to connect to that cloud.
Hmm, not sure about that.
Just to clarify: You did download that firmware from setup.particle.io and flashed it and then never flash your own code over it?
So you are useing Tinker firmware for your "product"?
Especially when you say
If not, then you still would have to set the APN in your own firmware as it replaces the Tinker firmware Particle provides.
Especially with non-AUTOMATIC SYSTEM_MODEs, due to a bug in some Device OS versions, you'll need to reapply the Particle.keepAlive() settings after each reconnect.
However, for white-listing, maybe @rickkas7 has a collection of the domains contacted by Particle devices.
Yes, you need to set the APN in all user firmware. The setting is saved in the RAM on the u-blox modem module, so it kind of looks like it sticks when you stop setting the APN in user firmware, but when you completely power down the setting is lost. So you really need to set it all the time.
If cloud access is enabled (AUTOMATIC mode or Particle.connect is used), then a DNS lookup for YOUR_DEVICE_ID.udp.particle.io is done, and UDP packets are sent to and from that IP address.
YOUR_DEVICE_ID is the unique 24-character hexadecimal number that uniquely identifies your Electron.
Note that the you will not get the same IP address back each time. It can rotate, and there are a number of servers available.
Also you’ll need to set the Particle.keepAlive() value as appropriate for your SIM provider. This is the amount of time the provider will keep the UDP back channel open to allow packets to be sent back to the Electron from the cloud. This varies from 30 seconds to 23 minutes, depending on the provider.
The Electron can be used in Internet-only, no cloud mode, however you won’t be able to do device management, OTA code flashing, and use features like functions, variables, publish, and subscribe.
If you can really whitelist by domain name, that would be ideal. Electrons do a DNS lookup for YOUR_DEVICE_ID.udp.particle.io . The IP address returned won’t necessarily be the same each time you resolve it. (Where YOUR_DEVICE_ID is the 24-character hexadecimal device ID, of course.)
If you need to whitelist by IP address, that’s harder because the the list of IP addresses is subject to change. Also, it’s not the same as the list of IP addresses for Wi-Fi devices.
All cloud communication is done over a single CoAP cloud connection. For Electrons, it’s CoAP over DTLS over UDP. For Photons, it’s CoAP with AES encryption over TCP. That single CoAP connection is used for functions, variables, publish, subscribe, OTA flash, and time sync. There’s only one connection and all of the uses are multiplexed over that connection (that’s what the CoAP part is for). The only exception is DNS, which is used to find the cloud server.
Of course, if you are directly using TCP or UDP from your user firmware, whatever ports you use for that.