Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering

Changing the Color of RGB LED (Part 11/13)

By Arpit jain

Changing the Color of RGB LED

SUMMARY
 
In this series we have conducted various experiments, out of which the previous one was related to dancing LEDs. Now let’s do some more experiments and see how far we can extend the Brain wave. 
 
Earlier we have changed the LED brightness using the Attention and Meditation values. The results were good and we were able to see the variation in the form of brightness. Though we didn’t get much clear variation, we also performed a similar experiment using motor and changed the motor speed. Now let us try one more such experiment and this time we will change the colour of the RGB Led. Also, earlier we have used attention/meditation waves of e meters; this time we will use some of the Brain Waves to control the colour.
 
Image showing RGB LED Color Change by Brainwave
 
Fig. 1: Image showing RGB LED Color Change by Brainwave
 
DESCRIPTION
 
RGB LEDs are colourful LEDs which can change the colour depending on the input. These LEDs are also controlled by the PWM wave. Many of things which work on variations can be controlled by PWM. So, in this article we will apply an RGB LED in front of the pin while changing the values.
 
Image showing RGB LED Color Change by Brainwave
 
Fig. 2: Image showing RGB LED Color Change by Brainwave
 
 
Image showing RGB LED Color Change by Brainwave
 
Fig. 3: Image showing RGB LED Color Change by Brainwave
 
 
Image showing RGB LED Color Change by Brainwave
 
Fig. 4: Image showing RGB LED Color Change by Brainwave
 
 
 
We will take the signals from the Mindflex Sensor and then extract the values of the desired signal. Once we have got the value we will map the value with that of 0 to 255. We have earlier seen the calculations of PWM before also.
Block Diagram of Brain Wave Module based RGB Color Changer
Fig. 5: Block Diagram of Brain Wave Module based RGB Color Changer
 
Hardware: Please find the attached circuit diagram of the connections that need to be established. We have taken a pin from T pin of the mindflex sensor and connected that pin to the Rx pin of our Arduino UNO. Also, we have shorted the ground of both the Sensor and UNO by a wire. Please take special care while soldering anything to the Mindflex sensor as pins are very close to each other. After that an LED is connected to PIN 9, by which we the PWM signals are sent.
 
Softwares: Let us come to the software part. We have been receiving the E meter values from the sensor to our arduino via T pin. Once we have received the value at any particular point, we just need to convert that value level to the brightness of LED. As discussed previously, we will use PWM techniques. PWM in arduino is done by analogWrite.
 
For example:
 
AnalogWrite(13,240);
 
AnalogWrite in arduino is use to write PWM wave to a pin. In above example, first parameter is PIN Number and second is PIN value. So, we are writing 240 to pin 13. Now we can calculate the analog voltage at the value 240 easily. Total voltage range is 0v – 5v and value range is 0- 255. 
 
This means 240 = (5/255)*240 =  ~4.70V.
 
The values we get from e meters are in range 0 – 100.
 
So let’s say we get evalue = 70.
 
We will multiply the e value by 2.55 to make it in the range of 0-255.
 
It will be analogWrite(pin,evalue*2.55) in a loop. 
 
Now the values we are getting are in range of 0 to 999999, so we will map the values in the range of 0 to 255 to produce above results , by using the map function of arduino .
 
output = map(num,0,999999,0,180);
 
Few points to Note:
 
The sensor usually gives the strength from 60 – 80% due to its orientation and the spot where we place it. Try to keep the metal sensor exactly above your left eye.  I have also applied salt water at my forehead for better connectivity to the sensor.  If you do not find it 100%, then it is normal.  
 
The signal strength also disrupts about how we solder the wire to the T pin. Try to shield this wire and also make sure that the references probes are correctly connected. If you have any wire connected to the EEG pin of the sensor, please disconnect that wire as that might create a lot of noise in the sensor values. 
 
You can also try this experiment on your own and let us know about your valuable feedback. Stay tuned for our forthcoming experiment on controlling servo motor through brain waves.

Project Source Code

###

//Program to 

#include <Brain.h>
 
// Set up the brain parser, pass it the hardware serial object you want to listen on.
Brain brain(Serial);
//char a[400];
String a,a1;
int v = 0;
int z=0,output;
uint32_t num=0;
uint32_t num1=0;
void setup() {
    // Start the hardware serial.
    Serial.begin(9600);
     pinMode(9, OUTPUT);
    }
 
void loop() {
    // Expect packets about once per second.
    // The .readCSV() function returns a string (well, char*) listing the most recent brain data, in the following format:
    // "signal strength, attention, meditation, delta, theta, low alpha, high alpha, low beta, high beta, low gamma, high gamma"    
    if (brain.update()) {
       // Serial.println(brain.readErrors());
       // Serial.println(brain.readCSV());
        //sprintf(a, "%c",brain.readCSV());
        a = brain.readCSV();
        v = a.indexOf(',');
        v = a.indexOf(',',v+1);
        v = a.indexOf(',',v+1);
        v = a.indexOf(',',v+1);
        z = a.indexOf(',',v+1);
        
        a1 = a.substring(v+1,z);
        num = a1.toInt();
         
        v = a.indexOf(',',z+1);
       
         
        a = a.substring(z+1,v);
         
        num1 = a.toInt();
        //Serial.println(num);
        Serial.println(num1);
        analogWrite(9,output)
        
        //brain.readCSV().toCharArray(a,200);
    }
}
 

###


Circuit Diagrams

Circuit-Diagram-Brain-Wave-Module-RGB-Color-Changer


Filed Under: Electronic Projects

 

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


Featured Tutorials

  • Introduction to Brain Waves & its Types (Part 1/13)
  • Understanding NeuroSky EEG Chip in Detail (Part 2/13)
  • Performing Experiments with Brainwaves (Part 3/13)
  • Amplification of EEG Signal and Interfacing with Arduino (Part 4/13)
  • Controlling Led brightness using Meditation and attention level (Part 5/13)
  • Control Motor’s Speed using Meditation and Attention Level of Brain (Part 6/13)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • What are the battery-selection criteria for low-power design?
  • Key factors to optimize power consumption in an embedded device
  • EdgeLock A5000 Secure Authenticator
  • How to interface a DS18B20 temperature sensor with MicroPython’s Onewire driver
  • Introduction to Brain Waves & its Types (Part 1/13)

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr bluetooth dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • Advice for my disabled son please
  • Very low voltage/power Schmitt trigger?
  • 3D IC Design: Is it possible to stack CPU and FPGA?
  • dc to dc converter sparks when inserting fuse
  • 7 segment display connections

RSS Electro-Tech-Online.com Discussions

  • Pet Microchip scan
  • Disabled son needs advice please
  • Modify a digital clamp ammeter ?
  • Confirming whether this circuit will work
  • How does a blinky/flashing ball work?
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering