Neopixel ring sequential timer

Hi :slight_smile:

I am new to arduino, and am attempting to use it to enhance my final university product design project.

I am attempting to create a timer in which two daisy-chained neopixel rings (24 and 16 pixels (40 in total)) light up, before the individual pixels turn off around the rings (from the outside in) until all leds are off. The leds turning off would be dictated by the time set - e.g. if it was 40 seconds then one led would turn off every second (the rate at which they turn off would depend on the time allocated - if that makes sense).

I have read and watched a heap of tutorials, but most refer to how to sequentially turn leds on rather than off.

I am using an arduino uno and have downloaded the neopixel library - I have set up the 'Simple' example within that library and that works fine, but I just don't know how to adjust that code so that it suits what I want (whatever changes I try to make are unsuccessful).

Any help or advice that could possibly point me in the right direction would be much appreciated.

You turn them off the same way you turn them on. Just turn them to black (RGB all =0) rather than a color,

Is the hardware ready and working with power supply and I/O?
Please post the best code, most look alike code You've got.

I believe so yeah

Welcome to the forum.

Post something that works at all, and describe what it doesn't do.

It may take a few more words to know what you have in mind, and basing discussion on code that operates, or code that you think should but doesn't, is the best way to get people's eyes and time onto this.

Also it will let us see what kind of code you are familiar with or want to use - there are as the proverb sez many ways to peel a carrot, prolly as many ways to do this as there are helpers here reading this thread.

Also, be patient… these are world wide fora and programmers are notorious for doing things at time when others are at the beach, or asleep or whatever.

I for example am about to consume mass quantities, so CU L8R, when there may be more here already.

a7

I bring to your attention the wokwi simulator - free, you don't need an account but it is simple and hassle free to make one:

Wokwi Arduino Simulator

Where I did play a bit with two rings and offer for you as a point of departure this simple sketch

// 
# include <Adafruit_NeoPixel.h>

# define TANKSIZE 23    // units and LEDs as well
# define NTANKS 3       // hardware. three tanks

# define LED_PIN    7
# define LED_COUNT 40

Adafruit_NeoPixel rings(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  Serial.begin(115200);
  Serial.println("rings of LEDs\n");

  rings.begin();
  rings.show();
}

int nextLED;

void loop() {
  rings.setPixelColor(nextLED, 0x0); // turn off the one that is on

  nextLED++; // move to next LED

  if (nextLED >= LED_COUNT) // maybe off the end!
    nextLED = 0;

  rings.setPixelColor(nextLED, 0xff0000); // turn on one LED

  rings.show();     // and set all the LEDs to the new values

  delay(133);        // hang out for a bit so we can see it
}

which you can see running here:

Ring Thing

I find it easiest to use one neopixel object, rings in my sketch, and use simple mathematics to direct which LED on which ring is being talked about.

You may find it easier to have two rings.

Rewiring in the wokwi is easy, dare I say almost intuitive, and using the wokwi is vastly easier than messing around with wires and boards and stuff.

Thhre only thing about the wokwi is that I have powered the rings from the Arduino board's 5 volt output. wokwi simulated boards seem to have infinite current ability, you are definitely advised to power your rings directly from a god source of 5 volts.

This is worth all the time you give it:

HTH

a7

Hi! Thank you this is very helpful :))

The only thing I'd like to change is so that all of the leds on both rings starton and then they turn off one at a time from the larger ring to the smaller until they're all off (rather than leds turning on and off one at a time).

How would I adjust the code to do that?

I understand that what I wrote is not at all what you are aiming for.

What you describe, and in addition to what we can glean from your first post

doesn't make sense enough to do any coding, which in any case is your work not ours.

You know how to turn on LEDs, how to turn them off. It is not clear where

  the time allocated

is set, or determined. Which I can guess is proportional to the rate at which a looping process might have to run. In a simple program, which this could well be, such rates are governed by delay() calls at points where a new set of LEDs should be shown.

So: Turn on all the LEDs. Turn them off one by one. Show the LEDs after each time you turn one off.

You have also not thought, or told us about, what happens then?

Over to you.

Write some code, post it here and describe any problems you are having getting it to function properly, or if it won't even get past the hurdle which is compiling and uploading, show the errors which are keeping that from happening. Which may be language issues or other totally solvable problems.

I offered the wokwi "skeleton" so you see a way to share not just your code, but an operating demo - with stuff like this, code speaks but demonstartions shout.

I often am surprised by my own concepts once they are running on real strips or rings. Back to the drwaing board, as they say.

It is also possible that some kind reader of this will just go ahead and dash off a program which might be just the thing, or close enough for you to fix. Or become involved enough to carry the project for you to your idea of finished. In that sense, I am unkind. :wink:

In less time than I took now, putting off getting to the next thing I have to do around here, about which I will only say it involves a certain cat and dog...

a7

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.