Skip to content

Voice Controlled Android Things Robocar (L298N Driver)

License

Notifications You must be signed in to change notification settings

caohuicn/android-robocar

 
 

Voice Controlled Android Things Robocar (L298N Driver)

Major changes in this branch: L298N and voice command support

Hardware

Nothing expensive. The most expensive one is the Android things board, which I got from Google I/O :)

  1. Android things board (NXP i.MX7D)
  2. A robot car chassis. I used this one
  3. L298N motor driver board (included in the above robocar package)
  4. Power source for DC motor (included in the above robocar package)
  5. Power source for Android Things (I used my cellphone power bank)
  6. Microphone and speaker ( I simply used a phone headset(CTIA plug))
  7. Some pieces of wood and glue car2

You can ignore the PCA9685 board (not wired, not used).

L298N Motor Driver

Both Antonio Zugaldia's and Google's android things robocar use Adafruit stepper & DC Motor hat as the motor controller. Since the robot car kit I ordered already has L298N motor driver, one less thing to buy. Check L298NDriver.java.

Wiring

Headset & power bank are removed to show the wiring: car I'm using pins 12(PWM1)/14(Ground)/29(GPIO2_IO01)/31(GPIO2_IO02)/33(PWM2)/35(GPIO2_IO00)/37(GPIO2_IO05). See https://developer.android.com/things/hardware/imx7d. Make sure to use the ground pin. Basically PWM controls the motor speed, and 2 GPIOs together control the motor current direction so that the wheels can move forward and backward.

Voice Control

Speech recognition engine is using Pocketsphinx on Android(https://github.com/cmusphinx/pocketsphinx-android-demo).

        recognizer.addKeyphraseSearch(WAKEUP_SEARCH, ACTIVATION_KEYPHRASE);
        File actionGrammar = new File(assetsDir, "commands.gram");
        recognizer.addKeywordSearch(ACTION_SEARCH, actionGrammar);
        // For continuous recognition, keyword search is preferred to grammar search

Activation keyphrase is used so that the car will not move by accident. My son likes to call it "Mr. crazy car" :). Once it's activated, it'll be ready to take the following commands(in commands.gram):

forward /1e-15/
backward /1e-17/
reverse /1e-17/
left /1e-15/
right /1e-15/
good job /1e-30/
stop /1e-20/

"stop" (to stop the car) and "good job" (to stop the car and de-activate the command mode) are given a higher sensitivity level to avoid having to screaming at the car to make it stop, given the motor noise and the mediocre microphone.

Have fun!

References

  1. Donkey car
  2. Android things robocar
  3. Build your own (small) Autonomous Robocar
  4. Android Things - Control your devices through voice with USB Audio support
  5. Arduino DC Motor Control Tutorial – L298N | PWM | H-Bridge

About

Voice Controlled Android Things Robocar (L298N Driver)

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Java 95.5%
  • Python 3.8%
  • Makefile 0.7%