Car Robot Controlled by Voice Commands and Alexa

by Ayamola in Workshop > Electric Vehicles

528 Views, 4 Favorites, 0 Comments

Car Robot Controlled by Voice Commands and Alexa

FGDT4BYLHNFFCAC.jpg

With this robot car, students can explore the endless possibilities and benefits of IoT in the real world. The car responds to voice commands, allowing for hands-free control and making it an excellent tool for educational purposes. Using Alexa, the car can be connected to various smart home devices, providing a seamless integration and enhancing the user experience. The robot car is equipped with sensors, allowing for accurate and precise movements, making it perfect for exploration, experimentation, and learning.

Supplies

ESP8266 Motor shield.jpg
coche-robot-metacrilat-2.jpg
octocoupler encoder.jpg

1x Esp8266 ESP-12E Module

1x Motor Shield NodeMCU L293D

1x Kit Chasis 2WD Robot Smart Car

2x IR Infrared Slotted Optical Optocoupler Module Encoder

4x AA Batteries

Dupont jumper wires

Screwdriver (typically Phillips head)

CODE : https://github.com/Ayamola/Robot-internet-of-tricks.git

Assembly of Chasis

IMG_9501.JPEG
  1. Lay out all the parts from the kit and identify the main body of the plastic platform.
  2. Locate the two motor mounts on the body and attach the motors to them using the nuts and bolts provided.
  3. Connect the motor wires to the motor controller or driver board, following the instructions provided with the board.
  4. Secure the controller board onto the body using the screws provided.
  5. Connect the power source to the controller board, following the instructions provided with the board.
  6. Test the motors and wheels to ensure everything is working properly before adding any additional components or programming the robot.

Connect Wires

robot_bb.png
nodemcu-esp8266-esp12e-motor-shield-pinout.jpg


Connect the wires as shown in the diagram.

Left Optocoupler -> GPIO13 (D7)

Right Optocoupler -> GPIO12 (D6)

Install the ESP8266 Board

Install-ESP8266-Board-add-on-in-Arduino-IDE-open-preferences.png
Install-ESP8266-Board-add-on-in-Arduino-IDE-enter-URL.png
Install-ESP8266-Board-add-on-in-Arduino-IDE-search-ESP8266.png
ESP8266-Board-add-on-in-Arduino-IDE-installed.png
Install-ESP8266-Board-add-on-in-Arduino-IDE-open-boards-manager.png
  1. Open the Arduino IDE on your computer.
  2. Go to the File menu and select Preferences.
  3. In the Preferences window, find the "Additional Boards Manager URLs" field and paste the following URL:
  4. http://arduino.esp8266.com/stable/package_esp8266com_index.json
  5. Note: If you already have a URL in this field, simply separate it from the new URL with a comma.
  6. Click OK to close the Preferences window.
  7. Next, go to the Tools menu and select Board > Boards Manager.
  8. In the Boards Manager, search for "esp8266" using the search bar.
  9. Click on "esp8266 by ESP8266 Community" and then click the Install button.
  10. Wait for the installation to complete. This may take a few minutes, depending on your internet speed.
  11. Once the installation is complete, close the Boards Manager and go back to the Tools menu.
  12. Under the Boards submenu, you should now see a list of ESP8266 boards. Select the one you are using.
  13. Now you are ready to program your ESP8266 board with the Arduino IDE!

Install Libraries

  1. Open the Arduino IDE (Integrated Development Environment) on your computer.
  2. Go to the Sketch menu and select Include Library > Manage Libraries.
  3. In the Library Manager, search for the libraries you want to install by typing their names into the search bar. For example, search for "FS" and select "FS by Ivan Grokhotkov."
  4. Click on the library you want to install and then click the Install button. The IDE will download the library and install it for you.
  5. Repeat this process for each of the libraries you want to install: Arduino, Wire, ESP8266WiFi, DNSServer, ESP8266WebServer, WiFiManager, ArduinoJson, and PubSubClient.

#include <ESP8266WiFi.h>    https://github.com/esp8266/Arduino

#include <WiFiManager.h>     https://github.com/tzapu/WiFiManager

#include <ArduinoJson.h>     https://github.com/bblanchon/ArduinoJson (only works with version 5.x)

Upload the Code

  1. Select the board NodeMCU 1.0 (ESP-12E Module)
  2. Select your port
  3. Compile and upload the code

Now we are ready to receive commands through the mqtt broker

Downloads

Create an Account in the Mqtt Broker

  1. Go to the maqiatto.com website at https://www.maqiatto.com/.
  2. Click on the "Create Account" button at the top right corner of the homepage.
  3. Fill out the registration form with your personal information, including your name, email address, and password.
  4. Choose your preferred language and time zone.
  5. Check the box to agree to the terms and conditions of the website.
  6. Click on the "Register" button to complete the registration process.
  7. Once you have created your account, you can log in using the email address and password you provided during registration.


