Autoconfiguration Of WiFi

I’m working on a project that I think might be able to take advantage of Spark Core, but I’d like confirmation from the experts. Essentially, what I want is a WiFi / TCP-IP enabled Arduino. My application precludes the use of the Cloud features. Here’s the idea:

I’m building an experimental avionics system based on an embedded Linux platform. The Linux server creates a WiFi network using a set prefix followed by the MAC address as the SSID. (Example: “OrionEFIS-xxxxxxxxxx”) I would like to build a number of Spark-based sensors that send data to the Linux system over WiFi. Here’s what I would like to happen:

  1. Spark boots up with WLAN on and cloud off
  2. If Spark finds a known network, it attempts to connect to that network
  3. If Spark does not have any network settings, or if none of the previously connected networks can be found:
    a. Spark scans for networks
    b. Spark attempts to connect to first network it finds with an SSID starting with “OrionEFIS-”
  4. Once connected to WiFi, the Spark connects with the Linux system via TCPClient
  5. Once connected via TCP, begin sending sensor data (received over UART or SPI) to the Linux system

The connection state would be presented to the user through color and cadence indications from a multi-color LED (can I control the built-in LED?). A button would allow the user to delete the store SSID and put the device back into seek / connect mode.

Questions:

  1. Can the Spark start up and run my code without a WiFi / Cloud connection? It looks like the answer is “yes, but…” I would need to create a separate routine that prevents the default behavior (connect to WLAN, connect to cloud)

  2. Can the WiFi component / stack on the Spark scan for available networks and pass that data to my application? This post makes it look possible.

  3. Can my code update the WiFi configuration for the Spark, adding a newly discovered network to the list? Can’t readily find an answer to this one. The Smart Config process and the CLI appear to be able to do this, but there isn’t any mention of use code altering the configuration.

  4. Can my code receive callbacks indicating connection, connection timeout, connection failure, etc? If not, can you poll for it in the loop() function? Didn’t see anything on this in the forums.

  5. Can my code read / delete known networks from the CC3000’s configuration?

Any answers, pointers or suggestions you might have would be greatly appreciated.

Cheers

Steve

2 Likes

This sort of WiFi functionality is absolutely essential for any complex projects we’re going to be developing on the Spark.

Please introduce it at one of your upcoming sprint planning sessions.

2 Likes

I’m just digging into the firmware found on github, and was considering some of these issues myself. From what I have seen (anyone correct me if I’m wrong) it should be possible to at the very least write in a default set of credentials / SSID to connect to, and have an automatic attempt to the linux server via TCP. After that you can assuredly send sensor data over.

I am not sure if you could do it from the cloud IDE though. It is definitely a departure from the current way spark seems to be used.

1 Like