Neopixel ring to match potentiometer sweep

I've just got into using arduno and teensy boards and built a simple midi controller with a teensy, after originally trying an arduino and finding a teensy was better suited.

So now I have a couple of nanos lying around, I set about trying to find a use for them.

I saw a video of someone using a neopixel ring to display potentiometer position, like many modern dj style midi controllers, so of course, I wanted some of that action for my midi controller so I am considering reworking my teensy midi controller to include an a nano beside it, to control a neopixel ring around each potentiometer.

I know very little about coding, so this is a learning process at every step, so does anyone have experience coding something like this? At my current level of understanding, I'd think it was impossible if I hadn't seen other people making them already :slight_smile:

How come the teensy was suitable but the Nano was not? Was it the native USB interface?

For a beginner, its generally not a good idea to use multiple microcontrollers in the same circuit. Getting them to coordinate with each other makes those projects significantly more advanced. So I would recommend keeping the Nano for a future project, or just for trying stuff out and learning.

If you want to attach NeoPixel rings directly to your teensy, that should work, except that if the teensy is 3.3V, you might have problems controlling the ring. The Nano, being 5V, would not have that problem, but connecting the 5V nano to a 3.3V teensy would then be a problem. If you do find that the teensy can't reliably control the ring, just use a 74hc14 chip as a level shifter.

PaulRB:
How come the teensy was suitable but the Nano was not? Was it the native USB interface?

For a beginner, its generally not a good idea to use multiple microcontrollers in the same circuit. Getting them to coordinate with each other makes those projects significantly more advanced. So I would recommend keeping the Nano for a future project, or just for trying stuff out and learning.

If you want to attach NeoPixel rings directly to your teensy, that should work, except that if the teensy is 3.3V, you might have problems controlling the ring. The Nano, being 5V, would not have that problem, but connecting the 5V nano to a 3.3V teensy would then be a problem. If you do find that the teensy can't reliably control the ring, just use a 74hc14 chip as a level shifter.

It may have been my extreme inexperience, but I just couldn't get it to connect to the computer and work reliably as a midi device, when i got the teensy it pretty much worked first time and needed less software thanks to the native midi.

My plan is to have both microcontrollers work independently. Arduino for lights, Teensy for midi interfacing, using potentiometers with 2 sets of connections. I think that will be the easiest way to achieve what I am going for. The neopixels will pull too much current for either microcontroller anyway so I'll be adding a dedicated powersupply for the lighting circuit.

Just wanna get the neopixels doing what i need first though, before I get any further in the plan.

kelaifu:
My plan is to have both microcontrollers work independently. Arduino for lights, Teensy for midi interfacing, using potentiometers with 2 sets of connections. I think that will be the easiest way to achieve what I am going for.

You didn't answer the question. Why not use the Teensy to control the NeoPixels? Cross-connecting potentiometers is probably asking for trouble. :roll_eyes:

kelaifu:
The neopixels will pull too much current for either microcontroller anyway so I'll be adding a dedicated power supply for the lighting circuit.

Neither a Teensy or a Nano in any way whatsoever resembles a "power supply", so "pulling current" is just complete nonsense! :astonished:

The NeoPixels only require a connection to the data pin via a 470 Ohm resistor - no significant power involved there and in fact, you would use a 74HCT14 or 74HC04 level shifting buffer to drive them from a Teensy output. If you have an adequate 5 V regulated power supply to power the NeoPixels, you would use that to power the Teensy as well via its regulator. Using separate power supplies is not advisable in any configuration.

Paul__B:
You didn't answer the question. Why not use the Teensy to control the NeoPixels? Cross-connecting potentiometers is probably asking for trouble. :roll_eyes:
Neither a Teensy or a Nano in any way whatsoever resembles a "power supply", so "pulling current" is just complete nonsense! :astonished:

The NeoPixels only require a connection to the data pin via a 470 Ohm resistor - no significant power involved there and in fact, you would use a 74HCT14 or 74HC04 level shifting buffer to drive them from a Teensy output. If you have an adequate 5 V regulated power supply to power the NeoPixels, you would use that to power the Teensy as well via its regulator. Using separate power supplies is not advisable in any configuration.

Searching for neopixel projects pulled up many examples using external power for the neopixels, similar to the one below:

Maybe I am misunderstanding things, but as i said, I am totally new to this and infact I bought the neopixels by mistake looking for a standard rgb led ring....

as for using the teensy, If its a better option, then of course I will try it but again, searching via google brings up problems due to the voltage differences and numerous references to an Arduino being a better option.


