r/ArduinoHelp • • Jun 25 '26

Ultrasonic Sensor fail after second trigger

2 Upvotes

Hello, all --

I've been designing a "mimic" using an old chest, a linear actuator, and a speaker system. Everything had been working fine enough on desktop testing a few weeks ago, but now I'm getting a stalled loop after a second triggering event.

In short:

Ultrasonic Sensor is measuring distance.

If distance < 85", play from the mp3 queue

if distance < 36", play from mp3 queue, and activate the linear actuator. Wait 5s. Reverse linear actuator.

The problem I'm encountering is that the sensor will register either status, and it will work fine for exactly one loop, then the whole thing stalls out and it bricks up on me and I have to reset it.

It ONLY happens after the < argument is triggered for a second time. The first time through it works perfectly. I cannot figure out why this is happening. Can anyone please help?

#include <DFRobotDFPlayerMini.h>


#include <SoftwareSerial.h>


int rxPin = 5;
int txPin = 6;


SoftwareSerial fxSerial (rxPin, txPin);
DFRobotDFPlayerMini fxPlayer;


const int openPin = 7;
const int closePin = 8;
const int ENAPin = 9;
const int trigPin = 10;
const int echoPin = 11;


float duration;
float distanceCM;
float distanceIN;



void setup() {
  Serial.begin(9600);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(openPin, OUTPUT);
  pinMode(closePin, OUTPUT);
  pinMode(ENAPin, OUTPUT);
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);


  fxSerial.begin(9600);
  fxPlayer.begin(fxSerial);
  fxPlayer.volume(30);
  delay(1000);


}


void loop() {
  // Close the box
  digitalWrite(closePin, HIGH);
  digitalWrite(openPin, LOW);
  digitalWrite(ENAPin, 250);
 // start with a clean signal
 digitalWrite(trigPin, LOW);
 delayMicroseconds(20);
 // send trigger signal
 digitalWrite(trigPin, HIGH);
 delayMicroseconds(10);
 digitalWrite(trigPin, LOW);
 // return pulse duration in microseconds
 // if set to HIGH, pulseIn() waits for the pin to go from LOW to HIGH
 // stops timing when pin goes back LOW
 duration = pulseIn(echoPin, HIGH, 99991);
 // convert m/s to in/microsec
 // 343 m/s = 0.034 cm/microseconds
 distanceCM = (duration * 0.034) / 2;
 // convert to inches, 1 in = 2.54cm
 distanceIN = distanceCM / 2.54;
 // print distance
 Serial.print("Distance: ");
 Serial.print(distanceCM);
 Serial.print(" cm | ");
 Serial.print(distanceIN);
 Serial.println(" in"); 
 delay(100);


if (distanceIN <= 85) {
    if (distanceIN <= 36) {
        Serial.println("!!!ROAR!!!");
        fxPlayer.play(random(1, 8));
        digitalWrite(openPin, HIGH);
        digitalWrite(closePin, LOW);
        digitalWrite(ENAPin, 250);
        delay(5000);
        digitalWrite(openPin, LOW);
        digitalWrite(closePin, HIGH);
        digitalWrite(ENAPin, 250);
        delay(1500);
    } else {
        Serial.println("=GROWL=");
        fxPlayer.play(random(1, 8));
        delay(1500); 
    }
} else {
    Serial.println("=Shhhh=");
    digitalWrite(closePin, HIGH);
    digitalWrite(openPin, LOW);
    digitalWrite(ENAPin, 250);
}


}

The Code:


r/ArduinoHelp • • Jun 25 '26

Is arduino sufficient/strong enough for an outdoor water level sensor meant to measure the level of a river?

2 Upvotes

So for context, my friend and I are fresh grads trying to help our local community by doing a simple level sensor for one of the rivers. I believe these are the only necessary components bar the power supply and chassis?

Arduino or something like arduino but better
Submersible Hydrostatic Pressure Sensors
Siren/Alarm
LED Industrial

Arduino was the first thing that came to mind because well, it's the only thing I have experience with. I was also thinking raspberry pi but it seems too much for a project that can probably be done with a microcontroller like arduino, I don't think a minicomputer is all that necessary. But at the same time, I think an arduino is far too weak for this. I mean, I have this bias that it's used mainly in diy basic stuff, certainly not for something of a pretty large scale like this that requires lasting materials.

Thank you!


r/ArduinoHelp • • Jun 20 '26

Que programa me recomiendan

2 Upvotes

Holaa como están. Quiero hacer un proyecto con arduino y tengo duda que programas usar para hacer la simulación del circuito y/o conexiones y del modelaje del esqueleto del mismo ( es un dron acuático) que software me recomiendan gracias 😁


r/ArduinoHelp • • Jun 19 '26

Voltage level shifter but from 30v 2A to 3.3v 20mA

Thumbnail gallery
2 Upvotes

r/ArduinoHelp • • Jun 16 '26

Small motor replacement

Post image
2 Upvotes

Hi, I know this isn't necessarily arguing, but I'm trying to source a replacement motor for my rotating Zippo display case. Would be very appreciative if someone could point me in the right direction


r/ArduinoHelp • • Jun 14 '26

Deal: Electrobot RFID Starter Kit for UNO R3 from Knowing to Utilizing, Servo, RC522 RFID Module, PS2 Joystick, Learning Kit with Guidebook

Thumbnail amzn.in
2 Upvotes

Is this a best starter kit


r/ArduinoHelp • • Jun 05 '26

ESC on Atmega328p Questions & Help : Code profiling for Arduino nano (Atmega328p)

Post image
2 Upvotes

r/ArduinoHelp • • Jun 04 '26

VVB001> PLC S7 1500> PLATFOM

2 Upvotes

Hi everyone, I am currently working on a vibration analysis project using an ifm VVB001 sensor. I am routing the data through a Siemens S7-1500 PLC and sending it to a custom monitoring platform I developed in Python. Currently, I can successfully retrieve and display cyclic data (V-RMS, A-RMS, temperature, etc.) on both the PLC and my platform.

My current challenge is streaming the raw time-domain vibration signal from the sensor to the Python platform to perform a Fast Fourier Transform (FFT). If anyone has experience extracting and transmitting raw waveform data from this sensor via an S7-1500, I would highly appreciate your insights or advice!


r/ArduinoHelp • • Jun 03 '26

Trying to forward Serial1 reading to Serial.println and only getting numbers

2 Upvotes

I have a battery with a built-in BMS that has a serial console port. It has a baud rate of 115200 and I have been able to successfully send commands and read clean data from it via the Arduino IDE serial console. Considering I can communicate to the battery via the serial console, that suggests there shouldn't be any weird encoding issues.

I want an Arduino Mega to read from this using the Serial1 connection. The problem is, if I try to forward what the battery sends to the Arduino, all I get is a jumble of nothing but numbers. When connecting to the BMS directly, typing "help", the output is mostly text.

Here's what I tried in void loop()

