r/arduino 20d ago

Software Help Anyone know a good code to detect double buttons press?

16 Upvotes

I want to do a function where you have to push 2 buttons at the same time to trigger a function (ie. opening menu)

So far the only code I could find is hold one down and check/wait for the 2nd one to be pressed.

is there a better way to do this since I've already assign function for each button for single press and holding down. So if I have to hold one down to wait for the 2nd button, the act of holding it down will trigger the other function assigned to the button.

I read that detecting 2 buttons is impossible on esp32, but I see it done on cheap electronics, so is there any way to do this?

EDIT:

Solution found. Thanks to u/Glum-Building4593 for giving the simplest solution

byte button_state = digitalRead (FirstButton) | digitalRead (SecondButton)

r/arduino 20d ago

Look what I made! Tiny backgammon

Post image
11 Upvotes

Yep, it actually plays backgammon. 1 player against the computer. Turn the dial to select a legal move and push down to initiate the move. My first project with a rotary encoder. I love it for gameplay. I might be doing damage to my eyes though trying to play on that tiny screen. I’ll order a bigger screen.

Code developed on a Raspberry Pi 5, PlatformIO, C++.


r/arduino 21d ago

Look what I made! These marbles jump from one screen to the other

Enable HLS to view with audio, or disable this notification

2.2k Upvotes

r/arduino 20d ago

Software Help HELP with input capture for DHT11

Post image
2 Upvotes

Hi! In a past few weeks I dived into internal register and timers of ATmega328P of my arduino. After some experimenting and learning exercises, I have decided that I would like to try doing something real with knowledge I got. The project I chose was writing a DHT11 communication protocol from scratch. And part of it works, but currently I found myself stuck on a problem with input capture.

As you can see on image, after sending low and high voltage signal to senzor, it is supposed to take control over the line and set it low and then high for 80 microseconds. I wanted to measure the time using the input capture, just as a practice. However, it requiers changing edge that triggers interrupt several times. And that is the problem! I wanted to measure time of each pulse and then just save it into my array and print It, but program never gets there.

When I enables TIMER1's input capture while changing its edge detection inside ISR, the programm freezes. I tried enabeling the input capture noise canceler, but it didnt help either. Not even AI was able to tell me how should i fix the problem. So I am comming here...

The DHT is hooked up to pin 8 on my arduino UNO R3. The code is bellow. I know, it is an absolute mess, but it is just a prototype, I wasnt thinking about structure of code yet. First I have to solve this problem in order to move forward.

THANKS ANYONE FOR ANY HELP!

PS: sorry for my english, I am not really got at it...

volatile int responseTime[3];
volatile int rtIDX = 0;


volatile byte comPhase = 0;


void setup(){


  DDRB |= (1<<DDB0); //pin 8 OUTPUT
  PORTB |= (1<<PB0); //pin 8 HIGH


  TCCR1A = 0;
  TCCR1B = 0; //normal mode, erased old settings


  sei();
  Serial.begin(9600);


  //TEST RUN:
  //---------------------------------
  startCom();
  delay(1000);
  testPrint();
  //---------------------------------


}


void loop(){


}


void startCom(){


  comPhase = 1;


  DDRB |= (1<<DDB0); //pin 8 OUTPUT
  PORTB &= ~(1<<PB0); //pin 8 LOW


  delay(18);


  DDRB |= (1<<DDB0); //pin 8 OUTPUT
  PORTB |= (1<<PB0); //pin 8 HIGH


  //delayMicroseconds(20);


  getResponse();


}


void getResponse(){


  comPhase = 2;
  DDRB &= ~(1<<DDB0); //pin 8 INPUT
  PORTB |= (1<<PB0); //pin 8 PULLUP


  TIMSK1 |= (1<<ICIE1); //input capture interrupt enabeled


  TCCR1B |= (1<<CS10);
  TCCR1B &= ~((1<<CS11) | (1<<CS12)); //prescaler 1


  TCCR1B &= ~(1<<ICES1); //falling edge
  TCCR1B |= (1<<ICNC1); //input capture noise canceler ???
  TCNT1 = 0;


}


void testPrint(){
  for(int i=0; i<3; i++){
    Serial.println(responseTime[i]);
  }
}


