/r/arduino

Photograph via snooOG

An unofficial place for all things Arduino!

We all learned this stuff from some kind stranger on the internet. Bring us your Arduino questions or help answer something you might know! 😉

/r/arduino

676,572 Subscribers

1

arduino microstepping

Hello, I am trying to use microstepping using none other than DRV8825, Arduino Mega 2560, and ramps1.6.

How should I connect the m0, m1, and m2 pins between ramps1.6 and drv8825, and can I know the pin numbers? Even looking at the picture, I don't know what it is haha...

https://preview.redd.it/jvhwiiutee4e1.jpg?width=750&format=pjpg&auto=webp&s=b49a1c81bc66abd840b0021a40ed630d9873d410

0 Comments
2024/12/02
08:46 UTC

1

Would an app to identify electronic components help Arduino users?

I am thinking of making an app that uses your phone camera to identify electronic components like resistors, capacitors, ICs, etc., and provide information such as data sheets and specifications. There can also be additional things like offline scanning and guide for beginners. Is that useful for your Arduino projects? What features would you have liked to see? Would welcome all thoughts and ideas about this.

0 Comments
2024/12/02
09:29 UTC

1

It works well at first but then i need to touch it

I have a stepper motor attach to an Arduino uno. After uploading the code, it works well at first. Then i plug it off and rest for a moment. Trying it again, at first i thought that the code is not working. But after touching it someplaces, on pins below and top of it, it working but not that good, the stepper has noise not like when it first work.

I tried it with other arduino , 2 to be exact and its the same, the uno is need to be touched.

Trying in tinkercad. It was working well. I can’t identify what is wrong here

0 Comments
2024/12/02
10:11 UTC

2

guys, please, help

can’t upload my sketch on arduino nano because of this. what can I do???

13 Comments
2024/12/02
10:29 UTC

1

Can two rf remote control the same module

I have a rf module and can be pair using the button on the rf module. If for instance i have two same remote with the same frequency and pair one remote to the rf module will both remotes control the rf module even the other one is not pair?. If no please explain

0 Comments
2024/12/02
10:18 UTC

1

avrdude: ser_open(): can't open device "\\.\COM4": The system cannot find the file specified.

I'm getting this error and I've tried just about every solution online - changing the COM port, closing the serial monitor tab, trying multiple codes. I tried using a different Arduino with the same cable and that worked fine, so I'm guessing it's an issue with my Arduino itself. I tried rebooting it with the reset button on the Arduino, and the lights don't blink like they're supposed to. But the Arduino is turning on when I plug it in, the ON and L lights are lit up.

I'm still very much a beginner in this field, please help me out.

2 Comments
2024/12/02
07:06 UTC

3

Easy project for a 9 year old who loves music?

I was looking at something picollo (which seems to be obsolete?). The child loves to play the piano and it would be great to "see" the music as the device hears the music without any wired connections to an analog pianos.

Any links with easy tutorial and link to parts?

5 Comments
2024/12/02
04:53 UTC

1

Flight Sim Panel Theory (if it were YOU)

Good day everyone,

To preface this post, I'm brand new to this so please forgive my ignorance up front.

I have a fairly in depth F/A-18C flight sim cockpit - So far I have purchased all of my current panels and it adds up quick. In my attempts to get away from paying $1,000ish per panel, I would like to start creating my own. I do already have 2 3D printers and a 40w laser cutter, so I have the equipment to make panels. However, I do not have the knowledge for the Arduino side of things.

Of course, I'm perfectly capable of doing my research but I wanted to reach out here to get opinions.

If this were YOU; what components are you using and what is your theory behind it so you ensure there is no ghosting effects, multiple switches being used at the same time, etc. Are you using a single Arduino or multiple?

I'm looking at using a Leonardo so once it is setup correctly, it can be mostly plug and play and key binds made within the sim (in theory).

Refer to my rudimentary sketch showing what all needs to be included - What isn't listed is the addition of backlighting with 2.7mm 5v cob LED strip that will be integrated into the laser cutting layers.

If any of you wiring guru's include wiring diagrams, that's a huge plus just to help my understanding!

