Own IPhone App to Control Spark

Hi all,

I have a little project were I want to control a LED RGB strip via an IPhone app.
BDub helped me already a lot in getting the driver for my strip controller implemented in the neopixel library. See here: post

The coding works fantastic, but now I am struggling with the further architecture. So I wanted to get some ideas from you on how to do it best.

My idea is basically just a simple app on the iPhone like a color wheel to control the strip or strips.

Now I was thinking of using the spark cloud, but I think a perm anathema internet connection for a simple RGB light is over the top.

Then I was looking into the web server library with a simple web app, but the response times are horrible, also it seems to be very unstable.

The next idea was to use the touch osc but the core implementation of the library seems to be still in a very early stage and quite complex to use.

What are your ides on a simple and easy to implement solution? Best with a feedback to the IPhone on the current color settings.

Honestly, you may want to look into a different technology. Bluetooth LE may be better suited for what you describe, which is just the iPhone directly talking to an LED strip. Something like the RFDuino would do nicely, it is Arduino compatible, so if you got this code working on the Core or any Arduino, it will work on the RFDuino. They have great examples and samples to start from. It would allow you to establish a simple connection without having to worry about too much overhead.

Of course, if you want to control it remotely at all, this wouldn’t work, so it all depends on your requirements.

First of all, have you done development on the iPhone before. I have been looking at this for a client and to be able to deploy and test on your own phone you need to sign up the $99 developers program. It can take days to be activated. (no wonder I prefer to work with Android) :smile:

If you already have this you are on your way.

eely22 is right in some ways but the Spark Core offers you a few things over and above a Bluetooth based system. You can control from another room (assuming you have WiFi from there) and you can control and check the status from the internet.

I have a Spark Core on my network that I can control remotely. I setup the router so that the IP is always the same. This is not needed for internal use as I can use UDP to find it but for outside remote access, it needs a fixed IP unless of course you use the standard Spark Cloud to do this from functions and variables. I wanted more control so I have is listening on a port for TCP/IP connections. :smile:

Dear all,

thanks for your answers. Actually I don’t wanted to use Bluethooth, because I want to keep the possibility to later integrate it in a WLAN based home automatization and particularly because of the short distance. Also, not all IPhones & IPads are supporting Bluetooth LE…

Isn’t there any proper and more simple alternative to Touch OSC existing. The concept of a framework APP with customizable controls would be a nice solution.

Or any better option for a web-app running directly on the spark. Is there a better and more responsive option than the webserver include?

What is the best option to make the spark “listen” on commands sent via the local network?

With best regards
Michael

Hi Michael,

For Spare Core’s on my local network I use UDP to send a broadcast that the Spark Core listens for. When a core receives the message, it send back a reply and I get back an IP address of the core that I can now communicate through. If the core is reset and the IP changes, my software detects a timeout on the existing IP and then sends a UDP broadcast to find it again. This method has been working fine and I can send and receive data to the cores over TCP/IP even though they get a dynamic IP within my network.

If you have no coding skills to programme an app for the iPhone then a webserver is the ideal way but it would mean that you need to make sure the core’s IP is always the same and you can do this through your router setup.

An APP on the phone would give you a better interface but it all depends on what features you need. The APP can also be setup to periodically talk to the core or listen for messages and then alarm etc.

I’ve found this and it works very well, but unless jailbreaking an iphone I’m finding the same issue of being able to run an app for just my own personal use. Kinda sucks that you have to pay $99 for a developer license and all you are using is someone elses coding for your own personal use.

Check this out it works very well in the xcode simulator.

Hi RBDDigital,

thanks for this hint, that looks promising, but I agree that needing a Dev license is a drawback. Beside that I still can’t get used to the promoted concept to use the spark cloud api. For me it just sounds so massive ridiculous to control your LED strip with the need to send data once around the world…

You can always take up the challenge to create your own TCP or UDP server, manage those API calls etc in order to interact with the core.

The :cloud: is designed to do all the heavylifting. Doing this all by yourself might be tedious just to blink an led. All you do now is take out of the box, connect Wifi and control wirelessly. :wink:

Something so simple as toggling an led was never so easy till the spark :cloud: concept appeared. :slight_smile: