/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

655,189 Subscribers

1

[noob] - new nano not showing as a serial device in linux

I have just bought a starter kit with a Arduino nano. When I plug the usb into my linux box the nano itself has one solid light and one blinking light.

on the linux side there is no evidence that the usb/serial device is connected.

if I list active serial devices the only one is /dev/ttyS0 (and that shows up in the IDE).

If run # dmesg -c after a unplug/replug nothing is shown.

my user is part of dialout group

is there some nano driver that I need to install or something?

0 Comments
2024/07/20
10:21 UTC

1

Playing buzzer music with IR remote. Why doesn't the music play for the second time?

What I'm trying to do

I wired up buzzer and IR receiver. I'm trying to play music with buzzer using IR remote. I intend to make the project so that if I press button 0, playtestSong() gets called to play some music on the buzzer if I press button 1, playHipHop() gets called and so on.

Overview of the Issue

However, in reality, when I press button 0, the music plays the first time but none of the buttons work for the second time.

If I remove playtestSong(); then remote works fine. The print statements inside the if statement for respective buttons gets executed. For example, if I press button 1, 2, 3, it outputs

You pressed button 1
You pressed button 2
You pressed button 3

What I tried to fix it

I added print statements before, after, and inside the playtestSong();. There is another print statement Serial.println("after if"); at the end of the if statements. If I run it and press button 0, the print statement before, inside, after playtestSong(); gets executed and works fine for the first button press.

First time I pressed button 0:

You pressed button 0
Playing test song
Done with test song
Exited out of the function
after if

However, if I press it again. Only "after if" gets printed. The whole if statement doesn't seem to be running.

Second, third, fourth time I pressed button 0:

after if
after if
after if

I figure out the issue but I don't know how to fix it

So I printed buttonCode after the if statements. Serial.println(buttonCode); and when I run the program and press button 0 it only print 3910598400 (the button code associated with button 0) first time but seemingly random number thereafter.

Example pressed button 0 four times:

3910598400
2287147692
16384
96

Example reuploaded and pressed button 0 four times again:

3910598400
2048
2450028189
2104792976

When I removed playtestSong(); it consistently prints 3910598400

Example pressed button 0 four times:

3910598400
3910598400
3910598400
3910598400

But why on earth would playtestSong() affect the variable buttonCode?

The code

music.ino

#include <IRremote.hpp>
const int IR_RECEIVE_PIN = 9;


void setup() {
  Serial.begin(9600);

  IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK); // Start the receiver

}


void loop() {
  if (IrReceiver.decode()) {
    unsigned long buttonCode = IrReceiver.decodedIRData.decodedRawData;

    // Button 0
    if (buttonCode == 3910598400) {
      Serial.println("You pressed button 0");
      playtestSong();
      Serial.println("Song done");
    }
    // Button 1
    else if (buttonCode == 4077715200) {
      Serial.println("You pressed button 1");

    }
    // Button 2
    else if (buttonCode == 3877175040) {
      Serial.println("You pressed button 2");

    }
    // Button 3
    else if (buttonCode == 2707357440) {
        Serial.println("You pressed button 3");

    }    
    // Button 4
    else if (buttonCode == 4144561920) {
      Serial.println("You pressed button 4");

    }
    // Button 5
    else if (buttonCode == 3810328320) {
      Serial.println("You pressed button 5");

    }    
    // Button 6
    else if (buttonCode == 2774204160) {
      Serial.println("You pressed button 6");

    }
    // Button 7
    else if (buttonCode == 3175284480) {
      Serial.println("You pressed button 7");

    }  
    // Button 8
    else if (buttonCode == 2907897600) {
      Serial.println("You pressed button 8");

    }
    // Button 9
    else if (buttonCode == 3041591040) {
      Serial.println("You pressed button 9");

    }
    Serial.println("after if");
    Serial.println(buttonCode);


    IrReceiver.resume(); // Enable receiving of the next value
  }


  delay(0.01);
}

musicFunctions.ino

const int BUZZER_PIN = 8;

