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

FOC Light Fountain with RGB Colour Control

By Ashutosh Bhatt

Here I am presenting very interesting project that can be use as a nice show piece or display item with live colours. The desire colour can be set manually from 7 different RGB (Red-Green-Blue) colour combinations.

FOC light fountain is a made up of hair like small optical fibre cables bunched togather at one side. When light of different colours is given from that side the entire bunch of fibers look like fountain of light. Such show pieces are readily and easily available in gift article shops or show piece item shops.

I have also brought one such piece from market and because I am an engineer (espically an EC engineer) i just open it up to look what is inside and to find out its working. After knowing its simple working, this interesting idea comes into my mind that let us make it this way!!!!! The idea in my mind was to change the colours using volume control type knob (just like in music systems or FM/AM radios) and to display the name of colour on LCD (displaying name of colour is actually for kids so that they may get learn with fun).

So what I did is i took 3 LEDs, one red – one green and one blue. Then I made micro controller AT89C52 based circuit with pot, ADC0804 and LCD and controlled this 3 LEDs to generate different colours and colour combinations by varying pot along with displaying colour name on LCD. So let us see the circuit diagram its working and operation.

Circuit diagram:

The circuit is built using ADC0801, micro controllerAT89C52, LCD, 3 LEDs and few extra components.

·  The analog input of ADC (Vin) is connected to slider arm of 1 K pot. The other two terminals are connected with Vcc and Gnd. So as pot is varied the analog voltage at pin is varied from 0 V to Vcc

·  The chip select pin (CS) is permanently connected to Gnd to make chip always enable. Analog ground (AD), digital ground (DG), Vin- etc pis are also connected to Gnd

·  Reference voltage pin Vref is given Vcc/2 voltage through voltage divider network formed by R3 and R4

·  Data pins DB0 – DB7 are connected with port P1 of AT89C52. Control pins RD, WR and INTR are connected to port P3 pins P3.7, P3.6 and P3.3 respectively. The INTR is the output from ADC0801 that is used to generate interrupt for AT89C52

·  The data pins of LCD D0 – D7 are connected to port P0. Two control pins Rs and En are connected to port P2 pins P2.7 and P2.6 respectively. Control pin RW is connected to ground to make LCD write always enable. Vee pin is connected to slider of another pot that is used to vary the brightness of LCD

·  Three LEDs – Red, Green & Blue are connected to port P2 pins P2.0, P2.1 and P2.2 respectively through current limiting resistors in current sinking mode

·  A 12 MHz crystal with two 33 pF capacitors is connected to crystal input pins to provide basic clock signal to micro controller for its working and internal operations 

Circuit operation:

The circuit generates 7 different colour combinations

1. Only Red

2. Only green

3. Only blue

4. Red and green

5. Green and blue

6. Blue and red

7. Red green and blue

These combinations are changed as pot is varied (turned clockwise or counter clockwise). As the pot is varied the analog voltage at ADC input pin varies. The micro controller gets the corresponding digital value of this analog voltage through ADC. Micro controller gives control signals (WR and RD) to ADC to convert this analog value into digital. The ADC gives 8-bit digital value that is varying from 0 to 255. The micro controller compares this value with 7 different ranges like 0 – 36, 37 – 72, 73 – 108, … … (the ranges are in multiples of 36 because i have divided 0 – 255 in 7 equal ranges so 255 / 7 ≈ 36). These 7 different ranges correspond to 7 different colour combinations given above. The micro controller turns ON required LED or LEDs as per the value falls within any range and generate the colour. The name of the colour or colour combination is displayed on LCD. As anyone continuously varies the pot from min to max, the micro controller generates all 7 colour combinations one by one.

Softwere program

Here are the photographs of running project

Prototype of 8051 Microcontroller based FOC Light Fountain

Fig. 1: Prototype of 8051 Microcontroller based FOC Light Fountain

Prototype of 8051 Microcontroller circuit controlling FOC Light Fountain

Fig. 2: Prototype of 8051 Microcontroller circuit controlling FOC Light Fountain

Software program:

For complete circuit operation, the software program is written and embedded into internal memory of micro controller. The program performs following tasks

·    It controls ADC, sends write/read signals to it and gets digital value 

·    It compares this digital value with 7 different ranges like 0 – 36, 37 – 72, 73 – 108 etc 

·    It turns ON particular LED or LEDs to generate colour

·    It displays colour name or colour combination on LCD

The program is written in C language. It is compiled using KEIL (IDE) software tool. This software generates HEX file when the program is compiled successfully. This HEX file is downloaded into internal FLASH (EEPROM – memory) of micro controller using EEPROM programmer software and hardware tools.

Project Source Code

###


#include

#include "lcd.h"

#include

 

#define ON 0;

#define OFF 1;

 

sbit rs = P2^7;

sbit en = P2^6;

sbit wr = P3^6;

sbit rd = P3^7;

sbit red_led = P2^0;

sbit green_led = P2^1;

sbit blue_led = P2^2;

unsigned int color_flag=0,prev_color_flag=0;

unsigned char data d;

 

void delay()

  {

      int p,q;

      for(p=0;p<150;p++)

      for(q=0;q<1000;q++);

  }