https://preview.redd.it/81pa4ail3d4e1.jpg?width=1200&format=pjpg&auto=webp&s=c8bf990069d6bc80e23a52fb3193bc2f02e7e998

7 Comments
2024/12/02
04:35 UTC

1

Want to do a project, don't know which Arduino to look for

Full disclosure, this would be my first time with an Arduino.

I am looking to program an Arduino to sequentially turn on (fade on ideally) 6-8 LED lights that would be organized to resemble a constellation in the sky, and then slowly fade them off. The process would cycle until the power switch was hit, and begin when it was flipped to the on position.

Is there one model of Arduino better than the other for doing this?

2 Comments
2024/12/02
03:26 UTC

4

JST connectors for Arduino project (Nano clone)

Hi everyone!

I just built a prototype for a personnel project of mine. The project is lodged in a guitar pedal aluminum case, so I just soldered the wires directly to the Arduino board (Nano clone in my case).

I plan on making more copies of this project, and I'm thinking of using connectors. Even though the connection between the wire and the Arduino is permanent, I reckon I'll be happy to have a way to debug any issues more rapidly this way.

I can't use DuPont connectors because the circuit is upside down. I was thinking about using 6-pin JST XH connectors with a 2.54 mm pitch (I will need three of them for my project). Just to be clear, I would solder the male pins to the Nano and connect the wires to the female connector.

I searched quite a bit on the internet and although they should fit without an issue, I didn't see anyone using them for their project, which isn't a good sign. I'm wondering if I'm missing something here.

Thanks in advance for your guidance!

17 Comments
2024/12/02
01:22 UTC

1

