Skip to content
Wish Lists Cart
0 items

#16 Voice Controlled Robot Car Project With PicoBricks

12 Nov 2023
#16 Voice Controlled Robot Car Project With PicoBricks
A voice controlled car is the dream of everyone who is interested in robotic projects. In this article, we will learn how to make a voice control car with the parts from the Picobrick Zero to Hero Kit. You can see the codes at the bottom of the page.

Table of Contents

    Artificial intelligence applications are attempting to recognize human characteristics and learn and try to behave like people. We can define artificial intelligence crudely as software that can learn. Learning can happen through images, sound, and data collected  from the sensors. Algorithms used help in the decision-making processes in various areas AI is deployed. Artificial intelligence applications are now used in situations where the decision-making process needs to be done quickly and without errors. From the marketing to the defense industry, from education to health, from economy to entertainment, artificial intelligence increases efficiency and reduces costs. 

    In this PicoBricks project, we will make a 2WD car that you can control by talking. PicoBricks bluetooth module allows you to control wirelessly 2 6V DC motors.

    Details and Algorithm

    The robot car kit that comes with the set will be assembled. The car is controlled via a mobile phone APP. The HC05 bluetooth module enables us to communicate wirelessly between PicoBricks and a mobile phone. Thanks to a mobile application installed on the mobile phone, the commands spoken into the phone will be transmitted to PicoBricks via Bluetooth  and the robot car will move according to this data. We can direct the robot car with the forward, backward, right, left, stop  voice commands.

    Components

    1X PicoBricks
    2X 6V DC Motor
    1X HC05 Bluetooth Module

    Wiring Diagram

    You can code and run Picobricks modules without wiring. If you are going to use the modules by separating them from the board, you should make the module connections with grove cables.

    Construction Stages of the Project

    1) Screw the first motor to the chassis of the 2WD robot car that comes out of the set and fix it.

    2) Fix the second motor by screwing it to the chassis.

    3) Attach the wheels to the motors.

    4) Fix the caster under the chassis using spacers.

    5) Fix the spacer with the nut from the top of the chassis.

    6) Fix 4 spacers on the four corners of the lower chassis.

    7) Fix the upper chassis with plug and nuts.

    8) Connect the cables of the motors to the terminals on the motor driver.

    9) Fix the motor driver, Bluetooth module, PicoBricks board and battery box to the chassis using hot silicone.

    In this project, we move the robot car by giving it voice commands via a mobile application.

    Instead of the car, you can also control the pan-tilt mechanism in the two-axis robot arm project using the same method. Likewise, you can try a mobile application where you can use buttons instead of voice commands, or you can develop your own application with the MIT Appinventor.

    With the HC05 Bluetooth module, you can operate not only the motor driver and motor, but also other modules on PicoBricks. For example, you can light the RGB LED in any color you want, read the temperature and humidity values from the DHT11 module, the light values on the LDR sensor, and print text on the OLED screen.

    There is a special mobile application written with the MIT Appinventor, and one in Microblocks to demonstrate this interactivity. You can test all these features by downloading the ZIP file from the link below.

    There are two files in the ZIP archive:

    1. A MicroBlocks program  – PicoBricks BT Demo2
    2. An Android APK – PicoBricks_Remote_BKGND.apk

    Extract and install the APK file to your mobile phone. Extract and save the MicroBlocks program to your PC. You need to run both of them at the same time and have a Bluetooth module installed in its slot on the PicoBricks board.

    DOWNLOAD Link for the Android APP and associated MicroBlocks program

    For the Android APP:

    The screen layout of the APP resembles the PicoBricks board layout, with buttons representing the modules and a module map at the bottom of the screen. When you select a module to test, its name will turn yellow in the button and the corresponding module location on the map will display in orange color the module you are exercising.

    First thing you need to do is to PAIR your phone Bluetooth settings with the HC-05. Refer to your device’s instructions on how to do that. Once you are paired, you can start using the Demo APP.

    In the APP, click CONNECT to establish the bluetooth connection to the PicoBricks. You’ll see your BT module lights switch to a double blink every two seconds. Now you are ready to test.

    Modules LED, DHT, RELAY, LDR, BUZZER operate with a single click of their respective buttons on the phone. LED and RELAY will turn on when tapped, and turn off at next tap. DHT, LDR will provide a sensor readout when tapped, which are displayed on the phone. BUZZER will make a short buzz sound.

    Module POT will prompt to operate the potentiometer on the PicoBoard and display pot values on the OLED and the phone.Tap the POT button again when done.

    Module NEO will display three sliders to control the RGB colors. As you adjust them, the NEOPixel on the PicoBricks and the NEO button background will change color simultaneously, showing you the resulting color selection. Tap the NEO button again when done.

    Module OLED opens up a text entry area where you can type short messages. As you start typing, the Android keyboard will pop up for data entry. When you are done entering text, hide the keyboard and then tap the “SEND TO OLED” button. your message will be displayed on the OLED display of the PicoBricks. Tap the OLED button again when done.

    Module MOTOR will display a slider that will let you control a SERVO motor attached to the PicoBricks. NOTE that the demo only operates SERVO #2. You can exercise a -90 to +90 degrees of motion with the servo motor. Tap the MOTOR button again when done.

    It is possible that during the operation BT connection may drop or you may experience message synch problems between the phone and the PicoBricks unit. These programs were written to demo the concepts and do not contain rigorous error checking. Best course of action is to restart everything and try again.

     

    Mobile companion APP:

    You can download the mobile application for android devices from the link below and install it on the phone.

    Download Link

     

     

    Remember that since this is a Bluetooth APP, you need to set your phone Bluetooth option on and pair it with the HC05 on the PicoBricks. See your phone’s instruction manual on how to do this.

     

    You can change the language of the APP with the Language button and select another one from the menu. Just remember that the project code in MicroBlocks is programmed to expect English commands. If you change your voice control language in the APP, then you also need to change the command strings in the MicroBlocks program.

    MicroBlocks Codes of the PicoBricks

    You can access the Microblocks codes of the project by dragging the image to the Microblocks Run tab or click the button.

    Microblocks Run Tab

    MicroPython Codes of the PicoBricks

     

    from machine import Pin, UART
    from utime import sleep
    
    uart = UART(0,9600) #If connection cannot be established, try 115200.
    m1 = Pin(21, Pin.OUT)
    m2 = Pin(22, Pin.OUT)
    cmd = uart.readline()
    
    m1.low()
    m2.low()
    cmd = ""
    while True:
        sleep(0.05)
        if uart.any():
            cmd = uart.readline()
            print(cmd)
        if cmd.startswith(b'f') or cmd.startswith(b'F'):
            m1.high()
            m2.high()
        elif cmd.startswith(b'r') or cmd.startswith(b'R'):
            m1.high()
            m2.low()
        elif cmd.startswith(b'l') or cmd.startswith(b'L'):
            m1.low()
            m2.high()
        elif cmd.startswith(b's') or cmd.startswith(b'S'):
            m1.low()
            m2.low()
        cmd=""
    

    GitHub Project Page

    Arduino IDE Codes

    
    void setup() {
      Serial1.begin(9600);
    }
    
    void loop() {
      if (Serial1.available() > 0) {
     
          char sread = Serial1.read();
          Serial.println(sread);
          
          if (sread == 'f') {
          Forward();
        } else if(sread == 'r'){
          Turn_Right();
        } else if(sread == 'l'){
          Turn_Left();
        } else if(sread == 's'){
          Stop();
        }
      }
    }
    
    void Forward(){
      digitalWrite(21,HIGH);
      digitalWrite(22,HIGH);
      delay(1000);
      digitalWrite(21,LOW);
      digitalWrite(22,LOW);
    }
    void Turn_Left(){
      digitalWrite(21,LOW);
      digitalWrite(22,HIGH);
      delay(500);
      digitalWrite(21,LOW);
      digitalWrite(22,LOW);
    }
    void Turn_Right(){
      digitalWrite(21,HIGH);
      digitalWrite(22,LOW);
      delay(500);
      digitalWrite(21,LOW);
      digitalWrite(22,LOW);
    }
    void Stop(){
      digitalWrite(21,LOW);
      digitalWrite(22,LOW);
      delay(1000);
    }
    
    Prev Post
    Next Post

    Thanks for subscribing!

    This email has been registered!

    Shop the look
    Choose Options

    Edit Option

    Have Questions?

    Back In Stock Notification

    Compare

    Product SKURatingDescription Collection Availability Product Type Other Details
    this is just a warning
    Login
    Shopping Cart
    0 items
    Same Day Shipping No Extra Costs
    Easy Returns Guarantee Return with Ease
    Secure Checkout Secure Payment