PDA

View Full Version : More wood chuck lighting questions



AvionicsMaster1
- 17th January 2011, 03:07
I've been working with a 12f683 trying to get 20 diodes working off one chip. So far the success has been rather good. Until today when I hooked up the circuit to 4 x 1.5AA batteries through a TO-92 5V regulator. I had been using an old computer power supply for the 5V and disconnected that to hook in the 5V from the regulator/battery setup to the same spot. Now, almost all the LEDs ghost blink while the program is cycling to the next LED. I assumed you couldn't get any cleaner power than from a battery but what vexes me is why they ghost light with the battery and not the power supply?

Your thoughts would be appreciated.

cncmachineguy
- 17th January 2011, 03:41
well without any real details, my first guess is you are overworking your regulator. I am guessing that reg is only good for ~40mA with no heatsink. with heatsink, ~100mA. thats 5 to 10 led's at once with no reguard for other circuit requirments. Another guess is 6V (best case) is not enough for the reg to provide good 5V. so maybe browning out?

Bottom line is more details will be needed I think for any real help to be had.

Acetronics2
- 17th January 2011, 08:24
Hi, AvionicsTaster

YOUR SCHEME !!!! :eek:

Alain

AvionicsMaster1
- 19th January 2011, 00:53
First, I must apologize. I assumed that you'd assume I wouldn't try to turn on 20 LEDs at one time with a 12F683. I'm only turning one at a time. The total current draw at any one time including LED and chip functions is around 25mA and that's well within the capacity of the voltage regulator.


Second, the computer I use for programming isn't hooked up to the internet so I had to recreate part of the programming here. Why I can't install Microcode studio on this computer is something the IT guys will have to fix.

Finally, schematics. We use a different program for schematics and all I had was LTSpice. The schematic shows U2 as being an LT1585-xxx. Well I couldn't find a 78L05ABZ in their symbols library so I used an LT1585 and hope you can make the necessary corrections.

So here are my issues. I get different results during program operation and ICSP. For instance, when I first wrote this all the LEDs were ghosting during the off time of the LEDs. Now the program is running correctly without the ghosting. I don't believe I am doing anything different form then to now in either programming or circuit construction. When I try to do ICSP with the power supply I have always had to disconnnect all but the programmer from pin 7 but the program will load. Yet, while under battery power and pin 7 disconnected from the circuit I can't get the program to transfer. I get an error something like error in instruction set 0028. If it matters all of this is on a proto board.

What can I do to first, make sure the program will run correctly without the ghosting? Second, why does ICSP act differently from the power supply to the battery?

As you can tell, I'm new to this. Some patience will be required no matter what my user name infers.

AvionicsMaster1
- 28th January 2011, 00:44
Well, I figured out part of the problem. To eliminate the ghosting issue I added GPIO=%000000 in the main part of the program after the TRISIO= noghost. That seemed to eliminate the odd LED lighting up willy nilly.

What I don't understand is why I can't do ICSP under battery power. Initially the voltage was a couple of hundred millivolts higher than the power supply but after running this for a week or so the voltage is now around 4.6VDC. Program will run but I have to hook it up to the power supply to program it.

As usual your thoughts are appreciated.

AvionicsMaster1
- 17th May 2011, 14:49
I always like answers and Darrel, from MELABS, provided one so I thought I'd play nice in the schoolyard and share. I've been trying to get 20 LEDs to light sequentially using a 12F683 for several months. I could never get one LED to light without another ghosting. I'd thought my code was the issue but it turned out to be the circuit itself. The circuit attached to this reply works. You can look further up the thread to see what doesn't. The code previously attached does work, even in the new circuit, but Darrel again came to the rescue with a significantly simpler and more elegant way to do it. That code is also attached.I apologize for the run on. My computer form some reason doesn't like carriage returns today.

Demon
- 17th May 2011, 16:57
...
I hooked up the circuit to 4 x 1.5AA batteries through a TO-92 5V regulator
...


