[SOLVED] Do i need Capacitors and other noise filtering stuffs when i use max232?

Status
Not open for further replies.

burrow

Full Member level 2
Joined
Dec 15, 2014
Messages
147
Helped
3
Reputation
6
Reaction score
3
Trophy points
18
Visit site
Activity points
1,148
Hai , i was having problems while using long wires to feed inputs to pic microcontroller. I tried everything like Capacitors in parallel, resistors in series pull up etc. But i couldn't fix the problem.
So i decided to switch to max232.
So when i use max232 can i avoid all these noise filtering things i made before ?
 

Your question is ambiguous. How long are the 'log wires', what kind of wires are they and what signals do they carry? Where is the noise coming from?

MAX232 is a possible solution for slow changing signals up to lengths of maybe 100m or more but they are relatively expensive, can only carry two signals in each direction and cannot be disabled so you can't use them bidirectionally on a single wire. There are many solutions to your problem but you will have to describe it in more detail to get better advice.

Brian.
 



Okay. Their are some sensors and all of them feed to a 7404 ic. So basically My source is a 7404 IC, from their the signals Travel through ordinary wire (i used ribbon wire ) for about 25 metres to the Input of PIC16F628A. The speed is not an issue, the signals are just slow changing signals.

The problem i was having was wires started picking up random signals.

So i used a 1k resistor in series along with 10k pull down in parallel . Also i added a ceramic capacitor and a 1 mf capacitor parallel to each signal ( their are 4 signals ) . T

But still i faced problem of noise. So i decided to use max232 ic's.

So my question is when i am using max 232 , should i just keep all my noise filtering things still their or can i remove those resistors and capacitors.
 

The MAX232 is not the best solution. The first thing I would try is changing the receiving 7404 to a 7414 which is a drop in replacement but with much higher noise immunity because of it's Schmitt inputs.

Your underlying problem, confirmed by the way filtering didn't help is the ground connection between the two ends. It sounds like there is enough voltage drop along the ground wire to lift the other signals into the 'no mans land' region where a signal can be interpreted as high or low. This would be particularly prevalent if you used different power sources at each end of the cable. If you have spare wires down the ribbon, connect them to ground at both ends, this will reduce the resistance and inductance, helping to keep the ground potentials as close as possible. If there are no spare wires, consider running a new wire from end to end to join the grounds.

The drawback to the MAX232 solution isn't the IC itself, it is that if you have a problem with 5V signals interacting, changing them to 24V (+12/-12) could make matters far worse. If you really need a high noise immunity over a long ribbon cable you should consider alternating signal and ground wires and if that isn't sufficient, using RS422 or similar which is good to much longer distances (> 1Km) and cheaper to implement. It does however need two wires to carry each signal.

Brian.
 


Hai
Thanks for your suggestions.
Let me put in some more information.


The main power source is a 12v adapter and for PIC circuit i use 5v obtained by using 7805.
And the same 12v goes to the sensors and 7404 upstairs. And on the board their ,their is another 7805.

So basically its like they use same source but regulated by 2 different ic's.


And by the way how will a 7414 help?. I use 7404 in the upper end and not near the PIC end , i mean i am feeding the PIC with inverted signals, I guess you assumed i use another invertor near PIC
So i guess noise is effecting after this point,.

- - - Updated - - -

Hai,
iam adding a rough circuit diagram too.




All pull up or pull down used are 10k

series resistors used near pic input are 1k

capacitors used are a ceramic capacitor with number 104 parallel with 10uf electrolytic
 

I'm not sure I understand the circuit. What type is U1.1? It appears to have I0 to I7 driving out to transistors and A0 to A2 driving the 7404. I'm going to guess its a 74LS148 priority encoder but if I'm right, you should tie the /E1 and /GS pins to ground for it to work properly.

At the moment you have the output of the 7404 driving a long line with a large capacitive load at it's end. That is not good practice, you will be overloading the outputs of the 7404 as they change state and that could be causing instability. At each logic level change there will be a large current spike drawn from the supply and lots of cross coupled voltages along the cable.

I would suggest you remove the 7404 completely and wire 100 Ohm resistors between the A0, A1, A2 pins of U1.1 and the cable. That will isolate the capacitance and inductance of the cable from the IC. At the PIC end, remove all the resistors and just use a single 100nF capacitor from each PIC input to it's ground pin. The signals will be inverted (or rather not inverted) but you can take care of that in the PIC program easily. Make sure in the PIC you are disabling any internal weak pull-ups that may be active on the port pins.

Let me know if that works.

Brian.
 