while (Serial.available() > 0 {
  Serial1.print(Serial.read());
}

while (Serial1.available() > 0) {
  //THE NEXT 4 LINES ARE VARIOUS THINGS I TRIED,
  //I UNCOMMENTED THEM ONE AT A TIME
  //String incomingtext=Serial1.readString();
  //char incomingtext=(char)Serial1.read();
  //char incomingtext=Serial1.read();
  //int incomingtext=Serial1.read();
  
  //I ALSO TRIED THE FOLLOWING ONE AT A TIME WITH EACH ABOVE COMBO
  //Serial.println(incomingtext);
  //Serial.println((char)incomingtext);
  //Serial.println(" "+incomingtext);
}

The first while() loop just takes whatever I enter from the serial console through USB to the BMS. I have no idea if the BMS is receiving the correct commands, but it does have a consistent output if I type different things.

Whenever I type "help" repeatedly, it's usually a consistent output, like this:

10410110811213


r/ArduinoHelp • • Jun 01 '26

What do you guys think of my design?? I have made an RPM reading module for a FSAE racecar that converts AC voltage signal from Crankshaft Position Sensor to PWM signal to be analyzed in an MCU like ESP32 or Arduino

Thumbnail gallery
2 Upvotes

r/ArduinoHelp • • May 24 '26

My Arduino not being read by my laptop

2 Upvotes

This is a issue I am facing for some time
My Arduino is not being read by my computer
When ever I try to connect it every com port is unknown and after selecting board when I click upload it just gets stuck on uploading
And while trying the online Arduino the board is not being found
Can I get some help I need to submit a project soon


r/ArduinoHelp • • May 24 '26

Arduino and stepper motor help

2 Upvotes

So I'm working a project.. just starting out and thought first... let's get the stepper motor to run. Watched this video and followed along.
https://www.youtube.com/watch?v=wcLeXXATCR4&t=8s
code I ran is below
What am I missing? should the code be uploaded and then just start running? driving me nuts trying to solve what should be a simple problem. Maybe it's not the code.. maybe my driver is fried .. not ever sure where to begin trouble shooting this

I appreciate any good advice you can give a newbie

Thanks in advance

code:

// pin connections

const int dirPin = 2; // direction pin

const int stepPin = 3; // step pin

void setup() {

pinMode(dirPin, OUTPUT);

pinMode(stepPin, OUTPUT);

// set direction of rotation to clockwise

digitalWrite(dirPin, HIGH);

}

void loop() {

// take one step

digitalWrite(stepPin, HIGH);

delayMicroseconds(2000);

// pause before taking next step

digitalWrite(stepPin, LOW);

delayMicroseconds(2000);

}


r/ArduinoHelp • • May 23 '26

My final project: Smart photography studio

2 Upvotes

Hi , I want to create a project for a smart photography studio that includes the following functions:

* Create an app to perform the instructions.

*Controlling brightness according to the object via a sensor.

*Align the object to the center.

*create smart lighting modes (e.g., cinema, gaming)

* Controlling the EVA foam background with a motor

I want to know if I use a Arduino Mega/Leonardo or ESP32 and what is the best motor to control the background...


r/ArduinoHelp • • May 21 '26

Help with setup - Spreadsheet to run LED's

2 Upvotes

I'm new to setting up an arduino and need help with how to get data from a spreadsheet to light up LED's. I've attached images of where I've got to and need help pointing in the direction of next steps please.

I have a spreadsheet with an input screen (Green boxes with amount) this drives the data screen with zero's and one's, where 'one' should light up the corresponding LED.

I want this to change the lights in real time so when the amount input is changed the lights will change.

Any help appreciated.


r/ArduinoHelp • • May 04 '26

Arduino Research Project

Thumbnail reddit.com
2 Upvotes

r/ArduinoHelp • • Apr 30 '26

I need help

2 Upvotes

I am working on my senior project for my engineering class and im trying to create a motion activated sink that dispenses both soap and water into one stream and after a few seconds the soap shuts off to only let water run. I’m using a arduino uno r3 board a pir sensor and a 2 relay module. is there a way i could wire all these components onto my board or am i cooked. (im not very familiar with arduino and this is my first time using it) this is what i have so far


r/ArduinoHelp • • Apr 22 '26

Why my Arduino shuts down when I connect it to the Vcc of the sensor?pls

Post image
2 Upvotes

My sensor is the SFR05 ultrasonic distance and the arduino uno


r/ArduinoHelp • • Apr 22 '26

SRF05 Ultrasonic distance sensor and Arduino

Post image
2 Upvotes

Each time that I try to connect the sensor Vcc pin with the Arduino it shuts down. Somebody can explain why please?


r/ArduinoHelp • • Apr 17 '26

can anybody tell me if it is possible to download the esp32 boards to the arduino ide, but as a tar.gz file

2 Upvotes

its because i have a pretty bad wifi connection for my computer, so it would be nice if i could download the boards without the Library Manager


r/ArduinoHelp • • Apr 12 '26

Newbie with Arduino. Is this diagram right for the perfboard?

2 Upvotes

Hello! I am a newbie with using the arduino. We currently have a huge final school project, and we're going to create a flood detection system, along with other systems.

We already have a physical prototype. Although it makes use of a breadboard. Now, as the wiring can be messy, we opted to use a perfboard/matrix board to have it look professional and durable for the final demo. We started our research, and this is what we concluded.

In the attached images, you can see the initial diagram created in Wokwi. The other is the edited version connected to the perfboard.

Is the perfboard wired correctly as to how it's wired in the Wokwi diagram? Do you have any tips and tricks as a newbie? What materials should we use? What should we anticipate when soldering? We plan on just soldering to the perfboard, and not to the pins connected to the sensors, buzzers, etc. Would that be fine?

For reference:
(image 1)
potentiometer 1 = ph sensor
potentiometer 2 = turbidity sensor

(image 2)
green highlight = connected to the Arduino with M to M jumper wires
blue highlight = connected to the rest of the components (servos, motors, buzzers, etc.) via jumper wires

Important note:
The perfboard is 7x9 cm. We will be connecting the wires to the perfboard through the male header pins of the jumper wires. We have limited time, and thought this way would be the most efficient.

Thank you so much for the help!!


r/ArduinoHelp • • Apr 09 '26

Servo details? (metal discs)

2 Upvotes

I know this is not specifically about Arduino (not sure where else to post though?)

But I -am- using it with an Arduino. :)