At best this configuration can provide 6 volts to the voltage regulator.




...
I couldn't find a 78L05ABZ in their symbols library
...


http://pdf1.alldatasheet.com/datasheet-pdf/view/100840/STMICROELECTRONICS/L78L05ABZAP.html

This voltage regulator has a voltage drop-off of 1.7 volts:

6Vin - 1.7Vdo = 4.3Vout

At full charge, the best you can get is 4.3 volts; things can only degrade as the batteries weaken.

Try adding an extra battery (5 x 1.5).

7.5Vin - 1.7Vdo = 5.8Vout

7.5 input volts is not going to put the voltage regulator in danger.

AvionicsMaster1
- 18th May 2011, 04:25
Well, thanks. For the voltage regulator I was indicating I couldn't find the symbol for a 7805 in LTspice library.

I'm not real sure your math is correct though. As long as I feed >5V into a 7805 regulator, unless it's overloaded, I should get very close to 5V out. With 4 batteries I'm inputting around 6V so until the batteries discharge somewhat then I should have 5V.

I think the 12F683 will work down to 3.3V so all I'm really buying with the regulator is the time it takes to discharge from 6V to 5V. Which may or may not be significant but for me it is.

If I'm missing something, please let me know.

Demon
- 18th May 2011, 05:09
I think the 12F683 will work down to 3.3V

Maybe, but what about the LEDs?

You want to read up on drop-out voltage.

Here is an excellent tutorial:
http://www.afrotechmods.com/videos/voltage_regulator_tutorial.htm

If the link doesn't work, it's on u-toob:
http://www.youtube.com/watch?v=GSzVs7_aW-Y

EDIT: Oh yeah, forgot to say, it's a must-watch video even for those that know this stuff. He's hilarious!

Ioannis
- 18th May 2011, 12:23
I saw his Ultracapacitor videos... He is absolutely nuts!

No question about it.

Ioannis

AvionicsMaster1
- 2nd September 2011, 21:06
In an effort to finally complete a project, here is the final schematic and diagram for a shadow box I made for one of my co-workers. There may be a few final tweaks once he sees what's available but with cut and past I can make it work.

The schematic is from Darrel Taylor and the same as previously but I've added it again for clarification. Although his LED numbers may not match my LED numbers exactly you get the point on how it's wired. Others on this forum may recognize parts of my program as e-mails texts or chats and for those I'm extremely greatful.

With the help of the NAP 4 line the PIC draws <5nA most of the time and draws only about 250nA when it does wake up for a few mSec. This should extend battery life considerably so I've taken out the relay, voltage regulator and their associated headaches.

I post this mainly for review to see where I could have saved a keystroke here or repetitition there. If you've got some constructive comments please add them. Thanks.

Heckler
- 2nd September 2011, 22:35
Is it just me?? or is your .doc file corrupted??

I can open the .pdf but not the .doc file.
I could open the .doc file from your earlier post but not your last post.

Thanks
dwight

SteveB
- 3rd September 2011, 03:23
Any chance to see a picture of the final project?

AvionicsMaster1
- 4th September 2011, 16:13
Looks like doc file is messed up. I don't have file at home so will post it when I get to work.

Sorry, there are some personal items in the shadow box I don't want pictures of circulating on the internets (Al Gore's word).

AvionicsMaster1
- 7th September 2011, 01:36
This is it. Enjoy. Sorry about formatting. Long story.

'************************************************* ***************
'* Name : Randomize 20 LEDs.BAS *
'* Author : Greg Browne *
'* Notice : Copyright (c) 2011 Not a chance *
'* : All Rights Reserved *
'* Date : 08/30/2011 *
'* Version : 1.0 *
'* Notes : 12f683 w/ nap to conserve power and various *
'* : lighting sequences *
'************************************************* ***************
' needs to be streamlined for cleaner reading
clear
define osc 4

' ------------------------------------turn off some stuff to save a little power
@ device mclr_off 'start button is connected here
@ device bod_off
@ device fcmen_off
@ device ieso_off
@ device intrc_osc_noclkout
@ device pwrt_on
@ device protect_off

