Jump to content
Electronics-Lab.com Community

My first project


Recommended Posts

  I'm new to electronics and i'm trying to experiment on my new project.
 
  Here's what i am trying to do:
   
    I want to turn on leds one by one using a PIC16F84A programed by the following program:


'Binary progression counting
'Initialize variables
Symbol TRISB=134 'Assign TRISB port to 134
Symbol TRISB=  6 'Asing the variable portB the decimal value 6
'Initialize Port(s)
Poke TRISB, 0 'Set port B pins to output
loop:
B0= 1 'Set variable to 1 to start
B1= 0 'Set variable to 0
Poke PortB, B0 'Place B0 value at port to light leds
Pause 250
For B2= 0 to 6
B1= B0 * 2 'Calculate next binary progressiv number
B0 = B1 'Set B0 to new value
Poke PortB, B0 'Place new value at port to light leds
Pouse 250
Next B2 'Next loop value
Goto loop

   
  I have decided to use 3 button cells (Bat2-bat9) for every led each 1.5V. I guess leds will shine forever.

  Since this is my first project i'd like some advices.
  What if switched the 4066 with a 4016?

  Will it work????
http://www.geocities.com/micogjergji/74HCT4066.pdf
http://www.geocities.com/micogjergji/mmc4016.pdf
http://www.geocities.com/micogjergji/shume.tif
shume.jpg

Link to comment
Share on other sites

Welcome

ah a few things I noticed wrong.  First use a 10K resistor for pin 4(MCLR) Then I was wondering why so many battires? You would only need one 9 Volt. Not all the leds will be on at once. Also you don't need the 4066's the pic will do all the work. I have a good web site tutorial link for you.
http://www.mikroelektronika.co.yu/english/product/books/PICbook/picbook.htm
  I use asm and not sure if the code you are using is C or Basic.
                Have fun gogo

Link to comment
Share on other sites

Thank you gogo2520

Just to clarify a few things.

I can get the three batteries+leds for thirty cent each in an assembled package.
They are inside some lighters. Thats why i planned to make it that way.

I found the code in a book and it is in PicBasic.

Not very keen on asm.

Any other idea or advice?

Link to comment
Share on other sites

I'm with gogo2520 on this one. You should only need one battery to power the 7805 regulator, which will provide a steady 5V to your PIC. The output i/o pins on the PIC will provide the necessary voltage to drive the LEDs, right? Just make sure to put an appropriately sized resistor in series with each LED to make sure not to overdrive them (based on whatever the current coming out of the pIC is).

Link to comment
Share on other sites

A 6V battery will drop to 4V near the end of its life.
A 7805 regulator won't work from a 6V battery anyway. It needs a minimum input of about 7V. A low-dropout regulator like an LM2931A-5.0 needs a minimum input of 5.5V to regulate well. Its Z package is like a little transistor and I use it for all my 9V battery powered projects where the battery voltage drops to 6V near the end of its life.

Link to comment
Share on other sites

I figured the 6-8V running into the 7805 in the picture should be more towards 8V than 6V :->. I've not worked with the LM2931. The most common type of +5VDC regulator I've seen is the 7805 (276-1770 from Radio Shack). But, like you said, the 7805 won't work with less than 7VDC input. The assumption I was working off of for my comments was based on gogo2520's comment about using a 9V battery as the power source.

--steve

Link to comment
Share on other sites

Cyril B.
      Playing with Pic's is fun and addicting. I guess i would want to know were your at  as far as having the tools. Like a breadboard, extra parts to play with and so on. Radio Shack dose have some stuff but they are expensive.
    Also picbasic is ok but I found asm easier to learn and the compiler is free and there is a lot of free help on the web.
                                    have fun gogo

Link to comment
Share on other sites

Hi Ed,
I like LEDs and have and had lots of projects with them blinking:

1) I made fifteen "Flash Lights" with a single ultra-bright blue, green or white LED blinking 5 times in half a second then a half-second pause. The circuit crams 90mA into the LED and at one time I had all 12 blinking on the ceiling randomly. They light up a car's licence plate from far away.

2) My "Mood Lights" slowly fade then brighten ultra-bright red, blue and green LEDs with slightly different frequencies so they make all colours and brightnesses.

3) I have a bunch of Plants Watering Watcher-2 gadjets that blink brightly when the plant needs watering and are off or very dim after watering, then their blinking slowly brightens as the plant dries.

4) I made ten Ultra-bright Chasers with 10 LEDs each that go around and around a few times then a pause before going again. They have a brightness control because they are really bright.

5) Now I have a Sound Level Indicator that uses an LM3915 driving ten LEDs according to

Link to comment
Share on other sites

Hi Audioguru, (The LEDing Man)  ;)

“The circuit crams 90mA into the LED and at one time I had all 12 blinking on the ceiling randomly. They light up a car's licence plate from far away.”

Do you really have car license plates hanging from the ceiling?  ;D

BTW. The "Mood Lights" circuit, is this published in the projects department?

Link to comment
Share on other sites


Do you really have car license plates hanging from the ceiling?

I lost the 1967 licence plates from my very 1st car. My circuits shine on the ceiling then its reflection lights up everything.

BTW. The "Mood Lights" circuit, is this published in the projects department?

My "mood lights" project isn't posted anywhere. It uses a positive-feedback arrangement to make the voltage ramps reverse-exponential, so they look like their brightness changes slowly very linearly.

Circuits that use a linear ramp don't produce a linear brightness change.
Link to comment
Share on other sites

Ok Tahnk you guys i'm clear about the power supply.

Now one thing i need some help is the 4066. Is it ok the way it is arranged.

What do you tell me about the code? Will it work? Can anybody help with the .hex.

Does anybody know any free compiler in PicBasic.

  gogo2520 you're right about getting addicting. I live in Albania and hardly found the Pic.

Also decided to change the subject. Just to clarify any of you.

One last thing is anybody who lives in Albania?  Just to help each other.

Link to comment
Share on other sites


Now one thing i need some help is the 4066. Is it ok the way it is arranged.

It isn't designed to pass current like for your LEDs.
Its input and output must be referenced to its supply voltage (your LEDs and their batteries are floating) and if the batteries for the LEDs are still connected when its power is shut off it will latch.
When passing power it works best with certain pins as inputs: 2, 3, 9 and 10.
With a 4.5V battery for 1.7V LEDs then the current will be about 35mA and blow the 4066's and LEDs without current-limiting resistors.
Link to comment
Share on other sites

Hi Cyril,
I suggest using the pic's outputs to drive each LED directly, through 240 ohm current-limiting resistors. The LED current will be typically 10mA which would quickly kill little button cells.

I suggest using a low-dropout regulator like an LM2931AZ-5.0 which still regulates with a supply voltage of 5.4V.

I suggest using at least a 7.5V battery, that will quickly drop to 6V then slowly drop more as it is used.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
  • Create New...