Is it possible to use a iPhone via WiFi to control an Arduino sketch? I want to use a iPhone app to control a strip of LEDs. On, off and maybe a few led display examples.
Specifically, I have a WS2812b strip and an Arduino Uno. Is there a shield available?
Yeah, you can run a little web server on the Arduino and make the Arduino react when you interact with a web form in a browser on your phone.
It's a bit easier with something line an ESP8266, mind.
Does the ESP8266 work with most Arduino boards?
Depending on your needs and I/O requirements.. the ESP can -REPLACE- the Arduino all together.
You can use the ESP (to host the webpage/contents).. * I usually configure them to be captive portals and only serve up that one page, no matter url is requested (kinda like a hotel does until you enter password or pay)..
Once you 'submit' the form.. you can send serial data to the connected Arduino.. and then parse that incoming 'action' (packet).. and do whatever you need to do to the led strip.
- this requires you to know (or learn or steal/borrow) some HTML to build the web page and form.
I have my Arduino running my program that controls a LED strip but had wanted to use an app to control a few different LED graphics on the strip. So the app can control the way the LEDs behave. I can program the sketch based on those inputs and control whatever State Machine function I need.
Just need to figure out what else I need, but the ESP8266 is definitely needed. I’ll take a look again on google to see what else.
Are there any good links that come to mind?
I understand what you want to do.
The ESP and Arduino is all you need (and your led strip of course)
You still need a way for the ESP to communicate to the Arduino.. to pass on the 'action' you want the LED strip to perform.
The ESP-01's do NOT have many I/O pins available.. which would limit your 'options' and is not really an efficient (as it would eat pins on both devices)
If you set up the ESP to communicate with the Arduino via softserial.. then you only need a few (2) pins.
However.. you will need to update your code/sketch to interpret this incoming serial data.... parse it.. and execute the 'action' that was sent.
This is a 2-stage project.
1.) Setting up the ESP
- captive portal
- web page
- parsing form data, sending action OUT via serial connection
- parse any incoming serial data
- execute led strip functionality based on the serial 'action' just received.
You could test with your Arduino first.. but making your code react to any incoming serial command from the serial monitor...
Then you know you are ready to handle/parse serial data from any source (ESP, bluetooth..etc)
That’s awesome info. I basically understand what you mean.
I don’t understand what parsing is tho.... ?
Instead of using ESP8266 with Arduino UNO, you should go with NodeMCU V3. It combines the two and works with Arduino IDE, best for your application.
'parsing' is just interpreting the incoming serial data.
From the ESP hosted webpage/site..
- one of those buttons or links on the page has a special purpose, and send $_POST (or $_GET) data to the browser/server (we'll say this button is a 'blink' command/action)
you then take this $_POST data ('blink').. or you can even use numbers to make it easier. (but not as intuitive)
and you send this to the Arduino via softserial..
What does your Arduino know what to do once it receives this 'blink' serial data command? (nothing)..
so you need parse the incoming serial data.. and know what 'action' the Arduino needs to do with it.
I have done this many times for projects.. I look at it as a way to have a locally accessible 'control panel' of sorts.
The ESP broadcasts its own SSID (wifi network).. so you dont need real wifi/internet access to the 'interwebs'..
Any wifi enabled device can connect to it
Built in webpage/admin page to control your project (or set up variables/data..etc)