Using the spark core connected directly to a computer (without router or cloud)

Hello,

I’d like to use my Spark for a show application. The gaol is to use the spark to send over wifi and easily, the values of the sensors that are connected to it. Right now, everythings works well. The spark core is connected to my wifi network and is able to send datas.

But, I’d like to know if it’s possible to run the programm without connecting to the Cloud in one hand (this should be ok using SYSTEM_MODE(SEMI_AUTOMATIC) ) and directly connect the spark to my computer using the “create a network” function of OSX. I didn’t find any documentation on this part.

It would be great to run the Spark Core without a router for some applications (OSC controller, for exemple).

Thanks.

Yes you can.
Have a look at TCPServer/TCPClient and UDP
http://docs.spark.io/firmware/#communication-tcpserver

ScruffR, i dont think thats what Bart is looking for. As far as i know, its not possible to use the USB port as its network. all it can do over USB is print data and receive new firmware/wifi configuration.

@bart, someone asked this a while back. Unfortunately, the CC3000 module does not support WiFi Direct which allows two devices to connect directly without a router. There are some members working on wired ethernet for the Core:

@bart, while the spark will operate without a connection to the cloud, it does require a local WiFi access point. That access point does not need to be connected to the internet, so you can just call Spark.disconnect() or if you want just use SYSTEM_MODE(MANUAL) then call WiFi.connect()

1 Like

Hello @ScruffR, @remcohn, @peekay123 and @mtnscott !

Thank you for all your answers !

Ok, understood; I can not connect the module directly on my computer, using a WiFi Direct connection.

So, at the beginning, I just called Spark.disconnect(). But this was only working if the router was connected to internet. If not, then, the spark was rebooting, and rebooting, and rebooting… looking for the cloud.

So, I called SYSTEM_MODE(MANUAL). No problem… except that I was loosing the UDP capability of the module. And I need to work in OSC with the module.

I founded a solution on the forum; using a ping on the gateway, I’m able to use the module with its UDP capability, in local, without any connection to the cloud and a router that is not connected to internet ! Cool !
(Using the thread fyi: http://community.spark.io/t/how-to-send-udp-broadcasts-in-manual-or-semi-automatic-mode/8144 )

Everything seems to work fine… but !

Sometimes, when I boot the spark this little red blinking led telling that there is no internet connection or no cloud connection. Why ? I don’t know. I’m calling System_Mode(MANUAL) during the boot sequence, so I should not have this red blinking led. Sometimes, the module needs to boot three or four times until the end, sometimes, just one.

Any idea ?

@bart,

I’ve been traversing some of the same ground as you: I’m capturing sensor data and want to send as OSC to a local iMac using UDP. Following your comments and those in attached threads, I’ve been able to get everything working in SYSTEM_MODE(SEMI_AUTOMATIC) with no need for a connection to Spark cloud. So far, so good.

But my problem is that I can only get things to work when using a router. Since I want to use this system in live performances, I need to be able to connect directly to a network created on the iMac or a Macbook pro using the OS’s “Create Network” capability. Thus far, I’ve had no luck getting things to work in this situation.

Have you encountered or perhaps solved this issue? I seem to remember some comments in Spark forums to the effect that the core firnware and/or comm device do not work in this configuration.

Any comment?

Oops… stupid oversight. The comments re the system’s non-support for this mode appear above in this thread.

So, my question is: is anyone aware of any new information on whether this capability has since become possible, or if there are plans to make it so in the future?

Hey Neurofrantic,

As said earlier, the C3300 module on the Spark doesn’t support the direct wifi connection. But, it seems that the wifi module on the Photon could support the direct wifi connection (I’ve read it somewhere in the forum, but I can’t find it anymore). If this is true, it will be possible to connect the photon directly to the computer.

By the way, if you need a strong wifi connection, you should use a router, specially if you are far from the computer on a stage, in your live performance. And you should use SYSTEM_MODE(MANUAL); I don’t know why, but it seems that the SYSTEM_MODE(SEMI_AUTOMATIC) takes more time to load (but maybe this is only a feeling).

Hi bart,

Yes, looks like we’ll need to wait. I checked the Photon specs and it uses the Broadcom BCM43362, whose WICED architecture supports WiFi direct (http://www.broadcom.com/products/wiced/wifi/faq.php). Assuming that 1) that is indeed the capability required to connect directly to a Mac; and 2) the Spark firmware also supports this feature, we can look forward to some improvements with the Photon.

I’m not strongly opposed to using a router in live settings. It is, however, an additional expense and an additional item to carry (a negative for artists who travel by air, where every cubic inch of space and ounce of weight are at a premium). Not to mention an additional item to be plugged into the wall (with attendant, often weighty wall-wart). Kind of ironic that this is required when one is using a battery-powered laptop and battery-powered Spark devices.

As for SYSTEM_MODE(MANUAL), I’ve found that the need to call Spark.process() within the processing loop() in this mode results in a serious degradation of performance for my code, which is sampling at 100Hz (10ms intervals). When the call to Spark.process() is added to the loop, the interval jumps to as long as 600ms. Maybe I’m misinterpreting the Spark docs for this case which say that the call to Spark.process() is necessary to keep the WiFi connection alive; but then it’s a cal to the Spark cloud API, not WiFi API, and we’re not supposed to be connected to the cloud in this mode. It’s seems a bit ambiguous to me. Any thoughts on this issue? (I’ll try manual mode w/o the call to Spark.process() and see what happens).

Hey Neurofrantic,

Sorry for the delay of my answer :slight_smile:

We have to wait the Photon I guess, yes. I already ordered one of these. We will see ! And yes, I understand your point of view for the router; I have the same problme with my performances :smile:

For System_Mode(Manual), I’m not sure to understand everything well, here. If you don’t want to get connected to the cloud (and I guess you don’t want to), you don’t need this function, as this function is only checking if everything is right by sending pings to the cloud.

In System_Mode(Manual) for your project, if I understand well, you only have to call “system_mode(manual” at the beginning (out of “void_setup()” and “void_loop()”) and then, all you have to do is calling for the Wifi fonction in the “void_setup()” loop with this function: “WiFi.connect();”

You can also ping for the router, if you need to. I found that the connexion is stronger when I ping on time the router at the beginning of the “void_setup()” right after “WiFi.connect();”

So, one setup could be (well, it works for me):

IPAddress router = IPAddress(192,168,0,1);

SYSTEM_MODE(MANUAL);

void setup()

{
    WiFi.connect();
    WiFi.ping(router);
}

the easiest way… softAP. Turn your laptop into a AcessPoint. It works… and is free.