Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] How to include a modification in a PIC dev board with PIC16F877A for OVP ?

Status
Not open for further replies.
You're right, I'm not planning to do all that for a simple course, it uses I2C chips and SPI .. etc. A bit complicated for starting the course.

But my plan is for the future when I get to a level in the course where I can start the course teaching I2C, SPI and write some modules libraries. That sounds nice, but considering teaching this stuff in one semester could be too much.

But in reality, I may do a simple board with several LEDs, 4 push buttons, LCD1602, some sensors and that's it, more than enough for one semester.
Hello again
teaching I2C,SPI ,PWM,Timers and counters are all ,you need more practice "write source code by your self" by use a programming language like C++or Basic and you have to determine which language you will use it and the Compiler you will handle with .usually the compilers includes the program language .but to understand the work of I2C,SPI,PWM,Timers,counters are don't take long time as much as how to interface for example 16f877A with I2C devices or use SPI to interface with other MUC .

hope i have understood you
kamal .
 
Hello again
teaching I2C,SPI ,PWM, Timers and counters are all ,you need more practice "write source code by your self" by use a programming language like C++or Basic and you have to determine which language you will use it and the Compiler you will handle with .usually the compilers includes the program language .but to understand the work of I2C,SPI,PWM,Timers,counters are don't take long time as much as how to interface for example 16f877A with I2C devices or use SPI to interface with other MUC .

hope i have understood you
kamal .

Yes, I agree with you, I like to teach these stuff in our microcontroller course, but in our diploma course in a technical/vocational college, there's only one microcontroller course and at the end of the program, there's a projects course which students are asked to do projects with microcontrollers they use in projects course Arduino boards, my colleague took the role of this course this semester and they actually done a good job doing like 10 projects not complex ones but considering diploma students, they are ok.

when I took role of projects, I tried to do a more complex projects; like, 3-way traffic light with red light violation and speed capture systems; but actually I'm the one who wrote the code and I didn't like that so I got back to microcontroller course and trying to establish their skills for programming microcontrollers but that would be not complying for a student who learn some stuff about PIC microcontrollers then do project with Arduino ! that is different, but anyway this is what we have.

so even, teaching I2C, SPI ,PWM, Timers and counters in a basic microcontroller course would be difficult for students to get so I teach simple stuff; like, pin control, LED examples .. etc.

thanks kamal for your reply
 

Hi Mr Brian,

Now it's the start of this new semester.
I received all the mod parts for our lab boards.

I got back to your post #5, and got some questions about of what should I do.


Use several combinations of 100nF ceramic and 10uF electrolytics in parallel,

what you mean by several combinations ? Do you mean I have for each power rails to connect more than 2 100nF caps in parallel ?

Or I have to connect one 100nF capacitor across each power rail and one 10uF on C3 ?

Another question about the values of the capacitros, if I ran out of 100nF for power rails or the 10uF for the C3, what alternatives I can go for ?


3. R32 in the open collector section will burn out if the pins are linked and it is set to low resistance.

There's one time I got a smoke from a pot, I don't know if it was this pot

I did a quick search and found this common pot that's found in most places, which is one of the types we use in this board.

https://components101.com/potentiometer

and found it's rated at 0.3W, so a common power that would burn it I guess would be 0.4W, so current = 0.4W/5V = 80mA !

So I got your point, this pot would be easily burnt if it set low.

===> So I think the solution is to connect a series resistor to limit the max current can be drawn from the source.

The series resistor should be at least:

R=V^2/P = 5^2/0.3W = 83.3ohms, so 82ohms resistor should do.

This won't be a deal breaker for this board, I can do whatever it takes to mount a resistor in this place. So thanks for this very important note.
---------------------------------------------------------------------------------------------

But what I'm still concerning about this circuit, is that what is the point of this circuit ?


Here's the circuit diagram again:

I circled two parts that I think are the most important ones.
1. The signal coming from R33 is coming from the mcu and this part is OK I guess and there's no problem here.
2. Part 1 circled with red, this is main current source with a pot, and it's not so clear what points this pot is connected to but I think it's connected between Vcc and Vee.
3. The part in green is open I guess, and I have to connect something in series, it could be a lamp, LED, motor, ... etc. If that the case, then it's related to 5V stuff, anything in this range and has to be driven by increasing/decreasing the voltage.

for_edit.jpg



4. You have no protection against an MCU pin being driven low and closing one of the push buttons to VCC. Connecting supply directly to a pin driven low will likely burn out the internal driver transistors.

I actually didn't investigate the circuitry of this board, I didn't care about how the buttons are wired, but I new it's a pullup approach and the buttons are pulled down with 10k resistors which I understand because not to leave the pins floating. But how this connecting is a problem ?

5. There is absolutely no point in using an opto-coupler in that way. The idea behind them is that the input side is isolated from the output side so feeding them from the same supply lines is pointless. Either use the transistor and the relay -or- use the optocoupler but not both at the same time.

Yes, got your point, after checking the circuit, there are different options:
1. use a transistor and activate/deactivate it directly from the mcu with base limiting resistor and just use a freewheel diode across the relay coil.
2. the same arrangement just replacing the transistor with the optocoupler.


=========================================================================================