void lcddly()

{

      int x;

      for(x=0;x<1500;x++);

 }

void writecmd(unsigned char a)

{

      lcddly();

      rs = 0;      

      P0 = a;      

      en = 1;      

      en = 0;

}

void writedat(unsigned char b)

{

      lcddly();

      rs = 1;      

      P0 = b;

      en = 1;      

  en = 0;   

}

void writestr(unsigned char *s)

{

      unsigned char l,i;

      l = strlen(s);

      for(i=0;i

      {

             writedat(*s);

             s++;         

      }     

}    

void init_lcd()

  {

      writecmd(0x3C);

      writecmd(0x0F);

      writecmd(0x01);       

  }  

void int1(void) interrupt 2

  {

      rd = 0;

      d=P1;

      rd=1;        

      if((d>0) && (d<=36)) {red_led = ON; green_led = OFF; blue_led=OFF; color_flag=1;}

      else if((d>37) && (d<=72)) {red_led = OFF; green_led = ON; blue_led=OFF; color_flag=2;}

      else if((d>73) && (d<=108)) {red_led = OFF; green_led = OFF; blue_led=ON; color_flag=3;}

      else if((d>109) && (d<=144)) {red_led = ON; green_led = ON; blue_led=OFF; color_flag=4;}

      else if((d>145) && (d<=180)) {red_led = OFF; green_led = ON; blue_led=ON; color_flag=5;}

      else if((d>181) && (d<=216)) {red_led = ON; green_led = OFF; blue_led=ON; color_flag=6;}

      else if(d>216) {red_led = ON; green_led = ON; blue_led=ON; color_flag=7;} 

  }

void display_color()

  {

      if(prev_color_flag!=color_flag)

      {

        if(color_flag==1) {writecmd(0x01);writestr("RED color");}

        else if(color_flag==2) {writecmd(0x01);writestr("GREEN color");}

        else if(color_flag==3) {writecmd(0x01);writestr("BLUE color");}

        elseif(color_flag==4)

{

writecmd(0x01);

writestr("RED & GREEN");

writecmd(0xC0);

writestr("colors");

}

      else if(color_flag==5)

{

writecmd(0x01);

writestr("GREEN & BLUE");

writecmd(0xC0);

writestr("colors");

}

      else if(color_flag==6)

{

writecmd(0x01);

writestr("RED & BLUE");

writecmd(0xC0);

writestr("colors");

}

      else if(color_flag==7)

{

writecmd(0x01);

writestr("RED & GREEN &");

writecmd(0xC0);

writestr("BLUE colors");

}

      prev_color_flag = color_flag;

      }

  }                       

void initialize()

  {

      P1=0xFF;

      P2=0x00;

      P3=0xCF;

      P0=0x00;

      P2=0x0F;

      IE=0x84;

  }  

main()

  {

      initialize();

      init_lcd();  

      while(1)

      {

             wr=0;

             wr=1;               

             display_color();                 

             delay();

      } 

 }

###

 


Circuit Diagrams

Circuit-Diagram-8051-Microcontroller-Circuitry-Used-Controlling-FOC-Light-Fountain

Project Video


Filed Under: Circuit Design

 

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.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

  • PS2 Keyboard To Store Text In SD Card Using Arduino Circuit Setup On Breadboard
    How To Use PS2 Keyboard To Store Text In SD Card Using Arduino- (Part 42/49)
  • Wireless Path Tracking System Using Mouse, XBee And Arduino Circuit Setup On Breadboard
    How To Make A Wireless Path Tracking System Using Mouse, XBee And Arduino- (Part 43/49)
  • How to Make a Wireless Keyboard Using Xbee with Arduino- (Part 44/49)
  • Making Phone Call From GSM Module Using Arduino Circuit Setup On Breadboard
    How to Make Phonecall From GSM Module Using Arduino- (Part 45/49)
  • How to Make a Call using Keyboard, GSM Module and Arduino
    How To Make A Call Using Keyboard, GSM Module And Arduino- (Part 46/49)
  • Receiving SMS Using GSM Module With Arduino Prototype
    How to Receive SMS Using GSM Module with Arduino- (Part 47/49)

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

  • How to interface a DS18B20 temperature sensor with MicroPython’s Onewire driver
  • What is a low power design?
  • Renesas partners with Tata to accelerate progress in advanced electronics
  • STMicroelectronics’ new touchscreen controller for smartphones enables longer runtime
  • Samsung unveils ISOCELL image sensor with industry’s smallest 0.56μm pixel

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

  • How do you find the angle made by two isosceles triangles in a kite?
  • MWO - EM Structure missing
  • Effect of variable gain amplifier and LNA on the input RF signal's phase
  • HF preamplifier with threshold?
  • Does Monostable pulse stay HIGH whilst input pulse is HIGH?

RSS Electro-Tech-Online.com Discussions

  • Help wanted to power an AC120v induction motor ( edited from Brushless motor - thank you @SHORTBUS= )
  • NOR gate oscillator in LTspice not working
  • HELP NEEDED
  • intro to PI
  • Lighting a .010 green fiber optic with led
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