ansel = 0
cmcon0 = 7
adcon0 = 0

' --------------------------------------------------------------- some variables
delay2 var word
myword var word

delay var byte
mybyte var byte
previous_random var byte
gpiostate var byte
tristate var byte
i var byte
j var byte
k var byte
l var byte

' ------------------------------------------------------------------ some values
delay = 50
delay2 = 500

'------------------------------------------------------------finally the program
starthere:
if gpio.3 = 1 then goto main
nap 4 'naps for 288 milliseconds

goto starthere

'--------------------------------------------flash them all to make it look cool
main:
for i = 1 to 20
random myword
mybyte = (myword//20)
if previous_random = mybyte then goto main
gosub high_led
pause delay
gpio = %000000
pause delay
previous_random = mybyte
next i
'---------------------------------------------------------------- first 13 boxes
mybyte = 0' start LEDs in sequence
for mybyte = 0 to 12
gosub high_led
pause delay2*2
gpio=%000000
pause delay
next mybyte

'---------------------------------------------------------- four stars real fast
mybyte = 13' beginning of stars
for j = 1 to 4
for mybyte = 13 to 16
gosub high_led
pause delay2/5
gpio=%000000
pause delay
next mybyte
next j
'---------------------------------------- four stars with another blinking twice
mybyte = 13' beginning of stars
for mybyte = 13 to 17 ' with the HUD glass this time
gosub high_led
pause delay2
gpio=%000000
pause delay
next mybyte
' ---------------------------------------blinks these lights k number of times
mybyte = 17
for k= 1 to 3
gosub high_led
pause 500
gpio = 0
pause 100
next k
'-----------------------------------now for the flag and name//take this out ???
' mybyte = 18' show them off a little
'for mybyte = 18 to 19
' gosub high_led
' pause delay2
' gpio=%000000
' pause delay
'next mybyte
'----------------------------------------light american flag first then name tag

trisio = %001111
gpio = 0
for l = 0 to 255 step 5' led18 gpio.4
pwm gpio.4,l,10' light number 18, l intensity step, 10 usec
next l

for l = 255 to 0 step -5
pwm gpio.4,l,10
next l

trisio = %001111

for l = 0 to 255 step 5 'led 19 is gpio.5
pwm gpio.5,l,10' light number 19, l intensity step, 10 usec
next l

for l = 255 to 0 step -5
pwm gpio.5,l,10
next l

'----------------------------------------------------------------turn it all off
gpio = 0
trisio = %111111
' -----------------------------------------------------------send it back to nap
goto starthere

high_led:
lookup mybyte,[%000001,%000010,%000001,%000100,%000001,%010000,%0 00001,%100000,%000010,%000100,%000010,%010000,%000 010,%100000,%000100,%010000,%000100,%100000,%01000 0,%100000],gpiostate
gpio = gpiostate
lookup mybyte,[%111100,%111100,%111010,%111010,%101110,%101110,%0 11110,%011110,%111001,%111001,%101101,%101101,%011 101,%011101,%101011,%101011,%011011,%011011,%00111 1,%001111],tristate
trisio = tristate
return

end

Heckler
- 7th September 2011, 02:43
Like SteveB said...
"any chance of seeing a photo of your project??" or even a drawing of the LED layout or just describe it...

Thanks for the code... but it would be nice to see how you arranged the LED's.
Specifically how each LED is laid out. You could possibly number the led's in the schematic and then show how they should be arranged.

Thanks

PS... the next time you post code use the "#" button at up on the message tool bar and it will put your code in a scrolling window.

AvionicsMaster1
- 14th October 2011, 23:11
Attached is the shematic, outline drawing and code for the plaque.

It was an interesting project to control that many LEDs (20) with only 5 pins.

If there is any further clarification needed or more info desired please ask.

Demon
- 22nd January 2012, 04:45
Moved from Schematics.

Robert