Project tutorial
Color Detector for Blind People

Color Detector for Blind People

When you put anything in front of your mobile camera and push the button, your mobile will say the color of that thing.

  • 2,629 views
  • 0 comments
  • 6 respects

Components and supplies

About this project

This project's main target is to make your smartphone say the color of anything using just your smartphone and 1Sheeld with Arduino. This project uses the color sensor shield from 1Sheeld app this shield uses the camera of your smartphone to get the color of the object in front of it as an RGB value and sends this value to the Arduino. Then the Arduino compares between these values and the values of the colors when it finds a match it sends the name of the color to your smartphone. Then the phone says the color name using the text-to-speech shield.

This project will be very helpful for people who suffer from blindness or color blindness especially when they want to know the color of their clothes.

Step 1: About 1Sheeld and Arduino

Arduino is an open-source platform based on flexible, easy-to-use hardware and software. It is intended for anyone who has an idea for a project and wants to bring it to the real life. To make a project with Arduino you need to buy some accessories to connect your Arduino to the real world, these accessories are called shields. 1Sheeld is a shield that allows you to use your smartphone as an Arduino shield like GSM, WiFi, Gyroscope, etc.

The main advantage of 1Sheeld is that it replaces all other shields with just your smartphone and saves you a fortune. It connects the Arduino to your smartphone using Bluetooth and it gives you the ability to use more than shield at a time like GSM, WIFI, Accelerometer, Gyroscope etc.

1Sheeld

Step 2: Adjust 1Sheeld

If you use an Arduino that works with 3.3 V like Arduino Due, you must switch your 1Sheeld to operate on 3.3V since it may damage your board. If you use an Arduino that works with 5V like Arduino Uno, then switch your 1Sheeld to operate on 5V.

Place your 1Sheeld on your Arduino board; then plug the Arduino to your laptop or PC.

If you use an Arduino Mega, then connect your 1Sheeld to the Mega as shown in the image below:

Step 3: Download the 1Sheeld Application

For Android smartphones, download the application here. For iOS smartphones download the application from here.

Step 4: Download 1Sheeld library to your computer

Download the library from here.Then, after you successfully downloaded the library, add the library .ZIP file to your Arduino program.

Step 5: Write your code inside Arduino sketch

