RGB Smile - Daniel

by HerbieHusker1 in Circuits > Arduino

15 Views, 0 Favorites, 0 Comments

RGB Smile - Daniel

WIN_20231113_09_43_48_Pro.jpg
WIN_20231113_09_48_46_Pro.jpg

My Project is a smiley face, that is made of RGB lights. You can change the color of the lights with a remote. There are twenty-one different colors. Created by Daniel Miller.

Supplies

I used an Arduino Mega ADK, an RGB light string, a solderless breadboard, an IR receiver with remote, some cardboard, tape, a few wires and a USB to USB type B cable.

Coding

I recorded the numbers that the remote tells the receiver, and then I made the Arduino board tell the lights to light up with a programed color when it detects the number from the remote buttons. this is the code beneath. NOTE: while recording the IR code, if it shows a 0, then the signal is being obstructed by something and is not fully reaching the receiver. Make sure that you get the correct signal for each button listed. All you have to do is download the code and open the file or copy everything in the text box below after you copy the code, paste it into the Arduino app.




// Daniel Miller's RGB face with remote. this is the code for it


#define IR_RECEIVE_PIN 12

#include <Adafruit_NeoPixel.h> //variable for lights

#include "IRremote.h"     //variable for remote


#define PIN 2    // On Trinket or Gemma, suggest changing this to 1

#define NUMPIXELS 16 // this is how many lights that I used


Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);


#define DELAYVAL 100

int receiver = 2;

/*Open the Serial Monitor

1. Press each button on the remote control

2. Record what number each button produces

Row (), button1 button2 button3

Row 1, 69 70 71

Row 2, 68 64 67

Row 3, 7 21 9

Row 4, 22 25 13

Row 5, 12 24 94

Row 6, 8 28 90

Row 7, 66 82 74

*/

void setup() {

 pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)

 Serial.begin(9600);

 IrReceiver.begin(IR_RECEIVE_PIN);

}

// you will have to put your own numbers into the decoded spot. this is because not all IR remotes put out the same signal