Reactions: burrow

    burrow

    Points: 2
    Helpful Answer Positive Rating

Oh sorry i forgot to mention. Yea it is 74ls148. and yea E1 and /GS pins are grounded, i forgot to mention it in the diagram.


So are you suggesting me to take inputs directly from 74LS148 with a 100 ohm resistor in series?. well i am ready to try that .

And just a 100nf capacitor near pic end will filter out the noise ? . And by the way I don't have to use any pullup/down too ?.. Well sounds great if this is gonna work.
 

Give it a try.

What concerned me about your original method was that even if the 7404 had not been capacitively overloaded, the 10uF capacitors would have made any voltage changes (such as the noise you are seeing) very slow to react. So although you were breaking the design rules it should still have filtered out the noise. That leaves only one possibility, the logic levels themselves are not a good low and a good high and are failing to meet the necessary levels for the PIC to be sure what they were.

I think the method I suggest should work. The output drive level of the 74LS148 is the same as the 74(LS)04 so there isn't much point in using the extra IC. At the PIC end, to ensure you get the biggest voltage swing you shouldn't add a pull-up or pull-down resistor or enable the ones that may already be inside the PIC. The capacitors should work as noise filters, they will charge and discharge through the cable and 100 Ohm resistors. Make sure you connect the ground side of each capacitor close to the VSS pin of the PIC and of course make sure there are also capacitors (100nF + 10uF) directly across the VDD and VSS pins of the PIC too.

Brian.
 
Reactions: burrow

    burrow

    Points: 2
    Helpful Answer Positive Rating
So how about this circuit.
is this okay?? taking input from 7404 with a resistor in series


- - - Updated - - -


Okay i am working on that. will let you the result when i finish. So Iam not actually removing 7404 for now, If i remove it i will have to make few more holes in pcb to get output directly from encoder. so instead of i will be adding series resistor to the output of 7404 and then feeding it to long cable.
And on the PIC side i will try out the configuration you said.

Thanks mate..
 

That should work. If you remove the 7404 you could wire the 100 Ohm resistors between the original 7404 input and output holes in the board.
Your schematic shows "outputs pulled high" between the 74LS148 and 7404, if you have wired pull-up resistors there they should be removed, the 74LS148 can drive that point high by itself.

Brian.
 
Reactions: burrow

    burrow

    Points: 2
    Helpful Answer Positive Rating

Okay, i will remove those pull up resistors. Would you suggest me to add 7414 in the recieving end ? whether thats gonna give me extra immunity to noise?
 

You could try it if you still have problems but to be honest, I would consider a completely different way of wiring your circuit if it still gives trouble.

example: you could use a serial link and RS422 driver. That uses one less wire along the cable and can still let you read each of the inputs. In fact you could read each of the inputs individually rather than just the one with the highest value.

Brian.
 
Reactions: burrow

    burrow

    Points: 2
    Helpful Answer Positive Rating

Also one more question, , i will be adding another sensor. So i will be having one more line as source, the source will be Collector of BC547 transistor. Can i use the same method their also, a 100ohm resistor in series at source end and near the pic a capacitor in parallel to ground?

- - - Updated - - -

and Brian sir, Thanks a lot. I would have got stuck if you weren't their to help me out. Actually this is my first project with Microcontroller and electronic stuff like this,So i am a total beginner.
 

Yes, you can do that and you probably don't need the 100 Ohm resistor. It is there on the output of the 7404 because it can source current when it's output is high and you need the resistor to limit it to a safe amount. If you use a transistor, the collector load resistor will limit the current so the extra one isn't needed.

Brian.
 
Reactions: burrow

    burrow

    Points: 2
    Helpful Answer Positive Rating
Your problem is caused by ground shift and no RC combination can fix that.

Ensure U shield the signals using good ground between long distance, not used for carrying transient currents, so add ferrite ring around wires or a balun.

- shielded wires or twisted pairs
 


Sir,

seems like the circuit is working fine now.. Didn't see any problems so far. so i guess the problem is solved. You are just awsome. Thank you sir.
 

So what solved it>?

Just tried out what Brian sir suggested

"wire 100 Ohm resistors between the A0, A1, A2 pins of U1.1 and the cable. That will isolate the capacitance and inductance of the cable from the IC. At the PIC end, remove all the resistors and just use a single 100nF capacitor from each PIC input to it's ground pin. The signals will be inverted (or rather not inverted) but you can take care of that in the PIC program easily. Make sure in the PIC you are disabling any internal weak pull-ups that may be active on the port pins. "

Also added a 7414 near PIC end.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…