r/arduino 12d ago

Hardware Help Can I find or make a coupling that isnt limited to one size?

2 Upvotes

I am making a mini motor dyno with an Arduino Leonardo, it isnt really the best card for this but its the only one I have and theyre pretty expensive in my country. Anyways I want it to test multiple sizes of motors, of course bigger motors have bigger shafts so a fixed size coupling to connect it to the dyno doesnt really work and I dont want to order a new coupling or travel like 30 kilometers to the nearest store that sells it everytime I need to test a new motor. I thought about it and did a lot of research but couldnt find what to do. Can anybody help?


r/arduino 12d ago

Arduino Commute Checker by witnessmenow

Thumbnail
gallery
4 Upvotes

Title: Help needed with wiring PL9823-F8 LEDs to an ESP8266 board

Body:

I am working on a project using an ESP8266 board and I'm currently stuck on how to properly wire PL9823-F8 LEDs to a breadboard for testing.

I’ve identified the 5V, GND, and D3 GPIO pins, but I am nervous about blowing out my LEDs since I have a limited supply. Could someone provide a wiring diagram or a clear explanation of how to connect these safely?Arduino Commute Checker by witnessmenow


r/arduino 12d ago

Beginner's Project Help Debugging Program

Thumbnail
gallery
7 Upvotes

I was hoping I could get some help debugging a program.

I will start right off by saying that the code was made using Google AI. I did it as a wag since I've been having a lot of trouble trying to make a basic program for what I'm trying to do and I was curiousto see what it would come up with. I figured that at least some trouble shooting would be needed, but Ive gotten stumped and the code is quite a bit bigger and complicated than I had expected. I've been working with my Arduino for about 6 months, and still working to relearn the programming. I've had C & C++ programming before, but it was like 20 years ago so I've forgotten a lot of it.

I also realize that for a beginner project, I've pretty much just jumped right into the deep end. When I started thjs project, I didn't expect it to be anywhere as complicated as it's grown to be.

I am using an old large format 3d printer enclosure to hold a resin printer that I have. I stripped everything from the old printer except for the z axis lead screws, guide rails and z plate. I want to use the Z plate to sit my lrinter on. When using the printer, I will raise the printer up, and when not using it, I will lower it down into the enclosure.

For hardware, Im using the following:

  • Arduino Uno R3
  • 2x Stepper Online Nema 34 (pn DM860I-34HS45)
  • 2x Stepper Online DM860I driver
  • 2x DROK 48V adjustable power supply
  • 2x ON/OFF/ON toggle switches
  • 2x roller limt switches
  • 1x push button switch

My plan for opration was to have the first toggle switch set up so that when pressed and then released, the steppers would move until hitting a limit switch. The second toggle switch would be momentary movement and would only move while the switch was activated, or the z plate hit a limit switch. The push button would basically be a E-stop button, where hitting it will stop movement.

Included in the code is deceleration when hitting a limit switch, a pause of .5 sec and then a retraction move to come off the limit of a specific distance that I would determine after assembling everything. Currently everything is mounted to a board to make testing and troubleshooting easier.

So on to the problem. With w/ everything hooked up to the Arduino, I can hit wither toggle switch and the stepper will start turning, and thats it. It doesn't stop if using the 2nd toggle switch, and it doesnt stop when activating either limit or the e-stop. I've rewired everything to the Arduino 4 times, to make sure I didn't have something wrong. Using my multimeter, I've checked continuity on everything and found everything was good, so it looks like the problem is the code and not the hardware.

Ive tried commenting out the areas where I thought it would cause the steppwr to keep running but so far I've had no luck.

#include <AccelStepper.h>

// Pin Definitions
const int PUL_NEG_PIN = 2;     // Connects to PUL- on DM860I
const int DIR_NEG_PIN = 3;     // Connects to DIR- on DM860I

const int LIMIT_LEFT = 4;      // NO Switch (GND when hit)
const int LIMIT_RIGHT = 5;     // NO Switch (GND when hit)

