Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

12F675 LED lightning effect

Status
Not open for further replies.

manojsoorya

Member
Hi all
In this christmas, I wish to give my kids for an amazing LED show..Like a LED thunderstorm lightning effect with 12F675 or 12F629. But no project or circuit find in internet. So I request to all , please guide me to make this light effects.

Regards
Manoj Soorya
 
Last edited:
Do you want something more than a bright white LEDs flashing at random times?

Since you've specified the uControllers you want to use, I assume that you can do the programming.
 
Do you want something more than a bright white LEDs flashing at random times?

Since you've specified the uControllers you want to use, I assume that you can do the programming.

Thank for the guideline bro. Do you have the white LED flashing at random times with the above chip?

I dont know to programme or write a line of programme...
 
You will have to define the request a bit better. Is it just one string of LEDs or do you want multiple strings. The 12F675 can only provide 6 outputs maximum. To drive the LEDs, you would need to interface to some driver circuit, typically a MOSFET driver. Size of that depends on how many LEDs you are driving and with what voltages. Some LED strips are designed for specific voltages, like 12V or 24V and already have built in curent limiting resistors. Other LEDs are bare, and you have to design the interface and current limiting.
The other option is to go to a small Arduino Nano and find a program for it, similar to here:
You will still have to do the interfacing between the Nano and the LEDs
 
You will have to define the request a bit better. Is it just one string of LEDs or do you want multiple strings. The 12F675 can only provide 6 outputs maximum. To drive the LEDs, you would need to interface to some driver circuit, typically a MOSFET driver. Size of that depends on how many LEDs you are driving and with what voltages. Some LED strips are designed for specific voltages, like 12V or 24V and already have built in curent limiting resistors. Other LEDs are bare, and you have to design the interface and current limiting.
The other option is to go to a small Arduino Nano and find a program for it, similar to here:
You will still have to do the interfacing between the Nano and the LEDs

Hi sagor
I just need a single white led to blink randomly. I just make a mechanical type and intalled in my house. But it not relaible. only single output I need.

see this mechanical sections attached....its working good...real animation got it...

But it with a PIC12F675, Its most valuable and worthy and simple to assemble, I think
IMG-20201212-WA0056.jpeg


regards

manoj soorya
 
a small video what I really done it. its a simulation with mechanical switch and just installed. My kids are really amazing....
 

Attachments

  • Video.rar
    2.5 MB · Views: 204
one of my friend write a programme to me, but it not working...
see this code attached
Code:
#include"pic.h"

__CONFIG(FOSC_INTRCIO & WDTE_OFF & PWRTE_OFF & MCLRE_OFF & CP_ON & CPD_ON );

#ifndef _XTAL_FREQ
 // Unless already defined assume 4MHz system frequency
 // This definition is required to calibrate __delay_us() and __delay_ms()
 #define _XTAL_FREQ 4000000
#endif

#define    LED     GP1
//#define    SW1     GP3
//#define    SW2     GP2
//#define    SW3     GP1


unsigned int i,j,count_on,result;  //16 bit variable
unsigned int star_en,sol_min,sol_sec,sol_millisec,minutes,on_sec,sec_1,sec_2,off_min,on_sec,result;  //16 bit variable

unsigned int read_adc(unsigned char channel);
void delay_in_seconds(unsigned char sec_del);
void delay(int del);
struct datax
    {            
      unsigned LED_start_on:1;
      unsigned BUZZER_start_on:1;
      unsigned CHECK_on:1;
    }
  struct datax flags;
    
void interrupt isr(void) 
    {

    if ((TMR1IF) && (TMR1IE))      // 30MS  DELAY //
        {
           TMR1IF=0;
    
          TMR1H     = 0x8A;
          TMR1L     = 0xD0; 

        
        
           }
  }

void main()  // pic 16f676 MCLR ON    & OCC 14.1V;TRICLE CHARGE 12.8V
{

    CMCON=0x07;                // disable the comparator 
   
    TRISIO=0b00010000;    
    GPIO=0x00;    
    ANSEL=0b00001000; // adc port select
    ADCON0=0b0110000;     // adc control register 0

    GIE = 1;
    PEIE = 1;
    
    // 30 ms delay // 

    T1CON    = 0x01;
    TMR1IF    = 0;
      TMR1H     = 0x8A;
      TMR1L     = 0xD0;
    TMR1IE    = 1;
    INTCON    = 0xC0;    
    TMR1ON=1;    // timer-1 on
    

while(1)
    {

LED=0;
delay_in_seconds(on_sec);
LED=1;
__delay_ms(50);
LED=0;
__delay_ms(20);

LED=1;
__delay_ms(100);
LED=0;
__delay_ms(20);

LED=1;
__delay_ms(200);
LED=0;
__delay_ms(20);

LED=1;
__delay_ms(100);
LED=0;
__delay_ms(20);

LED=1;
__delay_ms(50);
LED=0;
__delay_ms(20);
__delay_ms(500);    
    on_sec=read_adc(3);  // ON SEC    
    }
}

unsigned int read_adc(unsigned char channel)
    {
    channel=channel<<2;
    ADCON0=(channel+0b10000001);
    __delay_us(30);
    GO=1;
    while(GO);
    result=(ADRESH*256)+ADRESL;
    return result;
    }
void delay_in_seconds(unsigned char sec_del)
{
for(i=0;i<sec_del;i++)
    {
    for(j=0;j<100;j++)//for(j=0;j<997;j++)
        {
        delay(81);
        }
    }
}

void delay(int del)
{    while(del--);    
}


[Code]

what problem with this code?

regards

Manoj
 
Hi sagor
I just need a single white led to blink randomly. I just make a mechanical type and intalled in my house. But it not relaible. only single output I need.

see this mechanical sections attached....its working good...real animation got it...

But it with a PIC12F675, Its most valuable and worthy and simple to assemble, I thinkView attachment 128473

regards

manoj soorya
That is a really cool electro-mechanical effects generator! How are the copper strip lengths read?

What is the issue with the new code?
 
I don't do a lot of "C", but the interrupt ISR code does not seem to do anything other than reset the interrupt timer. No where does the ISR set any flag or variable. Thus, that routine seems redundant.
 
That is a really cool electro-mechanical effects generator! How are the copper strip lengths read?

What is the issue with the new code?

Hi M. Joshi
The copper strip only for switching, length is not a factor. The round copper strip PCB is attached to a DC geared motor which speed was very slow.

The code not working properly as really what I need...
1. Hex file not working in real hardware.
2. Proteus simulation working, but its not random in timing as well as flikering...


Regards
 
Have you tried a basic program blinking an LED first?

I am trying with simple circuit and code available in internet.... I am not a specialyst in software, i am hardware engineer. That i seek a help.... Know to burn the chip and know electronics with 30 year of experience.

Regards
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top