Forums Power and Sound Electronics
  • Topic: Microcontroller powered RGB Strip lighting?

    Back To Topics
    (0 rates)
    • February 20, 2018 7:18 PM EST
      • Candlewood Valley, Connecticut
         
      • Posts
        12,771
      • Thanks
        623
      • Thanked
        368

      Microcontroller powered RGB Strip lighting?

      Inspired by Kevin Strong's use of RGB LED strip lighting on his Path Valley Railroad, I started looking into sources for them.  Most "kits" come with a small power supply and a controller that uses a hand held remote. That would work for me, but I'm thinking this may be my opportunity to start experimenting with microcontrollers (Raspberry Pi, etc.) to power them plus set and remember scenes.   There are systems available that use a WiFi controller and a phone app to do similar, but I'd just as soon roll my own.  I don't necessarily need wireless control, but it would be OK, especially if I could just say "Hey Alexa (or Yo Google) set the railroad lighting to Late Night.

       

      Problem is I have no idea where to begin.  Anyone played around with this at all?

      ____________________________________

      www.cvsry.com www.cvsry.com

    • February 20, 2018 7:29 PM EST
      • Waverly, Alabama
         
      • Posts
        926
      • Thanks
        99
      • Thanked
        143

      Not sure this counts, Jon, but I am using a RPi connected to an Arduino Uno to run a CNC router system that I am building.  Its all new to me so I won't be a lot of help, but I am interested in where this thread goes.

      This post was edited by Dan Hilyer at February 20, 2018 8:06 PM EST
      ____________________________________

       

    • February 20, 2018 8:50 PM EST
      • Kittery, ME
         
      • Posts
        510
      • Thanks
        36
      • Thanked
        179

      The Raspberry Pi is not a microcontroller.  It's a single-board computer (SBC).  A microcontroller is a microprocessor with some program memory that runs a single program over and over when you power it up, while a SBC has an operating system, file system, etc.  Most SBCs run Linux, including the Raspberry Pi.  To get it to do something, you need to boot it up and run a program.  The SBC is much more powerful and versatile than a microcontroller, but overkill for a lot of projects.  Microcontrollers boot instantly and can be turned off at any point without worry of corrupting the file system.  With Linux, you have to shut down the computer when you're done using it.

       

      For what you're interested in doing, I'd go for a microcontroller without a second thought.  There are several, such as the one Dan linked, that have networking capabilities and other bells and whistles.

       

    • February 20, 2018 9:27 PM EST
      • Charlottesville, Virginia
         
      • Posts
        324
      • Thanks
        4
      • Thanked
        34

      Normally, I would agree with Eric here but I just got a Raspberry Pi ZeroW for 10 bucks so I'm re-thinking my perspective.  A cheap tiny computer that runs a linux operating system is pretty cool :)

      This post was edited by Martin Sant at February 20, 2018 9:43 PM EST
    • February 20, 2018 9:43 PM EST
      • Kittery, ME
         
      • Posts
        510
      • Thanks
        36
      • Thanked
        179

      They are really cool and have a lot of great uses. I have 5 Raspberry Pis running full time doing specific tasks that are too intensive for microcontrollers  But it’s a lot of overhead for a beginner, particularly for a project requiring hardware I/O!

    • February 20, 2018 10:32 PM EST
      • Candlewood Valley, Connecticut
         
      • Posts
        12,771
      • Thanks
        623
      • Thanked
        368

      Thanks for the suggestions guys; I'll check that stuff out

       

      I'm not exactly a beginner, just 25 or more years behind. My brother in-law and I were networking TRS-80 model 3 computers over an RF link (27Mhz) in 1982. I've done some hardware dabbling and computer programming, but it's been a long while. I've played with Unix and Linux and PC OS from ROM Basic and MS DOS through Win 10.  Very little on the Apple side except some 90's hardware tech training.

       

      Glad y'all realize I am a noob when it comes to the current crop of stuff. I been watching the SBC's for a few years but never dug in.  I've had microcontroller experience as an end user in several RR R/C products.

       

      I'm thinking the microcontroller might be more suited to what I'm up to. My only problem there is programming. I'm nowhere with current languages.

       

       

      ____________________________________

      www.cvsry.com www.cvsry.com

    • February 20, 2018 10:49 PM EST
      • Martinez, California
         
      • Posts
        207
      • Thanks
        30
      • Thanked
        38

      I’m like Jon, experience but it goes all the way back to CP/M, never went much beyond MS-DOS and Windows 3.1, but I am really interested in seeing what this stuff can do.

      ____________________________________

    • February 20, 2018 11:39 PM EST
      • San Mateo, California
         
      • Posts
        193
      • Thanks
        34
      • Thanked
        56

      On Saturday, Feb. 10, at the Bay Area Garden Railway Society (BAGRS) annual meeting (after I gave my presentation on Body Mounting Kadees) another presenter Seth Neuman, of Model Railroad Control System, described what they used (the Arduino microcontroller run with "Sketches"-  a C based software so he said) along with various sensors they have.

      Has anyone looked at or used any of the Model Railroad Control Systems products?

      -Ted

    • February 21, 2018 6:52 AM EST
      • Kittery, ME
         
      • Posts
        510
      • Thanks
        36
      • Thanked
        179

      I hadn't thought about CP/M for years, but I was just getting nostalgic for my family's first PC, a Kaypro II, the other day, and watching videos of it on YouTube.  I was a kid in the 80s (41 now), and grew up alongside the personal computers.  The Raspberry Pi really feels like going back to those days.  I love the accessibility of the hardware and terminal style interface.  I'm glad that kids now have something like that available.  Also, being a Mac user, it's easy to go back and forth between MacOS and Linux since they are both Unixes.  

       

      The Arduino, ESP8266, and many other microcontroller platforms are typically programmed in C++.  The ++ is the object oriented capability, but if you've done any C programming, even 30 years ago, you'll recognize the syntax.  When I first used microcontrollers in the 90s, it was all assembly.  I couldn't believe how far things had come when I got back into it 15 years later.

    • February 21, 2018 8:40 AM EST
      • Charlottesville, Virginia
         
      • Posts
        324
      • Thanks
        4
      • Thanked
        34

      I suggested the Pi Zero simply because it's only $10.  Obviously running a linux box for controlling LEDs would (normally) be overkill, but at $10, and considering the setup to get going on Ardunio, it's a wash in my view.  It also lets you program in python and has built in Wifi.  So you could, in theory, setup a self contained network and web server to talk to your phone to turn your LEDs on and off.  That's pretty impressive for a board about the size of two postage stamps.

       

      https://www.adafruit.com/product/3400

    • February 21, 2018 9:03 AM EST
      • Candlewood Valley, Connecticut
         
      • Posts
        12,771
      • Thanks
        623
      • Thanked
        368

      This is quite a rabbit hole.  I spent 15 minutes just looking at the product page on adafruit.  Need to read thier how-to pages to get a better idea of what they have going on.

       

      I never did any programming in C. I was pretty strong in Basic before VB came along - I never made the jump to the GUI based stuff.  I did some very light assembly programming back in the 80's just to get a function I could call from Basic.  I don't even remember the project, but at the time I was running a TRS-80 Color Computer with OS9 - another Unix derivative.  It's interesting to look back now on how Multi-user was the rage then the way cloud computing is now.

       

      Bottom line is I have the aptitude, just don't know if I have the discipline to learn new languages.  On the other hand, it looks like there is a lot of open source stuff out there and learning to modify for personal needs may not be as daunting as writing from scratch.

      This post was edited by Jon Radder at February 21, 2018 9:03 AM EST
      ____________________________________

      www.cvsry.com www.cvsry.com

    • February 21, 2018 11:01 AM EST
      • Kittery, ME
         
      • Posts
        510
      • Thanks
        36
      • Thanked
        179

      For your LED project, my understanding is that you need to generate 3 PWM signals - red, green, and blue - such that the duty cycle of each corresponds to the contribution of that color to the composite color you're after.  These will be logic level, so you need a transistor driver for each to interface with the strip.  

      To get started, once you've worked out the hardware, take a look at the analogwrite() function for the Arduino and other compatible platforms.  https://www.arduino.cc/reference/en/language/functions/analog-io/analogwrite/

       

       

    • February 21, 2018 1:16 PM EST

      •  
      • Posts
        371
      • Thanks
        5
      • Thanked
        69

      Good day - I spent some time experimenting with similar LEDs and have some notes that may be of interest on my web page - there is a YouTube video, too

      The LEDs that I worked with are not driven by PWM but by the Arduino sending data directly to a controller on each RGB LED - very cool technology!

      Please let  me know if you have any questions.

      dave

       

      http://www.trainelectronics.com/Animation-NeoPixel-LEDs/index.htm

      https://www.youtube.com/watch?time_continue=1&v=q59u55Yc7XY

    • February 21, 2018 9:59 PM EST
      • Candlewood Valley, Connecticut
         
      • Posts
        12,771
      • Thanks
        623
      • Thanked
        368

      Thanks David - I will read your pages and check out the video. The NeoPixels products were referenced earlie They are cool - driven by a single wire data line. Each LED is uniquely addressable

      ____________________________________

      www.cvsry.com www.cvsry.com

    • February 23, 2018 7:02 AM EST
      • Candlewood Valley, Connecticut
         
      • Posts
        12,771
      • Thanks
        623
      • Thanked
        368

      After viewing David Bodnar's video and page on the adafruit NeoPixels I think I'm just going to put a toe in the water and buy one of their smaller microcontrollers and maybe an array panel rather than a strip and start experimenting. I think I read that some of their microcontrollers have Bluetooth which interests me too for wireless remote.

       

      But first, I need to get back to working on Martin's beta of his Bluetooth RC/DCC locomotive control.  I got a really bad idea last night while playing with it which I will share privately with Martin, but it might get me back into building electronics.

      ____________________________________

      www.cvsry.com www.cvsry.com

    • March 4, 2018 11:25 AM EST
      • Candlewood Valley, Connecticut
         
      • Posts
        12,771
      • Thanks
        623
      • Thanked
        368

      I'm about two or three videos and help pages away from pulling the trigger on some hardware to begin breadboarding some ideas.  I found this nifty piece of hardware that is designed as a programming helper, but, with a few mods might be the basis for what I am after...

       

      I envision a hardware control that has slide pots for each of 4 colors (Red Green Blue and White) allowing me to have infinitely variable light from Red through  Violet plus white.  I'm still in the 'figuring this stuff out' mode, but I am starting to get a handle on what does what and what I want.

       

      Initially I will buy a Neopixel 8 LED RGBW strip for hardware and code development.  I'm thinking about trying out the Fadecandy Controller that allows the Neopixels to be driven from any PC from a SBC to a full on desktop via USB. In the end though, I will probably end up with some type of Minicontroller.  Working on a block diagram in my head to give me a better idea of the end goal. Right now I have too many conflicting ideas :)

      ____________________________________

      www.cvsry.com www.cvsry.com

    • March 5, 2018 9:32 PM EST
      • Candlewood Valley, Connecticut
         
      • Posts
        12,771
      • Thanks
        623
      • Thanked
        368

      I have now learned enough about Neopixels to be dangerous and go over the head of many except the programmer types that hang out here.  I have put some ideas down on paper so I can start working on design. This is what I have decided I want my end result to be:

       

      Manual and Android App control of Neopixel RGBW strip lights.  Neopixels are individually addressable, but for my initial purpose I will address them as parallel groups of 8. In other words, a 5 meter strip of RGBW 30 pixels/meter is about 150 modules. I'll chop that to 144 modules, or 18 groups of 8.  This will be for the purpose of what I will call Density.  At 100% density all 144 pixels will be lit, or all 8 pixels of each group. At 50% density 72, or 4 pixels of every group will be lit and so on down to the last step before off which would be 18 pixels or 1 pixel per group. I am using groups since I really don't need control of every pixel for static lighting. I may also program some of the standard effects down the road that addresses each pixel independently.  I am not limiting myself to 144 pixels. I chose that as a close number to a stock length of Neopixel strip.

       

      Color control, or what I am calling R G B & W Intensity, will be done with 4 sliders. One for each color of a pixel. The color values derived from setting the sliders will be sent to every pixel setting the brightness of each channel. For example; I could set a very washed out blue, or a very cool white by keeping the Red and Green sliders off and advancing just the Blue and White sliders. The further one advances the slider, the brighter that color becomes.

       

      Once I have basic functionality I would like to implement pre-sets or scenes. It might be fun way down the road to just say "Alexa, set my Moonlight in Rockhill Furnace scene" and the lights come up to a pre-set color and brightness.

       

      What I hope to achieve here is nearly infinitely variable colors and brightness. By controlling the percentage of pixels lighting up I hope to be adding steps to brightness control without affecting color. It may have a side benefit of altering the light source angle for photography. All of this remains to be seen.

       

      When I started working out the Density steps I was surprised how quickly working with binary numbers came back to me.  I can represent each of the 8 pixels in a group by one binary digit in an 8 bit byte.  Full on would be  all 1's or Hexidecimal FF or 255 in Decimal.  Half on of would be 10101010 or AA Hexadecimal or 170 Decimal.  Part of the bread boarding task will be decide on how much resolution (how many steps) I want for density. 5 steps is pretty simple and offers some symmetry in which of the 8 pixels are lit. Maximum resolution would be 9 steps including All Off.

       

      I'm still deciding on what hardware to buy. I'll probably start with a simple 8 pixel strip which is all I need to develop the software.  What the controller will be is still up in the air.

       

      From the programming side I was happy to learn that the data stream for controlling Neopixels is really simple old-school logic. No protocols, just timing. The way the chip in each pixel handles the data stream is pretty cool too. It grabs the first chunk of color data, latches that then strips it from the stream and outputs the balance of the stream to the next pixel This allows each pixel to be addressed by it's position on the strip, not be assigning it an address.  Allows a bad pixel to be jumped around with no affect on the balance of the strip other than shifting everything to left by how ever many pixels are jumped out of the strip.

       

      Seeing this from just blue LEDS has me psyched to get going...

       

      This post was edited by Jon Radder at March 5, 2018 9:59 PM EST
      ____________________________________

      www.cvsry.com www.cvsry.com

Forums Power and Sound Electronics

    Icon Legend

  • Topic has replies
    Hot topic
    Topic unread
    Topic doesn't have any replies
    Closed topic
    BBCode  is enabled
    HTML  is enabled

Add Reputation

Do you want to add reputation for this user by this post?

or cancel

Ads by Google