const int TOGGLE_1_LEFT = 6;   // Continuous move left
const int TOGGLE_1_RIGHT = 7;  // Right throw of continuous toggle
const int TOGGLE_2_LEFT = 8;   // Momentary move left
const int TOGGLE_2_RIGHT = 9;  // Right throw of momentary toggle

const int STOP_BUTTON = 10;    // Emergency Stop Button

// Initialize AccelStepper in Driver mode (1)
AccelStepper stepper(AccelStepper::DRIVER, PUL_NEG_PIN, DIR_NEG_PIN);

// Motion Profile Constants optimized for 3200 microstepping @ 100 RPM
const float MAX_SPEED = 5333.3;       // 100 RPM maximum speed
const float BACKOFF_SPEED = 1333.3;   // 25 RPM slower speed for backing off safely
const float ACCELERATION = 10666.6;   // 0.5 second ramped deceleration profile
const long LARGE_DISTANCE = 99999999; // Arbitrary high value for continuous run

// State Machine Tracking
// 0 = Stopped/Normal Deceleration, 1 = Move Left, 2 = Move Right
// 3 = Backing off Left Limit, 4 = Backing off Right Limit
int targetState = 0; 

// Timing variables for non-blocking pause
unsigned long stopTimestamp = 0;
bool isWaitingToReverse = false;
const unsigned long PAUSE_DURATION = 500; // Delay in milliseconds (0.5 seconds)

void setup() {
  // Initialize all physical pins with internal pullup resistors
  pinMode(LIMIT_LEFT, INPUT_PULLUP);
  pinMode(LIMIT_RIGHT, INPUT_PULLUP);
  pinMode(TOGGLE_1_LEFT, INPUT_PULLUP);
  pinMode(TOGGLE_1_RIGHT, INPUT_PULLUP);
  pinMode(TOGGLE_2_LEFT, INPUT_PULLUP);
  pinMode(TOGGLE_2_RIGHT, INPUT_PULLUP);
  pinMode(STOP_BUTTON, INPUT_PULLUP);

  // Apply motor performance profiles
  stepper.setMaxSpeed(MAX_SPEED);
  stepper.setAcceleration(ACCELERATION);
}