can we get time/date from pc/phone usb with hid boards (pro micro 32u4 esp32s2/s3 ?

i made a clock code and i have an manual auto update time date trought the serial console.

it requiert to open ide software or similar.

i wonder if it possible to get the time from usb descriptor when plugging my board to any usb from a pc or a phone.

without any control over the said system.

i know than usb hid is complex to learn.

i already used successfully 32u4 and pro micro and esp32s2 for making joystick and keyboard but i just used existing library.

actually i can buy esp32s3 for under 5$ what raise the complete clock at just 10$.

im bored of all that clock that need a button for changing the hour because shifted of summer time.

and now day everyone have to own a internet phone .

so maybe not requiered to use radio controled time .

i dont even know by name .

also i will use a battery to charge on usb.

not even know if we can charge a battery from a phone.

but a least i know we can charge battery from computers.

16 Comments
2024/12/02
00:59 UTC

1

Arduino code not working on TinkerCAD (LCD not turning on)

Hello! I am making a school project that requires us to share the tinkerCAD link. I have made the actual circuit in real life and the code works properly. When I try to run it on TinkerCAD, the LCD doesn't turn on. I'm new to coding, help would be appreciated!

https://preview.redd.it/lhfilm7azb4e1.jpg?width=2200&format=pjpg&auto=webp&s=ee9807ee1aa6c7413e7e53a4dee6a2a455e45121

#include <EEPROM.h>
include <LiquidCrystal_I2C.h>

// Initialize the LCD with the pins connected to the Arduino 
LiquidCrystal_I2C lcd(0x27,  16, 2);

define MoistureSensorPin A0 // Analog pin for the soil moisture sensor
// Define button pins
  define bt_set  A1
  define bt_up   A2
  define bt_down A3
  define motorRelay 9 // Pin for the motor relay

  int moistureValue; 
  float setL_moisture = 30.0; // Default low moisture level
  float setH_moisture = 70.0; // Default high moisture level float moisture = 0;
  int Set = 0, flag = 0, flash = 0;

void setup() { 
  pinMode(MoistureSensorPin, INPUT);
  pinMode(bt_set,  INPUT_PULLUP); 
  pinMode(bt_up,   INPUT_PULLUP); 
  pinMode(bt_down, INPUT_PULLUP);
  pinMode(motorRelay, OUTPUT);
  Serial.begin(9600); // Start serial communication 
  lcd.setBacklight(HIGH); 
  lcd.init (); // Initialize the LCD with 16 columns and 2 rows 
  lcd.clear(); lcd.setCursor(0, 0); 
  lcd.print("   Welcome To   "); 
  lcd.setCursor(0, 1); 
  lcd.print("Plant Watering ");

// Initialize EEPROM values 
  if (EEPROM.read(0) == 255) { 
// First-time run, save default values to EEPROM 
  EEPROM.put(10, setL_moisture);
  EEPROM.put(15, setH_moisture);
  EEPROM.write(0, 0); 
}

// Retrieve stored values from EEPROM 
  EEPROM.get(10, setL_moisture);
  EEPROM.get(15, setH_moisture);
  delay(2000); // Wait for 2 seconds 
  lcd.clear(); 
}

void loop() { 
// Read moisture sensor value and map it to percentage 
  moistureValue = analogRead(MoistureSensorPin);
  moisture = map(moistureValue, 0, 876, 0, 100);

// Serial monitor
  Serial.print("Moisture: ");
  Serial.print(moisture);
  Serial.println("%");

// Control motor relay based on moisture levels 
  if (moisture > setL_moisture) { 
   digitalWrite(motorRelay, LOW); // Turn off the motor 
} 
  else { 
digitalWrite(motorRelay, HIGH); // Turn on the motor 
}

// Button handling for setting modes 
  if (digitalRead(bt_set) == 0) {
   if (flag == 0) { 
   flag = 1;
   Set = Set + 1;
   if (Set > 2) { 
    Set = 0;
    flash = 0; 
    } 
    elay(200); // Debounce delay 
} 
  } else { flag = 0; }
// Button handling for increasing set values 
  if (digitalRead(bt_up) == 0) { 
  if (Set == 1) { 
  setL_moisture = setL_moisture + 1;
  if (setL_moisture > 100) setL_moisture = 100; // Limit to 100% 
  EEPROM.put(10, setL_moisture); 
} 
if (Set == 2) {
 setH_moisture = setH_moisture + 1;
 if (setH_moisture > 100) setH_moisture = 100; // Limit to 100%
 EEPROM.put(15, setH_moisture); 
}
delay(10); // Debounce delay 
}

// Button handling for decreasing set values 
if (digitalRead(bt_down) == 0) {
 if (Set == 1) {
 setL_moisture = setL_moisture - 1;
 if (setL_moisture < 0) setL_moisture = 0; // Limit to 0%
 EEPROM.put(10, setL_moisture); 
}
 if (Set == 2) {
 setH_moisture = setH_moisture - 1;
 if (setH_moisture < 0) setH_moisture = 0; // Limit to 0%
 EEPROM.put(15, setH_moisture); 
}
delay(10); // Debounce delay 
}
// Display current moisture level and motor status
 if (Set == 0) {
 lcd.setCursor(0, 0);
 lcd.print(" Moisture: ");
 lcd.print(moisture, 1);
 lcd.print("%  ");
lcd.setCursor(0, 1);
lcd.print(" Motor: ");
if (digitalRead(motorRelay) == HIGH) {
  lcd.print("ON ");
} else {
  lcd.print("OFF");
}
lcd.print("   ");
} else { // Display setting mode lcd.setCursor(0, 0);
 lcd.print("  Setting Mode  ");
lcd.setCursor(0, 1);
lcd.print("L:");
if (Set == 1 && flash == 1) {
  lcd.print("    ");
} else {
  lcd.print(setL_moisture, 1);
}
lcd.print("%  ");


lcd.setCursor(9, 1);
lcd.print("H:");
if (Set == 2 && flash == 1) {
  lcd.print("    ");
} else {
  lcd.print(setH_moisture, 1);
}
lcd.print("%  ");
}

// Flash the display in setting mode 
if (Set > 0) {
 flash = !flash; 
} 
delay(1); // Small delay for loop 
}
0 Comments
2024/12/02
00:36 UTC

5

Could use some help figuring out why the 7 segment display isn't functioning

7 Comments
2024/12/01
23:18 UTC

1

Error 516 Arduino Uno & Bluetooth HC-06

Hello, I have a problem, I am making a robot that works with a Bluetooth module and is controlled through an App in MyApp Inventor.

The components are 4 sg90° servos, Arduino Uno board, and a Bluetooth HC-06 (attached link of the circuit: https://www.tinkercad.com/things/5abqJnyhW3r-spectacular-leelo-hillar?sharecode=Y3dhSwCAj2jzYFZ5xzBGxgQ8i_7QOwgkIlz-t9giotc).

It happens that when I move the servos of the robot's "hands" from the app everything is fine, but when the legs are activated after a few seconds the connection is lost. The Bluetooth remains on as if it were connected but it is not, although sometimes it turns off and other times it does not, when it stays on the legs also stay on (video attached)

It won't let me put a screenshot of my app but the error is "516: Broken pipe"

3 Comments
2024/12/01
23:16 UTC

1

Novice looking for the correct way to safely charge a 400mAh LiPo battery connected to a Seeed Studio XIAO ESP32-C3

My understanding is that the ESP32-C3 can safely manage the charging of the LiPo battery and no additional boards or circuitry is needed. My preference would be to simply plug a standard USB charger into the ESP32-C3's USB-C port. I plan to have up to 8 of these devices which can be plugged into a charging station and left over the weekend or at least overnight (I don't need fast charging by any means).

Is there something I need to consider in this setup like using a specific LiPo charger or can I simply use a multi-port USB charger like this one and rely on the ESP32-C3's built-in charging management?

I've never built a battery-powered project before so I'm trying to make sure I'm doing it correctly and reducing risks as much as possible.

6 Comments
2024/12/01
22:27 UTC

4

Gift Help: Trying to find an Arduino tank that can shoot projectiles

Does anyone know of any good Arduino tank kits?

Trying to find a fun project for 11 year old nephew who wants to learn more about electronics. He's been writing Python code for 2 years now and could probably pick up C pretty easily.

More context: Specifically trying to find a toy that would come unassembled and would be built by the kid. Also should be programmable in Arduino / MicroPython

3 Comments
2024/12/01
22:21 UTC

1

HELP - Sending information from one Arduino uno to another.

I’m trying to send information from one Arduino to another. More specifically, one Arduino has a distance sensor and the other Arduino has the motor driver. What I want to happen is that when the distance is great, the motor will move, and when the distance is small, the motors will stop moving. I was thinking that depending on the distance , a variable is equal to a value, and that is sent to the other Arduino, And depending on the value, the motors move or don’t. I do not know how to make this happen.

1 Comment
2024/12/01
21:49 UTC

438

I created a digital dice roller for D&D using an ATtiny84 and Arduino!

Checkout the project site for a small write up, source code, more photos, schematics, parts list, and 3D models! https://zbauman3.github.io/digi-roll/

35 Comments
2024/12/01
22:20 UTC

0

Does anybody know how to use a TTL/Serial camera like this?

Ah the classic story, I purchase a part from Amazon and it doesn't have good docs or a datasheet. I figured that'd be fine in this case, because how hard could a Serial camera be? But I can't get a response from any Serial command I try to send. The unit could be defective, but it looks well put together/professional enough.

https://www.amazon.com/gp/product/B0845N8QGN/ref=ask_ql_qh_dp_hza

1 Comment
2024/12/01
19:51 UTC

1

Cellular capabilities

It's been a while since I've tried to do something using Arduino, but I want to try and make a wireless water sensor. The sensor is too far to use wifi but is close to a cell tower. I've seen some affordable cellular arduinos but those seem to be the outdated 2G kind.

I've looked around for some options like the SIM7600G-H CAT4 4G (LTE) Shield, the Arduino cellular module for Arduino pro (I'd prefer a solution for an Arduino nano), a custom built PCB as seen in this https://youtu.be/-bg9RBhMMks?si=ziYwIqAO1lQWLHdt As well as simply using a 4G capable ESP32 (The SIM7600G-H). I'm not super concerned with only using Arduino. I was hoping to ask if any of you have experience with Arduino 4G projects or products and if you have suggestions