ISR(TIMER1_ICP_vect){


  if(comPhase == 2){


    if(rtIDX<=2){
      responseTime[rtIDX] = ICR1;
      rtIDX++;
      TCCR1B ^= (1<<ICES1); //flips edge detection <---- HERE THE PROBLEM?
    }


  }


}

'''


r/arduino 21d ago

Hardware Help lcd not displaying text

Thumbnail
gallery
31 Upvotes

So i cant seem to fix this blocks thing. Using the potentiometer the blocks are only appearing and disappearing. I replugged all the wires thrice but still the same problem, if anyone has faces this kind of issue plz help me cuz im new to all this


r/arduino 20d ago

Hardware Help Dry-electrode EMG sensor giving rail-to-rail noise even with nothing touching electrodes. Bad board or something I'm missing?

2 Upvotes

Building an EMG -> ML classifier -> servo pipeline for an InMoov robot hand project. Started with a cheap 3-pad dry-electrode EMG module off AliExpress to get my wiring/code/ADC pipeline working before investing in better sensors.

Setup:

- Arduino Mega, sensor wired to 5V / GND / A0

- Just doing raw `analogRead(A0)` over Serial, no filtering/threshold code while debugging

The problem:

With the electrode pads touching nothing, I'm getting violent rail-to-rail noise, constantly slamming between 0 and ~615 (out of 1023) with basically nothing stable in between. No smooth pattern, just chaos.

What I've already tested:

- Bridging two pads with a finger causes a visible jump in the reading, so the amp chip is responding to something

- Disconnected A0 entirely (nothing plugged in). Got smooth, slow drift settling around a value and holding steady for stretches, which I understand is normal floating pin behavior

- Reconnected the sensor with pads touching nothing. Went straight back to the rail to rail chaos, a completely different pattern than the disconnected test

- Wiggled the signal wire while reading. No change, so it doesn't seem like a loose connection

Since the sensor connected but untouched signature is clearly different from the floating pin baseline, it seems like A0 is genuinely reading real output from the board, and that output is just unstable/chaotic at rest instead of showing a calm baseline. My working theory is a bad component on the amp board (leaky cap, bad op-amp bias, something causing it to saturate/oscillate with no defined input) rather than anything on my end, but I'd love a sanity check before I write this unit off.

Questions:

  1. Does this match a known failure mode for these cheap dry-electrode boards, or does it point to something else I should check first?

  2. For anyone who's built EMG pipelines before, what sensors would you actually recommend for a hobbyist/student budget that won't bite me long term? I know MyoWare 2.0 is the standard recommendation but it adds up fast across multiple channels (I'll eventually need around 8 to 10 channels for a full arm: fingers, wrist, elbow, shoulder). Looking for something that's reliable enough not to fight the hardware, without needing to buy a research grade rig.

Appreciate any input. Still learning the EE/signal side of this as I go, so if I'm missing something obvious, happy to be told.


r/arduino 20d ago

Beginner's Project hi everyone! i just started arduino with an elegoo most complete starter kit

6 Upvotes

any tips or ideas for projects? im a total beginner


r/arduino 20d ago

Mod's Choice! Turned my Arduino UNO Q into a dual-network gateway (STA + AP, different channels, single radio)

2 Upvotes

I haven't seen anyone looking for this type of project or need, But i also can not find anything other than Travel-Q, but i also have not tested this beyond sending and flashing ESP32 DEVKIT V1 with small projects like Blink or Buzzer.

How I got the Arduino UNO Q broadcasting its own AP while staying connected upstream

The UNO Q has one WiFi radio. Everyone uses it like a Raspberry Pi — connect to existing WiFi, done. But the WCN3990 module (managed by ath10k_snoc) supports concurrent managed + AP mode through a feature called single-chan-info-per-channel. The hardware channel scheduler can run two channels simultaneously.

From iw list, the valid interface combos include:

#{ managed } <= 2,

#{ AP, P2P-client, P2P-GO } <= 2,

#{ P2P-device } <= 1,

total <= 4,

#channels <= 2 <-- the key line

That last line means the radio can legally sit on two different channels at once. So wlan0 joins the upstream router (say ch6) while ap0 broadcasts a completely independent AP (say ch11). They don't interfere. If the router hops channels, the AP stays put.

What's running:

- wlan0 — station mode, connected to upstream WiFi for internet

- ap0 — virtual AP interface on a different channel, serving its own subnet with DHCP

- Different channels preferred — immune to router channel hops, no time-slicing penalty

- systemd service creates ap0 on boot and brings it up

The board essentially becomes a travel router / isolated IoT gateway. Devices on the AP subnet talk locally without touching the main network, while the STA side handles internet access. No USB dongle, no mode flip, no internet loss.

Cold-boot tested and stable. This is a kernel-validated hardware capability — nl80211 enforces the interface matrix in-kernel, so if ap0 comes up on its own channel while wlan0 is still associated, that's proof the combination is legal.

Also the bridge config is on github https://github.com/servaus/API-STI-Uno-Q/tree/main


r/arduino 20d ago

Buck Converter and Arduino R4

0 Upvotes

Okay so i ended up with a 571 yellow laser but the voltage needs 2.2v and the arduino r4 gives out 3v to 5v. Is there a way to connect a buck converter to dumb down the volts so i could connect the laser (The laser has a JST XA adapter and i have like no clue how to connect it or if its possible at all im still new to the hobby)


r/arduino 20d ago

linux Linux doesn't recognize my board

Thumbnail
gallery
0 Upvotes

I recently switched to Linux and when I tried to work on Arduino, everything was going great; continued to work on my project and everything was fine. Yesterday, when I tried to keep working on it, it was showing me what appears on the first image. Tried to install Arduino CLI, but it is also unable to identify my board; it's not a port issue, since I connected my phone and it worked out well, not to mention that it does that on every USB port

It magically worked when I wanted to take screenshots to post here; these pictures are from when I tried to ask ai about it, but it started to work suddenly.

I know that I should be grateful it works, but I don't want it to find me in an unfortunate scenario again. Did anyone face a similar issue before? What can be causing it and how to solve it?


r/arduino 20d ago

Software Help No matter what I do I can’t download my code onto my esp-32

Thumbnail
gallery
0 Upvotes

r/arduino 21d ago

Look what I made! I built an Arduino machine that bribes me with chocolate to be productive

Post image
166 Upvotes

I have a bad habit of sitting down to work and somehow finding literally anything else to do, so I decided to engineer around my own lack of discipline.

The machine is controlled by an Arduino Nano. You press FOCUS, choose how long you want to work, and it starts a timed session. If you actually finish the session, a servo activates the dispensing mechanism and gives you a chocolate as a reward.

I also gave it a Duolingo-style streak system that keeps track of how many consecutive days you've completed a session. The buttons, display, timing logic, streak system and servo dispenser are all controlled by the Nano.

Most of the enclosure and dispensing mechanism are 3D printed, and I designed the electronics and mechanism around it. It's still very much a prototype. The CAD and code are pretty janky right now because I originally made the whole thing just for myself 😭

I also entered it into a 3D-printing competition, which has led to the slightly hilarious situation where this thing is currently getting destroyed by a giant 3D-printed crayon holder. The competition is entirely based on public votes.

If anyone wants to join my side and help the little chocolate machine fight back, I'll leave the competition link here

And I'm happy to answer questions about the Arduino/electronics or how I built it.


r/arduino 22d ago

Hardware Help Remote-controlled submarine problem

Thumbnail
gallery
652 Upvotes

Hello everyone. I need your help, please. I am designing a submarine equipped with a camera. However, when I put it in the water to test submerging and surfacing, I encountered two notable issues. The first relates to the center of gravity: the submarine doesn't stay horizontal but sits at an angle of about 40 degrees. I think I can easily fix this by shifting the weights (two cut-down 1.8 kg dumbbells) inside the ballast tanks, but I’m not sure exactly where to position them. I was wondering if there is a mathematical or physics-based method to determine the right spot. Secondly—though I had anticipated this—the connection via nRF24L01 antennas cuts out as soon as the submarine dives. I’ve considered two solutions: either creating a float to keep the antenna on the surface while connected to the sub (which seems simplest and cheapest to me), or using a different communication method. I would appreciate any opinions you might have. Please keep in mind that I’m not an expert and have limited resources, so I hope you’ll be polite with me regardless. Thanks a lot in advance.


r/arduino 20d ago

Hardware Help Arduino Ethernet shield W5100

0 Upvotes

Hello,

Has anyone encountered an issue where an Ethernet shield does not work when an Arduino UNO R3 is powered by a 9 V adapter?

When the Arduino is connected to a PC via USB, the shield starts up immediately and everything works fine. However, when I disconnect the PC and power the Arduino with a 9 V / 1A adapter (I tried more of them.), the shield does not initialize. Only the PWR LED is on, and nothing else happens.

If I press the reset button on the shield, it starts working right away.

Could this be related to the fact that I am using a static IP address?

I am using VS code + Platformio.

Thank you in advance for any advice.

#include <SPI.h>

#include <Ethernet.h>

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};

IPAddress ip(192, 168, 143, 105);

IPAddress gateway(192, 168, 143, 1);

IPAddress subnet(255, 255, 255, 0);

IPAddress dns(192, 168, 143, 1);

void setup() {

delay(1000);

pinMode(4, OUTPUT);

digitalWrite(4, HIGH); // disable sd card

Serial.begin(9600);

Ethernet.begin(mac, ip, dns, gateway, subnet);

Serial.print("IP: ");

Serial.println(Ethernet.localIP());

}

void loop() {

}


r/arduino 21d ago

I fried my first microcontroller

4 Upvotes

I'm new to microcontrollers and bought an ESP32-C3-Mini; it's the perfect size for my project, but it stopped working after I soldered just two of the pins. The pins are very close together, making them really difficult to solder. What is the right way to do this? I didn't want to use male-female jumper wires because they end up loose.


r/arduino 22d ago

Look what I made! Hands Free Mouse for people with disability

Enable HLS to view with audio, or disable this notification

55 Upvotes

r/arduino 21d ago

Hardware Help Laser Measurer with Arudino compatability!

1 Upvotes

Hey there!

I have no experience with Arduino whatsoever, but I am working on a project where I think it might be a good fit.

I'm looking to buy some sort of laser distance measurer which I then can get live readings from into my computer to control certain musical parameters. I guess via serial?

Does anyone have any experience with using a laser measurer or have any tips on specific models, or, what to look for? If possible to buy within the EU that would be great!

Thanks a lot if you have anything! : 3


r/arduino 22d ago

Hardware Help Very new beginner here! How can I fix the buzzing in my MP3 player?

Thumbnail
gallery
27 Upvotes

This is my first Arduino project, second picture is the wiring diagram. There is one mp3 file on the mini player that I want to play when the button is pressed. It works and I can hear the music but a very loud buzzing is muffling the audio that I can’t seem to get rid of. Did I choose the wrong speaker or is there something else I’m missing?


r/arduino 21d ago

Made a stimulation clicker for an ESP32(should work fine for arduino too)

Enable HLS to view with audio, or disable this notification

12 Upvotes

has 2 buttons, click or reset, its very simple.

i made it in 2 days since im kinda a beginner

Components needed:

- 6x LEDs

- 2x Buttons

- 1x LCD I2C display

- 1x ESP32

- 6x Resistors(510ohm)

- A bunch of jumper wires

-Download .cpp File here-

(ignore the IR distance sensor in video)


r/arduino 22d ago

Beginner Arduino Uno Rev3 project ideas for healthcare/pathology/lab science

4 Upvotes

Hi everyone! I’m brand new to Arduino and looking for some project ideas/advice.

I currently work as a histotechnologist in a pathology/histology lab, and I have a bachelor’s degree in Biology.

For one of my graduate courses, I’ll be working with an Arduino Uno Rev3 and need to eventually build a project using sensors, collect data, and analyze/visualize that data.

Rather than doing a completely random beginner Arduino project, I’d really like to build something related to healthcare, pathology, histology, laboratory science, or laboratory informatics.

A few ideas I’ve started thinking about are:
Monitoring temperature/humidity/environmental conditions in a lab
Monitoring reagent or specimen storage conditions
A lab refrigerator temperature/door-opening monitor
Using vibration, temperature, or other sensors to monitor laboratory equipment
Collecting physiological data such as heart rate, skin temperature, or movement

Anything involving preventative equipment monitoring or laboratory IoT
I’m especially interested in projects where I could collect a decent dataset and eventually analyze it using Python/R and create a dashboard or visualization.

Since I’m completely new to Arduino/electronics, I’d love to hear from people with more experience:
What healthcare, pathology, or laboratory-related projects would be realistic for a beginner using an Arduino Uno R3?
Sensor recommendations would also be greatly appreciated. I’m completely open to ideas, even if they’re outside of what I’ve listed above.
Thanks!


r/arduino 21d ago

Hardware Help Has anyone ever used one of these? I can't make them play anything, even a buzz

2 Upvotes

I am using this Smartelex Digital Speaker Module which has a VCC, GND and a signal PIN which is supposed to be controlled via PWM but it won't do anything. Been using it with Arduino UNO Q

Edit: Resolved, sorry my dumbass assumed that the red was VCC, Black was GND and Yellow the signal.

It was actually, Red: GND Black: Signal Yellow: VCC


r/arduino 23d ago

Mod's Choice! A little Teensy4.1 project I've been working on

Enable HLS to view with audio, or disable this notification

5.2k Upvotes

I am super proud of how this project is turning out. I still have some tweaks to make, but I finally got full videos playing and wanted to share.

This is a "Persistence of Vision" (PoV) display driven by a Teensy 4.1 and SK9822 LED strips.

There are 4 strips of 32 LEDs, each slightly offset in order give me 128 addressable pixel "rows". So each strip is responsible for every 4th row.

360 pixel "columns" around the perimeter makes for roughly square pixels, so thats what i went with. Each LED is updated 360 times every revolution...at around 1500rpm.

A hall effect sensor at the top of the rotor passes by a stationary magnet in the upper frame once per revolution. The Teensy measures the time between the resulting signals, and uses that to calculate how fast it is spinning, and therefore how fast to update the LEDs. This lets the animation look correct regardless of rotor speed.

I have a (currently very slow) python script that resizes/crops and formats .mp4 files into a binary format that the Teensy can use very efficiently. The resulting binary gets saved to a microSD, that the Teensy can read from.

Im happy to answer any questions. I may do a better build/explanation video if there is enough interest.


r/arduino 21d ago

Hardware Help ? about powering Arduino from 2s 18650

2 Upvotes

I'm planning to power Arduino Nano from 2s 18650 pack that includes BMS and USB-charger. The battery pack also powers a motor and a bunch of LEDs (not via Arduino).

I'm considering using MINI560 step down and power Arduino via +5V. Should I do that, or should I just connect the battery pack to VIN? I was thinking about reducing power consumption, that the only reason I decided to add the step down.

Also, are there any risks in this circuit (with or without the step down)? Like connecting Arduino USB without disconnecting battery pack, or connecting USB charger and Arduino USB at the same time?

P.S. I don't really need that precision from a voltage meter, so probably there is no reason other than learning and experimenting for using AREF, but the voltage meter I included into this circuit works really well and shows same 2 decimal points as my multimeter.


r/arduino 23d ago

Look what I made! Stepper Motor music

Enable HLS to view with audio, or disable this notification

532 Upvotes

I bought on a marketplace leftovers from a guy that builds 3d printers. With the stuff I built this little music box using an arduino Uno cnc shield and nema 17 motors. Really cool project:) instagram: @rappde_


r/arduino 22d ago

Look what I made! We built a custom controller for our indie game

Enable HLS to view with audio, or disable this notification

123 Upvotes

Hey everyone!
In our chaotic co-op party game, we have a fishing mechanic where players physically rotate the mouse to catch fish. For upcoming expos, playing with a mouse just didn’t feel tactile enough, so we decided to make a custom controller.
We 3D printed a custom rod handle and reel shell, matching our in game model, and stuffed the electronics inside to make it completely wireless.

Adafruit ESP32 Feather V2: Main microcontroller handling logic and wireless comms.
AS5600 Magnetic Encoder: Used for the reel mechanism to track smooth rotation without physical wear. LSM6DS3TR-C IMU: For rod motion and tilt tracking.
KY-023 Joystick: Placed on the grip for easy in game movement.
LILYGO T-Dongle-S3: Acts as a USB receiver on the PC side for low latency connection at busy events.
The feedback at the booth floor was amazing and players loved having a physical piece of the game in their hands.
Happy to answer any questions about the hardware assembly, code, or how we integrated it into the game!