Unable to get Photon out of RED flash error

HI Will -

No Problem.

As far as I know, we don’t have the option of making boards locally, we have to revert to US or China. In my brief experience with this, I have found China to be more cost effective.

The PCB design and enclosure design is what I enjoy most, so I am trying learning as much as I can. To the extend that I sold my business and enrolled at ASU to study electrical engineering. I always try to make things as small, neat and with as few wires as possible :relaxed:

While still studying, I turn to Google, Youtube and wherever I can learn from :slight_smile: Some people in the forum like yourself and @ScruffR,@peekay123, @jaredwolff, @gusgonnet to name a few, has been great!! THANKS!!

I always order a small number of boards first (±10) from PCway. Cheap enough, usually around $5 - $10 for 10 depending on the copper weight of course. I had sample boards made up first and they seemed to work just fine. I then opted for more boards and decided to try their assembly option, which of course, increase the board price due to the components and the 4oz copper traces for the 220V.

I decided to close my eyes, hold my breath and cross my fingers and installed another photon on the board… success!!! No issues… well, so far. :smile:


Thank you for all your help!
Regards, Friedl.

3 Likes

Looking good @friedl_1977!

1 Like

Thanks @jaredwolff -

Finishing up the units now for shipping soon. Just trying to figure out best way to deliver the product in order for client to be able to connect to their WiFi Networks :slight_smile:

Regards, Friedl.

How technically savvy are they? I’ve had folks download the Particle CLI in the past and then update the Wifi credentials that way. There are a bunch of ways to accomplish this but that is by far one of the easier methods. :slight_smile:

1 Like

Hi -

Well, this particular client is quite clued up and that fact that the product requires a professional to install (due to 220V connection to DB) I suppose this is an option with one problem… they don’t have access to the the USB part on the device.

The enclosure is sealed tamper proof.

I managed to write some code that puts the device into listening mode if it is unable to connect to WiFi for certain time. It also exists listening mode and tries to reconnect after x-seconds. This works well with once exception (and of course it is the most critical one):

if the device is powered off and then needs to connect to a new WiFi network, it never enters listening mode. My suspicion it that it is stuck trying to connect to the current WiFi so never enters void loop() If I use THREAD_ENABLE, for some reason, the device loses it’s connection to BLYNK even though everything else works fine :thinking:

I put together this piece of code, but for the love of me, can’t remember why :rofl: :rofl:

#include "Particle.h"

//STARTUP(WiFi.selectAntenna(ANT_EXTERNAL))

unsigned long old_time = millis();              // set Timeout to enter Listening Mode

int redPin = D3;       
int greenPin = D2;    
int bluePin = D1;

void setup() {

   RGB.mirrorTo(D3, D2, D1); 
   
   pinMode(redPin, OUTPUT);
   pinMode(greenPin, OUTPUT);
   pinMode(bluePin, OUTPUT);
   
   EEPROM.clear();

   WiFi.useDynamicIP();
   WiFi.clearCredentials();

   // So you can tell the operations have completed
   pinMode(D1, OUTPUT);
   digitalWrite(D1, HIGH);
}

void loop() {

   if(millis() - old_time >= 30000 && millis()) {
           if(!WiFi.ready()){
               WiFi.listen();
           }
     }    
   
}

@friedl_1977 have you tinkered with the SYSTEM_MODE macro? SYSTEM_MODE(SEMI_AUTOMATIC); will make it so the system doesn’t block infinitely until a connection starts.

Another alternative is you can also clear the credentials before sending to the customer. That way it’s always in listening mode on install.

Jared

Hi Jarred -

I have indeed. Initially, I wanted the following:

  1. Device looks for existing network.
  2. If no connection is found for x-min, enter listening mode.
  3. After x-min, exit listening mode and attempt to connect with existing credentials.

I was hoping to cover several scenarios:

  1. If Photon has credentials, but Wifi router is disconnected for any reason. The device will then alter between listening mode waiting for new credentials or attempt to reconnect to existing network in case router comes back inline.
  2. Photon has credentials but router i.e was replaced and network has new credentials OR new product shipped to a client. Device will then enter Listening mode after x-min of trying to connect to WiFi, waiting for new credentials. Eventually exiting again incase the Router comes back online.

The more I think about it, alternating between the two modes might also not be such a great idea. This lead me to wonder whether I can maybe use one of the exposed analog pins to put the device in listen mode by supplying 3.3V to it? I can ship the device with a “custom jumper” that can be used to connect the 3.3v pin on the JST connector to the Analog pin on the the JST? Similar to the way we used to reset PC CMOS by shifting the onboard jumper back in the day.

Not a bad way to handle it if you don’t think your customer will screw things up. Alternatively you could hijack the Mode button (or add your own) to force it into Wifi setup mode. However you do it sounds like you’re on the right track!

Well, I this case the products will be installed by a certified electrician, so maybe one way is to provide them with a “master key” that can put the device into listen mode.

Just realised, I will have to make it work in SEMI_AUTOMATIC mode or THREAD_ENABLED else if the product restarts while there is no WiFi connection (or when it is shipped and arrives as new destination for that matter) it will never get to the code telling it

IF A2 == 4095 then Particle-listen

Having said this, I would really like a blanket solution for all products, at least for connecting to networks. I really started liking BLYNK, but the pro version (which includes BLYNK INJECT :tm: is unfortunately quite expensive unless you are rolling out 1000’s I get cellular devices will make life easier, but they are sometime just not feasible, specially due to our weak currency against $

Let me see what I can come up with… C++ really not my strong suit :rofl:

Cheers!