First Arduino project

Hi everone!

My name is Antonio and I'm starting with simple project.
I'm working on school project and the task is to connect Arduino with six push button.

Every button will be in the one part of teddy bear (hand, leg, ear).
Push button is sending signal to Arduino and then I need to play via Arduino and speaker which part of the body it is.

If someone press right leg then on speaker we need to hear "Right leg."
Hope everyone understand task.

Now I have question..

  1. Do you prefer some push button for this occasion?
  2. Which Arduino model should I use?

That's all for now!

Thanks everyone hope project will go well.

Any Arduino would do the job. Selecting a fysically small version might be interesting. Power consumption might be interesting.
Buttons... The fycical aspect us likely the most imoortant aspect.

What really matters is how you will mount the push buttons so the can be pushed. They can't be left with nothing to hold them while being pushed!

Is the project going to be placed inside a teddy bear or just laid out on say a breadboard ?

It's prefered to be inside.
We are thinking even about touch sensor.
Of course, it's will be supported by something that will hold it.

We expect to support it by something not developed yet but something will hold button or touch sensor of course.

The you must match the physical construction of the push button with the unknown supporting material! Designing things have to be done one step at a time!

Stuffed animals generally have switches similar to this that are sewn in place

Maybe use an Adafruit Pro Trinket or it's newer replacements

Audio by DFPlayer Mini

1 Like

Thank you very much @2112 !
You helped a lot!

Happy to help. Here is another switch

Have fun and best of luck to you

Welcome to the forum.

You didn't say, but if you've not done anything like this, it will go easier if you proceed step by step.

Use any Arduino board and perfect a sketch that prints "you pushed on the kidney" or whatever is appropriate, for each of six pushbuttons of any kind.

That will be most of the logic for your toy and will be easier to get working before you start on the audio, before you start on the final mechanical concept.

If you use the DF player, start by getting example code to work, code you didn't write or mess with.

Combining working parts is better than having the hole thing inside a teddy bear doing nothing at all.

a7

Hi Alto

Thanks for warm welcome message.

This is my first Arduino project so I'm thinking step by step.

