Arduino Tutorials – பாடம் 33 – DF Player mini using Arduino MEGA2560

DF Player mini ஐ Arduino Uno Board ஐ பயன்படுத்தி சோதனை செய்வது.

Required Components

  1. DF Player mini -1 no
  2. Data Cable -1 no
  3. Connecting Wires -1 set
  4. Arduino Uno -1 no
  5. Speaker -1 no
  6. Resistor 1000ohm -1 no

Circuit

Steps

  1. நாம் பயன்படுத்தும் உபகரணங்கள் சரியாக வேலை செய்கிறதா என்பதை உறுதி செய்து கொள்ளவும்.
  2. Arduino Uno Boardன் +5V மற்றும் ground சப்ளையை DF Player Mini VCC மற்றும் GND உடன் இணைக்க வேண்டும்.
  3. Resistor ன் ஒரு முனையை DF Player Mini RX மற்றும் Resistor ன் மறு முனையை Arduino Uno Board 1 அல்லது TX உடன் இணைக்க வேண்டும்.
  4. Resistor ன் ஒரு முனையை DF Player Mini RX மற்றும் Resistor ன் மறு முனையை Arduino Uno Board 1 அல்லது TX உடன் இணைக்க வேண்டும்.
  5. மற்றொரு Resistor ன் ஒரு முனையை DF Player Mini TX மற்றும் Resistor ன் மறு முனையை Arduino Uno Board 0 அல்லது RX உடன் இணைக்க வேண்டும்.
  6. DF Player Mini SPK-1 & SPK-2 ஐ Speker உடன் இணைக்க வேண்டும்.
  7. Arduino program ஐ சரி பார்க்க வேண்டும்.
  8. மின்சுற்றை சரி பார்க்க வேண்டும்.
  9. Arduino program ஐ ரன் செய்ய வேண்டும்.

Arduino Program

#include "SoftwareSerial.h"
#include <DFMiniMp3.h> 
#define DEBUG 0
class Mp3Notify
{
public:
 static void OnError(uint16_t errorCode)
 {
  Serial.println();
  Serial.print("Com Error ");
  Serial.println(errorCode);
 }
 static void OnPlayFinished(uint16_t track)
 {
  Serial.print("Play finished for #");
  Serial.println(track);
 }
 static void OnCardOnline(uint16_t code)
 {
  Serial.println("Card online ");
 }
 static void OnCardInserted(uint16_t code)
 {
  Serial.println("Card inserted ");
 }
 static void OnCardRemoved(uint16_t code)
 {
  Serial.println("Card removed ");
 }
};
SoftwareSerial secondarySerial(10, 11); 
DFMiniMp3<SoftwareSerial, Mp3Notify> mp3(secondarySerial);
const int LDRpin = A0; 
const int LEDpin = 13; 
int Song=1; 
int ldrStatus;
boolean onStatus = true;
boolean takeLowTime;
long unsigned int timeoutTimer = 0, resetCount = 0;
long unsigned int pause = 2000;

void setup()
{
 Serial.begin(115200);
 if (DEBUG) Serial.println("initializing...");
 pinMode(LDRpin, INPUT); 
 pinMode(LEDpin, OUTPUT);
 mp3.begin();
 mp3.reset();
 uint16_t volume = mp3.getVolume();
 Serial.print("volume ");
 Serial.println(volume);
 mp3.setVolume(20);
 uint16_t count = mp3.getTotalTrackCount();
 Serial.print("files ");
 Serial.println(count);
 uint16_t mode = mp3.getPlaybackMode();
 Serial.print("playback mode ");
 Serial.println(mode);
 if (DEBUG) Serial.println("starting...");
 mp3.playFolderTrack(6, Song);
}

void loop()
{
 ldrStatus = analogRead(LDRpin);
 if (ldrStatus >=300)
  {
    digitalWrite(LEDpin, HIGH);
    mp3.start();
    onStatus = true;
  }
 else 
  {
    digitalWrite(LEDpin, LOW);
    mp3.pause();
  }

 mp3.loop(); 
}

