Education is boring for children, and we always need new ideas to attract them and make them fall in love with all kinds of sciences and knowledge, and always want more.
Our idea this week is to make an interactive toy for children that teaches them the fruits. When they touch the picture of the fruit, the name of the fruit is said and the picture lightens up. And we will use the Bluetooth transceiver to change the language, we will have 3 languages: Arabic, English, and French.
Touch sensor to get input is it touched or not?
An USB cable for uploading the code on the Arduino
Arduino UNO as the brain and controller
Arduino IDE for uploading the code to the Arduino
The DFPlayer mini mp3 playeris used to store the sound tracks on it.
Bluetooth Transceiver to transfer and revieve Blutooth signals from the user's phone.
For connecting electrical components with each other.
Speaker
SD card for storing mp3 files
SD card reader
First, I got my components. Please note that there are many similar touch sensors, the differences between them is very small, the one I used is called: ttp223 capacitive touch sensor
I had 2 inputs: the touch sensors and the push button.
And 2 outputs: the speaker and some LEDs.
And the Bluetooth: to change the language and volume settings.
Second, I drew my circuit on Tinkerkad to make sure everything is okay.
The Bluetooth transceiver has normally 6 pins, but we only connect the 4 middle ones.
The first pin from the left (RXD) ---> TXD (d1) in the arduino
The second pin from the left (TXD) ---> RXD (d0) in the arduino
The third pin from the left ---> GND (ground)
The fourth pin from the left ---> to a 5V source
It looks a bit messy, but it's really simple. Every sensor has 3 jumper wires going out from it. One for 5v, the second for GND and the third is a pin on the Arduino.
You need to download and access 2 important files, the (Arduino.ٍh) that includes lots of amazing functions, and the (DFRobotDFPlayerMini.h) to access the MP3 library.
#include "Arduino.h"
#include "DFRobotDFPlayerMini.h"
I defined lots of variables:
3 sensors
switch
language variable
volume_level variable
I also included some important libraries which I have already installed on my desktop.
Then, I initialized 4 inputs (3 sensors + 1 switch) in "void setup", and created a simple if-condition to clarify the running process of the code.
The "printDetail" function is the most important function in the entire code because it identifies all kinds of errors that can happen and helps us to find the problem and to solve it.
I faced a huge problem
Receiving data from the user (mobile app) all comes in the form of serial, I had a problem because the user can send me either a character (to change the language settings) or a number (that indicates his desired volume level).
I can't treat both integers as characters, so I used the "isDigit" function to check first if the received data is or is a digit or not (integer), if it is a digit then that means that this is an input for volume and that the user changed the slide (in MIT app inventor). And if it is a character then that means that the user changed the language.
My first trial was only in English , and it worked pretty much well. Alhamdulillah :)
Bluetooth was really a game-changer for me, not only it helped me get information easily from the user it also applied some functions to the project remotely, without manually doing it.
I learned a lot about inputs and how to upload libraries and soundtracks and download them on the mini MP3 player.
I'm sure that these skills will be very useful in my final project, where I'm going to use them to connect my project to mobile phones through Bluetooth.