Annoying problem involving dying LEDs

Jamster

Senior Member
Ok really annoying problem that i cant get my head around, i have tryed all day and i am begining to consider smashing the PCB in frustration.

So the idea is a serial signal is sent to the three picaxes saying the name of the trio (in my case: 1), if the picaxes hear there "name" they listen out for a colour (red, green or blue) this is the name of each of the 3 chips. if it is that particular chip that is addressed it listens for a number on the same pin as the previous signals; this number is the duty of a pmwout command-10000 . picaxe then outputs pmw to leds and creates different brightneses.

Trouble is that the lights come on for a few seconds and then die every time they receive this data stream when they are surpossed to stay on the whole time.

For 08M:
Code:
init:  pause 1000
	Symbol name=b0		
	Symbol anologue=w2
	name=1
	anologue=0								
main:  serin 4,N2400,(name)
	serin 4,N2400,("blue") 		'Permitted values at string: red,blue,green	
	serin 4,N2400,anologue
	let anologue=anologue-10000		'/change brightness
	pwmout pwmdiv4, 2, 210, anologue	'\
	goto main
I've tryed hundreds of variations but am now at the edge (and its crumbling), so if anyone can suggest anything I would deeply appreciate it.

Jamster
 

Jamster

Senior Member
Best tell you its meant to be an RGB fader (again) also that i have made PCB and bought £50 worth of components so dont really want to spend a second month building it.
 

Andrew Cowan

Senior Member
If the LEDs are dying, it really sounds like a hardware problem - you you post a schematic/circuit diagram (or PCB layout if there is no circuit diagram)? Your code seems fine.

Are you using constant current LED drivers? What size/power of LED?

Andrew
 

Jamster

Senior Member
I think they do clash so i tryed adding a pulse from the computer, catching with 'if' and then using serin so it wasnt sat there on serin.

circut diagram wont fit in attachments so can't get that to you, it uses logic level MOSFETS, they work and ive had them on constantly with the high command.
 

eclectic

Moderator
I think they do clash so i tryed adding a pulse from the computer, catching with 'if' and then using serin so it wasnt sat there on serin.

circut diagram wont fit in attachments so can't get that to you, it uses logic level MOSFETS, they work and ive had them on constantly with the high command.
1. Shrink the schematic.
Use a photoeditor or Irfanview.

2. Please post ALL your code,
transmitter as well.

e
 

Andrew Cowan

Senior Member
What are the LEDs? (Specs, make and manufacturer please).

Operating LEDs in parallel is slightly risky - they'll have slightly different forward voltages, and that can cause one to hog all the current.

That looks like a circuit wizard schematic - if it is, if you upload it here (you'll need to change it to .jpg or something), then I can upload a resized version for you.

Andrew
 

Jamster

Senior Member
her you go (ran out of space on other post)
i'm pretty sure it is on the picaxe code though

cant acsess the internet until tues sorry(please keep trying to fix though)
 

Attachments

eclectic

Moderator
@Jamster.
I should have noticed before,
but there appears to be a fundamental flaw
in your program from post#1


You are trying to Serin Word values.
But, Serin can only receive Byte (0-255) values

Your "anologue" values will be unpredictable.

See Manual 2, p.198.

And from your schematic, a few
capacitors in the right places might help.
e
 

lanternfish

Senior Member
While some ar pointing to a hardware problem may I suggest you have a software problem.

Your code is:

Code:
main:  serin 4,N2400,(name)
	serin 4,N2400,("blue") 		'Permitted values at string: red,blue,green	
	serin 4,N2400,anologue
	let anologue=anologue-10000		'/change brightness
	pwmout pwmdiv4, 2, 210, anologue	'\
	goto main
so when serin timesout it continues to loop around main:. And the line let anologue=anologue-10000 will have the value anologue varying all over the place.

Temporarily replace let anologue=anologue-10000 with a serout command that sends the value of anologue back to the PE terminal so you can see what is happening.

Cheers
 

hippy

Ex-Staff (retired)
I'm not familiar with the PC-side language for the code in post #8, but it could be that the PC is sending its messages too quickly ( ie what's called back-to-back transmission ) and the PICAXE having separate SERIN lines is too slow to keep up under all circumstances.

PRINT#port%,"a"
PRINT#port%,light%
PRINT#port%,"red"
PRINT#port%,positionr%

serin 4,N2400,(name)
serin 4,N2400,("blue")
serin 4,N2400,anologue

As well as the 'cannot receive a 16-bit value direct to a word variable' issue, there is another issue -

What does "PRINT#port%,light%" and "PRINT#port%,positionr%" send ? Presumably, as PRINT is likely the generic 'give human readable display command', these will not send single or dual bytes but ASCII text representations of the values.

I would suggest taking a step back, get the PC sending a single byte value (0-255) to the PICAXE, get the PICAXE displaying that (SERTXD/DEBUG). Get that working, move up to word values, then onto multiple values.
 

Jamster

Senior Member
Thank you for all the replies, i'm sorry i couldnt get back to you sooner but i cannot acsess the internet at home, bt sent phone enginer to fix brodband problem (thats indian call centers for you!:D).

Tryed some of the suggestions and still nothing.

Hippy: the PRINT# command sends the value of the second variable to the com port, the first variable is the com port to send to. Also in Basic(BBc) the % sign by the variable tells the computer it is an number and therefore should be sent as an number.
e: thanks forgot about that, still dosnt work though

Well im going to keep trying, go back to basics:)D) and will report back sometime when (if) it works.
 

Jamster

