1. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  2. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  3. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

Tutorial diy ardunino adjustqable rpm leds using ws2812b leds

Discussion in 'DIY peripherals' started by minimus1899, Oct 22, 2017.

  1. minimus1899

    minimus1899 Member

    Joined:
    Mar 7, 2016
    Messages:
    64
    Occupation:
    retired/broken/falling to bit
    Location:
    lincoln
    Balance:
    416Coins
    Ratings:
    +56 / 1 / -0
    My Motion Simulator:
    Arduino
    If you are to put LEDs behind the rpm gauge numbers like I am (pics coming ) this is an easy project for you to change the red line with a pot,

    Parts need:
    10 k pot
    Wire
    Arduino nano or uno
    some ws2812b LEDs


    Wiring diagram below

    ajustable rpm leds.png


    Here is a video of it working

    don't forget you can change the colours in the code please see note in the code

    Code:
    #include "FastLED.h"
    
    // How many leds are connected?
    #define NUM_LEDS 10
    
    // Define the Pins
    #define DATA_PIN 4
    
    // Define the array of leds
    CRGB leds[NUM_LEDS];
    
    void setup() {
    FastLED.addLeds<NEOPIXEL,DATA_PIN>(leds, NUM_LEDS);
    }
    
    void loop() {
    
    int val = analogRead(1);
    
    // Map the pot values to 0 - Number of Leds
    int numLedsToTurnRed = map(val, 0, 950, 0, NUM_LEDS);
    
    // Clear the existing led values
    FastLED.clear();
    
    // Change led colors // after the crgb below change to what coulors you want.... web colours heres a website:: http://htmlcolorcodes.com/color-names/
    for(int led = 0; led < NUM_LEDS; led++)
    {
      if(led < numLedsToTurnRed)
      {
        leds[led] = CRGB::Red;
      }
      else
      {
        leds[led] = CRGB::Blue;
      }
    }
    
    FastLED.setBrightness(50);
    FastLED.show();
    
    }
    
    • Like Like x 1
  2. Ads Master

    Ads Master

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
  3. minimus1899

    minimus1899 Member

    Joined:
    Mar 7, 2016
    Messages:
    64
    Occupation:
    retired/broken/falling to bit
    Location:
    lincoln
    Balance:
    416Coins
    Ratings:
    +56 / 1 / -0
    My Motion Simulator:
    Arduino
    Here a video of the leds behind a dash, note this is still a working progress so the clock faces are not completed nore is the cluster all wired up this is just a demo of what i am trying and almost have achieved




    Kind regards

    Andy
    • Like Like x 1
  4. martingever

    martingever New Member

    Joined:
    Sep 17, 2018
    Messages:
    1
    Balance:
    98Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, 4DOF
    Last edited by a moderator: Sep 17, 2018
  5. hideki

    hideki Member

    Joined:
    Feb 3, 2014
    Messages:
    96
    Location:
    Spain
    Balance:
    22Coins
    Ratings:
    +24 / 1 / -0
    My Motion Simulator:
    2DOF, SCN5
    Wow MArtin! really nice. Any chance to use it with Simhub? many thanks.
  6. thecure

    thecure New Member

    Joined:
    Aug 21, 2011
    Messages:
    15
    Balance:
    - 91Coins
    Ratings:
    +2 / 1 / -0
    IT'S possibile to make whit simhub !!!!..try
    • Like Like x 1