I have 8 days before I need to go back to work and I want to spend it establishing some baseline tools for my adventures next year. The first is to find an app that can control at ESP-32 project on IOS. It should be configurable and look presentable. I will document the ESP32 Arduino code to make it run.
Thinking back to past projects, they often were unfinished due to incomplete software. Software of they type I wanted was available so it seemed trivial to complete and I moved on. The truth is it was not straight forward for me to do it. I want to create some plug in tools that when I get to the part of the project I can sprint across the finish line with a nice video instead of saying the rest is just software.
Again the functionality I want is as follows:
1) Bluetooth control of an ESP32. The Bluefruit app has directional arrows. I will start with learning how to use that.
2) Display sensor readings on the phone.
3) Display the reading with a graphical output.
Ok, starting with the the most basic example, I will take a generic ESP32 dev board straddling 2 bread boards so the pins are accessible and set up a program that cycles through 4 lights. Actually lets use the WS2812B to represent the 4 locations for interest sake.
So the information I have to assemble to get to this place are as follows:
1) Library or code for the WS2812B
2) Make a subroutine that switches the LED based on a case switch input.
3) Make a For loop that cycles through it for confirmaion.
4) Understand and implement the code to read the arrow status of the Bluefruit app.
So starting with the WS2812B I chose to use the FastLED library. I looked at bit banging it to
understand it better but the timing looked non-trivial.
The documentation directs you to identify the following:
1) Type of LED - WS2812B (Neopixel)
2) Number of LEDS - Ring of 12
3) Pin to attach on the ESP32 - Use Pin 19. Confirmed I can use it freely by flashing an LED.
A few hours later...
The FastLED library is awesome. Within 15 minutes I had the LEDs running around the ring.
The coolest part is the color names are the HTML colors with can be found here.
DeepPink was my favorite. It was not hard, but the time was spent because it was so much fun!
Now on to making the arrows light up the LEDs.
Now again, I realize this is so 2015 but it is a tool I want in my box and I am probably not alone so lets complete this.
So I tried the NRF code from Adafruit and although it compiles without error, it does nothing and the ESP does not show up on the app.
And some times you get lucky! I dropped the code found in the comments and I can see the button presses from my phone in my serial monitor! Now I just have to connect them to the LEDRing and part 1 will be done.
Wow, thanks to Wim, that was dead easy.
The code will be attached as part of the project.
Next is working on displaying sensor readings on the tablet.
Previously I would have used Thunkables and made my own app. However, being a reluctant iphone user, I do not think the development landscape is a maker friendly. So lets see what can be done with a off the shelf app. Why spend weeks learning a new platform if a $10 app can achieve the same thing.
App Requirements
- No ongoing subscriptions needed.
- No need to be connected to wifi.
- Support BLE or Bluetooth.
Step 1 Control LED's on the ESP through the app.
Step 2 Receive a 600 item list and plot it on the phone.