#define CUSTOM_SETTINGS 
#define INCLUDE_COLOR_DETECTOR_SHIELD 
#define INCLUDE_TEXT_TO_SPEECH_SHIELD 
#define INCLUDE_PUSH_BUTTON_SHIELD 
/* Include 1Sheeld library. */ 
#include <OneSheeld.h> 
void setup() { 
 /* Start communication. */ 
 OneSheeld.begin(); 
 /* Set the color detection palette to get only 8 different colors instead of the default 16 million. */ 
 ColorDetector.setPalette(_3_BIT_RGB_PALETTE); 
} 
void loop() { 
 /* Check if there's a new color received. */ 
 if( PushButton.isPressed()) 
 { 
 if(ColorDetector.isNewColorReceived()) 
 { 
   /* Read the last received color and save it locally. */ 
   Color readColor = ColorDetector.getLastColor(); 
   /* Get red, blue and green components values. */ 
   byte redValue = readColor.getRed(); 
   byte greenValue = readColor.getGreen(); 
   byte blueValue = readColor.getBlue(); 
   colorName(redValue,greenValue,blueValue); 
   } 
delay(1000); 
 } 
}    
/* indentify the color using the values of red ,green,and blue and say the color name  */ 
void colorName(byte redvalue,byte greenvalue ,byte bluevalue) 
{ 
     if (redvalue== 0 && greenvalue== 0 && bluevalue == 0) 
        TextToSpeech.say("black"); 
    else if (redvalue== 0 && greenvalue== 0 && bluevalue == 85) 
        TextToSpeech.say("nave"); 
    else if (redvalue== 0 && greenvalue== 0 && bluevalue == 170) 
        TextToSpeech.say("dark blue"); 
    else if (redvalue== 0 && greenvalue== 0 && bluevalue == 255) 
        TextToSpeech.say("blue"); 
    else if (redvalue== 0 && greenvalue== 85 && bluevalue == 0) 
        TextToSpeech.say("dark green"); 
    else if (redvalue== 0 && greenvalue== 85 && bluevalue == 85) 
        TextToSpeech.say("green"); 
    else if (redvalue== 0 && greenvalue== 85 && bluevalue == 170) 
        TextToSpeech.say("blue"); 
    else if (redvalue== 0 && greenvalue== 85 && bluevalue == 255) 
        TextToSpeech.say("blue"); 
    else if (redvalue== 0 && greenvalue== 170 && bluevalue == 0) 
        TextToSpeech.say("green"); 
    else if (redvalue== 0 && greenvalue== 170 && bluevalue == 85) 
        TextToSpeech.say("dark green"); 
    else if (redvalue== 0 && greenvalue== 170 && bluevalue == 170) 
        TextToSpeech.say("sky blue"); 
    else if (redvalue== 0 && greenvalue== 170 && bluevalue == 255) 
        TextToSpeech.say("light blue"); 
    else if (redvalue== 0 && greenvalue== 255 && bluevalue == 0) 
        TextToSpeech.say("green"); 
    else if (redvalue== 0 && greenvalue== 255 && bluevalue == 85) 
        TextToSpeech.say("spring green"); 
    else if (redvalue== 0 && greenvalue== 255 && bluevalue == 170) 
        TextToSpeech.say("light green"); 
    else if (redvalue== 0 && greenvalue== 255 && bluevalue == 255) 
        TextToSpeech.say("aqua"); 
    else if (redvalue== 85 && greenvalue== 0 && bluevalue == 0) 
        TextToSpeech.say("dark red"); 
    else if (redvalue== 85 && greenvalue== 0 && bluevalue == 85) 
        TextToSpeech.say("dark purple"); 
    else if (redvalue== 85 && greenvalue== 0 && bluevalue == 170) 
        TextToSpeech.say("purple"); 
    else if (redvalue== 85 && greenvalue== 0 && bluevalue == 255) 
        TextToSpeech.say("blue"); 
    else if (redvalue== 85 && greenvalue== 85 && bluevalue == 0) 
        TextToSpeech.say("yellow"); 
    else if (redvalue== 85 && greenvalue== 85 && bluevalue == 85) 
        TextToSpeech.say("gray"); 
    else if (redvalue== 85 && greenvalue== 85 && bluevalue == 170) 
        TextToSpeech.say("blue"); 
    else if (redvalue== 85 && greenvalue== 85 && bluevalue == 255) 
        TextToSpeech.say("light blue"); 
    else if (redvalue== 85 && greenvalue== 170 && bluevalue == 0) 
        TextToSpeech.say("green"); 
    else if (redvalue== 85 && greenvalue== 170 && bluevalue == 85) 
        TextToSpeech.say("lame green"); 
    else if (redvalue== 85 && greenvalue== 170 && bluevalue == 170) 
        TextToSpeech.say("green"); 
    else if (redvalue== 85 && greenvalue== 170 && bluevalue == 255) 
        TextToSpeech.say("light blue"); 
    else if (redvalue== 85 && greenvalue== 255 && bluevalue == 0) 
        TextToSpeech.say("light green"); 
    else if (redvalue== 85 && greenvalue== 255 && bluevalue == 85) 
        TextToSpeech.say("green"); 
    else if (redvalue== 85 && greenvalue== 255 && bluevalue == 170) 
        TextToSpeech.say("blue green"); 
    else if (redvalue== 85 && greenvalue== 255 && bluevalue == 255) 
        TextToSpeech.say("aqua"); 
    else if (redvalue== 170 && greenvalue== 0 && bluevalue == 0) 
        TextToSpeech.say("red"); 
    else if (redvalue== 170 && greenvalue== 0 && bluevalue == 85) 
        TextToSpeech.say("dark pink"); 
    else if (redvalue== 170 && greenvalue== 0 && bluevalue == 170) 
        TextToSpeech.say("purple"); 
    else if (redvalue== 170 && greenvalue== 0 && bluevalue == 255) 
        TextToSpeech.say("purple"); 
    else if (redvalue== 170 && greenvalue== 85 && bluevalue == 0) 
        TextToSpeech.say("light brown"); 
    else if (redvalue== 170 && greenvalue== 85 && bluevalue == 85) 
        TextToSpeech.say("pale pink"); 
    else if (redvalue== 170 && greenvalue== 85 && bluevalue == 170) 
        TextToSpeech.say("purple"); 
    else if (redvalue== 170 && greenvalue== 85 && bluevalue == 255) 
        TextToSpeech.say("meduim purple"); 
    else if (redvalue== 170 && greenvalue== 170 && bluevalue == 0) 
        TextToSpeech.say("yellow"); 
    else if (redvalue== 170 && greenvalue== 170 && bluevalue == 85) 
        TextToSpeech.say("pale green"); 
    else if (redvalue== 170 && greenvalue== 170 && bluevalue == 170) 
        TextToSpeech.say("gray"); 
    else if (redvalue== 170 && greenvalue== 170 && bluevalue == 255) 
        TextToSpeech.say("blue"); 
    else if (redvalue== 170 && greenvalue== 255 && bluevalue == 0) 
        TextToSpeech.say("light green"); 
    else if (redvalue== 170 && greenvalue== 255 && bluevalue == 85) 
        TextToSpeech.say("green"); 
    else if (redvalue== 170 && greenvalue== 255 && bluevalue == 170) 
        TextToSpeech.say("green"); 
    else if (redvalue== 170 && greenvalue== 255 && bluevalue == 255) 
        TextToSpeech.say("light blue"); 
    else if (redvalue== 255 && greenvalue== 0 && bluevalue == 0) 
        TextToSpeech.say("red"); 
    else if (redvalue== 255 && greenvalue== 0 && bluevalue == 85) 
        TextToSpeech.say("pink"); 
    else if (redvalue== 255 && greenvalue== 0 && bluevalue == 170) 
        TextToSpeech.say("pink"); 
    else if (redvalue== 255 && greenvalue== 0 && bluevalue == 255) 
        TextToSpeech.say("pink"); 
    else if (redvalue== 255 && greenvalue== 85 && bluevalue == 0) 
        TextToSpeech.say("orange"); 
    else if (redvalue== 255 && greenvalue== 85 && bluevalue == 85) 
        TextToSpeech.say("lame pink"); 
    else if (redvalue== 255 && greenvalue== 85 && bluevalue == 170) 
        TextToSpeech.say("pink"); 
    else if (redvalue== 255 && greenvalue== 85 && bluevalue == 255) 
        TextToSpeech.say("pink"); 
    else if (redvalue== 255 && greenvalue== 170 && bluevalue == 0) 
        TextToSpeech.say("orange"); 
    else if (redvalue== 255 && greenvalue== 170 && bluevalue == 85) 
        TextToSpeech.say("light orange"); 
    else if (redvalue== 255 && greenvalue== 170 && bluevalue == 170) 
        TextToSpeech.say("pink"); 
    else if (redvalue== 255 && greenvalue== 170 && bluevalue == 255) 
        TextToSpeech.say("pink"); 
    else if (redvalue== 255 && greenvalue== 255 && bluevalue == 0) 
        TextToSpeech.say("yellow"); 
    else if (redvalue== 255 && greenvalue== 255 && bluevalue == 85) 
        TextToSpeech.say("light yellow"); 
    else if (redvalue== 255 && greenvalue== 255 && bluevalue == 170) 
        TextToSpeech.say("paje"); 
    else if (redvalue== 255 && greenvalue== 255 && bluevalue == 255) 
        TextToSpeech.say("white"); 
}  

Step 6: Compile and Upload your sketch to your Arduino board

Switch 1Sheeld to the uploading-mode before you upload your sketch to the Arduino board to avoid serial conflicts between 1Sheeld and Arduino. Upload mode is turned on when the UART switch is pushed away from the 1Sheeld logo.

And then press the Upload button in the IDE, and upload your code to Arduino.

After you completed your upload you need to switch 1Sheeld back to the operating mode.

Step 7: Connect 1Sheeld to your Smartphone using 1Sheeld Application

You will be required to enter the pairing code (the default pairing code is 1234) and connect to 1Sheeld via Bluetooth.

Step 8: Access Shields

  • Color detector
  • Push button
  • Text to speech

Press on the multiple shields icon at the top right of the app.

Step 9: Configure Color Detector Shield

Thank you!

Code

color informer for blind peopleArduino
#define CUSTOM_SETTINGS
#define INCLUDE_COLOR_DETECTOR_SHIELD
#define INCLUDE_TEXT_TO_SPEECH_SHIELD
#define INCLUDE_PUSH_BUTTON_SHIELD

/* Include 1Sheeld library. */
#include <OneSheeld.h>



void setup() {
  /* Start communication. */
  OneSheeld.begin();

  /* Set the color detection palette to get only 8 different colors instead of the default 16 million. */
  ColorDetector.setPalette(_3_BIT_RGB_PALETTE);



}