// Note frequencies in Hz
const int NOTE_B0  = 31;
const int NOTE_C1  = 33;
... other notes here
const int NOTE_D8  = 4699;
const int NOTE_DS8 = 4978;


void playNote(int note, int duration) {
  tone(BUZZER_PIN, note, duration);
  delay(duration * 1.30);  // Adding a delay to separate the notes
  noTone(BUZZER_PIN);  // Stop the tone
}

void playtestSong() {
  Serial.println("Playing test song");
  playNote(NOTE_E5, 300);
  playNote(NOTE_DS5, 300);
  Serial.println("Done with test song");

}

I'm using https://github.com/Arduino-IRremote/Arduino-IRremote library

2 Comments
2024/07/20
08:00 UTC

4

Trying to send a specific voltage range to A0-A4, but it seems to have an effect on the neighboring ports. Any ideas?

5 Comments
2024/07/20
07:27 UTC

1

Can i possibly transfer Audio from an ISD1820 to my laptop???

My project consist of recording answers of random questions and get them on my laptop, the "recorder" i chose for my project is the "ISD1820" but i'm not sure if i can transfer the audio to my laptop through an Arduino Uno R3. Can someone help me or tell me what microphone module i can buy? It's for a school proyect literally.

1 Comment
2024/07/20
02:15 UTC

0

Thermal imaging system

Hi everyone, I want to know if there are any Arduino-compatible thermal imaging systems on the market, I searched online but I couldn't find any. I am looking for something that would output a view like this

https://preview.redd.it/yl4wlnfa1ldd1.png?width=259&format=png&auto=webp&s=e2df51043bd8b6fdc32b2c276c1484a6466c672f

Thanks for your help :)

3 Comments
2024/07/20
02:11 UTC

1

Wiring check.

https://preview.redd.it/4ae7ugfgzkdd1.jpg?width=1641&format=pjpg&auto=webp&s=f12a18e8f6b3531223caeb7720c18e62db923b3d

Just making sure if i have my GPIO pins set as inputs, that this wiring would work. All good?

0 Comments
2024/07/20
02:00 UTC

1

Controlling led strip with ATmega8

Hey guys new to programing and circuits. I have been able to program an atmega (or so I think) just trying to problem solve if my circuit is built right.

(As in the picture) pin 4 (digital pin 2) to data wire of the led strip through 330ohm resistor. p5 (D3) to button 1 (b1). P6 (D4) to b2. P7 (VCC) connects to power of leds. P8 (GND) connects to ground of leds. P9 and P10 connected to 16mhz crystal with 22p capacitors connecting each side to ground. P11 (D5) connected to B3. Also all buttons are connected to ground and theres a 10uf capacitor between power and ground.

Here is the start of the code as well.

#include <FastLED.h> #include <OneButton.h>

#define LED_PIN 2 #define BTN_PIN 3 #define BTN2_PIN 4 #define BTN3_PIN 5 #define NUM_LEDS 72

CRGB leds[NUM_LEDS]; uint8_t patternCounter = 0; uint8_t patternCounter2 = 0; uint8_t patternCounter3 = 0; OneButton btn = OneButton(BTN_PIN, true, true); OneButton btn2 = OneButton(BTN2_PIN, true, true); OneButton btn3 = OneButton(BTN3_PIN, true, true);

If this is the wrong place let me know so I can post it somewhere else. Any help would be greatly appreciated. Thanks

0 Comments
2024/07/20
00:38 UTC

2

SoftwareSerial issue

Im working on a project involving an Arduino nano 33 BLE rev2, and am working on a Mac. There is an HC-05 bluetooth module connected to it, and I'm trying to receive IMU data, namely from the gyroscope and accelerometer, and output it to either the serial monitor or to a separate text file. I saw a YouTube video that did such a thing, and it involved using SoftwareSerial to, as I understand it, change the TX and RX pins to different pins. When I run the code that includes #include <SoftwareSerial.h>, it tells me that the file or directory can't be found. I thought that it was included with the Arduino IDE, but maybe not?