It is sadly common for people to be misled into "powering" an Arduino by the "barrel jack" or "Vin" - in fact the antique "tutorials" on this website actually appear to encourage this. :roll_eyes:

The on-board regulator on the "classic" boards - UNO, Nano, Pro Mini, Leonardo, Pro Micro, Mega 2560 - is barely able to supply power to the microcontroller itself and a few LEDs powered with up to 20 mA each either by the "5V" pin or output pins; it does depend on what voltage you are supplying. If that is how you are powering it, then it most certainly is folly to attempt to power LED strips of any form from the "5V" pin.

A USB source will generally be able to supply at least 500 mA - noting that the UNO has a "polyswitch" rated at 500 mA so drawing more current will eventually cause it to shut down. For testing/ experimental purposes you can power a few RGB LEDs from the "5V" pin.

It is however wrong to consider the "5V" pin a power output. If you have a (regulated) 5 V supply to power things, then this pin is the preferred power input to the Arduino. There is a slight concern that if a UNO (or Mega) is connected to the USB port of a laptop, it may "back-feed" 5 V into the USB port and damage it. I do point out however, that the vast majority of "powered" USB hubs would do exactly that and there seems to be negligible criticism of them. :astonished:

The diode in a Nano prevents this from happening.

kelaifu:
I bought the neopixels by mistake looking for a standard RGB led ring....

But a "standard RGB led ring" would not allow for animation. :grinning:

kelaifu:
as for using the teensy, If its a better option, then of course I will try it but again, searching via google brings up problems due to the voltage differences and numerous references to an Arduino being a better option.

Immediately fixed by using two cascaded gates of a cheap 74HCT14 or 74HC04 as a level shifting buffer.

There may be troubles using an ESP8266 as its WiFi functionality may interrupt the data burst required by the NeoPixels, but this will not be the case with a Teensy, so there should be no trouble implementing these bursts to update the NeoPixels interspersed any time your device is not sending serial data. In fact, sending serial MIDI data should not be too time-critical, receiving might be more of a problem. And you will not be updating very many LEDs in any case so the bursts will not be very long.

Paul__B:
It is sadly common for people to be misled into "powering" an Arduino by the "barrel jack" or "Vin" - in fact the antique "tutorials" on this website actually appear to encourage this. :roll_eyes:

The on-board regulator on the "classic" boards - UNO, Nano, Pro Mini, Leonardo, Pro Micro, Mega 2560 - is barely able to supply power to the microcontroller itself and a few LEDs powered with up to 20 mA each either by the "5V" pin or output pins; it does depend on what voltage you are supplying. If that is how you are powering it, then it most certainly is folly to attempt to power LED strips of any form from the "5V" pin.

A USB source will generally be able to supply at least 500 mA - noting that the UNO has a "polyswitch" rated at 500 mA so drawing more current will eventually cause it to shut down. For testing/ experimental purposes you can power a few RGB LEDs from the "5V" pin.

It is however wrong to consider the "5V" pin a power output. If you have a (regulated) 5 V supply to power things, then this pin is the preferred power input to the Arduino. There is a slight concern that if a UNO (or Mega) is connected to the USB port of a laptop, it may "back-feed" 5 V into the USB port and damage it. I do point out however, that the vast majority of "powered" USB hubs would do exactly that and there seems to be negligible criticism of them. :astonished:

The diode in a Nano prevents this from happening.
But a "standard RGB led ring" would not allow for animation. :grinning:
Immediately fixed by using two cascaded gates of a cheap 74HCT14 or 74HC04 as a level shifting buffer.

There may be troubles using an ESP8266 as its WiFi functionality may interrupt the data burst required by the NeoPixels, but this will not be the case with a Teensy, so there should be no trouble implementing these bursts to update the NeoPixels interspersed any time your device is not sending serial data. In fact, sending serial MIDI data should not be too time-critical, receiving might be more of a problem. And you will not be updating very many LEDs in any case so the bursts will not be very long.

good info, thanks for explaining it, it'll definitely help going forward.

I've ordered a few chips and a dedicated little pcb that do level shifting, so they should arrive in a few days, so i can pursue the teensy route, but, teensy or arduino, I still dont know how to write the code to do what I need!

since starting the thread here I have found 3 projects that feature the same effect, all are either asking for advice on fixing problems in their code, or just undocumented videos.

Looks like this poster has resolved his problem:

Although I have no idea how to get the snippets of code posted there into code I can send to my microcontroller. So Far I have only been sending examples and other peoples code to my nano and making experimental changes.

Although I have no idea how to get the snippets of code posted there into code I can send to my microcontroller.

Most people use copy and paste.

