Now a days a self-flying DORAMONE toy is common and a piece of attraction for small children. You have to design your own product that can compete with this product in the market. What you are required to do is.
1. Design the complete circuit of the toy.
2. Code the circuit using Arduino Mini board.
3. The toy must be cheap and easy to use.
4. Try to add an extra feature like sound in your toy.
Required components for this circuit:
Arduino Mini / Arduino UNO - 1 Quantity
Ultrasonic Sensor - HC-SR04 (Generic) - 1 Quantity
Buzzer - 1 Quantity // to make sound
Breadboard - 1 Quantity
Male/Female Jumper wires - Few Quantities
Design of the circuit:
I have Arduino UNO board in my home. So, I created the above circuit. In the picture, I mentioned as Arduino Mini.
==========================================================
Product Procedure:
============================================================
Code the circuit using Arduino Mini board:
<SoftwareSerial.h> - Library need to be installed.
Code using HC-SR04 ultrasonic range:
#include <SoftwareSerial.h>
int trigPin = 2;
int echoPin = 3;
int buzzer = 10;
void setup() {
Serial.begin(9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(buzzer,OUTPUT);
}
void loop()
{
// if someobject comes closer than 50 cm then it triggers buzzer
- If needed increase the distance
if(measureDistanceInCM() < 50){
digitalWrite(buzzer,HIGH);
delay(1000); //delay is given to avoid errors
}
else
{
digitalWrite(buzzer,LOW);
delay(1000); //delay is given to avoid errors
}
delay(300);
}
long measureDistanceInCM(){
long duration, distance;
digitalWrite(trigPin, LOW); //PULSE ___|---|___
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
Serial.println("distance:");
Serial.println(distance);
return distance; //returns distance in cm
}
=================================================================
How is it works?
In the void loop() function, Sensor measures the distance of other objects which come near to the sensor.
measureDistanceInCM() function is used to measure the distance.
So, if someobject comes nearer to the Sensor (As per this program, less than 50 cm - If needed, we can increase) then it triggers buzzer sound.
=============================================================
Try to add an extra feature like sound in your toy.
Buzzer sound is added - if someobject comes nearer to the Sensor (As per this program, less than 50 cm - If needed, we can increase) then it triggers buzzer sound.
============================================================
Get Answers For Free
Most questions answered within 1 hours.