Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: Schematic for a shift-register controlled LED Ring - do I need anything else?

  1. #1
    Junior Member
    Join Date
    Aug 2017
    Posts
    13

    Schematic for a shift-register controlled LED Ring - do I need anything else?

    While working on my first project (a basic 2-way MIDI DAW Controller) , more specifically on rotary encoders with LED Rings around them, I noticed how much of a pain it was to wire it on perfboard, especially since I don't want a huge footprint. After finding out about the relatively low price of getting small PCBs made , even at small quantities, I figured I'd be better off designing a PCB with some SMD parts for something like this.
    However, my general electronics knowledge is still very limited, and as you may have guessed, this would be my first PCB design, so I also have a few basic questions.

    As far as the led ring goes, what I'd like to achieve is this (starting with highest priority)
    -chainable (let's say up to 8 or preferably 16 times)
    -fewest amount of board to board connections/connectors/ used teensy pins
    -easy possibility to control brightness, preferably in software (doesn't have to be every LED separately but should be every board separately). And in case it matters for PWM or related stuff: The brightness setting doesn't have to be high-resolution, 16 steps would be enough.



    Here's what I have so far:
    https://imgur.com/a/mmKmO



    The connector wires got all tangled up after moving the components around, so I just deleted them, but the idea would be 2 connectors, IN and OUT that each have 3V,GND, and the 3 lines for the shift register (data, clock , refresh). The rotary encoder (with switch) part of the schematic will see some hardware debouncing added and go to a separate 3 pin output connector (Rotary Encoder A+B, Switch). The 3V line will probably come from an external power supply.


    Here are the questions that come to mind:

    - Am I missing something in the LED Ring part of the schematic? I honestly have little idea when or where to put extra capacitors or resistors that might be needed.

    - This schematic seems to be pretty bad for my 3rd requirement, I think PWM-ing even 4 encoder rings (64 LED) would be terribly inefficient. Also I can't help but wonder if 16 separate resistors are really needed here.
    Knowing the MAX7219/7221, it would be nice to have a similar setup with a common current-limiting resistor, if only to make it easier to change the brightness through hardware / replacing one resistor instead of 16. However at 10x the price of two 595 shift registers the 7219 seems a bit overkill ? Of course I could use them to control four 16-LED-rings, but if there's a solution that is more modular (enabling me to add "self-contained" modules one by one , rather than having a chip control 4 modules ), I would much prefer that.


    Thanks for reading and best regards,
    Jazz

  2. #2
    You can do it this way, but I don't think shift registers are what you're really after.
    The questions you pose -
    If in doubt whack some holes/pads for a capacitor and mark as DNE - do not equip. If you're having trouble you can always add it in later then; generally I'd pop some decoupling on and power line that's present.
    You could probably manage to hack your way through some digitally controlled brightness by PWMing the outputs however it sounds like hard, inefficient work. You have to have separate resistors for each LED in this case, the resistor limits the current and using one would set the current for all 8 LEDs to share - so you have either one LED at 20mA, or two at 10mA, four at 5mA .... You could use resistor arrays to make the assembly easier.

    Have a look at adafruit's neopixels, they look much more like what you want; and teensy's library fast LED will controll them happily.

  3. #3
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,458

    Cool

    Edward mentioned neopixels from Adafruit, here are some ring sizes:



    Neopixels have somewhat fussy timing and voltage requirements. Typically you need to feed the neopixel 3.7 to 5.5v of power. If you are powering the Teensy via a lipo (3.7 - 4.2 volts), you can typically connect the Teensy to the neopixel. But if you power the Teensy with 5v, the neopixel might not see the 3.3v signal from the teensy, and you have to convert the signal from 3.3v to 5v. Due to the strict timing issues of the neopixels, the typical voltage bi-directional voltage converters are too slow. If you are not going to a large display, the simplest way to use them on a Teensy is:

    • If you have a Teensy LC, there is a pin in the back row that is setup for controlling neopixels assuming you power the Teensy with 3.7-5v. You would connect this pin to the neopixel data port, connect VIN to the neopixel power port, and connect a Teensy ground pin to the to neopixel ground port. You would use pin 17 (A3) as the data pin.
    • If you have Teensy 3.1/3.2, you can use either of the prop shields (low cost or motion) to convert both pins 13 and 11 to 5v (note, you have to set pin 7 high to enable the voltage transmission).
    • You can use the prop shield on the 3.5/3.6 as well, but you would need to snake wires to connect the back pins as they are in a different location on the 3.5/3.6.
    • You can also use a 74AHCT125 to do the level shifting. It is fast enough for neopixels.
    • I've used the Pololu logic level shifter (#2595) for small number of neopixels and it seemed to work.


    I would recommend using the Adafruit_Neopixel library at first rather than fastled. Some versions of fastled have been problematical on Teensy. For a small amount of pixels, you don't need the speed improvements that fastled brings.

    Note, neopixels come in RGB and RGBW varieties. You can't mix RGB and RGBW neopixels. You have to mark whether you have the more common RGB version or the RGBW version that adds an extra white pixel. And the RGBW versions come in 3 varieties, depending on the color temp. of the white LED. Note, there is no marking on the PCB which of the RGBW versions you got, so if you get different varieties, you probably need to establish your own marking to identify the different ones. To tell a RGB from a RGBW, if you look at the LED, and there is a half circle visible, you have the RGBW.

    Here is the Adafruit neopixel tutorial, and a link to the best practices section:


    The generic name for neopixels is WS2812B. I've had mixed luck using non-Adafruit WS2812Bs. In particular, the WS2813B's that I got somewhere are problematical. You mentioned an 8 LED ring. You can an 8 LED ring from generic sources (Adafruit doesn't provide one). If you want stacking rings (such as to do an ironman power pack), the Adafruit 12/16 LED rings don't stack, but again there are generic versions that are made for stacking.
    Last edited by MichaelMeissner; 09-26-2017 at 02:41 PM.

  4. #4
    Junior Member
    Join Date
    Aug 2017
    Posts
    13
    Quick update as this hasn't been forgotten:

    First of all, thanks for the replies and the help guys, I never got around to reply but I did read and look into what you wrote.

    So I ended up opting for the WS2812s as you suggested and designed my first PCB around it. After some reading, redesigning and double checking, I finally bit the bullet and did a 10 piece order using one of the many affordable prototyping services from China. It is a 10x10cm panel with four 50x50mm boards. To those curious, I have attached a preview of how the boards will look like, hopefully.

    Right now, this board is designed around 5V supply and the level shifting will have to be external but since I did get some level shifters (and will need an external 5V+ supply anyway for the LEDs) that will be fine. This is my first board, so I'm "cautiously pessimistic" about whether everything will work as it should. But with a first order coupon and slow shipping option (up to 40 days or so) , it came out to under 20$ for 10 of these panels. And, worst case, I'll have some "wallpaper" to decorate my desk area with

    So once again , thanks for the feedback and I will report back in about a month for anyone interested.


    All the best,
    Jazz

    The board:
    Ground plane on bottom, hatched VCC plane on top (I have no idea if this is good or bad but I will find out )
    16x WS2812 + 100nF caps
    1x rotary encoder with switch
    2x 4.7 or 5.1k resistors
    2x 5-Pin 0.1" Headers IN/OUT (2x GND 2x VCC 1x signal) , 1x 3-Pin Encoder (A, B , Switch)

    Click image for larger version. 

Name:	ledring panel.png 
Views:	112 
Size:	372.5 KB 
ID:	11935
    Click image for larger version. 

Name:	ledring top.png 
Views:	51 
Size:	315.2 KB 
ID:	11938
    Click image for larger version. 

Name:	ledring bottom.png 
Views:	108 
Size:	176.3 KB 
ID:	11937

    (note: the rainbow colors are generated by the gerber viewer software - ZofzPCB )
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	ledring top.jpg 
Views:	20 
Size:	173.5 KB 
ID:	11936  

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,139
    Good timing. The new WS2812Serial library will probably come in handy, so you don't miss encoder pulses while updating the LEDs.

    https://github.com/PaulStoffregen/WS2812Serial

    Of course, if you connect a very large number of these (500+ LEDs), maybe OctoWS2811 would be more appropriate.

  6. #6
    Hi Paul, looking at your code, am I right in assuming that it currently only supports RBG but not RGBW LEDs?

    I am using the Adafruit NeoPixel Library with encoders and the Adafruit 24 LED RGBW rings and the "missing encoder pulses" is an issue for me. So I would like to give your new library a go in case it does / or will support RGBW LEDs.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •