-
1Step 1
Purchase the Arduino Uno, the 1Sheeld, and some LEDs. Links to these items can be found in the components list.
-
2Step 2
Download the Arduino software (known as the Arduino IDE). Found at the following link:
http://www.arduino.cc/en/Main/Software
Always make sure to download and constantly update to the newest version of the Arduino IDE. This will save a lot of headaches in the future.
For additional details on installing and connecting your computer to the Arduino IDE, please see the link below:
http://www.arduino.cc/en/Guide/HomePage
Don't move to the next step on this tutorial until you have successfully uploaded the "blink" sketch to your Arduino. By this time, you should understand how to select the Arduino board in the "tools" menu of the Arduino IDE. You should also be able to determine which COM port to select. Once again, work through this link if you are having issues:
-
3Step 3
Attach the 1Sheeld to the Arduino. The pins on the 1Sheeld should fit directly into the Arduino.
-
4Step 4
Power the 1Sheeld by plugging USB cable from your computer's USB port to the female type A port on the Arduino. The 1Sheeld should initially flash a green LED...then a blue LED will flicker repeatedly.
-
5Step 5
Place the longer pin (anode) of your LED into pin 12 of your 1Sheeld. Place the short pin (cathode) into the GND pin of your 1Sheeld. There are multiple GND pins on the shield. Because you are not using any jumper wires, you can just use the GND pin located near pin 12.
(Note that using an LED without a resistor is not advised as you will burn up the bulb quickly. This tutorial skips using a resistor for quick satisfaction of getting the 1Sheeld to work!)
-
6Step 6
Locate the UART switch on the 1Sheeld. Flip the switch to "upload mode". This is the side closest to your LED. It is critical that you remember to do this every time you upload a sketch.
-
7Step 7
Download the 1Sheeld Library, which is located at the following link:
https://github.com/Integreight/1Sheeld-Arduino-Library
Getting a library installed and usable in the Arduino IDE will be one of the more complicated aspects of this tutorial. Here are a few tips that will help you get through this process with as little frustration as possible:
1. Teach yourself how to properly install a library. Use this tutorial to do it:
https://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use/arduino-libraries
2. The library will be referenced in the Arduino sketch with the following syntax "#include <OneSheeld.h>". This line of code will be found at the start of the sketch.
3. If the library is properly installed, the Arduino IDE will recognize it and change the text to either a green or yellow color. You will know you have not properly installed the library if the text remains black.
(Always remember to close and restart the Arduino IDE after you have installed a new library. I have even found that sometimes I have to restart my computer to get the library to work)
-
8Step 8
Copy and paste the following code into a blank Arduino sketch screen:
/* Include 1Sheeld library. */
#include <OneSheeld.h>
/* Voice commands set by the user. */
const char onCommand[] = "on";
const char offCommand[] = "off";
void setup()
{
pinMode(12, OUTPUT);
/* Start Communication. */
OneSheeld.begin();
/* Error Commands handiling. */
VoiceRecognition.setOnError(error);
VoiceRecognition.start();
}
void loop ()
{
/* Check if new command received. */
if(VoiceRecognition.isNewCommandReceived())
{
/* Compare the "on" command. */
if(!strcmp(onCommand,VoiceRecognition.getLastCommand()))
{
/* Turn on The Light. */
digitalWrite(12, HIGH);
}
/* Compare the "off" command. */
else if (!strcmp(offCommand,VoiceRecognition.getLastCommand()))
{
/* Turn off the Light */
digitalWrite(12, LOW);
}
}
}
/* Error checking function. */
void error(byte errorData)
{
/* Switch on error and print it on the terminal. */
switch(errorData)
{
case NETWORK_TIMEOUT_ERROR: Terminal.println("Network timeout");break;
case NETWORK_ERROR: Terminal.println("Network Error");break;
case SERVER_ERROR: Terminal.println("No Server");break;
case SPEECH_TIMEOUT_ERROR: Terminal.println("Speech timeout");break;
case NO_MATCH_ERROR: Terminal.println("No match");break;
case RECOGNIZER_BUSY_ERROR: Terminal.println("Busy");break;
}
}
-
9Step 9
Upload the code to your Arduino. (You should see a right facing arrow at the top left of the Arduino IDE. This is the upload button)
If the sketch was uploaded successfully, you will not encounter any errors in the Arduino IDE, and the program will read "Done Uploading".
-
10Step 10
Switch the UART Switch on the 1Sheeld back to "Operation Mode", which is the side closer to the 1Sheeld logo.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
hello.
i tried this project but it is not functioning like what it should be.
the LED didnt ON whenever i said "ON"
Are you sure? yes | no