Servo: 25KG Digital RC Servo RDS3225

It comes with the with the round metal discs (to attach to each side one with gear/teeth)

Its 20mm wide disc.

Q: where can I get info on this disc? specifically the hole position/spacing? (I think they are M3 sized holes?)


r/ArduinoHelp • • Apr 09 '26

Guys, i used this nrf24l01 module with antenna. Then i did everything as right but i used arduino's 3.3V without capacitor or adapter like AMS1117.So nrF is heating. And the final question is the module fried or it is just gonna by fixing power problems?

Post image
2 Upvotes

r/ArduinoHelp • • Apr 03 '26

Why does my stepper cause main loop to slow down?

2 Upvotes

I have a big built a pretty complex project with Arduino Uno 3 and it's working, but only for 1-2 minutes and then it randomly stops - most of the times when one of two servos performs a move.

I tried to understand why this is happening and I found out that moving my stepper up somehow messes Arduino's main loop() - it slows it down (in my entire code there is no delay() - I control stepper using micros() ). To demonstrate this, I added a LED to blink every 6000th loop. It blinks evenly until I start to move the stepper (see the video).

My setup is: PSU 24v 14.5A from Ender 3v2, then I reduce and split the voltage to 5v and 12v bridges and they power all the components, including Arduino. The stepper is Z-stepper from Ender 3 v2 also getting 12v from the bridge. I use A4988 driver and it's set to 0.5V (before it was set to 0.75V but it doesn't affect how stepper messes up the LED blinking).

Any help to understand why my stepper makes LED slow down would be appreciated

#include "Pins.h"
#include "Logic.h"

int currStep = 0;
constexpr int stepCount = sizeof(logic::steps)/sizeof(logic::steps[0]);
#define RUN_STEP(_param) logic::steps[_param].func(logic::steps[_param].param)

void setup() 
{
    Serial.begin(9600);
    Serial.println(F("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nPROGRAM IS RUNNING"));
    
    initAllPins();
    logic::initAllComponents();
    logic::waitForUserToPressButton(Pins::BtnStart);
}

void loop() 
{
    if(currStep < stepCount && RUN_STEP(currStep))
        ++currStep;
    else if(currStep == stepCount)
        currStep = 2; // start from 2 to skip "homeAll" step
    
    static int m = 0;
    static bool mbool = false;
    ++m;
    if(m == 6000)
        digitalWrite(Pins::LED, mbool),
        mbool = !mbool,
        m = 0;

    static bool suc;
    if(!digitalRead(Pins::BtnMoveStepper) && servoSlide.reachedPosition())
        suc ? servoSlide.moveHome() : servoSlide.moveWork(),
        suc = !suc;

    // e-stop
    if(currStep != 1000 && !digitalRead(Pins::BtnStop))
    {
        currStep = 1000;
        stepper.moveBy(Stepper::down, 30, 100);
        logic::enableSuck(false);
    }

    logic::updateStateForAllComponents();
}

EDIT (SOLUTION): Turned out I had a stupid bug in my Stepper class - every single time you call a function "moveBy" it turns the LED off...


r/ArduinoHelp • • Mar 29 '26

Powerstarve Problem

2 Upvotes

hello so

i have an Arduino Nano

a Powerbank Module which provides 5V

2 4ohms 3W speaker

then i have a DFMiniPlayer

4 Water Proof Prox Sensor

Oled Screen I2C 0.96 INCH

so the problem is when this is all connected

my Powerbank Module Crashes i suspected it to be powerstarving since when the Speaker gets to play something with voice the Light on my Powerbank Module Blinks until i clear the obstacle in the Proximity Sensor

my question is how would i fix this?

PS; i did try to put a powerbank instead and it worked fine but i wanted it to not include a Powerbank if possible what could be done properly here? I'm quite lost also I'm new to Arduino and this is just for our project