0 Comments
2024/12/01
21:15 UTC

0

Is my idea even possible?

Hello, I don't have that much experience with circuits, so please be kind. I'm trying to design a project for a competiton, and the basic premise of it is a smoke detector combined with a sprinkler, so that when it detects smoke it can spray a specific area with water. I want to use an arduino nano every, as its small and i've used arduinos before to mess around. The main parts of my circuit are a buzzer, stepper motor and controller, magnetic encoder, electric pump, ir LED and receiver, and a ultrasonic sensor. But is this even possible? I've watched some tutorial videos but I can't make sense of them. Is this project even possible or do I need something like a custom PCB? I am happy to provide a more detailed parts list if needed. Thanks.

2 Comments
2024/12/01
19:39 UTC

0

Help: Where can I find cheap components for my automatic watering syste,

Back in school, I was part of an afternoon Arduino group, so I still have my Arduino Uno and some basic components. Now that I'm in college, I want to create an automatic watering system for my (up to 10) plants.

I've done some research and know what I need (relays, pump, tubing, sensors), but I'm struggling to find affordable sources (Amazon prices are insane).

Any help would be greatly appreciated!

3 Comments
2024/12/01
16:36 UTC

0

Good distance sensor for project

Hi everyone, looking for advice on distance sensors!

I’m working on a project where I need a distance sensor that can accurately detect the distance to a 510mm x 380mm rectangle centered directly in front of the sensor. Here are my requirements:

