r/arduino • • 18h ago

Hardware Help Dunno if this belongs here but I'm too frustrated, help pls

Thumbnail
gallery
2 Upvotes

For some context, I've got making a minisumo as a project, so here it is my problem:

If you check my pic (Yeah, bad soldering, need to improve it someday), you're going to see that I'm using an ESP32-C3 with a Tb6612fng H bridge paired with two N20 motors (1100 RPM, 12v), I'd checked its datasheet before so it is supposed to be able to handle those two motors simultaneously.

I decided to make a basic code just to try it out, the motors worked out well for 15 secs until the left one suddenly stopped (Channel B). i already measured the three pins of channel b and, apparently, it's fine.

What would you recommend me to do? Please I'm getting so frustrated for this


r/arduino • • 22h ago

Software Help Why Arduino IDE is slow and old?

11 Upvotes

Time is gone, and after making projects for years with platformio I had to take a look on an old project maded with Arduino IDE.

Compilation time 4minutes.

The project is big, but I got similar and biggest projects that (in platformio) compiles in 40sec.

And it's not a PC problem, I tried it in 3 different PC.

For not talking about library and board versioning...


r/arduino • • 6h ago

Beginner's Project Button Box assistance

Post image
2 Upvotes

So this is my first arduino project and having a little difficulty. the setup will be used for sim racing and the toggle switches should just send a quick pulse (not continuous). same for the button.
- each toggle should only light up in the on position.
- the left most toggle (ignition) should "control" the button. when on, the button led lights up and is able to start the sim car.
- i was able to get 1 toggle working pretty reliably.
- once i add 2 more toggles (3 in line) they all stop working (haven't even attempted the 4th toggle and button yet)

i am trying to use the joystick library, and ill be honest, AI, to create the sketch. i guess id like to know, does my diagram look sound? is there anything i should look to use in the sketch? maybe an example i can use to compare with what i have

(diagram using parts as close as i could find in cirkit designer)

really appreciate any guidance

/*
 * Arduino Pro Micro (ATmega32U4)
 *
 * Three SPST toggle switches as pulsed joystick buttons.
 *
 * No external resistors required.
 * Uses internal INPUT_PULLUP.
 *
 * Switch 1: D2 -> Joystick Button 1
 * Switch 2: D3 -> Joystick Button 2
 * Switch 3: D4 -> Joystick Button 3
 *
 * Wiring per switch:
 *   Contact A -> GND
 *   Contact B -> Digital input pin
 *
 * Switch ON  = LOW
 * Switch OFF = HIGH
 *
 * Every stable toggle transition (ON or OFF)
 * generates one short joystick button press.
 */


#include <Joystick.h>


const uint8_t NUM_SWITCHES = 3;


const uint8_t SENSE_PIN[NUM_SWITCHES] = {
  2, 3, 4
};


const uint8_t RX_LED_PIN = 17;


// Timing
const unsigned long DEBOUNCE_MS = 25;
const unsigned long PULSE_MS = 40;


// Joystick configuration
Joystick_ Joystick(
  JOYSTICK_DEFAULT_REPORT_ID,
  JOYSTICK_TYPE_JOYSTICK,
  NUM_SWITCHES,
  0,
  false, false, false,
  false, false, false,
  false, false,
  false, false, false
);


// Switch tracking
bool lastReportedState[NUM_SWITCHES];
bool lastReading[NUM_SWITCHES];


unsigned long lastDebounceTime[NUM_SWITCHES];
unsigned long pulseEndTime[NUM_SWITCHES];


void setup() {


  for (uint8_t i = 0; i < NUM_SWITCHES; i++) {


    pinMode(SENSE_PIN[i], INPUT_PULLUP);


    lastReading[i] = digitalRead(SENSE_PIN[i]);


    lastReportedState[i] = lastReading[i];


    lastDebounceTime[i] = 0;


    pulseEndTime[i] = 0;


    Joystick.releaseButton(i);
  }


  // RX LED mirrors switch 1
  pinMode(RX_LED_PIN, OUTPUT);


  digitalWrite(
    RX_LED_PIN,
    lastReading[0] == LOW ? LOW : HIGH
  );


  Joystick.begin();
}


void loop() {


  for (uint8_t i = 0; i < NUM_SWITCHES; i++) {
    handleSwitch(i);
  }
}


void handleSwitch(uint8_t i) {


  bool reading = digitalRead(SENSE_PIN[i]);


  // Detect a change in raw input
  if (reading != lastReading[i]) {


    lastDebounceTime[i] = millis();


    lastReading[i] = reading;
  }


  // Wait for stable input
  if ((millis() - lastDebounceTime[i]) > DEBOUNCE_MS) {


    if (reading != lastReportedState[i]) {


      lastReportedState[i] = reading;


      // Generate one joystick pulse
      pulseEndTime[i] = millis() + PULSE_MS;


      Joystick.pressButton(i);


      // RX LED mirrors switch 1
      if (i == 0) {


        digitalWrite(
          RX_LED_PIN,
          reading == LOW ? LOW : HIGH
        );
      }
    }
  }


  // Release joystick button after pulse
  if (
    pulseEndTime[i] != 0 &&
    (long)(millis() - pulseEndTime[i]) >= 0
  ) {


    Joystick.releaseButton(i);


    pulseEndTime[i] = 0;
  }
}

r/arduino • • 9h ago

Smart Energy Meter I Designed for Final year University Students

1 Upvotes

r/arduino • • 13h ago

Hardware Help One of the sides is not centered.

7 Upvotes

Hello everyone. I’m trying to get the box to rotate like in this video (https://youtu.be/ml_ZPaIL0-o?si=aNxnIkb1zLIO1pFe). I want it to rotate randomly to one of the square's 3 sides (one of them never rotates). However, when it spins, it only centers on side 3 or side 1, while side 2 ends up positioned between 1 and 3 (as you can see in the video). How can I fix this?


r/arduino • • 6h ago

Hardware Help Which board should I choose for hairclip with screen Arduino project

2 Upvotes

Hi everyone! I'm trying to start working on more creative projects on Arduino and I found a project online about a hairclip with screen on it, which I found to be really cute (in case you don't know, it's this one). My doubt is that I've seen different components used to do it. What would be better, a LILYGO T-display-S3 (like in the video I just linked), a LILYGO T-display chip 32 (like in this one) or a 1.28 in TFT (like in this one). I've worked with Arduino before, but it's been a long time and I'm basically relearning again haha, so I'm not sure about which one would be the best option for the project. Of course any suggestions different than the ones I listed are also welcome. Thanks a lot! :)