First idea is to connect six buttons and maybe use LED just to have some indication (even I can use monitoring in Arduino with message like "Button 1 - pressed."

Thanks for ideas.

No Arduino needed.

You can connect buttons directly to a DFplayer Mini like this:

I'd second the suggestion from @PaulRB (unless getting started with Arduino is your primary motive, rather than getting the toy made in a short time).

Using the link to the module's datasheet provided by @2112 I'd suggest the simplest version, with only five buttons. You'll find its schematic by scrolling about a third down. And I think instead of a miniature speaker you might need to consider an earpiece.

@Terrypin

To be honest, my main motive is to start working with Arduino so I think I will choose recommendation by @2112.

Thanks for ideas, will check what are you talking about tonight.

1 Like

That's why I didn't recommend the below. It's easier, it's comparable in cost considering it replaces the Arduino, audio player and amp, but no programming required.
Adafruit Audio FX Sound Board + 2x2W Amp - WAV/OGG Trigger - 2MB : ID 2210 : $24.95 : Adafruit Industries, Unique & fun DIY electronics and kits

Don't know if that leaves Antonio confused, but I am? He wants an Arduino solution, which I understood you recommended from your link in post #8. But now you don't?

My apologies if I confused anyone

Post #8 is an Arduino solution using Arduino IDE. Post #16 isn't. That's why I didn't bring it up at the time of post #8.

The Adafruit Audio FX can be Arduino controlled via serial, but why bother.

I mentioned it later to illustrate other alternatives in a small, easy to use package

Thanks for clarifying.

Based largely on Antonio’s last post but also on a guess as to his skill level, my suggestion would be a Uno plus an inexpensive DfR MP3 Mini Player module. He could use the latter either for a no Uno, resistor-based project, or successively less simple Uno stuff.

Everyone!

Project is at the moment in the last phase.
I have problem with some communication.
For this, I bought joy-it arduino mega 2560 rev3, I have DfR MP3 Mini Player module and speaker.

Problem is in some communication. For test, I worked with Arduino Uno and all worked well. Now I change to joy it and I have problem..

Code here:

#include "DFRobotDFPlayerMini.h"
#include <SoftwareSerial.h>
#include "Arduino.h"

#define rxPin 10
#define txPin 11

// Set up a new SoftwareSerial object
SoftwareSerial mySerial =  SoftwareSerial(rxPin, txPin);
#define FPSerial softSerial


// ============= PINS SETUPS =============

// buttons
const int btn_left = 2;
const int btn_right = 3;

// leds
const int led_left = 6;
const int led_right = 7;


// ============= OTHER =============

// state ON/OFF of buttons
int btn_left_state = 0;
int btn_right_state = 0;

int btn_left_state_prev = 0;
int btn_right_state_prev = 0;

int led_left_state = 0;
int led_right_state = 0;


unsigned long time = 0;           // the last time the output pin was toggled
unsigned long debounce = 200UL;


DFRobotDFPlayerMini myDFPlayer;


void setup() {

  // Define pin modes for TX and RX
    pinMode(rxPin, INPUT);
    pinMode(txPin, OUTPUT);
    
    // Set the baud rate for the SoftwareSerial object
    mySerial.begin(9600);
  
  // LEDs -> Outputs
  pinMode(led_left, OUTPUT);
  pinMode(led_right, OUTPUT);

  // Buttons -> Inputs
  pinMode(btn_left, INPUT);
  pinMode(btn_right, INPUT);




  FPSerial.begin(9600);

  Serial.begin(115200);

  Serial.println();
  Serial.println(F("DFRobot DFPlayer Mini Demo"));
  Serial.println(F("Initializing DFPlayer ... (May take 3~5 seconds)"));

  if (!myDFPlayer.begin(FPSerial, /*isACK = */true, /*doReset = */true)) {  //Use serial to communicate with mp3.
    Serial.println(F("Unable to begin:"));
    Serial.println(F("1.Please recheck the connection!"));
    Serial.println(F("2.Please insert the SD card!"));
    while(true){
      delay(0); // Code to compatible with ESP8266 watch dog.
    }
  }
  Serial.println(F("DFPlayer Mini online."));

  myDFPlayer.volume(30);  //Set volume value. From 0 to 30
  
}

void loop() {

  // read the state of buttons
  btn_left_state = digitalRead(btn_left);
  btn_right_state = digitalRead(btn_right);


  // left button
  if (btn_left_state == HIGH) {

    myDFPlayer.play(1);

    digitalWrite(led_left, HIGH);
    delay(2800);
    digitalWrite(led_left, LOW);

    
  }

  // right button
  if (btn_right_state == HIGH) {
    myDFPlayer.play(2);

    digitalWrite(led_right, HIGH);
    delay(2800);
    digitalWrite(led_right, LOW);
  }
 
}

Problem/Error next:

C:\Users\Antonio\Dropbox (Old)\PC (2)\Downloads\CAR_Arduino\CAR_Arduino\prototype\prototype.ino: In function 'void setup()':
C:\Users\Antonio\Dropbox (Old)\PC (2)\Downloads\CAR_Arduino\CAR_Arduino\prototype\prototype.ino:10:18: error: 'softSerial' was not declared in this scope
#define FPSerial softSerial
^
C:\Users\Antonio\Dropbox (Old)\PC (2)\Downloads\CAR_Arduino\CAR_Arduino\prototype\prototype.ino:64:3: note: in expansion of macro 'FPSerial'
FPSerial.begin(9600);
^~~~~~~~
C:\Users\Antonio\Dropbox (Old)\PC (2)\Downloads\CAR_Arduino\CAR_Arduino\prototype\prototype.ino:10:18: note: suggested alternative: 'mySerial'
#define FPSerial softSerial
^
C:\Users\Antonio\Dropbox (Old)\PC (2)\Downloads\CAR_Arduino\CAR_Arduino\prototype\prototype.ino:64:3: note: in expansion of macro 'FPSerial'
FPSerial.begin(9600);
^~~~~~~~

exit status 1

Compilation error: 'softSerial' was not declared in this scope

Need help! haha