pic 16f877 based circuit schematics

Status
Not open for further replies.

AboudaKing

Member level 1
Joined
May 22, 2019
Messages
37
Helped
0
Reputation
0
Reaction score
1
Trophy points
8
Activity points
234
i'm working on project with pic 16f877 that is connected to terminal blocks so i can control outputs related to them
simulation and my program works fine , however i'm wondering if my schematics are correct or if i need any other change before i order a PCB board from manufacturer
  • the MP2-3 and logic states are all slide buttons to control outputs
  • U5 is the reset button
  • U2 is 5v regulator 7805
  • U3 slide button ON/OFF
  • MP1 mount block for power source
  • MP4-5 mount block for outputs
how much resistor i need before the transistor BC547 for ideal function

  • if i'm using 5V/3A power supply how thick the traces in PCB need to be to avoid overheating ?



View attachment schematics.jpg
 

I doubt it will work as expected.

Firstly, the base resistors are FAR too low in value, the maximum current from a single IO pin is 25mA and the total for all the IOs combined must not exceed 200mA. The resistors should keep the current well below that.

Secondly, using an emitter follower configuration means the emitter (and therefore your output voltage) will always be about 0.6V lower than the base voltage. Given that the IO pin voltage will drop considerably under high current, you will probably only achieve quite a lot less voltage at MP4 and MP5. You will probably find the current available at the outputs is quite low too.

If you need high output current:
I would suggest you ground the emitters, connect the collectors to the outputs and make pin 6 of MP5/MP5 go to VCC instead.

If you need logic voltage outputs:
Ground the emitters, add a pull-up resistor between each collector and VDD and leave pin 6 at VSS. Note that this reverses the logic state so your software should output a '1' instead of '0' and '0' instead of '1'.

You should also add decoupling capacitors between VDD and VSS and be careful not to make VCC too high, it must be more than about 7.5V for the regulator to work but if you go too high there is a risk of the transistors back feeding to the PIC.

Brian.
 

    AboudaKing

    Points: 2
    Helpful Answer Positive Rating
Hi,

... and a bulk capacitor at the VRegulator input.

If MCLR is LOW_ACTIVE, then it maybe needs a pull_up (read datasheet). And the pushbutton (sadly no standard symbol, thus one has to do an internet search...) needs to be connected to GND.

U3 (sadly no standard symbol, thus one has to do an internet search...) short circuits your power supply. Is this what you want?

****
* Learn to use standard symbols
* Learn to use standard designators: https://en.wikipedia.org/wiki/Reference_designator
U3, U5 --> S
X --> XTAL
MP --> X

It makes life easier for yourself, but especially for everyone who wants/needs to read your schematics (edaboard useres)
.. sooner or later you will correct them anyways.

Klaus
 

you will probably only achieve quite a lot less voltage at MP4 and MP5. You will probably find the current available at the outputs is quite low too.
what if i replace the transistors with 5v relay and add a diode in parallel of it's coil could that work better than the transistor ?
the base resistors are FAR too low in value, the maximum current from a single IO pin is 25mA and the total for all the IOs combined must not exceed 200mA. The resistors should keep the current well below that.
i know it's 0 ohm resistor i chose that resistor only so i can design the PCB with PROTEUS apparently all other resistors had bigger size in the design
i used a 200ohm resistor in simulation what value you recommend for me ?
--- Updated ---

sadly no standard symbol, thus one has to do an internet search...

those are the symbols been provided by PROTEUS software to create a PCB design
regular standard symbols had no design library, ill consider your advice in further threads thank you
 

what if i replace the transistors with 5v relay and add a diode in parallel of it's coil could that work better than the transistor ?
You can do that but I'm not sure it solves the problem. Certainly a relay will allow you to switch outputs at whatever the relay contacts are rated at but how do you drive the relay coil?
Unless you use tiny relays, the PIC alone will not be able to provide enough current to drive the coils directly, you would still have to use transistors to switch them. However, it is a safer solution because the relay contacts are isolated and can be used for any purpose.

For the base resistors, aim for about 0.1 of the collector current (the relay coil current) flowing to the base pin but the amount must still be within the ratings of the PIC of course. Without knowing the relay current I can't give you a precise value but "R=((VDD-0.6) * 10) / Relay coil current" will give you the exact figure.

You still need diodes across the relay coils but have you considered using ICs like the ULN2803 as relay drivers? they interface directly between the PIC and relays with no other components and have the diodes built in.

Brian.
 

    AboudaKing

    Points: 2
    Helpful Answer Positive Rating
Hi,

I agree with Brian.

That´s all standard. So use standard circuits. Discussed many times here in the forum and much more often in the internet.
Please do some forum search or internet search on your own.

Hint: If you want to drive higher currents, then I recommend to use logic level Mosfets.

Klaus
 

    AboudaKing

    Points: 2
    Helpful Answer Positive Rating
Certainly a relay will allow you to switch outputs at whatever the relay contacts are rated at but how do you drive the relay coil?
the 5v relay coil draw 70-90mA
the bc547 draws around 10mA
if i use the transistor just before the relay i can use more relays (relay coil supplied directly from PSU 5V-3A)
16f877 pin as you have mentioned have a max IO 25mA for each pin, 200mA in total
that'll be more than enough to run up to 18 transistors to control relays unless i have missed something !!
You still need diodes across the relay coils but have you considered using ICs like the ULN2803 as relay drivers?
yes a diode across the relay coil is a must ,I'll be using the 1N4007
and for the ULN2803 IC is not available for purchase at this moment so I'll have to count on the 1N4007 diodes for the prototype
 

That should work.
If you want to reduce current consumption even more, consider using logic level MOSFETs instead of BC547. I am thinking of something like the BSS123 or BSS138 which are very inexpensive and will place almost no load on the PIC, saving you about 180mA in total to run 18 outputs.

Brian.
 

    AboudaKing

    Points: 2
    Helpful Answer Positive Rating
I am thinking of something like the BSS123 or BSS138 which are very inexpensive and will place almost no load on the PIC
thank you! i'll consider your suggestion and look for the logic level MOSFETs you recommended
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…