1 Comment
2024/07/20
00:59 UTC

0

Parking assist sensors with arduino projects?

Has anyone ever used parking assist sensors with their arduino projects? I would imagine them being more robust than the HC-SR04 ultrasonic sensors, but how else would they compare? More/less sensitive? Better range? How did you use parking assist sensors?

4 Comments
2024/07/19
22:57 UTC

0

how to program an Atmega644a with a t48 programmer

how do i upload code written in Arduino ide onto a Atmega644A. i have a t48 programmer

6 Comments
2024/07/19
21:33 UTC

1

Stabilizing my Standing Desk

I want to use an arduino and some motor to push and retract from wall on a button or switch, thereby greatly increasing the stability of my desk. I want suggestions for the motors as I couldn't find what i was looking for

9 Comments
2024/07/19
21:31 UTC

0

UnoKeys. Macros for pc using Arduino Uno https://github.com/Carloux/UnoKeys

Hi, im new in this reddit, but i wanted to share this thing i made,

https://github.com/Carloux/UnoKeys.

https://preview.redd.it/sdizhk9vijdd1.png?width=1200&format=png&auto=webp&s=aabb13139a70e0692f111300365989d88d83bd70

You can make pressing buttons on the Arduino execute keyboard keys or mouse clicks and more, you can also add delay to key combinations to make macros, you must follow the README for the program to run.

CONTEXT: I was looking online for a code to make keyboard macros with an arduino uno, but everywhere they said that I needed an arduino pro micro or a leonardo, so I got to work and made a solution, and since it was supposed to be something It couldn't be done, I wanted to share the program with everyone.

0 Comments
2024/07/19
21:06 UTC

1

vin as a power supply..

