Navigation

    The Onewheel Forum

    Onewheel Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Rules
    • Archive

    Extra LEDs For the Onewheel (Because RGB adds a 15% preformance boost)

    Mods & DIY
    5
    56
    2566
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • LOAFFETTE
      LOAFFETTE DIY @cheppy44 last edited by

      @cheppy44 yep!

      And I don't know how to get that to work

      113 volts?! I could lick that!

      cheppy44 1 Reply Last reply Reply Quote 1
      • cheppy44
        cheppy44 XR DIY @LOAFFETTE last edited by

        @loaffette I am setting up the electronics to try and write the code for it. I might start from scratch with the code, but I can try to explain the code I end up writing! I dont exactly want to rob you of learning how to do this, but it sounds like a fun small project to work on for me.

        LOAFFETTE 1 Reply Last reply Reply Quote 1
        • LOAFFETTE
          LOAFFETTE DIY @cheppy44 last edited by

          @cheppy44 Thanks man!
          I really owe you for this one! I'm pretty bad at programming and this really helps!
          I'll probably get around to building a controller for this and designing a mount for the arduino and the LEDs. Found that under the fender is the only safe bet for now, and the footpad would be a pain.

          May look at doing on the fender itself (On top) could be an option.

          113 volts?! I could lick that!

          cheppy44 2 Replies Last reply Reply Quote 1
          • cheppy44
            cheppy44 XR DIY @LOAFFETTE last edited by

            @loaffette here is a demo! still working out a few kinks

            LoafetteLightsDemo.gif

            1 Reply Last reply Reply Quote 4
            • cheppy44
              cheppy44 XR DIY @LOAFFETTE last edited by Lia

              @loaffette
              Here is the code I made! it uses 2 buttons and has 2 outputs for a front and a rear strip. Depending on what controller you use, you may have to set up the button inputs a bit differently. The ESP 32 I am using has Internal Pull up/down resistors for the inputs. I attempted to comment my code pretty good so you can attempt to learn a bit if you feel like it. If you've got any questions or want me to make some changes I am more than willing to help you out!

              IMG_4251.gif

              #include <Adafruit_NeoPixel.h>
              
              #define PIN1        12  // Pin for Front Strip
              #define PIN2        13  // Pin for Rear Strip
              #define BUTTON_PIN1 4   // Pin for Button 1
              #define BUTTON_PIN2 19  // Pin for Button 2
              #define NUMPIXELS   9   // Number of Neopixels in each strip
              
              Adafruit_NeoPixel strip1(NUMPIXELS, PIN1, NEO_GRB + NEO_KHZ800); //Setup for Strip1
              Adafruit_NeoPixel strip2(NUMPIXELS, PIN2, NEO_GRB + NEO_KHZ800); //Setup for Strip1
              
              int buttonState1 = 0;  // variable for reading the pushbutton status
              int buttonState2 = 0;  // variable for reading the pushbutton status
              
              uint32_t white = strip1.Color(255, 255, 255); //Defines a color later to be used in strip1.fill (r,g,b)
              uint32_t red = strip1.Color(255, 0, 0);
              uint32_t yellow = strip1.Color(255, 255, 0);
              
              void setup() {
              
                pinMode(BUTTON_PIN1, INPUT_PULLUP);  // Pin for button 1 other side connected to ground
                pinMode(BUTTON_PIN2, INPUT_PULLUP); // Pin for button 2 other side connected to ground
              
                strip1.begin(); // INITIALIZE NeoPixel strip1 object (REQUIRED)
                strip1.setBrightness(4); // a value from 0 to 255
                strip1.show(); // Initialize all pixels to 'off'
              
                strip2.begin(); // INITIALIZE NeoPixel strip2 object (REQUIRED)
                strip2.setBrightness(4); // a value from 0 to 255
                strip2.show(); // Initialize all pixels to 'off'
              
                Serial.begin(9600); //start Serial console for debuging
                Serial.println("begin");
              }
              
              void loop() {
                buttonState1 = digitalRead(BUTTON_PIN1);
                buttonState2 = digitalRead(BUTTON_PIN2);
                
                // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
                if (buttonState1 == LOW) {
                  // turn left turn signal on 
                  Serial.println("button one left");
                  strip1.fill(white, 0, 4); //strip.fill(color, first led index, number of leds to fill);
                  strip1.fill(yellow, 5, 4);
                  strip1.show();
                  strip2.fill(red, 0, 4);
                  strip2.fill(yellow, 5, 4);
                  strip2.show();
                  delay(500); //delay for 500 milliseconds or .5 seconds
              
                  strip1.fill(white, 5, 4);
                  strip1.show();
                  strip2.fill(red, 5, 4);
                  strip2.show();
                  delay(500);
              
                } if (buttonState2 == LOW) {
                  // turn right turn signal on
                  Serial.println("button two right");
                  strip1.fill(yellow, 0, 4);
                  strip1.fill(white, 5, 4);
                  strip1.show();
                  strip2.fill(yellow, 0, 4);
                  strip2.fill(red, 5, 4);
                  strip2.show();
                  delay(500);
              
                  strip1.fill(white, 0, 4);
                  strip1.show();
                  strip2.fill(red, 0, 4);
                  strip2.show();
                  delay(500);
              
                } else {
                  // turn leds back to "normal" 
                  //Serial.println("normal");
                  strip1.fill(white, 0, 4);
                  strip1.fill(white, 5, 4);
                  strip1.show();
                  strip2.fill(red, 0, 4);
                  strip2.fill(red, 5, 4);
                  strip2.show();
              
                }
              delay(50);
              }
              
              LOAFFETTE 2 Replies Last reply Reply Quote 4
              • LOAFFETTE
                LOAFFETTE DIY @cheppy44 last edited by

                @cheppy44 thanks man!

                This really helps me out with getting this going!
                I'll give the code a spin in Tinkercad when I have time later tonight!

                113 volts?! I could lick that!

                1 Reply Last reply Reply Quote 2
                • LOAFFETTE
                  LOAFFETTE DIY last edited by

                  Got the button code translated to work for the Arduino! Just had to change (INPUT_PULLUP) to (INPUT).

                  Tinkercad simulator is a bit broken though currently, and it's running slow. I'm gonna go and try to find a USB cable for the arduino and test it using real hardware instead.

                  Again, thank you so much for helping me out with the code!

                  113 volts?! I could lick that!

                  1 Reply Last reply Reply Quote 2
                  • LOAFFETTE
                    LOAFFETTE DIY last edited by LOAFFETTE

                    No dice yet.
                    The arduino isn't recognizing the button press.

                    Gonna try and see what I can chagne or what I can do

                    Changed the } if (buttonState2 == HIGH) {
                    to LOW instead of high, and found that when I hold it down, it pauses the flashing

                    113 volts?! I could lick that!

                    1 Reply Last reply Reply Quote 1
                    • LOAFFETTE
                      LOAFFETTE DIY @cheppy44 last edited by LOAFFETTE

                      @cheppy44 So I messed around a bit with the code to try and make it work

                      Added a fuction that would print to the console if button two wasn't pressed.
                      I don't have anything plugged into the pin for button 2 or 1 and it's reading that button one is pressed..

                      Could my arduino be messed up?

                      what board are you using, I might try and buy the board you have instead.
                      Also, when I have the button plugged in and I hold it down, the LEDs stop flashing but are stuck on red

                      113 volts?! I could lick that!

                      cheppy44 1 Reply Last reply Reply Quote 2
                      • cheppy44
                        cheppy44 XR DIY @LOAFFETTE last edited by

                        @loaffette I am using an ESP 32 dev module, but I would not recommend it if you want to implement this on your board. I have a suspicion your issue has to do with pull up/down resistors. Could you post a picture of what your electronics looks like? The purpose of the resistors is to give the digital inputs a default state. If you leave them unconnected or “floating”, they are subjected to back ground electronic noise and are not reliable. Some micro controller have certain pins that have internal resisters that you can enable.

                        LOAFFETTE 1 Reply Last reply Reply Quote 2
                        • LOAFFETTE
                          LOAFFETTE DIY @cheppy44 last edited by

                          @cheppy44 I may have forgotten about the resistor...

                          113 volts?! I could lick that!

                          cheppy44 1 Reply Last reply Reply Quote 1
                          • cheppy44
                            cheppy44 XR DIY @LOAFFETTE last edited by

                            @loaffette the controller you have may have internal pull up you can enable, that was why I was asking what your electronics situation looks like.

                            LOAFFETTE 1 Reply Last reply Reply Quote 1
                            • LOAFFETTE
                              LOAFFETTE DIY @cheppy44 last edited by

                              @cheppy44 I'm using an Arduino Uno, a button and two separate LEDs (4 leds per strip.)

                              Going to add the resistor.

                              Also, I had a cool idea to add on to it later on that would change the color of the LEDs depending on how fast I'm going, or how fast the motor is spinning

                              113 volts?! I could lick that!

                              cheppy44 1 Reply Last reply Reply Quote 1
                              • cheppy44
                                cheppy44 XR DIY @LOAFFETTE last edited by

                                @loaffette that will be interesting! You would probably need an IMU to tell how fast you are moving.

                                LOAFFETTE 1 Reply Last reply Reply Quote 1
                                • LOAFFETTE
                                  LOAFFETTE DIY @cheppy44 last edited by LOAFFETTE

                                  @cheppy44 I actually have one lying around

                                  So i tested it in tinkercad since I don't have any resistors IRL. It works with the pulldown, but only button 2 seems to be detected currently.

                                  Also, I had to change the code up for the LED so that strip 1 is for the left, and strip 2 is for the right since I'm going to be placing them under the fender for now

                                  Updated code:

                                  
                                  #define PIN1        3 //Pin for Front Strip
                                  #define PIN2        2  // Pin for Rear Strip
                                  #define BUTTON_PIN1 4   // Pin for Button 1
                                  #define BUTTON_PIN2 5  // Pin for Button 2
                                  #define NUMPIXELS   4   // Number of Neopixels in each strip
                                  
                                  Adafruit_NeoPixel strip1(NUMPIXELS, PIN1, NEO_GRB + NEO_KHZ800); //Setup for Strip1
                                  Adafruit_NeoPixel strip2(NUMPIXELS, PIN2, NEO_GRB + NEO_KHZ800); //Setup for Strip1
                                  
                                  int buttonState1 = 0;  // variable for reading the pushbutton status
                                  int buttonState2 = 0;  // variable for reading the pushbutton status
                                  
                                  uint32_t white = strip1.Color(255, 255, 255); //Defines a color later to be used in strip1.fill (r,g,b)
                                  uint32_t red = strip1.Color(255, 0, 0);
                                  uint32_t yellow = strip1.Color(255, 255, 0);
                                  
                                  void setup() {
                                  
                                    pinMode(BUTTON_PIN1, INPUT_PULLUP);  // Pin for button 1 other side connected to ground
                                    pinMode(BUTTON_PIN2, INPUT_PULLUP); // Pin for button 2 other side connected to ground
                                  
                                    strip1.begin(); // INITIALIZE NeoPixel strip1 object (REQUIRED)
                                    strip1.setBrightness(4); // a value from 0 to 255
                                    strip1.show(); // Initialize all pixels to 'off'
                                  
                                    strip2.begin(); // INITIALIZE NeoPixel strip2 object (REQUIRED)
                                    strip2.setBrightness(4); // a value from 0 to 255
                                    strip2.show(); // Initialize all pixels to 'off'
                                  
                                    Serial.begin(9600); //start Serial console for debuging
                                    Serial.println("begin");
                                  }
                                  
                                  void loop() {
                                    buttonState1 = digitalRead(BUTTON_PIN1);
                                    buttonState2 = digitalRead(BUTTON_PIN2);
                                    
                                    // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
                                    if (buttonState1 == LOW) {
                                      // turn left turn signal on 
                                      Serial.println("button one left");
                                      strip1.fill(white, 0, 4); //strip.fill(color, first led index, number of leds to fill);
                                      strip1.fill(yellow, 5, 4);
                                      strip1.show();
                                      strip2.fill(red, 0, 4);
                                      strip2.show();
                                      delay(500); //delay for 500 milliseconds or .5 seconds
                                  
                                      strip1.fill(white, 0, 3);
                                      strip1.show();
                                      strip2.fill(red, 0, 3);
                                      strip2.show();
                                      delay(500);
                                  
                                    } if (buttonState2 == LOW) {
                                      // turn right turn signal on
                                      Serial.println("button two right");
                                      strip2.fill(yellow, 0, 4);
                                      //strip1.fill(white, 5, 4);
                                      strip2.show();
                                      //strip2.fill(yellow, 0, 4);
                                      strip1.fill(red, 0, 4);
                                      strip1.show();
                                      delay(500);
                                  
                                      strip2.fill(white, 0, 4);
                                      strip2.show();
                                      strip1.fill(red, 0, 4);
                                      strip1.show();
                                      delay(500);
                                  
                                    } else {
                                      // turn leds back to "normal" 
                                      //Serial.println("normal");
                                      strip1.fill(white, 0, 4);
                                      strip1.fill(white, 5, 4);
                                      strip1.show();
                                      strip2.fill(red, 0, 4);
                                      strip2.fill(red, 5, 4);
                                      strip2.show();
                                  
                                    }
                                  delay(50);
                                  }
                                  

                                  Update:
                                  Checked the serial output and it does detect the button press, but nothing is changing with the LEDs

                                  update update:
                                  Code works! :) Copied code from the rigth blinker and copied it into the if statement for the left blinker and changed strip1 to strip2 and vice-versa

                                  iam smort

                                  113 volts?! I could lick that!

                                  cheppy44 1 Reply Last reply Reply Quote 2
                                  • cheppy44
                                    cheppy44 XR DIY @LOAFFETTE last edited by

                                    @loaffette sweet! the strip.fill commands are pretty useful when you know how to use them.

                                    LOAFFETTE 1 Reply Last reply Reply Quote 2
                                    • LOAFFETTE
                                      LOAFFETTE DIY @cheppy44 last edited by

                                      @cheppy44 yep!
                                      Tomorrow I'll order the arduinos, some resistors and I'll add them on later on this week.
                                      Need to focus on studying for two exams this week, but also I'd like to do a lot of my Onewheel work when I get everything for the Onewheel in! (This, life savers and the Badgersense!)

                                      113 volts?! I could lick that!

                                      cheppy44 1 Reply Last reply Reply Quote 1
                                      • cheppy44
                                        cheppy44 XR DIY @LOAFFETTE last edited by

                                        @loaffette did you decide which controller you are going to buy? For the application I do thing that any of the name brand arduinos may be a bit big.

                                        LOAFFETTE 1 Reply Last reply Reply Quote 1
                                        • LOAFFETTE
                                          LOAFFETTE DIY @cheppy44 last edited by

                                          @cheppy44 going for the Nano due to its compact size and okay price, though that's what I'm going to be using for now. Later i might switch it up to something else

                                          113 volts?! I could lick that!

                                          1 Reply Last reply Reply Quote 1
                                          • LOAFFETTE
                                            LOAFFETTE DIY last edited by

                                            Update!

                                            The Nano(s) are ordered and will be here next Tuesday! I will begin working on making a mount for the arduino and the battery. I will make a test mount for the battery and I'll probably modify an already existing nano mount for now

                                            113 volts?! I could lick that!

                                            1 Reply Last reply Reply Quote 2
                                            • First post
                                              Last post