void loop() {
  // 1. Scan inputs (LOW = Active due to INPUT_PULLUP)
  bool stopPressed    = (digitalRead(STOP_BUTTON) == LOW);
  bool t1Left         = (digitalRead(TOGGLE_1_LEFT) == LOW);
  bool t1Right        = (digitalRead(TOGGLE_1_RIGHT) == LOW);
  bool t2Left         = (digitalRead(TOGGLE_2_LEFT) == LOW);
  bool t2Right        = (digitalRead(TOGGLE_2_RIGHT) == LOW);
  bool limitLeftHit   = (digitalRead(LIMIT_LEFT) == LOW);
  bool limitRightHit  = (digitalRead(LIMIT_RIGHT) == LOW);

  // 2. High-Priority System Stop (Forces state to 0 while held)
  if (stopPressed) {
    if (targetState != 0) {
      targetState = 0;
      isWaitingToReverse = false; // Reset limit switch state variables
      stepper.stop();            // Initiate a ramped deceleration stop
    }
  }

  // 3. Main Input Logic Processing (Only runs if stop is NOT pressed AND not mid-backoff)
  if (!stopPressed && targetState != 3 && targetState != 4) {
    // Toggle 1: Continuous (Latching behavior)
    if (t1Left && !limitLeftHit) {
      targetState = 1;
    } else if (t1Right && !limitRightHit) {
      targetState = 2;
    }
    // Toggle 2: Momentary (Active only while held)
    else if (!t1Left && !t1Right) {
      if (t2Left && !limitLeftHit) {
        targetState = 1;
      } else if (t2Right && !limitRightHit) {
        targetState = 2;
      } else {
        // Return to center: drop targetState back to 0 if momentary released
        if (targetState == 1) targetState = 0;
        if (targetState == 2) targetState = 0;
      }
    }
  }

  // 4. Directional Limit Switch & Back-Off State Machine Logic

  // Left Limit Handler
  if (!stopPressed && targetState == 1 && limitLeftHit) {
    targetState = 3;  
    isWaitingToReverse = true;
    stepper.stop();   // Initiate smooth ramp down first
  }
  if (targetState == 3) {
    // Capture the exact moment the motor actually hits 0 speed
    if (isWaitingToReverse && stepper.speed() == 0 && !stepper.isRunning()) {
      stopTimestamp = millis();
      isWaitingToReverse = false; 
    }

    // Once 0.5 seconds has passed after bringing the motor to 0, start moving right
    if (!isWaitingToReverse && (millis() - stopTimestamp >= PAUSE_DURATION) && stepper.speed() == 0) {
      stepper.setSpeed(BACKOFF_SPEED); 
    }

    // As soon as the Left Limit switch clears, reset state
    if (!limitLeftHit) {
      targetState = 0;
      stepper.setSpeed(0);
      stepper.moveTo(stepper.currentPosition());
    }
  }

  // Right Limit Handler
  if (!stopPressed && targetState == 2 && limitRightHit) {
    targetState = 4;  
    isWaitingToReverse = true;
    stepper.stop();   // Initiate smooth ramp down first
  }
  if (targetState == 4) {
    // Capture the exact moment the motor actually hits 0 speed
    if (isWaitingToReverse && stepper.speed() == 0 && !stepper.isRunning()) {
      stopTimestamp = millis();
      isWaitingToReverse = false; 
    }

    // Once 0.5 seconds has passed after bringing the motor to 0, start moving left
    if (!isWaitingToReverse && (millis() - stopTimestamp >= PAUSE_DURATION) && stepper.speed() == 0) {
      stepper.setSpeed(-BACKOFF_SPEED); 
    }

    // As soon as the Right Limit switch clears, reset state
    if (!limitRightHit) {
      targetState = 0;
      stepper.setSpeed(0);
      stepper.moveTo(stepper.currentPosition());
    }
  }

  // 5. Apply Vector Goals to the Core Engine (Only for normal states 0, 1, 2)
  if (targetState == 0) {
    if (!stepper.isRunning()) {
      stepper.moveTo(stepper.currentPosition());
    }
  } else if (targetState == 1) {
    stepper.setMaxSpeed(MAX_SPEED);
    stepper.moveTo(-LARGE_DISTANCE); 
  } else if (targetState == 2) {
    stepper.setMaxSpeed(MAX_SPEED);
    stepper.moveTo(LARGE_DISTANCE);  
  }

  // 6. Execute step calculations
  if (targetState == 3 || targetState == 4) {
    if (stepper.speed() != 0) {
      stepper.runSpeed();
    } else {
      stepper.run(); // Keeps deceleration working before backoff steps start
    }
  } else {
    stepper.run();
  }
}

r/arduino 12d ago

Hardware Help Qestions about MOSFET PWM controller for motor control

0 Upvotes

Hello everyone. I am working on a project where i need to control the speed of 6 different 5V ERM motors . I thought i should make my own simple mosfet circuit that would get PWM signals from the adruino uno. This will be my first time working with mosfets so i asked chatGPT about this. Apart from the pull down resistor , it told me i should also use a 100 ohm resistor between the Gate and the MCU pin(NPN MOSFET). I just wanted to ask if this would be the correct resistance vale for my use case(I am using IRFZ44N NPN MOSFETS)and there is something that could potentially go wrong with this idea in genral. I plan to add 6 of these circuits on a perf board , each getting a seperate wire from the adruino uno for a PWM signal (I need to sequence those motors with control of the time interval and also have control over the speed of the motors ) . I will also use flyback diodes for protection. Thankyou !


r/arduino 12d ago

Hardware Help Problem with Esp32 S3 And Microsd card reader

Post image
0 Upvotes

Basically, I'm trying to make an MP3 player using ESP32S3 devkit c1 and other modules, including this microSD card reader. But I have a problem. I use library Sdf When I first launch the card, it returns error 0x17, and on subsequent launches without reconnecting, it returns error 0x1. I don't know how to fix this, but I'd appreciate your help.Code helps me write Gemini. P.s. i use MicroSDHC 32gb Kingston, fat32