•	**Accuracy:** Better than +/- 12mm.

•	**Range:** Ideally from **12mm to 900mm**.

•	**Environment:** The sensor will be used **outdoors**, so it needs to handle varying light conditions (which I know can affect accuracy for some sensors).

Right now, I’m using a VL53L0X sensor on an Adafruit breakout board. While it might work, the results have been less than ideal. From what I can tell:

•	It seems suited for shorter distances in my range but struggles with the longer distances.

•	Outdoor performance (range and accuracy) appears significantly worse compared to indoors, which is a big challenge since this is for outdoor use.

Before I dive into calibration or start filtering the outputs, I’d love to hear your thoughts:

1.	Are there better sensors for this kind of application?

2.	Has anyone had success with the VL53L0X outdoors?

3.	Does the color of the material being measured significantly affect performance in practice? (The datasheet says so, but I haven't seen much of a difference in practice yet.)

Any recommendations or insights would be greatly appreciated! Thanks in advance for sharing your expertise! 😊

0 Comments
2024/12/01
16:27 UTC

0

Stuck at this point

Imagine this as sequential shifter,

i have add to push buttons as shift up and shift down.

9 Leds has added. first one for neutral and other 8 as gears.

everthing works well,

if im at 6th gear and wants to shift to neutral or 1st gear, i need to press shift down button again and again, its to hard. so now i want to add two more push buttons ,

one for neutral led

one for first gear

then when i press one of them, quickly it will shift to neutral or first gear

can someone tell me how to add those two new buttons to work like this,,

code is below

int FWGear = 3; //foward button

int BWGear = 4; //backward button

//variables

int GearCount = 0;

int FWGearNew;

int FWGearOld = 1;

int BWGearNew;

int BWGearOld = 1;

// led pins

int NLed = 7;

int G1Led = 8;

int G2Led = 9;

int G3Led = 10;

int G4Led = 11;

int G5Led = 12;

int G6Led = 14;

int G7Led = 15;

int G8Led = 16;

void setup ()

{

pinMode(FWGear, INPUT_PULLUP); //foward button

pinMode(BWGear, INPUT_PULLUP); //backward button

pinMode(NLed, OUTPUT);

pinMode(G1Led, OUTPUT);

pinMode(G2Led, OUTPUT);

pinMode(G3Led, OUTPUT);

pinMode(G4Led, OUTPUT);

pinMode(G5Led, OUTPUT);

pinMode(G6Led, OUTPUT);

pinMode(G7Led, OUTPUT);

pinMode(G8Led, OUTPUT);

}

void loop ()

{

FWbutton();

BWbutton();

Neutral();

First();

Second();

Third();

Forth();

Fifth();

Sisth();

Seventh();

Eighth();

}

// Foward Gear Button Count

void FWbutton()

{

FWGearNew=digitalRead(FWGear);

delay(100);

if(FWGearOld==1 && FWGearNew==0 && GearCount <8)

{

GearCount = GearCount += 1;

}

FWGearOld=FWGearNew;

}

// Backward Gear Button Count

void BWbutton()

{

BWGearNew=digitalRead(BWGear);

delay(100);

if(BWGearOld==1 && BWGearNew==0 && GearCount >0)

{

GearCount = GearCount -= 1;

}

BWGearOld=BWGearNew;

}

// Led Funtions Based On Button Count

void Neutral()

{

if(GearCount==0)

{

digitalWrite(NLed, HIGH);

}

else

{

digitalWrite(NLed, LOW);

}

}

void First()

{

if(GearCount==1)

{

digitalWrite(G1Led, HIGH);

}

else

{

digitalWrite(G1Led, LOW);

}

}

void Second()

{

if(GearCount==2)

{

digitalWrite(G2Led, HIGH);

}

else

{

digitalWrite(G2Led, LOW);

}

}

void Third()

{

if(GearCount==3)

{

digitalWrite(G3Led, HIGH);

}

else

{

digitalWrite(G3Led, LOW);

}

}

void Forth()

{

if(GearCount==4)

{

digitalWrite(G4Led, HIGH);

}

else

{

digitalWrite(G4Led, LOW);

}

}

void Fifth()

{

if(GearCount==5)

{

digitalWrite(G5Led, HIGH);

}

else

{

digitalWrite(G5Led, LOW);

}

}

void Sisth()

{

if(GearCount==6)

{

digitalWrite(G6Led, HIGH);

}

else

{

digitalWrite(G6Led, LOW);

}

}

void Seventh()

{

if(GearCount==7)

{

digitalWrite(G7Led, HIGH);

}

else

{

digitalWrite(G7Led, LOW);

}

}

void Eighth()

{

if(GearCount==8)

{

digitalWrite(G8Led, HIGH);

}

else

{

digitalWrite(G8Led, LOW);

}

}

2 Comments
2024/12/01
14:26 UTC

1

Solution to run both CAN and an SD Card reader on Uno R4 WiFi?

Hi all! I'm working on a project using an Uno R4 WiFi, which needs both CAN and an SD card reader.

But on the R4 WiFi, CAN is pins 10 and 13. SPI also uses those pins.

Any suggestions on a solution?

I did see that the Uno R4 Minima uses different pins (4 and 5) for CAN, so I assume that would work and might switch to that (I don't need WiFi right now). But before I do, I wanted to see if there was a way to use the Uno R4 WiFi.

1 Comment
2024/12/01
21:13 UTC

1

what will I need to build a project that can accurately measure something length using Arduino + other electronics (has to be mm accurate)

working on a school project and I keep finding conflicting things in my research, I need just some advice on what components to get it has to be mm accurate

edit: to give more details its basically measuring somethings that will not exceed 80cm but it has to be mm accurate with a margin of error maybe 1-2 mm?

17 Comments
2024/12/01
21:12 UTC

1

HELP - "DFPlayer Mini Not Detected"

I’m trying to connect a DFPlayer Mini to an Elegoo Uno R3 but can’t seem to get the Arduino to detect the DFPlayer. Here’s my current wiring:

  • VCC: Connected to 3.3V
  • RX: Connected to D6 using a 1k resistor
  • TX: Connected to D5
  • GND: Attempted to connect but no luck

I’ve also installed the necessary libraries for the DFPlayer Mini but still no success. Am I missing something in the wiring or configuration? Is there a specific library setting I should check?

Any advice or troubleshooting tips would be greatly appreciated.

4 Comments
2024/12/01
20:02 UTC

2

Robot Bartender - Anyone want this?

Made a robot bartender to work with Arduino a while back, but no longer have the space for it. Was a cool project but was wondering if anyone wanted it or the components to it-otherwise I’m just trashing it. Post showing it can be seen here https://www.reddit.com/r/robotics/s/ws4do7uVrJ

7 Comments
2024/12/01
19:04 UTC

Back To Top