Recipe for creating products using the photon

Hi All,
We love the Photon and as a development house we want to start to build products with it, however we are finding id difficult to understand/choose how we implement it.
I would like to suggest that we put together some recipes so that developers can say - ah - yes that’s the recipe I should follow to do this style of product…

Here is my fictitious example - which awaits guidance on a recipe.

The Production Line Temperature Sensor
Let’s say we are developing a temperature control device for a manufacturing company, the device needs to be installed in a small foot print and a dirty environment, which means no touchscreen interface or LCD etc for input.

The device will report the temperature back to a RESTful web server, the device will also need to respond to requests from a Server to change it’s speed of update (say 10 seconds to 1 minute etc)

Assumptions:

  1. the Web API is already built for receiving data
  2. the customer understands nothing about the Photon - doesn’t even know it exists.

So how do we do this?

  1. We build our electronics with a temperature sensor and write our program to read the values
  2. What mechanism and how do we send the data back - WebHooks?
  3. We want to, from our web based front-end send a message to the Photon, what do we use to do this Cloud Code API?
  4. When the user gets their new box, and installs it, how do they connect it to the network, so that it can start working, (remember they are simple manufacturers!)
  5. If for some reason it drops off the network, (and we know this due to lack of reports via the web api), how does the user check/reset (i.e. there may have been a wifi password change).

I think this project forms the base of what most of us in the unglamorous non coffee-machine building world need to know, our users are manufacturers…

Really look forward to some good ideas/guides.

thanks

jon

2 Likes

@corey this one’s for you!!

@jsx001, here are some short answers until does a way better job than I can:

  1. You can have your server poll Spark.variables(), call Spark.function(), the Photon can Spark.publish() an event/data and your server subscribes to that event, have the Photon send data directly via TCP/UDP, create a TCPServer on your device and have your server call or data. As you can see, there are a HECK of a lot of ways with or without the use of the Cloud.

  2. You can call a Spark.function() or use Spark.subscribe()/Spark.publish() to have the Photon listen for the event or use a TCPServer for a non-Cloud connection.

  3. I will leave that one up to @corey but I can tell you that Particle has and is developing amazing “fleet” management tools to solve exactly this situation.

  4. @corey, this one is more for you.

The “problem” with the Photon is not limitations - it’s that there are so many amazing choices!!! :stuck_out_tongue:

2 Likes

We have been working on this exact application (not really specifically for production line, and not just temperature). I am now migrating from the spark core to the photon, and still have some pieces to implement, but here is our solution(s)

  1. We build our electronics with a temperature sensor and write our program to read the values
  2. What mechanism and how do we send the data back - WebHooks?
    Our answer: As peekay Spark.variable() is the the simplest from the embedded end. We are now looking into battery operation, so we may use webhooks so we can turn off the radio off in between transmissions. With Spark.variable() you need to stay connected all the time.
  3. We want to, from our web based front-end send a message to the Photon, what do we use to do this Cloud Code API?
    Answer: Yes, this is what we did, we needed historical data so our programmer made an application that runs on a web server to grab the Spark.variable() and put it in a database.
  4. When the user gets their new box, and installs it, how do they connect it to the network, so that it can start working, (remember they are simple manufacturers!)
    Answer: We “claim” all devices before they leave our building… This means as far as spark is concerned our company “owns” the device. This was important to us so we could manage firmware updates etc.
    for the user the start working with it we created an app to do the following
    a. The user must create an account with our web services. (this is done once then they can link unlimited devices to this account).
    b. They connect the photon to network. Mostly just a wrapper on the particle provided code, with a couple augmentations.
    c.During the connections process we grab the photon’s deviceID and link it to the user account in our web database.
    d.Now the user can view and send any functions that we allow them to. (again all handled through the app and web services)
  5. If for some reason it drops off the network, (and we know this due to lack of reports via the web api), how does the user check/reset (i.e. there may have been a wifi password change).
    Answer: Using our app. same as step b above. Except this time upon connection when we grab the deviceID we will tell the user you have already registered this device, and ask them “do you want to delete the old one and create a new one? OR just keep everything and update the Wi-Fi credentials?” Sometimes they are re-installing at a new location (i.e. delete data), sometimes someone changed the Wi-Fi network same site (i.e. keep data)

So far so good, I won’t pretend like the web service and the app wasn’t a lot of work, but it was a lot less work because the particle team has given us such a great place to start…

4 Likes

Hey @jsx001,

I’m glad this is something you’ve been thinking about in relation to Particle, because this is exactly what we’ve been working recently. Enabling our community members and customers to build a complete product with Particle’s platform is a recent development that we’ve near completed. More information to come (very soon) on that.

To answer your questions:

  1. @peekay123 is pretty spot on with his response, but like he said there are many more ways to do this.
  2. @peekay123 is, again, spot on with his response on that.
  3. Depends on what you mean by “web-based front end” --because that could mean a alot of things. But, from a simple nodejs server method, you could simply use socket.io plugins with our particle cli.
  • If you are referring to getting their Particle box, then my response is that we have just built a “getting started” guide for all of our IoT products that is set to release soon, after revision.
  • If you are referring to a device that is Powered by Particle, then this will also be discussed and explained in our new docs release, that is launching super soon! (I’m more than excited, :smile: :sunglasses: )
  1. I believe that our firmware team is currently working on a way of fixing this so that this isn’t a concern for our developer community/customers.

Let me know if you need more clarification!
-Corey :sunglasses:

Also, thanks @peekay123 for pinging me in on this!

4 Likes

I don’t think I’ve ever :heart:ed every post in a thread before, but this one got it. I’ve been tossing the idea of developing products (not quite like this) with Particle devices for a while now. Mine is more of a hobbyist/novelty audience, but the same questions regarding support for this still apply. Support for a wifi device in a remote location isn’t easy with all the millions of variables at play.

How would you reset the wifi credentials on a device enclosed in a project box, especially in an unforgiving environment like OP postulated? What’s the feasibility of doing it to dozens or hundreds of devices in a manufacturing factory setting?