Usage

  1. தீ எச்சரிக்கை குரல் எழுப்புதல் (Fire alarm voice prompts).
  2. கார் வழிசெலுத்தல் குரல் ஒளிபரப்பு (Car navigation voice broadcast).
  3. ரயில் நிலையம், பஸ் பாதுகாப்பு ஆய்வு குரல் எழுப்புதல் (Railway station, bus safety inspection voice prompts).
  4. மின்சாரம், தகவல் தொடர்பு, நிதி வணிக மண்டபக் குரல் எழுப்புதல் (Electricity, communications, financial business hall voice prompts).

Ball Collecting Robot – Arduino Robots

Ball collecting robot is a mobile controlled wheeled robot which can be used to collect balls in a playing area. This is a prototype project which will be useful to learn about mobile robots. This concept can be extended to build fully functional ball collecting robot.

Component Required

  1. Arduino Nano
  2. Bluetooth
  3. 12V DC Motors (2)
  4. Dc Motor Driver
  5. 12V battery
  6. Servo Motor
  7. Cables & Wires
  8. Robot Wheels
  9. Robot Gripper

Circuit Diagram

Steps

1 :Connect the DC Motors with DC Motor Drive

2: Connect the DC motor drive OUTPUT Pins with Arduino Nano Pins

   Drive Pins                Arduino Nano

      1A                        D3
      1B                        D4
      2A                        D5
      2B                        D6

3: Connect the Servo Motor with Arduino Nano

      wires                  Pins

       Red                    5V
       Black                  GND
       Yellow                 D10

4 : Connect the Bluetooth with Arduino Nano

  Bluetooth               Arduino Nano

   5V                          5V
   GND                         GND
   RX                          TX
   TX                          RX

5 : Check the Connection once

6 : Upload the arduino program

7 : Install the mobile application in the mobile device.

8: Test the robot with mobile application

Arduino Program

#include <AFMotor.h>
#include <Servo.h> 
// Check the motor driver datasheet for motor pin connections
AF_DCMotor rm(1, MOTOR12_64KHZ);  // Right motor
AF_DCMotor lm(4, MOTOR34_64KHZ);  // Left motor
Servo grServo; // Servo motor for gripper
byte incomingByte ;

void setup() 
{ 
   Serial.begin(9600);
  // Set motors speed
   rm.setSpeed(200);  
   lm.setSpeed(200);
   rm.run(RELEASE);
   lm.run(RELEASE);
	grServo.attach(10); // Attach gripper
} 
void loop()
{
   if (Serial.available() > 0) {
    incomingByte = Serial.read(); // Read the input character from bluetooth serial input buffer
  
    if (incomingByte == 'A') 
    {
         grServo.write(120);      // Gripper Open Position
    }
    else if (incomingByte =='B') 
    {
        grServo.write(180);      // Gripper Close Position
    }
    else if (incomingByte == 'C') 
    {
        rm.run(FORWARD);        // Run both motors in forward direction
        lm.run(FORWARD);
    }
    else if (incomingByte == 'D') 
    {
        rm.run(BACKWARD);       // Run both motors in backward direction
        lm.run(BACKWARD);
    }
    else if (incomingByte == 'E') 
    {
        rm.run(BACKWARD);       // Turning Left. Run right motor in backward direction and left motor in forward direction
        lm.run(FORWARD);
    }
    else if (incomingByte == 'G') 
    {
        rm.run(FORWARD);        // Turning Right. Run right motor in forward direction and left motor in backward direction
        lm.run(BACKWARD);
    }
    else if (incomingByte == 'F') 
    {
        rm.run(RELEASE);        // Stop both motors
        lm.run(RELEASE);
    }
   }
   delay(20);
}

Get the motor driver library from https://github.com/adafruit/Adafruit-Motor-Shield-library

Get the code from github : https://github.com/robolabz/ballcollectingrobot

For robot base and gripper design files and mobile application, contact “info at robolabz.com”