/r/arduino
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! 😉
A reddit for all things Arduino.
r/Arduino Information:
Arduino Information:
Related Subreddits:
Beginners:
Where to buy:
Tools / References:
Wokwi Arduino Simulator ✨ New!
/r/arduino
I can’t find any code online for using the MPU6050 interrupt pin that works for me. Does anyone have a link or good info about how to use the interrupt pin to sense acceleration?
I'm making a project where there will be a song playing in the background while also having sound effects played at the same time, there would only be 1 sound effect at a time so I only would need 2 "channels".
Should I buy 2 of some kind of board? Or is there a cheap board that can do it both?
Thanks!
Hi,
I had some fun with Arduino many many years ago, but never touched it since then. Recently someone I know wanted an electronic puzzle, and I found a number guessing puzzle online and offered to make it for them on a breadboard. Everything is there available, and I bought all the hardware (Arduino Uno, buttons, display, leds) and recreated this project but I can’t get any output. It verifies and uploads fine, but no output from the board.
I am pretty sure it’s something really basic, but I’m dreading to relearn how to do these stuff because I probably won’t do anything with it for a while, and I have very little mental capacity at the moment (just started a new demanding job). But I still want to help my friend.
Where would I find someone to remotely help me recreate this little project? I’m happy to pay for their time. I live in the UK if that helps. Thanks!
I think that I frayed my STM32, when I plug it in the leds turn on for a second and then they don't.
I want to make laser distance sensor to measure upto range of 50m using transmitter receiver laser diode Arduino through reflection. Laser will be used in the dark place. Don't have knowledge how to do this using these. Will this work for a long range, though surroundings will be dark. What kind of laser diode would be needed for this?
Hi all,
I'm trying to assemble an Airbus 320 radio for my sim rig. However I'm having some trouble trying to scout the web for a TM1637 6 digit module with a 0.28" inch display. I'm quite a beginner in this field but for all that is holy I cannot find a single 0.28" 6 digit module out there. Would anybody know if such a combination is possible, and if so, where I can find such module?
I'm also ok to assemble it myself, but I couldn't find any TM1637 DIY kit either.
As last resort I was going to order some 0.28" 3 digit display and replace the 0.36" displays on this one.
Hello, I am trying to upload the ESP3D code to my ESP32. However, while I can successfully upload any other code to the ESP32, when I try to upload the ESP3D code, I get this message in the console. Thank you for your hel
Hi everyone!!
I use an Arduino Mega 2560 as a custom keyboard for racing games (Assetto Corsa, BeamNG.drive). The goal is to use physical buttons to emulate keyboard key presses.
The keypress doesn't behave consistently in games.
It should block the wheels (parking brake) but only slows the car down.
(but if I press a on my keyboard it blocks the wheels normally... WHAT?)
Arduino code:
// Define the number of buttons
#define NUM_BUTTONS 21
// Define the pins for the buttons
int buttonPins[NUM_BUTTONS] = {
2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 22, 23, 24, 25, 26, 27, 28, 29, 30
};
// Define the corresponding characters for each button (lowercase)
char buttonChars[NUM_BUTTONS] = {
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u'
};
// Define debounce time
unsigned long debounceDelay = 50; // Adjust debounce delay as needed
unsigned long lastDebounceTime[NUM_BUTTONS] = { 0 }; // To store debounce time for each button
void setup() {
Serial.begin(9600); // Start serial communication at 9600 baud rate
// Initialize the button pins as inputs with internal pull-up resistors
for (int i = 0; i < NUM_BUTTONS; i++) {
pinMode(buttonPins[i], INPUT_PULLUP);
}
}
void loop() {
for (int i = 0; i < NUM_BUTTONS; i++) {
int buttonState = digitalRead(buttonPins[i]);
unsigned long currentTime = millis();
if (buttonState == LOW && (currentTime - lastDebounceTime[i]) > debounceDelay) {
Serial.println(buttonChars[i]); // Send the corresponding character
lastDebounceTime[i] = currentTime; // Update the last debounce time
}
}
}
Python code:
import serial
from pynput.keyboard import Controller
import time
keyboard = Controller()
ser = serial.Serial('COM12', 9600) # Your serial port
initial_delay = 0.5 # Delay before repeat
repeat_rate = 0.05 # Repeat rate
pressed_keys = {}
while True:
if ser.in_waiting:
data = ser.readline().decode('utf-8').strip()
for char in data:
if char not in pressed_keys:
keyboard.press(char)
pressed_keys[char] = time.time()
elif time.time() - pressed_keys[char] >= initial_delay:
keyboard.press(char)
time.sleep(repeat_rate)
keyboard.release(char)
pressed_keys[char] = time.time()
else:
keyboard.release(char)
del pressed_keys[char]
time.sleep(0.01)
and if I press a key on my keyboard, it presses the letter once waits almost 1 second, and then starts pressing rapidly. but this one with the Arduino immediately starts pressing the letter very fast. (idk how to explain this) But in asseto corsa, it slows the car down and it should lock the wheels so I can drift.
I hope someone can help!!
Thanks in advance! :)
I have a data logging application where I would like to do an analog read on three pins at 300 samples per second and periodically log the data to SDHC every 30 to 60 seconds.
I would like the samples to be fairly evenly spaced at 1/300 s intervals so I am considering an external 555 timer to set a input pin high when a sample is to be acquired. Then I can have a while loop where each iterate starts with blocking on the input pin to go high before taking the sample.
My concern is that every 30 seconds I need to save data to the SDHC and this may take longer than 1/300 of a second. It could take an unknown variable amount of time depending on the SDHC controller. It isn't clear how to avoid dropping/skipping samples while waiting for the SDHC to write.
Is there a "correct" way to handle this problem?
It occurred to me that with two microcontrollers, one could setup the first to read the input pins and then send the result to the second controller serially. The UART on the second controller could buffer the incoming samples during the moments when the second controller was busy writing to SDHC.
Macro pad made with Teensy, push buttons and a rotary encoder. The box is Lego because I don't have a 3D printer. Actions are: Play/Pause, Previous Track, Next Track, Mute, Left Virtual Desktop, Right Virtual Desktop and Volume
Heyo! I have a few years of coding experience in C/C++ from school/university and I decided to try working on an embedded project. I chose to start with Arduino as a basic introduction, but also heard focus on STM32 for best experience. However, I don’t know anything about electronics.
So, my main question is: What advantages does a larger board like the Arduino UNO R3 provide compared to the Arduino Nano V3? The RAM, CPU, and SRAM are almost the same.
I would be grateful if you could also add a some advices or instructions for a beginner :D
I'm planning to build an Internet radio using Arduino. I saw many people have built those with Wi-Fi shields or using ESP32. But I want to use a SIM card instead of Wi-Fi and I have some questions about it.
Hello all,
I need some help troubleshooting some oled behavior. I swear I always have trouble with these things but I'll give some background. There's 3 pieces of hardware connected together. A 128x64 monochrome oled, an arduino compatible SD reader, and an ESP32 wroom 32e dev board.
The code appears to be working and I believe the issue I'm having is a hardware one. Example oled test codes I've tried work but when I upload the code for the project that I'm actually working on it just shows a scrambled image.
What I wanted advice with is this project should only have 4 wires to the oled. GND, 3.3v, SCL, and SDA. When I use this config the oled doesn't respond. When I connect rst to en on the esp32 the oled responds and shows a scrambled image. I2C scanner sees the oled and my address is correct with the project code but I dont understand why the oled requires the rst wire.
Here is a the github link to the code I'm trying to run with the hardware i purchased:
https://github.com/Element18592/Sentry/tree/master/Sentry%20Sync
Here is the Amazon list of the hardware i purchased to make this project:
ESP32: SDATEKIT 2Pcs ESP32-DevKitC-32E... https://www.amazon.com/dp/B0D6BH4K9B?ref=ppx_pop_mob_ap_share
SD reader: HiLetgo 5pcs Micro SD TF Card... https://www.amazon.com/dp/B07BJ2P6X6?ref=ppx_pop_mob_ap_share
Oled: Teyleten Robot 2.42 inch 128x64... https://www.amazon.com/dp/B09LND6QJ1?ref=ppx_pop_mob_ap_share
diymore I2C Display Module 2.42"... https://www.amazon.com/dp/B07XRFFPCT?ref=ppx_pop_mob_ap_share (this was not I2C I had to convert it to I2C.)
The first set of esp32s i got were defective and didn't work right with a bunch of example code so what I've linked is tbe replacements that are working.
The projects goal is to receive data from the XBOX 360 UART bus. I can tell the code is working because the activity led is very busy on the esp32 but I can't test if the SD reader is working since the screen isn't working right to see if it mounts and reads the text file.
I talked to the creator of the project and he has been great assistance but I'm having hardware issues and I don't want to bother him about it hence why I'm here. So far I've spent 4+ hours trying to figure out why these oleds even after being set up for I2C are not functioning on 4 wires as expected and even with the rst connected to en I only get a scrambled frozen image without it the oleds remain blank.
The oled is connected to pins 21 and 22 of the dev board and should show a splash screen as the code starts. The reason it shared the github is because it's 500 lines of code and it's easier to view on github.
I really appreciate the help in advance as still can't wrap my head around how the oled works with example sketches but the project code doesn't. I didn't see any errors when examining it.
LINK: https://www.youtube.com/watch?v=pvAlaFNCH8w
I am completely new to Arduino and have decided to work on a project where I need to independently control multiple servo motors at once via Bluetooth. I've asked for some advice on here already and done my own research, and really like the method used in the link above. The sliders on the app shown imply that multiple servo motors could be controlled independently, but I am not sure how to go about this at all, from both a hardware and software perspective. Coding is a completely foreign concept to me, so I don't have a clue where to even begin on that side, so any help there would be greatly appreciated. Also, there doesn't seem to be enough outputs on the Arduino servo itself in order to connect 8 servo motors (how many I need for my project), so do I need to buy something like a pca board in order to cram them all in?
Sorry if this doesn't make any sense, this is a completely new world to me and I'm not sure if my idea's even possible lol. Thank you very much for any tips or suggestions, they're greatly appreciated!!
For context, I am completely new to Arduino but I am trying to create a set of moving wearable wings and I need 8 servo motors in order for them to work. My end goal is to get them to move to set positions using a wireless remote, but I'm not sure which Arduino board/other hardware to buy in order to accomplish this. If anyone has any pointers/recommendations I would greatly appreciate it! Thank you so much for your help!
PS I know this is an ambitious project, but I'm hoping to wow the kids at my work for World Book Day in a couple of months and show them maths and science can be useful sometimes lol.
Hi - I am trying to burn a bootloader to a new atmega 328pu using an elegoo uno r3 and the isp provided with arduino 1.8.13 development environment. I have used the uno many times, so I know that the board is recognised by the pc and is working correctly. I have mounted my new chip on a breadboard and connected it to the uno according to the diagram shown. I have uncommented a line in the arduinoisp software as shown:-
// Uncomment following line to use the old Uno style wiring
// (using pin 11, 12 and 13 instead of the SPI header) on Leonardo, Due...
#define USE_OLD_STYLE_WIRING
#ifdef USE_OLD_STYLE_WIRING
#define PIN_MOSI 11
#define PIN_MISO 12
#define PIN_SCK 13
#endif
I get the error message 'error while burning bootloader'.. Can anyone please spot anything that I have missed, or make any suggestions as to what to try next ?
Hello all, I am developing a project for an item detector using RFID Technology. So far I have decided on the ESP8266 board due to its cost/benefit characteristics. However, I am having a hard time finding the best RFID reader. Ideally, it would be:
Would that ever be doable? The most affordable subpar option seems to be the RC522, which I read works in a maximum of 50mm.
If there is any DIY I can put together I am up for the challenge, so long as it doesn’t exceed the initial budget and is properly connectable to the ESP board.
Any input is greatly appreciated, thank you in advance!⚡️
i am not able to find arduino nano 33 ble sense Rev2 board in arduino IDE, i tried re-installing the application but nothing seems to work. pls help me
I'm trying to attach RGB LEDs in a guitar that would light up to show a beginner where to put their fingers (based on color).
I need the LEDs to be thin enough to so that the frets (metal things on the guitar) to be still higher.
I saw and ordered LED RGB SMD Diodes 2121, but I still don't know if it's thin enough.
I'm new to arduino and I'd love to here your suggestions if I'm approaching this right.
Hi,
If I was buying this board, could I just remove the microcontroller provided (ATMEGA328P), put an Attiny85 instead, and program the Attiny85 directly from the Arduino IDE, connected by USB?
I have used an Arduino Uno before to program an Attiny85, but this would be simpler?
Board: OPEN-SMART 328P DIY Pro Module
Hi,
i am trying to communicate with a sam M10Q gps using a pi pico and the arduino core. this is my ccurrent code that works very well:
String receivedData = "",latd,latm,lngd,lngm;
double latdd,latmm,lngdd,lngmm,latitude,longitude;
String isfix = "V";
void setup() {
Serial.begin(115200);
Serial1.setTX(12u);
Serial1.setRX(13u);
Serial1.begin(19200);
}
void loop() {
// Check if data is available to read from Serial1
if (Serial1.available()) {
char incomingChar = Serial1.read(); // Read one byte
// If the incoming character is a newline, process and print the data
if (incomingChar == '\n') {
// Print the received data to the Serial Monitor, row by row
if (receivedData.startsWith("$GNRMC")) {
// Print the received data to the Serial Monitor
isfix = receivedData.charAt(17);
if(isfix == "A")
{
latd = receivedData.substring(19,21);
latm = receivedData.substring(21,29);
lngd = receivedData.substring(32,35);
lngm = receivedData.substring(35,43);
latdd = latd.toDouble();
latmm = latm.toDouble();
lngdd = lngd.toDouble();
lngmm = lngm.toDouble();
latitude = (latmm/60)+latdd;
longitude = (lngmm/60)+lngdd;
Serial.print(latitude,6);
Serial.print(",");
Serial.println(longitude,6);
}
else
{
Serial.println("0.000000,0.000000");
}
}
receivedData = "";
}
else {
// Add the incoming character to the string
receivedData += incomingChar;
}
}
}
If I try to add any other command in the loop like a delay or Serial.print everything stops working and it displays 0 or garbage values for the gps data. I think I have to do osmething with the Serial.read() command but I do not know what. Thank you!
Hi everyone, looking for a little bit of guidance with something I’m working on.
I’ve written code for a button box and uploaded it fine. I have a clone pro micro and a clone nano board on one perf board soldered in. The nano passes pull up button presses to the micro and uses the usb interface to act as a keyboard. The micro also has buttons and generates keys. Nano is powered from the micro.
I’ve noticed that the nano has stopped connecting via usb to allow me to upload code. Then when I take it out of the board it works? Has anyone had anything similar and could give some pointers about where to look? I have tried isolating from the micro with it still connected to buttons but it still would t work until I took it out of the board. Why would it being in the board do this? Am I missing something from an EMC point? The board has not been grounded to the usb cable or anything.
Thanks
I have issue with Arduino IDE, it can be launched but it doesn't display anything
I've tried this:
Idk what else to do or what caused this issue.
I recently bought a Arduino Compatible Long Range LoRa Shield (915mhz) from jaycar https://www.jaycar.com.au/arduino-compatible-long-range-lora-shield/p/XC4392?srsltid=AfmBOorfxx_Im_Ozko3VJeVyyODzQXRYTWzCk_qJ0FGi852jBPHYJDHD however whenever I run the code i get the same error message from the serial monitor I am using the lora and spi libraries on arduino ide, I was wondering if anyone could help me get this working.
Here is the test code i am using right now
#include <SPI.h>
#include <LoRa.h>
int counter = 0;
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("LoRa Sender");
if (!LoRa.begin(915E6)) {
Serial.println("Starting LoRa failed!");
while (1);
}
}
void loop() {
Serial.print("Sending packet: ");
Serial.println(counter);
// send packet
LoRa.beginPacket();
LoRa.print("hello ");
LoRa.print(counter);
LoRa.endPacket();
counter++;
delay(5000);
}
This is a test code but i always get "Starting LoRa failed!"
Many thanks, feel free to ask me any questions.
P.S the purpose is to transmitt sound via a square wave, to be recieved with an rtl- sdr and here is a link to the pdf describing it https://media.jaycar.com.au/product/resources/XC4392_manualMain_79416.pdf?_gl=1*nsv5wv*_gcl_au*MjE0NzQyNTYyOC4xNzMxMjkzNzU4
Title's pretty self-explanatory. I have some experience with Arduinos from school and Tinkercad and am thinking of playing around with them a bit more.
Hi, I’m really interested to know if it’s possible to use LEGOs ‘Poweredup’ app to directly connect to and control an arduino at all. Has anyone successfully done this? If so what Bluetooth module and libraries worked for you? Thank you!
I'm starting out using arduino. I already gained quite some knowledge on programing it, and i already have a good amount of electronics. After learning and experimenting whit some of the functions of the arduino, i started looking on how to use sensors and modules, and consequentialy, libraries. but how exacly i find and use any libraries for any aplications?