You have to understand what that "snippet" does and incorporate the technique into your own code.
If you are having difficulty doing this then your coding skills are not enough to do this project yet.
You have the choice, you can spend your time learning to code or looking for someone who has done the same project as you that you can copy. While the latter can provide a quick hit, the former is the way I would spend my time.

I bought the neopixels by mistake looking for a standard rgb led ring....

I don't think such a thing exists.

Grumpy_Mike:
Most people use copy and paste.

You have to understand what that "snippet" does and incorporate the technique into your own code.
If you are having difficulty doing this then your coding skills are not enough to do this project yet.
You have the choice, you can spend your time learning to code or looking for someone who has done the same project as you that you can copy. While the latter can provide a quick hit, the former is the way I would spend my time.
I don't think such a thing exists.

I'm pretty much level 0 at the moment, and although time to learn code is not something I have a lot of at the moment I'll look more into it as I am getting more interested the more dumb questions I ask, thanks for the input.

kelaifu:
I've ordered a few chips and a dedicated little PCB that do level shifting,

That worries me! Can you please cite what this "dedicated little PCB" is because I don't recall any such ready-made modules using a 74HCT14! :roll_eyes:


Grumpy_Mike:
I don't think such a thing exists.

Yes. What do you think a "standard RGB led ring" would actually be?

Paul__B:
That worries me! Can you please cite what this "dedicated little PCB" is because I don't recall any such ready-made modules using a 74HCT14! :roll_eyes:

this thing, it was listed as a logic level switcher and I saw another teensy user was using one in a project. It was literally 20cents and I was in a rush to place my order so I just added it and if its useless, no loss.

Paul__B:

Yes. What do you think a "standard RGB led ring" would actually be?

a bunch of LEDs on a ring, sometimes used in camera projects etc. I wanted one, or something to do a similar job for a DIY amplifier, but the neopixel ring arrived I realised it was something I could dig out my arduino to play with.

I'm actually buying things through China's taobao, and my Chinese reading is almost as poor as my arduino coding, so occasionally I end up with things I didn't really want, but in this case it's given me something new to play with.

kelaifu:
this thing, it was listed as a logic level switcher and I saw another teensy user was using one in a project. It was literally 20cents and I was in a rush to place my order so I just added it and if its useless, no loss.

Those are meant for level switching for i2c bus devices. I've tried using them for ws2812/neopixels, and they didn't work well for me, any maybe not at all for you. But I did find that 74hc14 worked well (that was Mike's suggestion).

You still haven't told us what type of Teensy you have. There are ~20 different models!

kelaifu:
this thing, it was listed as a logic level switcher and I saw another teensy user was using one in a project. It was literally 20cents and I was in a rush to place my order so I just added it and if its useless, no loss.

It is indeed useless for driving WS2812s; that's why I asked as I know it represents a temptation. Keep it for when you are working with I2C systems with different logic levels. :grinning:

When I said a 74HCT14 or 74HC04, that is exactly what I mean (a 74HC14 is probably OK too). That is what I always recommend, as also does Mike (who unlike myself, has actually used them in projects :roll_eyes: ).

kelaifu:
a bunch of LEDs on a ring, sometimes used in camera projects etc. I wanted one, or something to do a similar job for a DIY amplifier, but the neopixel ring arrived I realised it was something I could dig out my Arduino to play with.

"A bunch of LEDs on a ring" may be white or RGB - which I have not seen - but would only be able to show a uniform colour when controlled by PWM. Only a ring of "NeoPixel"s - WS2812 or similar - would be able to perform animations.

The teensy I have at the moment is a 2.0++, I could buy something more powerful if needed. I saw some great synth projects for the higher models.

Teensy 2.0++ is 5V, so no need for level converters.

This also answers my question from post #1, I suspect. Teensy 2.0++ has a native USB interface. Nano does not (it has a separate USB-serial chip). That's why the Teensy was suitable for your MIDI project but the Nano was not. There are Arduino that would have been suitable, such as Leonardo or Pro Micro.

PaulRB:
Teensy 2.0++ is 5V, so no need for level converters.

This also answers my question from post #1, I suspect. Teensy 2.0++ has a native USB interface. Nano does not (it has a separate USB-serial chip). That's why the Teensy was suitable for your MIDI project but the Nano was not. There are Arduino that would have been suitable, such as Leonardo or Pro Micro.

thought I'd mentioned it, but yeah, it was the midi capabilities, using the nano I needed to use serial to midi software, which seemed to dislike my computer but I did get working eventually. I wanted a set up as simple as possible as my friend also wanted me to make him a version of the midi controller I'd made.