Using Spark Core in a standalone product changing wifi credentials?

Hi,
If I decided to build a product that contained a spark how would I go about making it so the wifi credentials were editable by the user without using the spark core setup app?

eg. product is shipped to customer with the firmware pre-loaded. They need to enter their own wifi details so they can use it.

Would it have to be some bespoke application that can interact with the CC3000 chip directly?

I’m just not sure how feasible the spark core is to use in a standalone application other than for personal use. As the core is claimed on the cloud by the developer to install the firmware initially.

If someone could point me in the direction of any documentation on this I’d appreciate it.

Thanks

2 Likes

Wifi credentials are easily set by USB serial connection. So you can write a setup progrma yourself or use any serial client(like Termite, putty, etc…)
See Connect with USB section in http://docs.spark.io/#/connect

@ryotsuke I’m planning the same and this also is making me headaches. Please keep me posted on how you will go about solving this.

1 Like

About solving what? Using any serial terminal app via USB is already a solution for setting wifi credentials.

@ryotsuke For example: it would be extremely user-hostile if someone were to make a “clock” that used a spark, where it asked the consumer to connect it to a PC or Mac via a USB cable, and use some special wifi-setting software. This is a problem that needs to be solved, before it can be seriously used in commercial/consumer devices.

There is no really some other way. For example HP WiFi printers do the same. First connection is via USB to run WiFi setup utility. How do you expect Spark to connect to anything if no USB and no open WIFI network available?

I think the spark guys have released the android app code so I will have a look at the wifi setup code in that as a potential starting point.

Yeah ofc. But if you consider a regular customer. Do you think he will set his WiFi credentials via Putty? Maybe I misunderstood you - I thought you would like to use it in a final product that can be used by everyone. My bad.

1 Like

I would still recommend writing USB setup software too. If wifi credentials in core become wrong due password change - it will loose connection and you wont be able to reconfigure with mobile app.

No, not with putty :slight_smile: One can easily write a very simple app that would use serial port to config wifi and show core id. I suppose if you are doing stand-alone product you will want app anyway with your branding, logo, etc…

Now I see :wink: Yeah exactly.

It doesn’t need to be by putty… Any programming language can handle serial communication… It’s a pain in the butt if you want to make it fool proof… But it is possible… I agree though… It should be one of the possible ways of configuring it. android or iPhone seems like a sensible approach… The open sourcing of the Android app is a step in the right direction but a set of published APIs would be the better solution for the long term. I’m sure its on the road map.

It does make sense for embedded projects that you dont require the consumer to make a serial/usb or SSH connection to configure the device before use. You would want the consumer to unbox, plug and play with minimal configuration issues. Having a smartphone app to go along with your product similar to the Spark config app is an option. Unless I’m mistaken, I believe Spark leverages the Ti CC3000 ‘Smart Config’ technology which you can Google to learn more about and may be able to use in your app.

I would also think you could write a Windows or Mac based configuration utility and bundle a disk and USB cord with setup instructions (pretty common with other end user internet enabled products). This could also install your device firmware which would be updated as soon as the Core is connected for the first time.

But, if you’re not into writing custom Android/iOS/PC apps and want to leverage the Spark Cloud for sending commands to your consumable device it would be nice to see an unbranded app that does the same at the Spark config app without the Tinker part. Perhaps it just connected the device to your wifi (like it does now) and then displays the status with deviceID/Auth code. You can build a web based application that users would then log into and enter the id/auth codes. Using Spark Core API’s you would then push your latest firmware and handle other Cloud to Core commuunication.

Spark has done a great job with the integrated wifi on the Core and is diligently perfecting it even more. As the community learns how to leverage this new device I’m sure we will see so really cool stuff and new ways to integrate it for consumer based projects. When I finish mine, I’ll let you know!

2 Likes

Hey All,

There are a number of ways to implement this and make this available when using it in a commercial product. The “Smart Config” library provided by TI is available as a Java applet, as well as Android / iOS libraries and can be sourced from them directly. It allows sending wifi credentials from a custom app under the same constraints as setting up a core. You can also configure Wifi profiles on the CC3000 from your firmware, so you can also add any kind of custom process you could want. In our case we also added an interactive setup process via Serial, but there are lots of ways to accomplish that.

In addition I’ve been toying with the idea of encouraging a firewalled ‘sensor-only’ kind of second AP people could have that the Spark would just search for and connect to automatically. You could also just have custom firmware that searched for any access point that ended in a special string, or were unprotected, etc, etc.

There is a TI Smart Config app that I use for testing as well, if you want an unbranded app. :slight_smile:

Thanks,
David

The wifi HP printer that I have has an LCD display and keypad. There is absolutely no need for any user-hostile USB cable and software (and, yes, just because HP does does it, does not make it right). Eventually, I’d hope that the spark ecosystem would mature to the point where the spark could be used in a product with a display and keypad. Right now, it’s too immature for anything much more than a hobbyist toy or special consulting projects.

Don’t get me wrong – I like the spark. I’m just saying that the current functionality/API is rather sparse and needs to be enhanced/extended – which it is. Looking at the forums, I see progress on a number of areas. However, saying, that we don’t need an API for setting wifi credentials via a spark app, is counterproductive.

Hi @Raldus,

As it stands, all the code needed to setup Wifi credentials is already in there and ready to go: https://github.com/spark/core-firmware/blob/master/src/wifi_credentials_reader.cpp and here: https://github.com/spark/core-firmware/blob/master/src/spark_wlan.cpp#L97

Thanks,
David

That’s a good start, but it’s not enough. Eventually (someday, not necessarily now), the spark needs an api like:

spark.set_wifi_credentails(ssid, password)

(Well, maybe something a bit more complex, as you’d have to be able to specify WPA2 PSK or WPA2 enterprise, etc., etc.l.)

You shouldn’t care about where the ssid or password originated. Maybe the user entered it via a keypad/display attached to the spark. Maybe it came from an external voice recognition module. The point is that you must (eventually) allow developers to create user-friendly devices with the spark, or it’ll be forever relegated to hobbyist/special consultant use.

1 Like

Didn’t give me a chance to edit :slight_smile: I added another link above. I’d rather be building a product with this awesome community than out on my own. Don’t forget the core is only a few months old, lots of improvements already in progress.

But yes I agree, I think a simplified Wifi profile function like that would be very helpful.

Thanks,
David

thanks for all the info, I will do some more reading based on the suggestions made.

In the spark_wlan.cpp link @Dave posted, you can see we call wlan_add_profile. In case you’re thinking, “where the heck does that function come from?” here’s the scoop.

This is part of TI’s SimpleLink API for the CC3000. If you want full control over the Wi-Fi module, it’s all there, fully accessible to you, always has been:
http://software-dl.ti.com/ecs/simplelink/cc3000/public/doxygen_API/v1.11.1/html/index.html

Expand the “Modules” item on the left and then expand “Wlan_api”. Just another way in which we don’t sandbox or inhibit your abilities in any way here at :spark:!

2 Likes