I currently use a Node MCU ESP-32 ESP32 Board WROOM-32 WiFi Bluetooth Arduino IDE Compatible board and connect to the Glowbit 8x1 led sticks from Core. This then daisy chains to multiple glowbit sticks. I have an Arduino sketch programmed to run and replicate on each glowbit stick. I dont currently use the WIFi or Bluetooth yet but it is in the list to learn.
I have 2 questions related to this :
Is this ESP32 board overkill for what im using it for? Is there an alternative option, smaller that is still capable ie: the Beetle range of boards?
Can i have 2 different Arduino Sketchâs loaded onto the single board to enable more than one colour output option?
Please take this as just my view on things, as normally there is way more involved.
âIs the ESP32 Overkillâ - need to define overkill.
In short most people will tend to pick a controller based on one of the following
This is what I know (and have) - No issue for a hobby and one skill set can make things easier to learn and build on.
This is what the wiki/guide said to use - A good way to get up and running fast, but in the long term may leave you needing to learn more specific skills just to use, debug and expand.
What do I need/want at the end of the project: i.e. what are the project requirements; size, cost, available prebuilt things v dev 100% yourself; will all the parts be available in 1,2 10 years if I go to market.
So; short answer⌠this is hard to answer.
e.g. I have nearly always written my own code. often this can be based on someone elseâs code and working with datasheets, but I have the sources code for what I want and do it at the chip level. i.e. I very really use frameworks and prebuilt library and apps. This is not for everyone and is much slower from start to finsih of a project; but once done, you have a better understanding of how things work and you get exactly what you want⌠but, and I must stress will have lots of road blocks as you learn whats needed to make thigs work v just using what someone else has already got working.
This feeds into your 2nd question
"Can I have 2 different⌠" My answer would be sure⌠but no idea if your setup would support that.
i.e. You may need to customise some code to allow dual threads and 2 instance (if in fact thatâs the best design)
An ESP32 is a nice chip but it normally runs RTOS. As such its harder to get very accurate timers); I had all sorts of fun with my WS2812b led as they have strict timing on clocking out the data. But then I moved my buffer to a memory location and had the chip DMA the data and clock it out in the background (at the chip level) with very good timing. This then leaves more time in the 2 main cores for processing things like WiFi. the ADC on the ESP32 is not the best, but you can just use an external ADC if you need higher precision.
One thing I did like with the ESP32 is you can partition it. The do over the air updates; but you need to make sure your partitions are big enough, as lots of the chips âstorageâ is âlostâ to provide this feature.
i.e. there is the âfactory imageâ as flashed using the usb normal programming mode.
then there are 2 other image locations for the over the air updates. It will use 1, then if update is ok, switch over to that leaving the first one free for the next update⌠so 3 times the storage needed.
I will stop there as Im starting to waffle and more specific questions would be better to give specific answers.
Bottom line, my 2 cents worth, It depends. On what âyourâ key objectives are, and there is nothing wrong with rapid dev with pre built things; it it works for your projects.
The ESP32 you have is definitely capable of running your project as youâve no doubt discovered, if youâre looking for a smaller form factor controller you might be interested in the RP2040-Zero.
In terms of running 2 different sketches on the same module, as Michael99645 mentioned above it can be done, but there is a degree of complexity. If youâre looking to run two loops you could look into timers as a method of running the loops simultaneously without interrupting each other.
Let us know if you require any further questions or need help with your project
Michael thanks for the reply. To answer your first question would be Number 2! When i started i found out what would work quick and easyâŚbut as you said im now needing to be more specific to achieve the goal i am chasing.
So here is my use case:
I have a project already where i make star ceiling panels. Example use is home theaters to create a night sky in a dark room. A room can have 4+ panels all daisy chained, but powered from the initial controller (ESP-32 currently). I have a sketch which gives the effect i want, which is not a problem. The current effect is select colours i have chosen.
What i am trying to make work now, is to have more than 1 selection of colours, example i may want it to be plain white. Or, i may want to have the option of multiple colour choices. To do this i need to have the right controller in the smallest package, then have the ability to activate 1 selection at a time.
I hope this gives more specific information, what would you recommend?
Hi Michael, i had a look at the RP2040-Zero. It does not mention, that i saw, compatible flashing with Arduino. Is this possible? Size wise and cost it looks like a great alternative otherwise. Is there any other aspect of this that you can see would be a roadblock? Cheers.
There would usually be no need to run two separate sketches just because you want two different patterns. You could create just one sketch that selects the pattern to use from a table of different patterns, and if you code it carefully the number of different patterns would be limited only by available memory.
For this task you could go with a much simpler chip. In the ESP range this is about as simple as it gets:
Despite the small size it is quite capable of running a light show, with the pattern selected using an app on the mobile phone. Note that there is a small investment in a programmer to get started, but if you are making more than a few panels then the separate programmer turns out to cost much less than paying for programming facilities on each module.
From your description it seems you need only a few GPIO pins and, for future expansion, WiFi or Bluetooth capability. That requirement would cover almost everything except the original Arduino modules. I was pointing out one of the smallest and simplest ESP modules, which is fully compatible with what you currently have. But in fact there are many more options, including the RP2040 models, or any of the Pi range. If you are currently using a ESP I would recommend sticking with something from that family, as that would minimize the effort involved in migrating. But it all depends on the detail of what you are trying to do and the resources you have available.
The forum is available to you for anyone to answer whatever questions you have about your project. Just post the bit of code that is giving you trouble with a good description of what it is supposed to do and what it is doing wrong, and Iâm sure someone will jump in and offer advice.
A suggestion for (2). You create some sort of UI (e.g. some buttons) and later develop a WWW page you connect to over WiFi.
Button 1 chooses colour 1
Button 2 chooses colour 2
Button 3 chooses a different effect, e.g. random colours
Button 4 chooses another effect, e.g. moving lights
in your code this uses a âcaseâ statement that calls (as separate functions) the code that would have been in the âmainâ part of your different Sketches.
Dave
void loop() {
int q;
for (q = 0; q < 7; q++) {
if (millis() > myNeoTimers[q]) {
if(myNeoSettings[q][0] < 0){//light is out so ready to start a new cycle
//first select a colour for this neopixel
//this gives a white/yellow/blue effect
//add extra case statements and increase random max to add more fixed colours
switch(random(4)){
case 1://Yellow
myNeoSettings[q][myRed] = 100;
myNeoSettings[q][myGreen] = 100;
myNeoSettings[q][myBlue] = 0;
break;
case 2://Light Blue
myNeoSettings[q][myRed] = 0;
myNeoSettings[q][myGreen] = 100;
myNeoSettings[q][myBlue] = 100;
break;
case 3://Pink
myNeoSettings[q][myRed] = 100;
myNeoSettings[q][myGreen] = 50;
myNeoSettings[q][myBlue] = 100;
break;
default://Bright white
myNeoSettings[q][myRed] = 255;
myNeoSettings[q][myGreen] = 255;
myNeoSettings[q][myBlue] = 255;
break;
}
//This will select random colours
/*
myNeoSettings[q][myRed] = random(256);
myNeoSettings[q][myGreen] = random(256);
myNeoSettings[q][myBlue] = random(256);
*/
myNeoSettings[q][lightDir] = 1;//as light is out we want it to increase in brightness
myNeoSettings[q][lightState] = 1;//give the light a brightness value
}
if(myNeoSettings[q][0] == 256){//light maxxed so needs to start to turn off
myNeoSettings[q][lightDir] = 0; //tell system this pixel will be getting dimmer
myNeoSettings[q][lightState] = 255;//give the light a brightness value
}
//this section deals with setting the led brightness value and resetting the millis timer
//get the correct values for the RGB and set the neopixel to is.
pixels.setPixelColor(q, colourState(myNeoSettings[q][myRed],myNeoSettings[q][lightState]), colourState(myNeoSettings[q][myGreen],myNeoSettings[q][lightState]), colourState(myNeoSettings[q][myBlue],myNeoSettings[q][lightState]));
pixels.show();
//increase or decrease the lightState depending if getting brighte or dimmer.
if(myNeoSettings[q][lightDir] > 0){//getting brighter
myNeoSettings[q][lightState]++;
}else{//dimming
myNeoSettings[q][lightState]--;
}
if (myNeoSettings[q][lightState] < 0 || myNeoSettings[q][lightState] > 255) {
//at max state so longer value
// myNeoTimers[q] = millis() + random(200, 4000);//0.2 - 4 seconds
myNeoTimers[q] = millis() + random(50, 100);//0.1 - 1 seconds
} else { //increasing or decreasing in value so short value
if (random(250) < 2) { //lower this number to speed up flicker
if (myNeoSettings[q][lightDir] > 0) {
myNeoSettings[q][lightDir] = 0;
} else {
myNeoSettings[q][lightDir] = 1;
}
}
myNeoTimers[q] = millis() + random(40);//0 - 20 milliseconds
}
}
}
}
This is for a set colour appearance, but as mentioned i would like to have more than 1 and make the options selectable either by remote or by using the wifi and an app as such. This is where i need help.
If youâre still using the ESP32 from the start of the thread and are looking for something like that I have the perfect thing for you. WLED!
It will give you a browser based UI, as well as an app that you can use, it will give you control as to whether the LEDs are on or off, as well as allowing you to select solid colours, as well as giving you a variety of prebuilt patterns.
It will also give you scope for audio syncing later on as well as IR remote control.
And possibly the best part, if you decide you want a second device they can sync across your local network and be controlled from one interface.
We have a really detailed write up on how to install it (its refreshingly easy) available here WLED Guide
Wifi will be easier, but do you have a local network to connect to?
You can start by following this example and simply handling an âOn/Offâ application. Once you have that running you can have a go at integrating that code into your existing sketch. The step after that would be to change on and off to colour 1 and colour 2 (which is actually the easy bit). Then you can add as many buttons and colours as you want. ESP8266 Arduino WiFi Web Server LED on off control | Circuits4you.com
Note that there are many similar examples which you can look at, but they will all do things slightly differently so be careful about trying to reconcile them. But if you find one that seems to explain things better then by all means try it out. There are also plenty of UTube videos but I donât recommend trying to build a project using a video - much better to have a step-by-step guide in front of you.
Thanks for the feedback. Yes i already use WLED around the house and have looked into this before. The issue i have is being able to utilise the arduino sketch i currently use for the required effect.