Project tutorial
Voice Controlled Scooter Lights and Garage Door

Voice Controlled Scooter Lights and Garage Door

Wireless voice controlled garage door opener and animated turn signals.

  • 2,195 views
  • 0 comments
  • 12 respects

Components and supplies

Relay (generic)
×1
Ard nano
Arduino Nano R3
×1

About this project

Hello everyone!

I recently bought an electric scooter but it didn't have a rear light nor did it have an inbuilt garage door opener... SURPRISE!! (ノ゚0゚)ノ~

So, I decided to make my own garage door remote and rear lights instead of buying them.

What's the fun in having buttons for opening a garage door?! So, I decided to make the whole thing voice controlled. It's more fun to ask the door to open instead of pressing buttons. This works great in terms of functionality and show.

I looked up a few bike lights projects such as https://www.instructables.com/id/Bike-Light-and-Turn-Signals/ and decided to create my own upgraded version. So, I settled to step up my lights to match with my style on my electric scooter by adding animated turn signals. They Also have an nRF24L01 module to wirelessly control the garage door using voice.

The lights are made up of a 16x16 LED Matrix to have animated turn signals.

Please check it out in the video above.

Below are the instructions to make one for yourself.

Step 1: Gather the Parts

For this tutorial you need the following parts:

1: 2x Arduino (I'm using the Nano)

2: Voice recognition module (I got it at a cheaper deal from eBay)

3: LED Matrix (NeoPixel)

4: A 5V power source for LED Matrix

5: Another power source of 5V but I'm using 9V

6: 2x nRF24L01 modules

7: Relay module

8: Wires

Step 2: Connect the Components (Bike Unit)

To begin start wiring the Arduino, nRF24L01, speech recognition module, power source, and the LED matrix.

A. Connections for nRF24L01:

  • MISO connects to pin 12
  • MOSI connects to pin 11
  • SCK connects to pin 13
  • CE connects to pin 9
  • CSN connects to pin 10
  • GND and VCC of the NRF24L01 are connected to GND and 3.3V of Arduino

B. Connections for Speech Recognition Module:

  • RX connects to pin 6
  • TX connects to pin 5
  • GND and VCC of the module are connected to GND and 5V of Arduino

C. Connections for the LED Matrix:

I used a power bank to supply power. To connect a power bank take a USB cable and strip the +ve and -ve ends of the cable.

  • 5V of the Matrix connects to VIN pin of Arduino and the +ve connection of the power source
  • GND of the Matrix connects to GND pin of Arduino and the -ve connection of the power source

Step 3: Train Voice Module

A. Download the Voice control library.

B. Open file -> Examples -> VoiceRecognitionV3 -> vr_sample_train

i. Modify "VR myVR(2, 3);" to "VR myVR(6, 5);" in the code to account for RX TX pin change.

ii. Upload the code

C. Open serial monitor

i. Set the baud rate to 115200 and select the "Newline" option.

ii. A menu will open up the guide.

1. Use the "train" command to train speech.

2. Type "train 0", it'll ask you to speak the command and, then ask to say it again.

3. Do the same for "train 1", "train 2", etc.

In the code:

train 0 is to control the garage door

train 1 is the left signal

train 2 is the right signal

train 3 is to turn on red lights

train 4 is to turn off lights

Step 4: Get the Libraries and Upload the Code

Download additional libraries for LED Matrix and nRF24L01.

A. Go to Sketch -> Include library-> Manage libraries... and install RF24 by TMRh20.

B. Also, install the Neo Pixel library by Adafruit.

C. Upload the attached code ScootSendProtowtlightsIns.ino.

The code has comments for an explanation but it's very straight forward.

Step 5: Connect the Components (garage Unit)

For the garage door unit, we need to wire the relay module, nRF24L01, power source, and Arduino.

I created the entire assembly in a salt dispenser bottle.

A. Connections for nRF24L01:

MISO connects to pin 12

MOSI connects to pin 11

SCK connects to pin 13

CE connects to pin 9

CSN connects to pin 10

GND and VCC of the NRF24L01 are connected to GND and 3.3V of Arduino

B. Connections for relay module:

DC- and DC+ of the relay module are connected to GND and 5V of Arduino

The signal trigger port connects to pin 2 of Arduino

Connect one end of the switch to the common port of the relay

Connect the other end of the switch to the normally closed port of the relay

C. Connections for power source:

Connect the 9V battery's +ve end to the VIN pin of Arduino

Connect the -ve end to the GND pin of Arduino

Step 6: Test and Travel in Style

Demo video was attached at the top of the tutorial.

Hope you liked the tutorial. Comment if you have any questions.

You can add more animations to the LED matrix. You can also control things other than the garage door.

Surprisingly, the speech recognition works well even when at speeds of 15 mph.

Please vote for it.

Thank you,

Sahil Parikh

www.snp13.com

Code

ScootSendProtowtlightsIns.inoArduino
No preview (download only).
garage_door.inoArduino
/*
  Getting Started example sketch for nRF24L01+ radios
  This is a very basic example of how to send data from one node to another
  Updated: Dec 2014 by TMRh20
*/

#include <SPI.h>
#include "RF24.h"
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif

#define PIN 2
int b = 5;
int c = 0;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(256, PIN, NEO_GRB + NEO_KHZ800);
/****************** User Config ***************************/
/***      Set this radio as radio number 0 or 1         ***/
bool radioNumber = 0;

/* Hardware configuration: Set up nRF24L01 radio on SPI bus plus pins 7 & 8 */
RF24 radio(9, 10);
/**********************************************************/

byte addresses[][6] = {"1Node", "2Node"};

// Used to control whether this node is sending or receiving
bool role = 0;
void off()
{
  Serial.println("OFF");
  for (int i = 0; i < 256; i ++)
    strip.setPixelColor(i, 0, 0, 0, 0);
  strip.show();
}
void offp()
{
  Serial.println("pOFF");
  for (int i = 48; i < 256; i ++)
    strip.setPixelColor(i, 0, 0, 0, 0);
  strip.show();
}

void redLight(uint32_t c, uint8_t wait)
{

  for (uint16_t i = 0; i < 48; i++) {
    strip.setPixelColor(i, c);
    //strip.show();
    //delay(wait);
    //strip.setPixelColor(i+q, 0);

  }
}
void turnl()   //RGB (255,255,0)= Yellow
{
  strip.setPixelColor(255 - 11, b, b, 0, 0);
  strip.setPixelColor(225 + 11, b, b, 0, 0);
  strip.setPixelColor(221 - 11, b, b, 0, 0);
  strip.setPixelColor(195 + 11, b, b, 0, 0);
  strip.setPixelColor(187 - 11, b, b, 0, 0);
  strip.setPixelColor(163 + 11, b, b, 0, 0);
  strip.setPixelColor(157 - 11, b, b, 0, 0);
  strip.setPixelColor(129 + 11, b, b, 0, 0);
  strip.setPixelColor(127 - 11, b, b, 0, 0);
  strip.setPixelColor(255 - 10, b, b, 0, 0);
  strip.setPixelColor(225 + 10, b, b, 0, 0);
  strip.setPixelColor(221 - 10, b, b, 0, 0);
  strip.setPixelColor(195 + 10, b, b, 0, 0);
  strip.setPixelColor(187 - 10, b, b, 0, 0);
  strip.setPixelColor(163 + 10, b, b, 0, 0);
  strip.setPixelColor(157 - 10, b, b, 0, 0);
  strip.setPixelColor(129 + 10, b, b, 0, 0);
  strip.setPixelColor(127 - 10, b, b, 0, 0);
  for (int i = 0; i < 12; i ++)
  {
    strip.setPixelColor(255 - i, b, b, 0, 0);
    strip.setPixelColor(225 + i, b, b, 0, 0);
    strip.setPixelColor(221 - i, b, b, 0, 0);
    strip.setPixelColor(195 + i, b, b, 0, 0);
    strip.setPixelColor(187 - i, b, b, 0, 0);
    strip.setPixelColor(163 + i, b, b, 0, 0);
    strip.setPixelColor(157 - i, b, b, 0, 0);
    strip.setPixelColor(129 + i, b, b, 0, 0);
    strip.setPixelColor(127 - i, b, b, 0, 0);

    strip.setPixelColor(257 - i, 0, 0, 0, 0);
    strip.setPixelColor(223 + i, 0, 0, 0, 0);
    strip.setPixelColor(223 - i, 0, 0, 0, 0);
    strip.setPixelColor(193 + i, 0, 0, 0, 0);
    strip.setPixelColor(189 - i, 0, 0, 0, 0);
    if (i > 1)
    {
      strip.setPixelColor(161 + i, 0, 0, 0, 0);
      strip.setPixelColor(159 - i, 0, 0, 0, 0);
      strip.setPixelColor(127 + i, 0, 0, 0, 0);
      strip.setPixelColor(129 - i, 0, 0, 0, 0);
    }

    strip.show();
    delay(80);

  }
}

void turnr()   //RGB (255,255,0)= Yellow
{
  strip.setPixelColor(240 + 11, b, b, 0, 0);
  strip.setPixelColor(238 - 11, b, b, 0, 0);
  strip.setPixelColor(210 + 11, b, b, 0, 0);
  strip.setPixelColor(204 - 11, b, b, 0, 0);
  strip.setPixelColor(180 + 11, b, b, 0, 0);
  strip.setPixelColor(172 - 11, b, b, 0, 0);
  strip.setPixelColor(146 + 11, b, b, 0, 0);
  strip.setPixelColor(142 - 11, b, b, 0, 0);
  strip.setPixelColor(112 + 11, b, b, 0, 0);
  strip.setPixelColor(240 + 10, b, b, 0, 0);
  strip.setPixelColor(238 - 10, b, b, 0, 0);
  strip.setPixelColor(210 + 10, b, b, 0, 0);
  strip.setPixelColor(204 - 10, b, b, 0, 0);
  strip.setPixelColor(180 + 10, b, b, 0, 0);
  strip.setPixelColor(172 - 10, b, b, 0, 0);
  strip.setPixelColor(146 + 10, b, b, 0, 0);
  strip.setPixelColor(142 - 10, b, b, 0, 0);
  strip.setPixelColor(112 + 10, b, b, 0, 0);

  for (int i = 0; i < 12; i ++)
  {
    strip.setPixelColor(240 + i, b, b, 0, 0);
    strip.setPixelColor(238 - i, b, b, 0, 0);
    strip.setPixelColor(210 + i, b, b, 0, 0);
    strip.setPixelColor(204 - i, b, b, 0, 0);
    strip.setPixelColor(180 + i, b, b, 0, 0);
    strip.setPixelColor(172 - i, b, b, 0, 0);
    strip.setPixelColor(146 + i, b, b, 0, 0);
    strip.setPixelColor(142 - i, b, b, 0, 0);
    strip.setPixelColor(112 + i, b, b, 0, 0);

    strip.setPixelColor(178 + i, 0, 0, 0, 0);
    strip.setPixelColor(174 - i, 0, 0, 0, 0);
    strip.setPixelColor(144 + i, 0, 0, 0, 0);
    strip.setPixelColor(144 - i, 0, 0, 0, 0);
    strip.setPixelColor(110 + i, 0, 0, 0, 0);
    if (i > 1)
    {
      strip.setPixelColor(238 + i, 0, 0, 0, 0);
      strip.setPixelColor(240 - i, 0, 0, 0, 0);
      strip.setPixelColor(208 + i, 0, 0, 0, 0);
      strip.setPixelColor(206 - i, 0, 0, 0, 0);
    }

    strip.show();
    delay(80);

  }
}
void setup() {
  Serial.begin(115200);

#if defined (__AVR_ATtiny85__)
  if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
  radio.begin();

  // Set the PA Level low to prevent power supply related issues since this is a
  // getting_started sketch, and the likelihood of close proximity of the devices. RF24_PA_MAX is default.
  radio.setPALevel(RF24_PA_LOW);

  // Open a writing and reading pipe on each radio, with opposite addresses
  if (radioNumber) {
    radio.openWritingPipe(addresses[1]);
    radio.openReadingPipe(1, addresses[0]);
  } else {
    radio.openWritingPipe(addresses[0]);
    radio.openReadingPipe(1, addresses[1]);
  }

  // Start the radio listening for data
  radio.startListening();
  strip.begin();
  strip.show();
}

void loop() {




  /****************** Pong Back Role ***************************/


    unsigned long got_time;
unsigned long rec=2;
    if ( radio.available()) {
      // Variable for the received timestamp
      while (radio.available()) {                                   // While there is data ready
        radio.read( &got_time, sizeof(unsigned long) );             // Get the payload
      }

      radio.stopListening();                                        // First, stop listening so we can talk
      radio.write( &rec, sizeof(unsigned long) );              // Send the final one back.
      radio.startListening();                                       // Now, resume listening so we catch the next packets.
      Serial.print(F("Sent response "));
      Serial.println(got_time);
      if (got_time == 49)
      {
        digitalWrite(2, HIGH);
      }
      switch (got_time) {
        case 49:
          //do something when var equals 1
          analogWrite(4,255);
          delay(2000);
          digitalWrite(4,0);
          Serial.println("door");
          delay(2000);
          break;
        case 50:
          //do something when var equals 2
          turnl();
          break;
        case 51:
          //do something when var equals 2
          offp();
          break;
        default:
          // if nothing else matches, do the default
          // default is optional
          break;
      }
      got_time=0;
    }
  




  /****************** Change Roles via Serial Commands ***************************/

  if ( Serial.available() )
  {
    char c = toupper(Serial.read());
    if ( c == 'T' && role == 0 ) {
      Serial.println(F("*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK"));
      role = 1;                  // Become the primary transmitter (ping out)

    } else if ( c == 'R' && role == 1 ) {
      Serial.println(F("*** CHANGING TO RECEIVE ROLE -- PRESS 'T' TO SWITCH BACK"));
      role = 0;                // Become the primary receiver (pong back)
      radio.startListening();

    }
  }


} // Loop

Comments

Similar projects you might like

IoT Garage Door Monitor/Opener with Finger Print Scanner

Project tutorial by PlastiBots.com

  • 16,050 views
  • 8 comments
  • 43 respects

2WD Voice Controlled Robot with Arduino and BitVoicer Server

Project tutorial by Marcio Tamagushi

  • 11,403 views
  • 11 comments
  • 38 respects

Voice Controlled Robot using your Smart Phone

Project tutorial by Ahmed Yassin

  • 3,463 views
  • 0 comments
  • 5 respects

Voice Controlled Rover

Project tutorial by Team Brink.IO

  • 1,448 views
  • 0 comments
  • 12 respects

Voice Controlled Home Automation Prototype

Project showcase by Bharath Rao M

  • 1,601 views
  • 0 comments
  • 4 respects

Automatic Sliding Door for the Garage

Project tutorial by DVDMDN

  • 15,907 views
  • 37 comments
  • 68 respects
Add projectSign up / Login