Components -
1. Arduino (Any board will do). I recommend Arduino Nano
2. IR sensor - 3x
3. White LED
4. 7805 Voltage regulator
5. Micro SD TF module
6. Micro SD card (Less than 2GB)
7. Servo Motor (Micro Servo sg90) - 3x
Download the PCB files from here.
Add caption |
Talking Principle
Let’s talk about the
talking part of this robot. Well, robots can’t just start talking by
themselves. We can make robots/machines talk by two easy methods –
1. Speech synthesis. 2.
Prerecorded audio and
For my purpose I chose the 2nd method.
Download the Android application to convert text into audio file from here.
Change bit resolution
into 8 bit
* Sampling rate 16MHZ
* Audio Channel – Mono
* Then from Advanced option set pcm format into unsigned 8bit.
Then click start conversion.
Fact guys – Arduino can’t
read from an SD card that is more than 2gb. But it can write. In my case I will
play audio from sd card, which means I will read from it, so I used a 2GB micro
SD card.
Circuit Diagram
The circuit looks insane in some eyes. Also that's okay for prototyping but not for permanent solution. So I made a pcb.
To download the Circuit diagram/pcb file click here.
For online pcb
prototyping I recommend PCBWay.com.
Go to PCB instant quote
and upload the gerber file, the system will automatically recognize your board dimension,
layers etc. The best thing about PCBWay is, their engineering team will inspect
the pcb before receiving payment from you, that makes their service
outstanding.
Their pcb quality is very good, you can order a pcb and track it’s
making process. The customer service is very active to your response too. Go
ahead and place an order.
Making the body
I made the body using PVC
sheet. It is easy to cut and easier to attach the pieces using hot glue. I used a cardboard box as head, it can also
be made out of PVC board. Here are some old photos.
After making the body I
used spray paint to color it, and black permanent marker to add the black
touches. More detailed pictures are linked in the video description.
5. Code
The code is written using Arduino.ide. I had to use tmrpcm and servoTimer2 library because the servo library doesn’t work with TMRpcm. Anyway, as you can see here I read from sensors and if one sensor is low, means something is detected it plays an audio file from the sd card. You can download the code from the link attached in the video description.
Download the code from here.
/*MOFIZA - The Humanoid Smart Robot made with just Arduino
* By Ashraf Minhaj ashraf_minhaj@yahoo.com
* https://ashrafminhajfb.blogspot.com
*http://youtube.com/c/fusebatti */
#include "ServoTimer2.h" //declare ServoTimer2 library to run servo with TMRpcm
#include"SD.h" //declare SD library for SD cards
#define SD_ChipSelectPin 10 //select sd chip select pin 10
#include"TMRpcm.h" //library to play audio from sd card by arduino
#include"SPI.h" //create Serial peripheral Interface Communication
TMRpcm tmrpcm; //name tmrpcm
ServoTimer2 head; //declare Head servo followed by left right hand servos
ServoTimer2 lhand;
ServoTimer2 rhand;
int in1= 6; //declare Infrared sensor pins
int in2= 7;
int in3= 8;
void setup()
{
head.attach(2); //attach servos to pins
lhand.attach(3);
rhand.attach(4);
tmrpcm.speakerPin=9; //Speaker pin 9,audio out pin is 9
Serial.begin(9600); //initialize Serial communication
if(!SD.begin(SD_ChipSelectPin)) //this runs until SD is connected
{
Serial.println("SD FAIL");
return;
}
}
And that’s it.
Love yourself the most, then
passion, then everything else!
Comments
Post a Comment