Senior Member
What i have found whilst testing is that the picaxe dosnt work when placed in the holder on the PCB, but will work when it is on the 08 proto board with wire connecting: +V, Gnd, pin 2. is it becase i need pins tied down?

Also the code:
Code:
serin 4,N2400,b1
high 1
for some reason this acts like:
Code:
serin 4,N2400,b1
wait for a long, long time
high 1
question is: why?

Jamster
 

Jamster

Senior Member
Thankyou

I mean generaly rather than when downloading, is it ok to leave them floating?

i dont think it is waiting as when i send "1" from the terminal it shows "||||||||||||||||||" in the output buffer.
 

eclectic

Moderator
Thankyou

I mean generaly rather than when downloading, is it ok to leave them floating?

i dont think it is waiting as when i send "1" from the terminal it shows "||||||||||||||||||" in the output buffer.
When working, the Serin Leg 2
must
be grounded.

Q.2 From what are you sending?
And where to?
And how is it received.

Would it be easier for you to start
really simple and build only
on little working steps.

There are FAR too many variables in your first
BBC basic > Picaxe setup

e
 

Jamster

Senior Member
I noticed. the above program was a test it is just there to get serin to work and that is what i am using at the current point.

I am sending from the terminal in the PE and reciving using the code above

P.S. do i need to send the 1 in ""s?
 

eclectic

Moderator
I noticed. the above program was a test it is just there to get serin to work and that is what i am using at the current point.

I am sending from the terminal in the PE and reciving using the code above

P.S. do i need to send the 1 in ""s?
Just checking.
What is the process that SENDS data?

e
 

Jamster

Senior Member
I think there may be a problem with my cable, as i am only sending commands from the PC i have forgotten about the Tx line. So i end up with:

Code:
Rx -----22k-------- pin 4
       |
       |
      10k
       |
0v-----------------0v
____________
\ o o Rx o 0v /
 \   o o o o  /
   ----------
Is this correct?
Also the 22k seems to think its 17k although the stripes are 22k according to my multimeter.

EDIT: Wait just seen the manual and realised that i have drawn the connections differently, i have drawn then as if you are looking at the front (the bit which goes in the PC). Please tell me they have drawn it from the back...
 

Jamster

Senior Member
nope i have another problem, the leds just flash.

i send a blank serial stream containing "a", so that it understands there is a serial stream comming up; then i send the anologue value (0-255) which is the duty:

Code:
main:  if pin4=1 then 
		serin 4,N2400,b1
		serin 4,N2400,b1
	endif
	pwmout 2,250,b1
	goto main
as a test, i put the trigger and if in because i thought the pwm and serial commands clash. is there any other way of doing something similar so they dont clash?

I tried with the pwmout command the other side of the endif and it did nothing
 

Technical

Technical Support
Staff member
Try this:

Code:
main: 
    serin 4,N2400,("a"),b1
    pwmout 2,250,b1
    goto main
We assume 0-255 is a single byte value, not ascii. If ascii you need this:

Code:
main: 
    serin 4,N2400,("a"),#b1
    pwmout 2,250,b1
    goto main
 

Jamster

Senior Member
Thanks Technical, you have made a step up:

It now comes on dimly on the first command from my program but then dosnt change.
 

Jamster

Senior Member
the first code technical posted is the step up and i am sending: "a" and the brightness (0-250)

Also just discovered that the qualifier is the thing stoping it flashing and that it is ignoring the second value every time it loads
 
Last edited:

hippy

Ex-Staff (retired)
How are you sending the brightness, and with what; Programming Editor Terminal, VB.Net etc ?

The SERIN needs to match how the data is being sent, and the data sent has to be in a compatible form as to what's expected. The fuller details you can give of precisely what you are doing the better we will be able to understand what's happening and what the problem may be - don't forget we can't look over your shoulder.
 

Jamster

Senior Member
using my resonably fluent programming language, BBC basic, the command "PRINT#" has worked for me in the past on picaxe and is working now as i had a program where the light was on when the BBC basic program was open but when you close the program the light turned off.
 
Last edited:

eclectic

Moderator
using my fluent programming language, BBC basic, the command "PRINT#" has worked for me in the past on picaxe and is working now as i had a program where the light was on when the BBC basic program was open but when you close the program the light turned off.
Jamster.

I hate to stop youthful creativity flowing, but

WHAT are you doing?
Please see post 36 and others.

PLEASE post a CONCISE summary of:

1. Project outline.
2. Circuit (s)
3. Program (s)

Ec.
Who is sorry to say

but, is losing patience.
 

Jamster

Senior Member
Ok sorry if i am not being clear, very tired.

Curcuit:
http://surportpages.webs.com/art.JPG
http://surportpages.webs.com/PCB.JPG

Program:
Code:
main:	do 
    	serin 4,N2400,("a"),b1
    	pwmout 2,250,b1
    	loop
and
Code:
      REM. open port
      port% = OPENOUT "COM1: baud=2400 parity=N data=8 stop=1"
      
      
      REPEAT
        INPUT variable%
        REM. send pos
        PRINT#port%,"a",variable%
        WAIT 100
      UNTIL FALSE
help for this second code can be found at www.rtrussell.co.uk

The outline:
I am trying to create an rgb light similar to those made by WWW.kam.co.uk, it needs to be controlled by serial and be dasiy chainable (thats why there are two serial connections: out, in). it uses 3 08Ms which output pwm through three MOSFETS to the LEDs. The resistor interface circuit is in the D-type plug and definatly works.

I have tryed sending the data manualy through the program editor terminal (F8) and by my own program (^^above^^). Neither work. The best results are when i send the data the leds come on half brightness and get stuck there.

Hope i have put enough information in this. Jamster
 
Last edited:
Top