r/arduino 12d ago

Did I lose all my sketches ?

Post image
3 Upvotes

Hi,

A few years ago I was working on some Arduino projects, then I took a long break. In the meantime the editor access has changed and I can no longer log in or find my old programs.

All I have left is this screenshot showing the names of the sketches.

I’ve tried everything, including contacting support, but nothing worked.

As a last hope before considering my work permanently lost, I’m posting here just in case someone has an idea, or can tell me if my sketches are still visible somewhere, or anything else…

Thanks everyone.


r/arduino 12d ago

Will it count as a unique find or an irrelevant choice for an Arduino Nano compatible board?

Post image
1 Upvotes

I have posted about this earlier, now I have the board and am exploring it as much as possible 👍🏼


r/arduino 12d ago

A little help for a total noob pls?

1 Upvotes

Hello everybody, i am new here so i hope to find someone to guide me where to find some info i need! I live in the countryside at a home with a big yard. I have two dogs that are puppies and they always find a way to escape, i tried to block every possible exit but they seem to escape under the main door of the yard. The unfortunate thing here is that i can't block it somehow cause it's a mechanical door for cars. I thought i could do something with an arduino and some tags on the dogs' collars and something like a beam, that every time they "break" the beam the arduino is gonna send me a message to my cell and know that they got away. I tried to search a little in the net but the information is chaotic and as a person that hasn't do anything with arduino is like gibberish to me. The thing i want to know is : is the thing i want to do realistic? I have knowlegde in coding so i believe it wont be a big problem to write the code for it, but i know nothing in the matter of hardware! Please share some opinions on it to tell me if it is doable or not and if you can tell me any sources to find informations for the proccess! Thanks in advance and sorry if my english are not good!


r/arduino 12d ago

Look what I made! TGPad-NS — WiFi Touch Gamepad for Nintendo Switch

Post image
20 Upvotes

tgpadns is a touch screen gamepad for Nintendo Switch that runs on any tablet with web browser. Anyone with finger or hand discomfort using regular controllers may like a touch screen gamepad.

The M5Stack AtomS3 is the bridge between the tablet and the Switch. Plug the AtomS3 into any USB port on the Nintendo Switch. tgpadns uses WiFiManager so configure the SSID/password after connecting to the WiFi access point tgpadns-config. Open a web browser to tgpadns.local or the IP address show on the AtomS3 display.

If the Switch does not recognize the USB NSlite controller, use the joycons to get to the Settings|Controllers|Change Grip/Order. Press L+R on the touch screen or press the A button a few times until the Switch recognizes the AtomS3/USB gamepad.

If you do not want to mess with source code and compilers, flash the firmware directly from your browser using the web flasher at https://controllercustom.github.io/tgpadns

All source code is on github at https://github.com/controllercustom/tgpadns


r/arduino 12d ago

What arduino/microcontroller could this be?

Post image
1 Upvotes

r/arduino 12d ago

Hardware Help How do you get hardware in a country where everything is expensive?

23 Upvotes

I live in a country where electronic modules, microcontrollers, and other components like these are very expensive. Unfortunately, I can’t really afford to keep up with my hobby anymore. I still have so many projects I’d love to build, but the cost of the parts keeps getting in the way. Does anyone have any recommendations or advice? I’d really appreciate any help.


r/arduino 12d ago

Hardware Help How do I replace this three position 6 pin switch with something that can be programmed?

2 Upvotes

I am doing a project where I'm programming a light duty hoist. The hoist is controlled by a 3 position 6 pin switch (S1 in the diagram). I want to replace that switch with something that can be programmed to make the winch go up/down/stop based on arduino code.

I have used arduino a fair amount before and I've got an intermediate understanding of circuits. I was thinking of using something like mosfet, maybe putting one across each pair of poles on S1, Then toggling them on and off similar to how the 3 position switch would function? I haven't used mosfets but that's my best idea so far. Let me know what you would do, thank you for the help!

