20x2 low B problems

Brian Z

New Member
I’m doing my first Picaxe project here, in which I am trying to light up 8 banks of 5 parallel LEDs in a sequence with a 20x2. Each bank of parallel LEDs is controlled by its own pin, through a 2N2222 transistor. I’m using pins B.0 through B.3 and C.0 through C.3. The problem I’m having is that when I tell a B pin to go low, it automatically loops back to the beginning of the program. For example:

Main:
High B.0
Pause 1000
Low B.0
Pause 1000
Goto main

This code makes the LEDs on B.0 go high for 1 second, then flash off briefly, then go high for 1 second, then flash off briefly, etc. This is the case with any B pin, but all C pins work fine.

However, when I write code to sequentially turn all pins high with a 1000 pause in between them, then turn all pins low sequentially with a 1000 pause in between them, everything works fine.

Clues: 1) it seemed to work fine on the solderless breadboard with a 4.5v power supply. 2) now it’s soldered into a perfboard with 4 AA NiMH batteries, and this is my first soldering job, but my soldering looks good, and multimeters out fine, as far as I can tell. I used a 20 pin socket. I tested it with the 4.5v power supply again instead of the batteries, to no avail. 3) The B pins all have blue LEDs. The C pins all have yellow LCDs. 4) I’ve got a 1k resistor between each pin and its transistor.

Thanks for any advice!

Brian Z
 

premelec

Senior Member
Hi and welcome to this forum...I'm not quite sure what the problem you're having is but you mention LED banks which likely draw a lot of current and could be pulling your NiMH battery voltages down or causing a dip which causes reset etc... Have you checked that? and have bypass capacitors where appropriate and no floating inputs etc... Please explain further if this doesn't help... :)
 
Last edited:

Brian Z

New Member
I considered that the LEDs might be dragging my voltage down, but the reset occurs on making the pin low, which turns off the LEDs. Also, I read that the 20X2 operates way down to 1.8v. Could making the pin low be giving too much voltage to the chip? The batteries are fully charged, and putting out more than 4.8v. Could a voltage spike cause a reset? Would turning off 5 LEDs cause a spike? Also, I can’t download programs to this chip unless I disconnect the positive rail of all the LEDs, or start the download right when they are all off.
 

BeanieBots

Moderator
Resetting combined with your download problems strongly indicates a circuit error.
Double check your download is correct.

Post a circuit diagram or probably better, a photo of your setup.
 

Brian Z

New Member
I rebuilt my circuit on my solderless breadboard, and I'm still getting the problems. I've got the 10k resistor between headphone jack b and c, and the 22k to the serial in. I've checked and double-checked the download circuit. My batteries are giving 5v.

When I replace the banks of parallel LEDs and their transistors with a single LED on each pin (with a resistor) everything works fine. I guess I'll have to troubleshoot my transistor circuit. I'll draw the circuit and post it tomorrow when I get a chance.
 

Technical

Technical Support
Staff member
Your power supply is collapsing when the blue LEDs are lit.

Blue LEDs will be very different to yellow. They have a different voltage drop and current requirements. Check the datasheet for the blue LEDs and work out how many you can actually use, it may only be 1 or 2 with a 5V supply.
 

Dippy

Moderator
Why not post a schematic of your circuit?

1. It helps to remove ambiguity.
2. It helps speed up people's understanding of the circuit.
3. And sometimes when drawing it out you can have a Eureka moment yourself and spot the problem.

And any 'unusual' or special components should have a LINK so others can have a quick look at Data Sheets.

Remember, Brian, it is your 'baby' but others may not understand what you are describing.
 

inglewoodpete

Senior Member
Change the program to the following. Then you will see whenever the PICAXE reboots.

Code:
#terminal 4800
      '
      SerTxd ("Booted", CR, LF)
Main: High B.0
      Pause 1000
      Low B.0
      Pause 1000
      Goto main
 

Brian Z

New Member
Well, I just figured out that I don't have a 1k resistor on the transistor base. I have a 10k resistor. I switched it to 1.5k and all is well. I'm sort of new to this, and I forgot about the black stripe adding a 0.

Thanks!
 
Top