Creating a Topic:

  1. After logging in to your maqiatto.com account, click on the "MQTT Websocket" button on the top menu bar.
  2. Click on the "New Topic" button to create a new topic.
  3. In the "New Topic" dialog box, enter "robot" as the topic name.
  4. Click on the "Create" button to create the new topic.
  5. You have now created a new topic with the name "robot" on maqiatto.com.


Create Amazon AWS Account

  1. Go to the Amazon AWS website at https://aws.amazon.com/ and click on the "Create an AWS Account" button.
  2. On the "Create an AWS Account" page, enter your email address and select "I am a new user." Click the "Sign in using our secure server" button.
  3. On the next page, enter your name and create a new password for your AWS account. You will also need to enter your credit card information to verify your identity, but AWS offers a free tier with limited services that will not be charged if you stay within the free tier limits.
  4. Next, you will be prompted to enter your phone number. Amazon will send you an automated message with a verification code. Enter the code to complete the phone verification process.
  5. After verifying your phone number, you will be prompted to select a support plan. You can choose the free basic plan, which provides access to AWS documentation, whitepapers, and support forums.
  6. On the next page, you will need to provide additional information, including your company name, job title, and address. You can also choose to receive promotional emails from AWS.
  7. Finally, review the AWS Customer Agreement and click the "Create Account and Continue" button to complete the account creation process.


Install Node.js

For Windows:

  1. Go to the Node.js website at https://nodejs.org/ and click on the "Download" button.
  2. Select the Windows Installer option based on your system architecture (32-bit or 64-bit).
  3. Run the downloaded installer file and follow the prompts in the installer.
  4. Accept the license agreement, choose the installation location, and click "Next" to continue.
  5. Select the components you want to install, and click "Next".
  6. Choose the "Custom" installation type, and click "Next".
  7. Choose the features you want to install, and click "Next".
  8. Choose the "npm package manager" option, and click "Next".
  9. Click "Install" to begin the installation process.
  10. Wait for the installation to complete, and click "Finish" to exit the installer.
  11. To verify the installation, open the command prompt and type "node -v". This should display the version of Node.js installed on your system.


Install and Configure Ask-cli

  1. Install Ask CLI on your system by following the instructions on the official documentation at https://developer.amazon.com/en-US/docs/alexa/smapi/quick-start-alexa-skills-kit-command-line-interface.html.
  2. Open your terminal or command prompt and run the command "ask configure". This will start the configuration process for Ask CLI.
  3. Follow the prompts to enter your Amazon Developer account credentials, including your email address and password.
  4. If you have two-factor authentication enabled on your account, you will be prompted to enter the verification code sent to your device.
  5. Once you have successfully logged in, you will be prompted to create a new profile or use an existing one. Choose the "Create a new profile" option.
  6. Enter a name for your profile, such as "Robot ioTricks", and choose a default region.
  7. You will now be prompted to create an IAM user in your AWS account. Follow the prompts to create a new user and assign it the necessary permissions.
  8. Once the IAM user is created, you will be prompted to enter the access key ID and secret access key for the user. Enter the values and choose the default output format.
  9. Your profile is now configured and ready to use with Ask CLI. You can start building Alexa skills and managing your account using the CLI commands.

Create an Skill With Ask-cli

ask-cli1.png
ask-cli2.png
ask-cli3.png
new skill.png
  1. Go to your working folder location and run the command --> ask new
  2. Choose nodejs
  3. Move down with your keyboard until AWS Lambda
  4. Choose the template Hello World
  5. Write a skill name (Robot ioTricks)
  6. Write a folder name (Robot ioTricks)
  7. If everything run successfuly move to the created folder (Robot ioTricks)
  8. you will se several created folders like infraestucture, lambda, skill-package....
  9. Go to \RobotioTricks\skill-package\interactionModels
  10. You will find a json file with your lenguage (like en-US) replace the content with the file US-en Robotiotricks.json
  11. Remember to change the line 4 with your invocation name
  12. Copy from here the file mqttHelper.js inside lambda folder and edit your mqtt credentials (lines 3,4 and 17)
  13. Replace the content of index.js in lambda folder with the file index_robotiotricks.js here
  14. open terminal and go to the root of the ask-cli (Robot ioTricks) step 8
  15. run the command -> ask deploy
  16. now you will have a new skill in your amazon account

How to Operate the Robot

  1. Push the power button of the shield
  2. If you don't change your credentials od WIFI and mqtt broker on the code you can connect to the WIFI network of the ESP8266 should be "Robot Configuration"
  3. Edit your credentials and save
  4. Open your alexa app and invoke "Open robot i o Tricks"
  5. Alexa should response and now you can interact with the robot
  6. Remember the command should be like: please move forward 20 centimeters...

Enjoy your new voice command robot!!