void loop() {
  /* Check if there's a new color received. */
  if( PushButton.isPressed())
  {
  if(ColorDetector.isNewColorReceived())
  {
    /* Read the last received color and save it locally. */
    Color readColor = ColorDetector.getLastColor();

    /* Get red, blue and green components values. */
    byte redValue = readColor.getRed();
    byte greenValue = readColor.getGreen();
    byte blueValue = readColor.getBlue();
    colorName(redValue,greenValue,blueValue);
   
    }
 delay(1000);
  }
}   
/* indentify the color using the values of red ,green,and blue and say the color name  */
void colorName(byte redvalue,byte greenvalue ,byte bluevalue)
{
      if (redvalue== 0 && greenvalue== 0 && bluevalue == 0)
         TextToSpeech.say("black");
     else if (redvalue== 0 && greenvalue== 0 && bluevalue == 85)
         TextToSpeech.say("nave");
     else if (redvalue== 0 && greenvalue== 0 && bluevalue == 170)
         TextToSpeech.say("dark blue");
     else if (redvalue== 0 && greenvalue== 0 && bluevalue == 255)
         TextToSpeech.say("blue");
     else if (redvalue== 0 && greenvalue== 85 && bluevalue == 0)
         TextToSpeech.say("dark green");
     else if (redvalue== 0 && greenvalue== 85 && bluevalue == 85)
         TextToSpeech.say("green");
     else if (redvalue== 0 && greenvalue== 85 && bluevalue == 170)
         TextToSpeech.say("blue");
     else if (redvalue== 0 && greenvalue== 85 && bluevalue == 255)
         TextToSpeech.say("blue");
     else if (redvalue== 0 && greenvalue== 170 && bluevalue == 0)
         TextToSpeech.say("green");
     else if (redvalue== 0 && greenvalue== 170 && bluevalue == 85)
         TextToSpeech.say("dark green");
     else if (redvalue== 0 && greenvalue== 170 && bluevalue == 170)
         TextToSpeech.say("sky blue");
     else if (redvalue== 0 && greenvalue== 170 && bluevalue == 255)
         TextToSpeech.say("light blue");
     else if (redvalue== 0 && greenvalue== 255 && bluevalue == 0)
         TextToSpeech.say("green");
     else if (redvalue== 0 && greenvalue== 255 && bluevalue == 85)
         TextToSpeech.say("spring green");
     else if (redvalue== 0 && greenvalue== 255 && bluevalue == 170)
         TextToSpeech.say("light green");
     else if (redvalue== 0 && greenvalue== 255 && bluevalue == 255)
         TextToSpeech.say("aqua");
     else if (redvalue== 85 && greenvalue== 0 && bluevalue == 0)
         TextToSpeech.say("dark red");
     else if (redvalue== 85 && greenvalue== 0 && bluevalue == 85)
         TextToSpeech.say("dark purple");
     else if (redvalue== 85 && greenvalue== 0 && bluevalue == 170)
         TextToSpeech.say("purple");
     else if (redvalue== 85 && greenvalue== 0 && bluevalue == 255)
         TextToSpeech.say("blue");
     else if (redvalue== 85 && greenvalue== 85 && bluevalue == 0)
         TextToSpeech.say("olive");
     else if (redvalue== 85 && greenvalue== 85 && bluevalue == 85)
         TextToSpeech.say("gray");
     else if (redvalue== 85 && greenvalue== 85 && bluevalue == 170)
         TextToSpeech.say("blue");
     else if (redvalue== 85 && greenvalue== 85 && bluevalue == 255)
         TextToSpeech.say("light blue");
     else if (redvalue== 85 && greenvalue== 170 && bluevalue == 0)
         TextToSpeech.say("green");
     else if (redvalue== 85 && greenvalue== 170 && bluevalue == 85)
         TextToSpeech.say("lame green");
     else if (redvalue== 85 && greenvalue== 170 && bluevalue == 170)
         TextToSpeech.say("green");
     else if (redvalue== 85 && greenvalue== 170 && bluevalue == 255)
         TextToSpeech.say("light blue");
     else if (redvalue== 85 && greenvalue== 255 && bluevalue == 0)
         TextToSpeech.say("light green");
     else if (redvalue== 85 && greenvalue== 255 && bluevalue == 85)
         TextToSpeech.say("green");
     else if (redvalue== 85 && greenvalue== 255 && bluevalue == 170)
         TextToSpeech.say("blue green");
     else if (redvalue== 85 && greenvalue== 255 && bluevalue == 255)
         TextToSpeech.say("aqua");
     else if (redvalue== 170 && greenvalue== 0 && bluevalue == 0)
         TextToSpeech.say("red");
     else if (redvalue== 170 && greenvalue== 0 && bluevalue == 85)
         TextToSpeech.say("dark pink");
     else if (redvalue== 170 && greenvalue== 0 && bluevalue == 170)
         TextToSpeech.say("purple");
     else if (redvalue== 170 && greenvalue== 0 && bluevalue == 255)
         TextToSpeech.say("purple");
     else if (redvalue== 170 && greenvalue== 85 && bluevalue == 0)
         TextToSpeech.say("light brown");
     else if (redvalue== 170 && greenvalue== 85 && bluevalue == 85)
         TextToSpeech.say("pale pink");
     else if (redvalue== 170 && greenvalue== 85 && bluevalue == 170)
         TextToSpeech.say("purple");
     else if (redvalue== 170 && greenvalue== 85 && bluevalue == 255)
         TextToSpeech.say("meduim purple");
     else if (redvalue== 170 && greenvalue== 170 && bluevalue == 0)
         TextToSpeech.say("olive");
     else if (redvalue== 170 && greenvalue== 170 && bluevalue == 85)
         TextToSpeech.say("pale green");
     else if (redvalue== 170 && greenvalue== 170 && bluevalue == 170)
         TextToSpeech.say("gray");
     else if (redvalue== 170 && greenvalue== 170 && bluevalue == 255)
         TextToSpeech.say("blue");
     else if (redvalue== 170 && greenvalue== 255 && bluevalue == 0)
         TextToSpeech.say("light green");
     else if (redvalue== 170 && greenvalue== 255 && bluevalue == 85)
         TextToSpeech.say("green");
     else if (redvalue== 170 && greenvalue== 255 && bluevalue == 170)
         TextToSpeech.say("green");
     else if (redvalue== 170 && greenvalue== 255 && bluevalue == 255)
         TextToSpeech.say("light blue");
     else if (redvalue== 255 && greenvalue== 0 && bluevalue == 0)
         TextToSpeech.say("red");
     else if (redvalue== 255 && greenvalue== 0 && bluevalue == 85)
         TextToSpeech.say("pink");
     else if (redvalue== 255 && greenvalue== 0 && bluevalue == 170)
         TextToSpeech.say("pink");
     else if (redvalue== 255 && greenvalue== 0 && bluevalue == 255)
         TextToSpeech.say("pink");
     else if (redvalue== 255 && greenvalue== 85 && bluevalue == 0)
         TextToSpeech.say("orange");
     else if (redvalue== 255 && greenvalue== 85 && bluevalue == 85)
         TextToSpeech.say("lame pink");
     else if (redvalue== 255 && greenvalue== 85 && bluevalue == 170)
         TextToSpeech.say("pink");
     else if (redvalue== 255 && greenvalue== 85 && bluevalue == 255)
         TextToSpeech.say("pink");
     else if (redvalue== 255 && greenvalue== 170 && bluevalue == 0)
         TextToSpeech.say("orange");
     else if (redvalue== 255 && greenvalue== 170 && bluevalue == 85)
         TextToSpeech.say("light orange");
     else if (redvalue== 255 && greenvalue== 170 && bluevalue == 170)
         TextToSpeech.say("pink");
     else if (redvalue== 255 && greenvalue== 170 && bluevalue == 255)
         TextToSpeech.say("pink");
     else if (redvalue== 255 && greenvalue== 255 && bluevalue == 0)
         TextToSpeech.say("yellow");
     else if (redvalue== 255 && greenvalue== 255 && bluevalue == 85)
         TextToSpeech.say("light yellow");
     else if (redvalue== 255 && greenvalue== 255 && bluevalue == 170)
         TextToSpeech.say("paje");
     else if (redvalue== 255 && greenvalue== 255 && bluevalue == 255)
         TextToSpeech.say("white");
                 
}
 

Schematics

schematic
5c0cwana6uiozbewgtmd

Comments

Similar projects you might like

Controlling an RGB LED with Color Detector Camera

Project tutorial by Zowail

  • 1,330 views
  • 0 comments
  • 1 respect

Blind Stick Navigator

Project tutorial by Team MeRo

  • 10,215 views
  • 6 comments
  • 23 respects

Crying Baby Detector Using 1Sheeld

Project tutorial by Kirollos Magdi Sobhy

  • 4,508 views
  • 7 comments
  • 25 respects

Color Sensor Prototype: Detect Color Name from Objects

Project tutorial by moretticb

  • 3,035 views
  • 4 comments
  • 23 respects

Control a RGB Led using Arduino and a smartphone's camera

Project tutorial by Mr robot Maker

  • 2,288 views
  • 0 comments
  • 8 respects

Countdown timer using GLCD shield

Project tutorial by Ahmed Elsagaan

  • 558 views
  • 0 comments
  • 3 respects
Add projectSign up / Login