I'm using a nano to power servos that operate at 6V. Since I can't use the micro USB(it's max V is 5V.) Can I connect the external 6 DC wall wart to the Vin pin? Then where will I plug into the servos?

2 Comments
2024/07/19
21:17 UTC

2

How do I send data over range?

For context, I am building a model rocket that tracks its speed and altitude. I want to be able to have the information in real time, how can I do this? It’ll need to be in the 2000m range.

8 Comments
2024/07/19
20:50 UTC

18

Building a TARDIS from scratch

So this was a project I did about 10 years ago as a graduation gift for my kid. Everything was built up from scratch using balsa wood, and airbrushed using model railroad paint. It has an ATtiny85 and a cheap digital record/playback board inside. When turned on the top LED fades in and out multiple times as it plays "the TARDIS sound". The interior lights (LEDs) for the top 4 signs stay on constant. Yes; there is Gallifreyan writing on the inside and all kinds of Easter eggs hidden away in it. Eventually all of the electronics were stored up inside the TARDIS and some of it is in the base pedestal.

It was a labor of love and I spent over a year making it (and remaking parts of it) until it was as close to "perfect" as I could get it. The dimensions are totally accurate and scaled down. Sadly the source code is either lost or on another older machine (I looked for it). The ATtiny85 controlled the top light to fade in and out and the 4 signage lights individually, and also triggered the playback module. The playback module was one of those cheap "press a button to record 20 seconds of digital audio, press another to play it back" swag devices given away at some convention I had attended. After 10 years of being moved around from apartment to apartment the wires have now come loose so I'm in the process of repairing it and re-implementing the sound playback using a DF Mini sound module.

I showed the images to some friends and they suggested it might make a good "Look what I made!" post since I've never really posted much about it, even though I took pictures all along the building stages. The full build gallery (107 images!) is here on imgur. The following images are just a sampling of the build that included some of the Arduino/electronics images.

the final (almost completed) results

all hand made using balsa wood

https://preview.redd.it/zcicj2902jdd1.png?width=1280&format=png&auto=webp&s=8d2ef673c78e69b89b3e0a6c7fcceb1eb3bb4581

https://preview.redd.it/xoyjf7y22jdd1.png?width=1280&format=png&auto=webp&s=1db83bfab82c9841c6d5a4af41a3ae5d7d77de7e

https://preview.redd.it/igzf0ru62jdd1.png?width=1280&format=png&auto=webp&s=0bb2b379278afe0a75d174c6cd841bc7fc6f87b8

building out the top

the top light is a 0.5 cm section of a clear plastic Bic pen, with lines drawn on it

https://preview.redd.it/qow9v5xp2jdd1.png?width=1280&format=png&auto=webp&s=20facc1e4f882fff9aa891f90e286f2c0ab282ac

complete with Gallifreyan writing on the inside

hand for scale

programming and testing the top light as it slowly fades in and out

to get an idea of scale, that doorknob is a pin head

testing the top light and the 4 LED's for the signage at the top for all four sides

the guts just before assembly. Used a tiny 3.3V LDO voltage regulator to power it all

https://preview.redd.it/g7a3n5rh3jdd1.png?width=1280&format=png&auto=webp&s=b11042819135671e46c06a6a4f365d487f8b6df6

https://preview.redd.it/t9y89upk3jdd1.png?width=1280&format=png&auto=webp&s=6ec16619485ed5b423be3f17d1c0bbf9b48b9ae8

9 Comments
2024/07/19
20:23 UTC

1

Need help with rfr leonardo board steering wheel.

My steering wheel works fine but sometimes the steering center changes a little bit. But when I plug in buttons on my board and start pressing the buttons the encoder input just freezes and stops working for a few seconds. I am posting the diagram I used to set up the circuitry.

1 Comment
2024/07/19
20:10 UTC

1

Timer question

I know an Arduino has a timer inside it as I did the led on and off but what is it's maximum parameters? Can it time over an hour? 24 hour's? I mean if I want a lamp to come on every 8 hour's or so for a few minutes can the Arduino board do this or do I need an add on? Thanks in advance

3 Comments
2024/07/19
18:13 UTC

0

Help with Arduino

Hi I'm working on an iron man suit slowly but Shirley,

I want to find a board that would allow 3 button inputs as well as 3 light outputs and 2 servo motor outputs and 1 sound output.

Not sure if I would be able to find all that on 1 board that's small enough or if I would have to find a couple different boards

Just looking for recommendations and links for boards, servos and ect. Any help woould be great.

2 Comments
2024/07/19
16:25 UTC

6

arduino screw board

Looking for a way to easily connect wires to my arduino I have found this but unfortunately this is not compatible with my arduino pro micro. Does anybody know how it’s called, have a link to one for a pro micro or know of any better alternatives?

3 Comments
2024/07/19
13:29 UTC

0

Would I be arrested/booted from a plane if I carry my Arduino Starter kit in carry on/check in luggage?

So I started learning Arduino programming for my self and just for some fun little projects - like automatically watering my plants, etc. I landed a full time job and would need to fly to another state for it. Is it a good idea for me to bring my Ardunio kit (battery, motors, wires, arduino and modules, etc) in the Elagoo Starter Kit pack with me on the plane?

Or is this clearly illegal? I honestly dont know since Ive never brought anything like this sbefore.

I found a post from 8 years ago about this too, but i didnt really get a super clear answer...

If anyone has done this before, Id appreciate your honest experience. Is it a problem? I would just buy a new kit in my new residence if needed.

25 Comments
2024/07/19
18:54 UTC

0

How to make money with projects?

Hi everyone, so I’ve been making a bunch of projects over the years and have a bunch of experience working with esp32’s(+ other microcontrollers) and arduino coding, and made things like robotic arms, keyboard pianos, displays, and more. I’m looking to try and profit off my expertise, maybe by selling projects or code to people, whether it be something like commissions and I ship out a project, or people ask for a code online. How should I start? Social media? eBay?

5 Comments
2024/07/19
17:59 UTC

0

What are my odds of building something like this with an Arduino (lipo balance charger)?

https://blackmarketfpv.com/product/toolkitrc-m7-multifunctional-balance-charger-200w-dc-10a-2-6s/

I've seen a few schematics elsewhere, but obviously I'd like to approach the quality and functionality.

What books are recommended?

Thanks so much

Joe

4 Comments
2024/07/19
15:52 UTC

1

Using arduino uno for physics experiments

Hello everyone, do you guys have any ideas on how to use the arduino to conduct physics experiments ( any branch of physics : nuclear/particle/electromagnetism/quantum...) ( perhaps using a laser 650 nm red HeNe laser?)

Maybe like : Measuring the resistance and resistivity of materials Magnetic force Anything related to kinematics like free fall , projectile motion, speed of light, specific charge of electron, a simple Spectrometer, the photoelectric effect, frank hertz experiment, balmer series , zeeman effect, radiation.....

My questions is how can we do any of these if possible, like what kind of hardware to use, the connection and schematics, code, etc..

10 Comments
2024/07/19
15:03 UTC

1

Using Arduino to control SK6812 RGBW stripes via sACN

Hi everyone, for a project I'm currently working on I want to control SK6812 RGBW stripes from a GrandMA console. I'm currently using sACN for this, as it seems to be the easiest out of all the ways I've tried so far.

I'm able to control the stripes with the code below, they are however pretty slow in updating. According to Google, sACN is updated at up to 40 Hz when channels are changing, my stripes look to be updating around 5 Hz (just from looking at them). For tests, I simply output a white chaser on my GrandMA console, so the output into the network shouldn't be the issue, I think it's with either the stripes themselves or my program. I'm unsure whether this is an optimization issue or something else, that's why I've tried removing the Serial output, but that doesn't lead to any noticeable difference.

I'm using a D1 mini pro (so the ESP8266); the only thing I've wired is the data pin of the stripes. For sACN, I'm using the ESPAsyncE131 library by forkineye and the NeoPixel library by adafruit.

Thank you in advance for any advice.

#include <ESPAsyncE131.h>
#include <Adafruit_NeoPixel.h>

#define UNIVERSE 1                      // First DMX Universe to listen for
#define UNIVERSE_COUNT 1                // Total number of Universes to listen for, starting at UNIVERSE
#define DATA_PIN 2                      // D4 = 2 on D1 Mini Pro
#define NUMPIXELS 54                    // Number of pixels per stripe
const char WIFI_SSID[] = "ssid";
const char WIFI_PWD[] = "pwd";

// ESPAsyncE131 instance with UNIVERSE_COUNT buffer slots
ESPAsyncE131 e131(UNIVERSE_COUNT);

Adafruit_NeoPixel stripe = Adafruit_NeoPixel(NUMPIXELS, DATA_PIN, NEO_GRBW + NEO_KHZ800);

void setup() {
    //  Serial.begin(115200);
    delay(10);  
    WiFi.mode(WIFI_STA);
    WiFi.begin(WIFI_SSID, WIFI_PWD);
    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        //  Serial.print(".");
    }
    e131.begin(E131_MULTICAST, UNIVERSE, UNIVERSE_COUNT);
    stripe.begin();
}

void loop() {
    if (!e131.isEmpty()) {
        e131_packet_t packet;
        e131.pull(&packet);     // Pull packet from ring buffer
        stripe.clear();
        for(int led = 0; led < 55; led++) {
          stripe.setPixelColor(led, stripe.Color(packet.property_values[led*4],
                                                 packet.property_values[led*4+1],
                                                 packet.property_values[led*4+2],
                                                 packet.property_values[led*4+3]));        
        }
        stripe.show();
    }
}
0 Comments
2024/07/19
14:35 UTC

1

ESP8266 - Receiving data from sensor to print in Java Application

Hi guys, I am doing an obstacle avoiding car which will also going to map the room to my java application. Right now with serial connection I can collect and able to print the data coming from the sensor in my application. But I want to collect it without a cable plugged in. I found people using ESP8266 for these kinds of projects, but couldn't able to find a good resource to learn how to do exactly. Can anybody give me some insights about it?

1 Comment
2024/07/19
14:05 UTC

84

My mini robot nano with arduino uno

11 Comments
2024/07/19
11:41 UTC

Back To Top