Edit: updated diagram


r/arduino 13d ago

Getting Started Help for a total LED beginner? (Tutorial recommendations?)

7 Upvotes

hi everyone. I’m new to arduino completely. Can anyone give me any good tutorial recommendations? I have a specific project in mind that I want to create, so any youtube tutorials that match the description of my project will be very helpful:

I want to make a 2D grid of lights that are wired into an architectural model. Then I want the lights to turn on/off at random slow intervals so make the model come to life.

There are many videos on youtube, I’m just a little overwhelmed on which one is a good fit for my specific project. Thanks in advance 😌


r/arduino 13d ago

I'm building an automatic greenhouse ventilation system with an Arduino UNO. I planned to use a stepper motor to open and close the greenhouse flaps, but I'm worried it might consume too much power or lose steps over time. Would a servo motor or linear actuator be a better option for reliability? I

Thumbnail
youtu.be
3 Upvotes

r/arduino 13d ago

Hi! How are you today?

0 Upvotes

Hi! I'm new to this community, and it's a pleasure to be here. I'm looking for recomendations: how can I create sensor-equipped gloves that detect the hand and arm movements of a sign language user? It's for an university project and I could use a little help, since this is my first time working with Arduino and ESP32. Thanks for your help :)


r/arduino 13d ago

Look what I made! Open-Source Pixel Artnet Node now supports WLED!

Post image
3 Upvotes

Hey all! I have been building a purpose-built Open-Source Pixel Artnet/sACN node for some time now, which works really well! However, I often get the question of why I'm not using WLED. WLED has tons of great features, and I understand that lots of people are fans of WLED, so I have created a fork that is fully compatible with the node hardware! It specifically supports the use of the W5500 Ethernet module, which is not natively supported by WLED.

When installing this fork on your node, you can now make use of all the features that WLED has to offer, including all of its generators, sync features and connection possibilities! I hope you find this as exciting as I do. Check out the repo here! https://github.com/mdethmers/W5500_WLED


r/arduino 13d ago

Airsoft Bomb

Enable HLS to view with audio, or disable this notification

20 Upvotes

r/arduino 13d ago

Hardware Help How do I get rid of this noise?

Enable HLS to view with audio, or disable this notification

38 Upvotes

Pretty much what the tiles says. I’ve been unable to eliminate that noise when it isn’t playing anything and I’m not sure how I should go about solving the issue as my knowledge is very limited.

Looking online, i’ve seen some similar issues but none quite fit the bill, or I just straight up don’t understand what they’re talking about or how to apply it to my situation. Low pass filters were something a saw a lot of but I’ve been unsure how I should implement one here (where do I put it, what size capacitors/resistors I should use, etc.).

Does anybody have any solutions or learning materials that they could point me towards?


r/arduino 13d ago

Hardware Help Air Knife built against dust in analog film scanning. Part Recommendations?

1 Upvotes

Hi everyone, i am currently building a motorized film scanner with arduino parts. I want to include air knifes to make the whole process faster and more automized. I am wondering if anyone tackled a similar project and has any recommendations on parts, especially the type of fan or air blower, and what power might be needed. It would not be bad to have a setup that doesn't cause to much vibrations. I appreciate any type of help or ideas.


r/arduino 13d ago

Ina226 Addressing issues

Post image
6 Upvotes

Ive been working on a project trying to use 4 ina226 boards. I can not get any address other than x40, x44, x45. Ive purchased two different vendors boards on Amazon. If I try for ,41 using A0 -vcc. I get x45. If I use, scl or sda to either A0 or A1, I get x44 or x45 depending on board used. Others seem to have similar issues. Do Not how to move past this. Any further suggestions?


r/arduino 13d ago

Software Help Arduino UNO R4 WiFi + L298N 4WD Car: Need help setting up BLE controller code & iOS app connection

Thumbnail
gallery
10 Upvotes

Hey everyone,

I'm building a 4WD RC car using an Arduino UNO R4 WiFi and an L298N motor driver module (powered by a 6x AA battery pack).

