/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 want to build a device to support a board game I'm working on that has a function similar to Hot Shots Golf's power meter
Is there a good starter kit or resources I should look to start with that would enable me to build a device with this behavior?
Hello everyone,
I contact you today for asking some help!
I'm a beginner, I'll use a arduino nano for get values, analyse with firmware and 'write' analysed values on other arduino pins.
Context :
First of all, It's an oxygen sensor(wideband) used in cars. This sensor need a firmware for control it(here for more details how work).
There is some project about it on web, but its contain only 'ended' chip version, no usb for modify firmware.
I have a kicad version of arduino nano and I will integrate it on my motherboard(Engine management system).
For firmware I got this written in C. Originally on PsOC Designer. This code allow to show values on external screen. not for my need, do you think he can convert to arduino? I know Its the same language. I need someone for explain me this code+convert it for arduino libs/.h.
(I got another firmware for atmega, my needs stay the same)(here).
This works can be paid.
Thanks everyone>!!<
Hi everyone -
I'm refurbishing a bubble hockey table and want to update it's electronics using an Arduino controller. I'm looking to do the following.
Inputs
- (2) dry contact reed switches to determine if a goal is scored.
- (6) push button inputs to trigger a "Boo" "Cheer" "Song" for each team
Outputs
- (2) dry contact outputs to relay onto the manufacturer score board (basically relay the reed switches on to the original score board)
- (1) dry contact to trigger a timed RED beacon for when goals are scored
- MP3 audio outputs will be played based on the input events (goal score sounds, Boo, Cheer, Songs)
I understand I likely need a basic Arduino and likely a DAC and output relay board maybe? This is where I'm lost. Is there an easy setup I can buy that will help with wiring all this up instead of using a breadboard or soldering? I assume I can figure out the programming since it's basic, but I'm lost with the hardware. Any advice is appreciated.
Hello, everyone! Good evening. I'm working on an Arduino project, specifically an electronic drum kit, and I'm struggling quite a bit to make it work. I don't have much knowledge in this area, but I'm trying to overcome this challenge. (idk if i'm using the right flag, so sorry if its wrong)
The problem is that I can't make the connection between the serial port data and the audio program. I'm using Hairless MIDI as a "bridge," loopMIDI as a virtual port, and LF Studio to play the instrument sounds.
I want that when there is contact with the piezo sensor, Hairless communicates with LF Studio to trigger a note for a musical instrument. In the Hairless terminal, it seems not to recognize the touch on the sensor, and sometimes messages like the following appear:
Error: got unexpected data byte 0x0
Error: got unexpected data byte 0x78
Error: got unexpected data byte 0x18
I'm not sure if it's a problem with the code or the circuit assembly (I believe it's the first option). I really appreciate any help
int PadNotes[2] = {32, 38}; // notas
int sensorPins[2] = {13, 12}; // Pinos digitais
void setup() {
Serial.begin(57600);
for (int i = 0; i < 2; i++) {
pinMode(sensorPins[i], INPUT_PULLUP);
}
}
void loop() {
for (int i = 0; i < 2; i++) {
if (digitalRead(sensorPins[i]) == LOW) {
MIDI_TX(144, PadNotes[i], 127); // MIDI Ligado - Toca a nota
} else {
MIDI_TX(128, PadNotes[i], 0); // MIDI Desligado - Sem som
}
}
delay(50);
}
void MIDI_TX(unsigned char MESSAGE, unsigned char PITCH, unsigned char VELOCITY) {
Serial.write(MESSAGE); // Envia o tipo de mensagem MIDI
Serial.write(PITCH); // Envia a nota MIDI
Serial.write(VELOCITY); // Envia a intensidade (volume)
To those that know; On the Arduino CNC shield used with the Arduino Uno there is an X, Y, Z and an A axes. The A axes can be used as a clone for X,Y or Z to run two stepper motors at the same time . The clone setup is done easily with jumper pins. Is there any way to do this with the Arduino mega/Ramps 1.4 combination? Perhaps using the EO or E1 Axis? I knox the Z axis has a second set of pins for a second stepper motor BUT in that case , the two motors are being driven by only one driver.I would refer two drivers.
Thanks for any insights John
Hi everyone!
I’m planning to connect a MIDI sound module (like the Korg Volca Sample) to a microcontroller, but I’m having trouble figuring out exactly what cables or adapters I need. I’ve already set up a touchscreen and am using an Adafruit breakout for touch input, but I’m unsure about the next steps. My goal is to, for example, change the sound pitch by touching higher on the Y-axis of the screen.
Here are the components I’m using:
Can anyone advise me on the right MIDI controller and the software and hardware needed to make this work? I’d prefer to use a hardware MIDI controller so I’m not tied to a computer.
Thanks a lot for your help! 😊
My Journey with the ATtiny85: Tiny Size, Big Potential
When I first heard about the ATtiny85, I thought, “What can this tiny 8-pin chip really do?” Fast forward a few months, and it has become one of my favorite microcontrollers for compact, low-power projects. From simple LED blinkers to more complex creations, the ATtiny85 has pushed me to think creatively and maximize efficiency in my designs.
Here’s a look at some of my experiences, challenges, and projects that highlight just how capable this little chip can be.
Discovering the ATtiny85
I stumbled across the ATtiny85 while searching for a microcontroller to power a small, battery-operated project. At just a few dollars, it seemed perfect for projects that didn’t need the full power of an Arduino. Despite its small size and limited resources, it surprised me with its versatility and ability to handle surprisingly complex tasks.
Complex Projects I Built with the ATtiny85
For this project, I combined the ATtiny85 with a small I²C OLED display and a digital temperature sensor (like the DS18B20). The ATtiny85 handled the sensor data, calculated the temperature, and displayed it on the screen.
Challenges Faced:
Working with I²C on the ATtiny85 required careful optimization of memory and code.
Managing the limited RAM (512 bytes) meant minimizing the size of the fonts and graphics for the OLED.
Why It Worked: The ATtiny85’s 8 KB Flash memory was enough to store the code, and its low power consumption made it ideal for a battery-operated thermometer.
I wanted to build a custom USB media controller that could play, pause, or skip tracks on my PC. Using the V-USB library, I turned the ATtiny85 into a USB HID device. With just a few buttons wired to the GPIO pins, the ATtiny85 sent pre-programmed keystrokes to control media playback.
Challenges Faced:
Configuring V-USB was tricky because the ATtiny85 doesn’t have native USB support.
Ensuring the timing and communication adhered to USB protocol standards required fine-tuning.
Outcome: It worked perfectly! I programmed specific key combinations for media control, and the ATtiny85 seamlessly interacted with my PC.
For a more practical project, I created a motion-activated night light. Using a PIR motion sensor, the ATtiny85 detected movement and powered an LED strip. I implemented a sleep mode for power saving, waking the microcontroller only when motion was detected.
Key Features:
Adjustable timer to turn off the light after a set duration.
PWM control to dim the LEDs gradually.
Ultra-low power draw in sleep mode.
Challenges Faced:
Integrating the PIR sensor required careful pin management, as the ATtiny85 has limited GPIOs.
Sleep modes required precise configuration to ensure reliable wake-up triggers.
Using the ATtiny85’s PWM capabilities, I created a mini synthesizer that generated simple tones. By connecting a piezo buzzer and using predefined frequency values for musical notes, I programmed it to play basic tunes like "Happy Birthday" or even a mini alarm.
Advanced Features:
Buttons were used to control pitch and duration in real-time.
The program could store custom tunes in EEPROM for playback.
Challenges Faced:
Managing multiple buttons with limited GPIO required creative wiring and multiplexing.
Generating smooth tones with consistent timing was a learning curve but rewarding.
For this project, I used the ATtiny85 to control an RGB LED strip. The microcontroller read signals from an infrared (IR) remote, decoded them, and adjusted the LED colors accordingly.
Features:
Pre-set color modes controlled via the remote.
Brightness adjustment using PWM.
Smooth transitions between colors.
Challenges Faced:
Decoding IR signals required precise timing, which pushed the ATtiny85’s processing power to its limits.
The program had to fit within the memory constraints while still offering multiple modes.
Why I Loved It: The ATtiny85 handled the task beautifully, and I was able to create a compact and affordable LED controller that worked flawlessly.
What I Learned from These Projects
The ATtiny85’s limited RAM and Flash forced me to write clean, optimized code. This was a valuable lesson for all my future projects.
With only 6 GPIO pins, I had to get creative. Multiplexing, using I²C peripherals, and even sharing pins between components taught me how to maximize hardware.
I gained a deep appreciation for low-power design. Using sleep modes and efficient algorithms, I was able to stretch battery life in projects like the motion-activated light.
Why the ATtiny85 is Still My Go-To Microcontroller
Even though I now work with more powerful boards like the ESP32 or Raspberry Pi Pico, the ATtiny85 remains a favorite for compact, minimalist projects. It’s affordable, reliable, and forces me to think critically about design and resource management.
If you’re looking for a challenge or want to explore how much you can do with limited resources, I highly recommend giving the ATtiny85 a try.
Your Turn ! Have you worked with the ATtiny85? What’s the most interesting project you’ve built with it? Or are you curious about getting started? Share your experiences, questions, or ideas below—I’d love to hear them!
I want to measure the inside length and width of a rectangular fuel storage tank. To do this, I want to drop a sensor down through an opening in the top and rotate it around to shoot the distances at various angles. What would the best sensor be to accomplish this? There is about 6 inches of space between the fuel and the top of the tank. My worry is that for the longer lengths (~12ft/4m) the beam will be wide enough to hit the fuel and the top of the tank and mess up the measurement. I have found a couple of lidar sensors that I think might work but I am not sure. They are the TF-Luna and TFmini-S. Anybody have experience with these sensors or recommend another lidar sensor for this applications? I am looking for something accurate to 1 inch, narrow FOV, and under $100. Thanks!
I'm New at ardiunos and and coding and need help converting this to the bread board, does anyone have a idea on how to do this? Thanks in advance!!
Currently have a project that takes data from a neo 6m (long and lat) and then I need it to be uploaded to my computer from the modual. I currently have a sim800l interfaces to get the coordinates when periodically sent to my phone and an nrf2401 to send the coordinates all the time to my computer to be uploaded to the mapping software but I want to improve the range.
I’m under the influence that a LORA modual will provide about 15km range to the project with about 5k in urban settings which is good but there’s also the gprs root where I can upload directly to the website. Was wondering which methods people on here would be opting for as the gprs means I have extended range but I’m not too sure what people will say and if I’m overlooking something simple.
Thanks in advanced :)
The left VCC and GND is from the breadboard power supply which is 5v tone done by a 12V by a regulator (4th image). I am also using that breadboard power supply to power my ESP32 (got burnt). It had the blue connector connecting VCC with VCC-JD. What should I do so that I control the relay using the IN pins without burning my ESP32. I put both inputs as the same channel but different relays as one is using AC120V and another is DC12V.
In the modern day there are 4 most used ways to use remote controll between 1 electronic computers, Bluetooth, Wifi, Rfid and radio frequenty. Now you can do these with a flipper zero with ESP mod, for 300€ (in my country), wich is a lil out of my budget
Now I am going to build this myself using my fav compny, M5stack. Now the one i am going to use, is a esp32, so wifi and bluetooth is easy. Found by the same company going to use a RFID scanner and sender.
But now radio freqwenty. I am a prof drone pilot so I know what the drone use, but not my car key and garage door. What frequenty modules should i put? Looking on m5stack site there are a lot
Hello, I hope this isn't a silly question as i'm starting learning Arduino for my little project. I have a bunch of these buttons from a kit, and I’m curious about the purpose of this specific form factor. I’m currently building a control panel for a 3D scanner turntable, and I’m wondering if these buttons are primarily meant for quick breadboard prototyping. I’m struggling to think of a practical way to integrate them into any kind of enclosure I can visualize. Do you have any exemple of how you are using them ?
I purchased those others buttons which are easier to integrate as I can just tighten the nut, but they require soldering. What kind of buttons do you use in an enclosure ?
I need to make a maze solver, for the very first time. The worst part is, it's for a competition. I am under the water, please help me.
I will be using one of those "anti-gravity" toy cars due to their suction ability allowing for high precision when turning. I also want to use a camera with a raspberry pico. The motors will be controlled using a mini L293N. I also have a MPU6050 available. Would that be enough?
i'm trying to configure two hc05 transmitters but when i try to use AT commands it says "Error:(0)" in every single command. the only command it says "OK" to is when i type AT. I configured it to 9600 baud and NL & CR. please help as this is urgent.
Hi everyone,
I’m building a "Smart Climbing Wall" where each climbing hold lights up with an LED and has a button to press when you reach it.
I’m thinking of using piezo sensors as the buttons, but I’m not sure if they’ll last long or if I’ll need to keep fixing them all the time.
What do you think? Are piezos a good choice, or is there something better?
I've installed the cp210x drivers uninstall ed and reinstalled tried all the windows versions tried ch4ser one as well and it still won't appear. I had it working then the board suddenly turned off and the led only comes on now if I hold en but that's another issue so I switched to a new board but it won't connect at all now Any ideas? Thank you
Edit: I solved the problem not sure on the exact cause or why it worked before but I connected it to a power supply unit and it all started to work
Hi i made this project on wokwi(https://wokwi.com/projects/414874509761902593) and i want all the buttons on the same pin but i am so confuse how to do it. i try to learn following some tutorials online adapting the same wiring schematic on the tutorials to my project and nothing any help please thanks
kinda afraid of it
I'm on a mission to create a better candle flicker. I've experimented with various iterations using the random PWM output and they are OK but not what exactly I'm looking for. The function shown in the attached photo produces an incredibly smooth, stepless, and realistic simulation of a candle flicker when used to control an incandescent light bulb. I pulled it from my lighting console.
Can anyone point me in the right as to how to create a function that would essentially mimick what is shown in this graph? I have basic Arduino coding skills, but I lack the maths skills needed to create this sort of random time/intensity function with smooth transition on the Y axis.
Thanks!
I am a first year engineering student, and I am very new to arduino, and in fact I only am interested due to one of my courses where in matlab we learn to utilize the grove beginner arduino kit (nano3 board) and other attachments such as a moisture sensor, a water pump, and a co2 sensor (grove SGP30). Since matlab is not the language the designers intended to use, our prof had to create a matlab library for the sensor to output co2 levels in ppm. This would be fantastic if not for the fact that when attempting to collect samples with a set pause between samples, always at some point (as in sample ~60 of 1000) the library will throw a CRC error, as shown below. When I attempted to remove the block that threw the error in the library, the second error below appears, meaning there is an issue with the library itself.
% CRC error:
CRC error 133 != 245 for crc check 1
% error with CRC error block removed from library:
Unable to read the data from the I2C device. Check the connections between the hardware and device, For MATLAB clear the device object and try again.
My professor told us if we encounter the CRC error we can try to 1: increase pause time between sample collections (as in from 0.05sec to 1sec smh) or 2: fiddle with the timings in the matlab library as shown below.
%I2C Delay
Delay4IAQInit = 10; %ms Not defined in Datasheet uses 10ms
Delay4ReadAirQuality = 2; %Typ.2ms Max.10ms
Delay4ReadSerialNumber = 10; %Typ.10ms Max.12ms
Delay4GetBaseline = 10; %Typ.10ms Max.10ms
Delay4SetBaseline = 10; %Typ.10ms Max.10ms
Delay4SetHumidity = 1; %Typ.1ms Max.10ms
Delay4MeasureTest = 200; %Typ.200ms Max.220ms
Delay4GetFeatureSet = 1; %Typ.1ms Max.2ms
Delay4MeasureRawSig = 20; %Typ.20ms Max.25ms
%CRC
crc8Polynomial = 0x31;
crc8Init = 0xFF;
Nothing I try to change in the delay menu works, but I might have to set super specific timings that I am unaware of.
This is the crc function from my profs library if someone understands what's flying.
function crcOut = generateCrc(obj,data)
obj.logme(dbstack,' ');
% https://www.mathworks.com/help/matlab/matlab_prog/perform-cyclic-redundancy-check.html
% Online calculator: http://www.sunshine2k.de/coding/javascript/crc/crc_js.html
crc = sgp30.crc8Init; %SGP30 crc8Init is 0xFF;
polynomial = sgp30.crc8Polynomial; %SGP30 crc8Polynomial is 0x31
for k= 1:length(data)
bt = uint8(data(k));
crc = bitxor(crc,bt);
for i = 1:8
test = bitand(crc,0x80);
if test ~= 0
crc = bitxor(bitshift(crc,1),polynomial);
else
crc = bitshift(crc,1);
end
end
end
crcOut = bitand(crc,0xFF); %Converts to uint8
% SGP30 Datasheet Example CRC: 0xBEEF = 0x92
end
Nothing I try to change here works. Any suggestions would be greatly appreciated since my lab report with the sensor is due on sunday.
I'm trying to get my arduino nano to read through the PCF8574 when 8 select lines go high in a pre-midi music keyboard. One possible problem is I don't know if it is a PCF8574 or A. I bought these. My code is below.
I'm using the library from xreef.
5V and GND via Nano, SDA-A4 SCL-A5, int-D2
From the Serial Monitor I get lots of "S: 0000000". So I read that as the interrupt pin is firin (which it should, there'll be a state change every approx 50micro seconds), but I'm not getting the output correctly
#include "PCF8574.h"
/* * PCF8574
* J1 - KO1 - P0 (Select In 1)
* J6 - KO2 - P1 (Select In 2)
* J7 - KO3 - P2 (Select In 3)
* J8 - KO4 - P3 (Select In 4)
* J9 - KO5 - P4 (Select In 5)
* J10 - KO6 - P5 (Select In 6)
* J11 - KO7 - P6 (Select In 7)
* J12 - KO8 - P7 (Select In 8)
*
*/
// Function Interrupt
void keyPressedOnPCF8574();
PCF8574 pcf8574(0x38, 2, keyPressedOnPCF8574); //PCF8574 interrupt connected to D2
bool keyPressed = false;
void setup() {
// put your setup code here, to run once:
for(int i=0;i>8;i++){
pcf8574.pinMode(i,INPUT);
}
pcf8574.begin();
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if(keyPressed){
PCF8574::DigitalInput selectIn = pcf8574.digitalReadAll();
Serial.print("S: ");
Serial.print(selectIn.p0);
Serial.print(selectIn.p1);
Serial.print(selectIn.p2);
Serial.print(selectIn.p3);
Serial.print(selectIn.p4);
Serial.print(selectIn.p5);
Serial.print(selectIn.p6);
Serial.println(selectIn.p7);
keyPressed=false;
}
}
void keyPressedOnPCF8574(){
keyPressed=true;
}
Hey everyone,
I'm close to finishing a project I’ve been working on for months! However, coding is now the only thing I need to finish. My entire setup is perfect; everything is working (I only need to purchase the correct batteries). But before I go full throttle on the project, I wanted to ask if someone can double-check the coding for this project before I kick off with it, please.
I’m entirely new to the game and coding is not of my expertise.
For Hardware, I’m using:
An Arduino Nano A NOYITO I O Expansion Sensor Shield Module for UNO R3 Nano V3.0 Nano Pro Four Beffkkip SG90 9g Micro Servos for RC Robot Helicopter Airplane Controls Car Boat motors A DWEII IR remote 17 button system
For Software, I used a combo of Arduino and Otto Blockly.
This project's goal is to have a small robot I designed to move on an IR remote. I already did a test run with the IR remote function (which was successful) but now getting the bot moving via buttons is the next hurdle.
For the coding itself, I used a combination of the coding for the IR remote and some minor codings from Otto Blockly (hence why there’s a lot of the word ‘Otto’ thrown around)
Verifying-wise, Arduino said it was good to go, but I wanted to ask someone who was in this game a lot longer if they could look over the code and see if there are any mistakes to it and what could be changed. I have the link to the coding below and photos of my setup up as well as schematics for safety!
Thank you in advance!
Hi everyone,
I’m working on a senior design project to create an automated toilet seat lifter. Our setup includes:
I’ve attached pictures of our setup and included the code we’re using to run the motor.
The issue:
When we run the code, the motor activates (you can feel vibrations and hear it working), but the shaft does not rotate as expected. Instead, it sputters, shakes, or vibrates without stepping correctly. We are unsure if the issue we have is physical (i.e. missing wires in our setup), code-based (we are missing code or wires/pins listed incorrectly), or another issue (power supply, etc).
What we’ve checked:
Photos:
close up of pins and connections
Code:
#include <AccelStepper.h>
// Define pins for the X-axis motor
#define stepPin 2
#define dirPin 5
// Create an AccelStepper object
AccelStepper stepper(AccelStepper::DRIVER, stepPin, dirPin);
void setup() {
Serial.begin(9600);
Serial.print("Current Position: ");
Serial.println(stepper.currentPosition());
// Set maximum speed and acceleration
stepper.setMaxSpeed(500); // steps per second
stepper.setAcceleration(250); // steps per second^2
// Set initial position
stepper.setCurrentPosition(0);
}
void loop() {
// Move 1000 steps forward
stepper.moveTo(200);
stepper.runToPosition(); // Blocking call, motor moves to position
delay(1000); // Wait 1 second
// Move 1000 steps backward
stepper.moveTo(0);
stepper.runToPosition(); // Blocking call, motor returns to position
delay(1000); // Wait 1 second
}
My group has a mechanical engineering background, so we’re less familiar with the electrical side of things. Any advice on why the motor isn’t stepping correctly and how to fix it would be greatly appreciated!
I missed a call today and when I listened to the voicemail it was someone claiming to be with arduino?? Said they were just calling to see if they could help out and that a gabe or Gabriel would be emailing me. Then said something about deals until the end of the year. Super weird has anyone else every received anything like this before? I did get the engineering kit a little while back. I went to the arduino website contact and sent them a message asking about the phone calls validity but no response yet. Just curious as to if anyone else has had anything similar?
Hi all, I’m doing an arduino based engineering project and I’m in need of some help. I’m wanting to take diagnostic codes from a car have them read by the arduino and then have the arduino communicate back what parts need replaced. I have the translations from code number to part(s) need to be replaced or examined but am uncertain how to add this data base to the arduino and how I can have the arduino take the given codes and spit back the diagnosis. My idea is to use arduino to read car diagnostics and also use sonar sensors, piezoelectric sensors, and a few other things to search for mechanical errors. All help is appreciated I understand if this is not achievable as well, thanks in advance!