void loop() {

 if (IrReceiver.decode()) { //Checks if any button has been pressed

  IrReceiver.resume();   //Tells the receiver to

  Serial.println(IrReceiver.decodedIRData.command);

  if (IrReceiver.decodedIRData.command == 69) {

   OneColor();

  }

  if (IrReceiver.decodedIRData.command == 70) {

   OneColor2();

  }

  if (IrReceiver.decodedIRData.command == 71) {

   OneColor3();

  }

  if (IrReceiver.decodedIRData.command == 68) {

   OneColor4();

  }

  if (IrReceiver.decodedIRData.command == 64) {

   OneColor5();

  }

  if (IrReceiver.decodedIRData.command == 67) {

   OneColor6();

  }

  if (IrReceiver.decodedIRData.command == 7) {

   OneColor7();

  }

  if (IrReceiver.decodedIRData.command == 21) {

   OneColor8();

  }

  if (IrReceiver.decodedIRData.command == 9) {

   OneColor9();

  }

  if (IrReceiver.decodedIRData.command == 22) {

   OneColor10();

  }

  if (IrReceiver.decodedIRData.command == 25) {

   OneColor11();

  }

  if (IrReceiver.decodedIRData.command == 13) {

   OneColor12();

  }

  if (IrReceiver.decodedIRData.command == 12) {

   OneColor13();

  }

  if (IrReceiver.decodedIRData.command == 24) {

   OneColor14();

  }

  if (IrReceiver.decodedIRData.command == 94) {

   OneColor15();

  }

  if (IrReceiver.decodedIRData.command == 8) {

   OneColor16();

  }

  if (IrReceiver.decodedIRData.command == 28) {

   OneColor17();

  }

  if (IrReceiver.decodedIRData.command == 90) {

   OneColor18();

  }

  if (IrReceiver.decodedIRData.command == 66) {

   OneColor19();

  }

  if (IrReceiver.decodedIRData.command == 82) {

   OneColor20();

  }

  if (IrReceiver.decodedIRData.command == 74) {

   OneColor21();

  }

  

 }

}


 //------------------------------------------------------------------------------//

 void OneColor()

 {

  pixels.clear();

  pixels.show();

  for (int i = 0; i < NUMPIXELS; i++) {        

   pixels.setPixelColor(i, pixels.Color(0, 120, 0)); //green, red, blue, max is 250.

  }

  pixels.show();

 }


  void OneColor2()

 {

  pixels.clear();

  pixels.show();

  for (int i = 0; i < NUMPIXELS; i++) {        

   pixels.setPixelColor(i, pixels.Color(30, 40, 0)); //green, red, blue, max is 250.

  }

  pixels.show();

 }


 

  void OneColor3()

  {

  pixels.clear();

  pixels.show();

  for (int i = 0; i < NUMPIXELS; i++) {        

   pixels.setPixelColor(i, pixels.Color(50, 50, 0)); //green, red, blue, max is 250.

  }

  pixels.show();

  }


  void OneColor4()

  {

  pixels.clear();

  pixels.show();

  for (int i = 0; i < NUMPIXELS; i++) {        

   pixels.setPixelColor(i, pixels.Color(110, 0, 0)); //green, red, blue, max is 250.

  }

  pixels.show();

 }


 

  void OneColor5()

  {

  pixels.clear();

  pixels.show();

  for (int i = 0; i < NUMPIXELS; i++) {        

   pixels.setPixelColor(i, pixels.Color(0, 0, 140)); //green, red, blue, max is 250.

  }

  pixels.show();

 }


 void OneColor6()

 {

 pixels.clear();

 pixels.show();

 for (int i = 0; i < NUMPIXELS; i++) {         

  pixels.setPixelColor(i, pixels.Color(0, 200, 200)); //green, red, blue, max is 250.

 }

 pixels.show();

}

 void OneColor7()

 {

 pixels.clear();

 pixels.show();

 for (int i = 0; i < NUMPIXELS; i++) {        

  pixels.setPixelColor(i, pixels.Color(90, 0, 30)); //green, red, blue, max is 250.

 }

 pixels.show();

}

 void OneColor8()

 {

 pixels.clear();

 pixels.show();

 for (int i = 0; i < NUMPIXELS; i++) {         

  pixels.setPixelColor(i, pixels.Color(90, 220, 80)); //green, red, blue, max is 250.

 }

 pixels.show();

}

 void OneColor9()

 {

 pixels.clear();

 pixels.show();

 for (int i = 0; i < NUMPIXELS; i++) {         

  pixels.setPixelColor(i, pixels.Color(180, 80, 0)); //green, red, blue, max is 250.

 }

 pixels.show();

}

 void OneColor10()

 {

 pixels.clear();

 pixels.show();

 for (int i = 0; i < NUMPIXELS; i++) {        

  pixels.setPixelColor(i, pixels.Color(70, 0, 10)); //green, red, blue, max is 250.

 }

 pixels.show();

}

 void OneColor11()

 {

 pixels.clear();

 pixels.show();

 for (int i = 0; i < NUMPIXELS; i++) {         

  pixels.setPixelColor(i, pixels.Color(47, 50, 90)); //green, red, blue, max is 250.

 }

 pixels.show();

}

 void OneColor12()

 {

 pixels.clear();

 pixels.show();

 for (int i = 0; i < NUMPIXELS; i++) {         

  pixels.setPixelColor(i, pixels.Color(210, 0, 90)); //green, red, blue, max is 250.

 }

 pixels.show();

}

 void OneColor13()

 {

 pixels.clear();

 pixels.show();

 for (int i = 0; i < NUMPIXELS; i++) {         

  pixels.setPixelColor(i, pixels.Color(27, 39, 52)); //green, red, blue, max is 250.

 }

 pixels.show();

}

 void OneColor14()

 {

 pixels.clear();

 pixels.show();

 for (int i = 0; i < NUMPIXELS; i++) {         

  pixels.setPixelColor(i, pixels.Color(90, 90, 60)); //green, red, blue, max is 250.

 }

 pixels.show();

}

 void OneColor15()

 {

 pixels.clear();

 pixels.show();

 for (int i = 0; i < NUMPIXELS; i++) {         

  pixels.setPixelColor(i, pixels.Color(66, 66, 66)); //green, red, blue, max is 250.

 }

 pixels.show();

}

 void OneColor16()

 {

 pixels.clear();

 pixels.show();

 for (int i = 0; i < NUMPIXELS; i++) {          

  pixels.setPixelColor(i, pixels.Color(86, 186, 213)); //green, red, blue, max is 250.

 }

 pixels.show();

}

 void OneColor17()

 {

 pixels.clear();

 pixels.show();

 for (int i = 0; i < NUMPIXELS; i++) {         

  pixels.setPixelColor(i, pixels.Color(94, 7, 200)); //green, red, blue, max is 250.

 }

 pixels.show();

}

 void OneColor18()

 {

 pixels.clear();

 pixels.show();

 for (int i = 0; i < NUMPIXELS; i++) {        

  pixels.setPixelColor(i, pixels.Color(40, 2, 70)); //green, red, blue, max is 250.

 }

 pixels.show();

}

 void OneColor19()

 {

 pixels.clear();

 pixels.show();

 for (int i = 0; i < NUMPIXELS; i++) {         

  pixels.setPixelColor(i, pixels.Color(20, 20, 20)); //green, red, blue, max is 250.

 }

 pixels.show();

}

 void OneColor20()

 {

 pixels.clear();

 pixels.show();

 for (int i = 0; i < NUMPIXELS; i++) {         

  pixels.setPixelColor(i, pixels.Color(30, 50, 90)); //green, red, blue, max is 250.

 }

 pixels.show();

}

 void OneColor21()

 {

 pixels.clear();

 pixels.show();

 for (int i = 0; i < NUMPIXELS; i++) {         

  pixels.setPixelColor(i, pixels.Color(42, 42, 42)); //green, red, blue, max is 250.

 }

 pixels.show();

}


Downloads

Assembly

Screenshot 2023-11-13 092614.png

Follow the diagram picture. NOTE: do not pay attention to the light-yellow box that says "Pin 39B breadboard blahblahblah". when I took the screenshot, I had been hovering over that spot. but pay no attention to it ;) NOTE: Make sure the wires are going to the correct ports on the Arduino and the lights and the receiver.

The Test

WIN_20231113_09_48_46_Pro.jpg

Select the proper board on the Arduino App and attach the cable (USB to USB type B) from the computer to the Arduino Board. Press the button on your remote (Facing the receiver) and watch the colors!!!