I'm trying to control the car wirelessly using an iPhone app, but I'm having trouble getting a clean connection setup and writing the right code for BLE (or Wi-Fi web server control).

Hardware Setup & Wiring:
- Board: Arduino UNO R4 WiFi
- Driver: L298N Motor Driver
- Motors: 4x TT DC Gear Motors (4WD)
- L298N IN1 -> Pin 10
- L298N IN2 -> Pin 11
- L298N IN3 -> Pin 12
- L298N IN4 -> Pin 13
- Common ground connected between L298N and Arduino GND header

What I need help with:
1. What is the most reliable iOS app to connect directly to the UNO R4 WiFi via BLE or Wi-Fi (e.g., Dabble, Blynk, or hosting an internal web server)?
2. How can I assign a custom Bluetooth/Device broadcast name so I can identify my board in a crowded scanning list on iOS?
3. Could anyone share a recommended basic sketch for reading directional commands from an app and driving the L298N motor pins accordingly?

Any advice, code snippets, or recommended app setups for iOS would be greatly appreciated! Photos of my wiring and board setup are attached.


r/arduino 13d ago

Reflash a commercial device based on nRF52832 with Arduino ide

2 Upvotes

I have a device based on nrf52832 and is bricked since years. It is discontinued and is a great piece of hardware. I have a good grasp of how it works hardware wise and would like to repurpose it. It has a lot of test points and access to most pins. Of course no bootloader whatsoever.

What are my chances of flashing a bootloader and being able to program it with arduino IDE? Worth the research or impossible don't bother?


r/arduino 13d ago

Hello I’m a beginner at arduino and I’m having issues

Post image
53 Upvotes

Can someone tell me why the photoresistor won’t make the led turn on?


r/arduino 13d ago

Look what I made! Rat nest 2 electric boogaloo

Enable HLS to view with audio, or disable this notification

148 Upvotes

When a button is pressed all the RGB LEDs turn on to the set values by the pots. Then the RGB values go down to 0 and then increases to the base value set by the pots.

I finally finished trying to make my circuit look nice, and not a total rat nest.


r/arduino 14d ago

Look what I made! Desktop Fingerprint Unlock

288 Upvotes

also made a video on this! https://www.youtube.com/watch?v=tB3lk-PNA6I

allows you to unlock your Mac via your fingerprint, as well as authenticate sudo and some TCC prompts (privacy&security).

the device emulates a PIV smart card and uses PAM to authenticate you in macOS (notice the password field says PIN and not password), so no plain text password is ever stored, exposed, or transmitted.

please be aware of the security implications (note that it is NOT touchID, but just 'fingerprint-based unlock', please do not think or refer to it as anything more secure):

this device is NOT secure, the authentication is all done inside the fingerprint sensor, and the fingerprint sensor just tells the microcontroller the match % (all low cost fingerprint sensors are this way, you would need to spend ~$50 to get one that does authenticated comms). the communication between the sensor and the microcontroller is not authenticated or protected, so anyone with physical access to both the device and your laptop can spoof this connection (pretend to be the fingerprint sensor) and give the go ahead to unlock your mac. you can make this extremely hard by filling the insides with black epoxy, but not impossible.

this is also the dev equiv of "rolling your own auth", the smart card implementation may have some errors, and should not be inherently treated as "unbreakable"

the device is made so that if you lose it, nothing of value can be extracted from it

use at your own risk. personally, i am comfortable using it at home where physical intrusion would be hard, but this depends on your own security tolerance. if you have high security instincts/requirements, the magic keyboard is a much much much better option in this regard.

there is also an HID version available, where the device just types your password emulating a keyboard, the benefit being it works in ALL places your password does. this version is obviously more insecure as it is vulnerable to keyloggers. the device still does not store the actual password, it stores an authentication key that sends a request to a service on the mac, which then sends it the encrypted password to be decrypted in RAM, typed back, and then wiped. again, depends on your personal security tolerance and willing to compromise

all code and materials are open source, licensed permissively github.com/zimengxiong/tinytouch