PCB Heaven

General Category => Digital discussion => Topic started by: lefteris_ on May 01, 2013, 20:03:04 PM

Title: clock circuit problem
Post by: lefteris_ on May 01, 2013, 20:03:04 PM
Hello!

I build i clock with 7-seg digits and my problem is that the clock is "ticking" a litle bit faster than the normal time.

5 days now and the clock shows 5 minutes forward than the conventional time.

Here is the circuit, the  file and the components.
Title: Re: clock circuit problem
Post by: cheerio on May 01, 2013, 23:19:00 PM
maybe the clockrate is not stable? try a precision oscillator instead of the crystal.
Title: Re: clock circuit problem
Post by: George on May 02, 2013, 00:26:46 AM
Linear regulator needs a minimum of 2V differential - you have only 6V on a 5v Reg - output will be problematic.
Title: Re: clock circuit problem
Post by: kam on May 02, 2013, 09:41:51 AM
Watch out for parasitic capacitance. Where have you implement this circuit? If its on a breadboard, then it will not work because breadboards add huge parasitic capacitance. If you've got a PCB, make sure that the crystal is very close to the chip, as close as possible, and you have grounding planes around it. Microchip gives the proper footprint for this.
Title: Re: clock circuit problem
Post by: lefteris_ on May 04, 2013, 18:06:33 PM
The circuit has a 9v power supply.

Yes this circuit is on a breadboard.

So, if this was on a pcb i wouldn't had this problem?

Is there any other circuit or chip that i can build an accurate 7 seg clock?

Any suggestions?
Title: Re: clock circuit problem
Post by: kam on May 04, 2013, 19:10:00 PM
If any chip requires a crystal to operate, it will have the same problem on a breadboard. To achieve good results you must make a good PCB with very sort tracks between the chip and the crystal, and grounding layers around. For better results you have to match the chip's input capacitance with the crystal capacitance. Also you need to have good quality crystal. This way you may achieve much better results.
Title: Re: clock circuit problem
Post by: lefteris_ on May 07, 2013, 18:45:47 PM
Now i have another problem. I use the ULN2003A chip to display each segment of the digit with an led strip, so i need to control 7 led strips.

I have connected the gnd of the supply to pin 8 wich is the emitter, the gnd of the led strip to pin 16 and the + of the led strip to the +12 of the supply.

But the led strip is on at low and at hight state of B pin 1.

I want to replace the 7 seg display with 7 led strips using the ULN2003A

Any help?


Title: Re: clock circuit problem
Post by: cheerio on May 08, 2013, 11:56:31 AM
did you connect the pin 9?
Title: Re: clock circuit problem
Post by: kam on May 08, 2013, 14:50:10 PM
But the led strip is on at low and at hight state of B pin 1.

When you say "LOW", how low? The ULN has darlington transistors, which means that little above 1.3V for input it will conduct a lot of current. Try it by connecting 1 directly to 0. If still works, then the ULN has a problem. And as cheerio noted, leave pin 9 unconnected.
Title: Re: clock circuit problem
Post by: lefteris_ on May 08, 2013, 15:50:15 PM

The ULN has darlington transistors, which means that little above 1.3V for input it will conduct a lot of current.

Thats the problem.when one segment out of seven is on, the voltage is 2.6v and when the same segment is off the voltage is 1.8v. thats why the led strip is always on.
What i need is when a segment of the digit is on, i want the higher voltage that the pic can supply and when the segment needs to be off , i want the lower voltage. How can this be possible?Has to do with the programm of pic?

The pin 9 is unconnected.
Title: Re: clock circuit problem
Post by: kam on May 08, 2013, 17:42:39 PM
post a schematic. this is very strange. The output of the PIC goes 0 when LOW, not 1.8
Title: Re: clock circuit problem
Post by: lefteris_ on May 08, 2013, 19:21:20 PM
My first post has the schematic and the .asm file.

Another strange point is that the output of the pic is not stable. the led for the seconds,is on and off with a stable rate for seconds but  not with the same voltage every time.
Title: Re: clock circuit problem
Post by: lefteris_ on May 09, 2013, 21:48:36 PM
any ideas of what may happenig here?

Title: Re: clock circuit problem
Post by: kam on May 10, 2013, 10:06:30 AM
I mean a schematic with the ULN. Do you have one?
Title: Re: clock circuit problem
Post by: lefteris_ on May 12, 2013, 22:30:31 PM
There is going to be one pcb for the pic and the main components and one pcb for each digid uln chip.

I will post the schematics and the boards.

As i looking at the schematic i realize that i was connecting the gnd of the uln wrong.

The uln opperates as switch for the led strips and them lights up each time a signal is given from the pic to each segment of the digit from A to G.

I was connecting the gnd of the uln  to the main gnd of the circuit, but there's a transistor for each digit gnd.thats my problem. i dont know where i should groung the uln.I did some tests and the uln works better if i ground it to the collector of transistor of each digit.But but does not work 100%.

I thought that i wouldn't had so many problems with this project, and that it would be a bit easy..

All the testing of the uln is done with the 4 7-seg digits connected to the breadboard.I will try with the digits unconnected.

Title: Re: clock circuit problem
Post by: kam on May 16, 2013, 11:00:33 AM
"invalid data in file" for all files!  ??? ??? ???

The ground of the uln goes to the ground of your supply. Just make sure that you have a common ground with the LEDs. Do not think the transistor as teh NO contact of a relay! Maybe this is your mistake. The emitter of a transistor switch must have common ground for both the supply of the driver circuit (in your case the input ports of the ULN) and also common ground with the output (in your case the LEDs).
Title: Re: clock circuit problem
Post by: kam on May 16, 2013, 11:02:07 AM
oh, and please upload schematics with images, the eagle files you uploaded do not work for me
Title: Re: clock circuit problem
Post by: lefteris_ on May 18, 2013, 20:46:54 PM
This is the scematic

I read on the net that i have to use pull down resistors in order to control effectively the led strips with the uln!
Title: Re: clock circuit problem
Post by: kam on May 19, 2013, 17:36:03 PM
You use 4 2n222 transistors with no resistor base... I wonder how they operate! And i wonder how the PIC is not fried!
So, 2n2222 typical have 40hfe (if i can recall correct), you need say 8x20ma for each digits, say 200mA (always oversize), so the base current must be at least 5mA, PIC voltage is 5v... so use base resistors of 1K for each 2n2222

Next, you need filtering capacitors, one 100uF before the 7805 and one 1uF after. Then you need one 0.1uF as close as possible to the PIC's supply.

The ICL is a nice touch!

I think it will then work.
Title: Re: clock circuit problem
Post by: lefteris_ on May 19, 2013, 22:06:15 PM
I'm sorry,i forgot to mension that the 4 transistors are not 2n222 but c828...  :-[ :-[ :-[

does the filtering has to do with the clock rate(faster than convetional time)?or it is just the parasitic capacitance?

why the pic does not outputs stable signals for each segment?there must be alot of noise.

I will do the filtering capacitors.

Another thing which i say WTF is going on here is that when i connect the signal for the A segment to the pin 1 of the uln and the led's - to pin 16, the led stip turns on with the pin 8, which is the emitter, unconnected...  ???WTF? I think that the circuit got crazy after so many tests...... :o :o
Title: Re: clock circuit problem
Post by: kam on May 20, 2013, 18:21:05 PM
the filtering capacitors are used to smooth the input voltage and remove spikes and EMI/RFI. You need to use base resistors for the transistors! Check the transistor specifications for the one you use.

As for the ULN, most likely you've fried it big time.