Now it's time to stat checking and fixing the board, thank you so much for the notes about this board.
 

I actually didn't investigate the circuitry of this board, I didn't care about how the buttons are wired, but I new it's a pullup approach and the buttons are pulled down with 10k resistors which I understand because not to leave the pins floating. But how this connecting is a problem ?
You have to consider that the PIC pins can be configured as output too. If the pin is an output and driven high then the switch is closed it shorts the internal PIC output circuit directly to ground. This will allow far too much current to flow out from the PIC and could damage it.
The solution is simple, just add a resistor in series with each PIC pin that connects to a switch, a value like 470 Ohms to 1K would be suitable. That limits how much current can be drawn from the pins but has no effect on the operation of the pin when used as an input so the switches and pull-up resistors will work as before.

If the board also has facility to connect other things directly to those pins, add the resistor only in the connection to the switch/pull-up, otherwise it may limit the current from the pin when it is actually needed for some other purpose.

Brian.
 
You have to consider that the PIC pins can be configured as output too. If the pin is an output and driven high then the switch is closed it shorts the internal PIC output circuit directly to ground.
This will allow far too much current to flow out from the PIC and could damage it.

what if the resistor to the ground is 10k, won't that help in this case ? at least to lower the shorted pin current to ground.


The solution is simple, just add a resistor in series with each PIC pin that connects to a switch, a value like 470 Ohms to 1K would be suitable. That limits how much current can be drawn from the pins but has no effect on the operation of the pin when used as an input so the switches and pull-up resistors will work as before.

I think that would be a bit difficult to do because the pins are soldered to the buttons

One solution is to cut the PCB routes between the PIC pins and the buttons, and solder resistors from the top to the PIC, but that would really difficult to do + as long I have worked in this course I didn't one time set PORTD which is connected to the pins to output, and students won't try this because they would be busy doing their task.

If the board also has facility to connect other things directly to those pins, add the resistor only in the connection to the switch/pull-up, otherwise it may limit the current from the pin when it is actually needed for some other purpose.
Brian.

Yeah, I don't think there are header pins for the port that is using the buttons

I guess I can skip the buttons part, it won't be a big problem, because students most the time are busy working on the LEDs.

..................................................................

but wait a minute !! you're totally right, this could cause a serious problem in case we set PORTD to use for example the RD0 and RD1 and we wrote:

TRISD = 0b00000011;

but most the boards are soldered the resistors of RD0 and RD1, the rest aren't soldered because I don't need them for basic read button input exercise, and I guess I would skip soldering the rest of the buttons.
 

what if the resistor to the ground is 10k, won't that help in this case ? at least to lower the shorted pin current to ground.
I think you got the point already. The port would still be damaged but instead of being driven high and shorted to ground, you could drive it low and the switch would join it directly to the supply.

Brian.
 

I think you got the point already. The port would still be damaged but instead of being driven high and shorted to ground, you could drive it low and the switch would join it directly to the supply.

Brian.

I'm sorry I didn't get what you mean exactly.

What I understood, is that the port would still be damaged because if it's set output and it's already pulled down to ground with 10k resistor, then there are now two situations:
1. If I wrote high to the port and not pressing the button, ok, my guess in this case, that the pin is now shorted but there's a 10k resistor and the current won't be much.
2. If I pressed the button, I did a demo picture for this case.

I know the current paths maybe completely wrong but this is my understanding now about this case:

buttons ckt2.png


and my idea is that there would be 2 voltage sources:
1. Internal VDD that is already driving the pin HIGH
2. The VDD coming through the button

so both would be eventually sourcing current to the ground, that's what I'm imagining it.
 

You are right but missing the other possible condition.
Suppose the pin is driven low, the 'P' transistor is turned off and the 'N' transistor is turned on. Now close SW1 and see which way the current flows.

Brian.
 

buttons ckt3.png


You're right, that's a short @5V, I don't what current would go through the N mosfet ! as there are no resistors, then current would be too high can go more than 2A, am I right ? that may ruin just the pin or the microcontroller completely.



=========================================================================================

boards maintenance update:
Today we kicked off the boards modification process.

20210119_105606.jpg



A challenge is facing me right now, which is how to bend the pins in a good way, I tried with the pliers for a quick try but this what I got, I have to think of a better way that's easy and saves time.

20210119_105648.jpg
 

Update:

Hi,

I've finished putting the caps and the other parts, the boards now works pretty ok.

They connect ok without much problems, just few have small problems could be related to soldering or other issues, but most is really good.
 

Hi,

I want to add a new update to this thread, should I continue here or open a new thread ?
--- Updated ---

Hi,

I've decided to install lm7805, turns out they are the best solution for over voltage problems. Last time, the same problem, one turned on the bench power supply and it was on a high voltage; maybe 12V or something I didn't caught the number and there were sparks going on the board.

I knew either the PICkit 3 or the mcu is gone and it turned out the PICkit 3 fried.

So instead of loosing more expensive tools like the PICkit 3, it's better to solder lm7805 and that's it, no more over voltage problems.

Now, I went to the warehouse and got lm7805, 100nf caps, but didn't know what to get for input caps and there were 220n caps and got them.

the current circuit is the following.


lm7805.jpg


How about the green cap ? is it suitable or not ?
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top