Brake and turning lights for electric scooter

Hello all,
Im not rly sure where to go for this. I have an electric scooter (Gotrax GXL V2) and I want to add brake/turning lights to it. The main concept is that light strips become red when I press the brake on my scooter; light strips blink yellow whenever I press a button for turning right/left; and (if possible) a button that makes all lights blink, acting like hazard lights. I have absolutely no idea how to start this project, but from what I have found online regarding other previous projects Arduino seemed to be the best route for me to take. Id rly appreciate if I could get help on this project, as I have almost no knowledge regarding these types of projects. Also I'd like to make the project using a small Arduino board so that it isn't as obvious, and id rly appreciate it if anyone could provide tips for making the project waterproof (to an extent).

Here's a YT link showing something similar to what I have in mind: https://youtube.com/shorts/kVGeQokJryU?si=fNcNc73f_fcR1ZSC

@gudperson there are many articles out there to help you get started, here is one link that will give you an idea on where to start with hardware and software using an Arduino microcontroller

If the scooter is legal in any way, actuating the brake levers will cause a braking sensor to indicate to the motor controller to stop sending energy to the motor. Interfering with that circuit in a bad way will allow the race condition of throttle/brake. Even if you do not care about regulations, at least save your skin and teeth by finding another method of indicating a stopping condition, like a mercury switch (negative acceleration would actuate the mercury switch, indicating to your lights-controller to enable the stopping lights).

I don't intend to mess with the scooter's electronics.... The scooter has a manual disc brake which somehow also connects to the motor. What I was kinda thinking for brake light is to either have a circuit that would close when the disc brake engages and open when it doesn't, like how it's shown in the YT link above.

This is a big help. Would you have any suggestions for what Arduino I should get? The smaller the better

If the scooter is any bit legal, the brake lever has a braking sensor. When you pull the lever, the braking sensor changes a voltage level to the controller which stops power to the motor.

"Manual brake" - they all are. None are automatic. The brake rotor does not connect to the motor circuit. It is a physical device.

A standard NANO would likely do the job.The only tricky part is finding an activator for the brake lights. The turning lights are just a switch.

See post#3?

Abt the manual brake, I just wanted to be clear on what I'm saying...I'm not rly sure if my terminology is correct.
Regarding braking sensor... I don't intend to mess with the motor in any way. This project will be physically attached to the scooter, and won't rely at all on any electric signals from the scooter

//two short strips replace (or add) turning lights, R/L turn pins are from the lamps positive pole
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
#define BRIGHTNESS 255
#define NumLed_L 24
#define NumLed_R 24

#define LED_PIN_R 5
#define LED_PIN_L 6
#define RturnPin A0
#define LturnPin A1
#define brakePin A2
#define PulseLength 1050 // half of blinking period + 50 milliseconds

byte Pos = 0;

#include <FastLED.h>
CRGB ledsL[NumLed_L];
CRGB ledsR[NumLed_R];

void setup() {
  FastLED.addLeds<LED_TYPE, LED_PIN_R, COLOR_ORDER>(ledsL, NumLed_L).setCorrection(TypicalLEDStrip);
  FastLED.addLeds<LED_TYPE, LED_PIN_L, COLOR_ORDER>(ledsR, NumLed_R).setCorrection(TypicalLEDStrip);
  FastLED.setBrightness(BRIGHTNESS);
  pinMode(LturnPin, INPUT);  // This means the pin is EPU driven
  pinMode(RturnPin, INPUT);
  pinMode(brakePin, INPUT);
  whiteOut();
  FastLED.show();
  delay(1000);
}

void loop() {
  static bool LturnVal = false;
  static bool RturnVal = false;
  static bool brakeVal = false;
  static bool isTimeOut = false;
  static uint32_t awaiting = 0;

  if (digitalRead(RturnPin)) {
    RturnVal = true;
    awaiting = millis();
  }
  if (digitalRead(LturnPin)) {
    LturnVal = true;
    awaiting = millis();
  }
  brakeVal = digitalRead(brakePin);
  Pos = (millis() % 1000UL) / 250UL;

  if (millis() - awaiting > PulseLength) {
    LturnVal = false;
    RturnVal = false;
  }

  if (brakeVal)brake();
  else Black();

  if (LturnVal)leftTurn();
  if (RturnVal)rightTurn();
  if (LturnVal && RturnVal)Hazard();
  FastLED.show();
}

void rightTurn() {                              //Right Turn Signal
  //fill_solid(ledsR, NumLed_R, CRGB::Black);
  for (byte i = Pos; i < NumLed_R; i += 4)ledsR[i] = CRGB::DarkOrange;
}

void leftTurn() {                               //Left Turn Signal
  //fill_solid(ledsL, NumLed_L, CRGB::Black);
  for (byte i = Pos; i < NumLed_L; i += 4)ledsL[i] = CRGB::DarkOrange;
}

void brake() {
  fill_solid(ledsL, NumLed_L, CRGB::Red);
  fill_solid(ledsR, NumLed_R, CRGB::Red);
}

void whiteOut() {
  fill_solid(ledsL, NumLed_L, CRGB::White);
  fill_solid(ledsR, NumLed_R, CRGB::White);
}

void Hazard() {
  if ((millis() / 500UL) % 2) {
    fill_solid(ledsL, NumLed_L, CRGB::DarkOrange);
    fill_solid(ledsR, NumLed_R, CRGB::DarkOrange);
  }
  else Black();
}

void Black() {
  fill_solid(ledsR, NumLed_R, CRGB::Black);
  fill_solid(ledsL, NumLed_L, CRGB::Black);
}

Okay. Look up "arduino mercury switch"... it will help the Arduino know when you are using the brake (due to negative acceleration).

Aight, will do so tmrw...thx for the help

A trailer brake controller does exactly what the OP wants. I think it is pendulum operated but the last one I looked at was probably 20 or 30 years ago.

That sounds interesting and feasible.

And legal. Buying one and hacking it might be one approach, but I just googled it and now they use accelerometers, I forget the sensor number off the top of my head, but somebody on here will know it.

or going down hill.

Yes. Velocity is a scalar, acceleration is a vector.
[edit] (unless they continually increased speed)

Nano was mentioned I would go with that, I think most controllers are going to fit in a box that will mount discreetly to the scooter.

I would buy some parts and put them together at a bench and see how everything is going to work electrically, a controller, a brake switch, an indicator switch, a running light switch a short Neopixel strip. That in itself will present problems for you to solve such as how do I connect the parts together, what power supplies do I need how do I write the code etc.

The linked video gives a good starting point.

1 Like

So I looked it up... From what I found online (along with the comment from @lastchancename) it seems like it might malfunction on slopes...I live in a slope-y area and half the time I ride my scooter I'm tilted at least 30 to 45 degrees from the ground...would there be any way to make the mercury switch still work?

BTW here's reference pics for the scooter I have: