how to avoid electrical noise?

Mejlby

Member
how to avoid electrical noise?

I'll try to explain what my problems:

If I program a piaxe 18m2 and user the command “ if pinc.1 = 0 then sek0 “ then activate the switch as soon as I approach with a finger - even 1 inch from the wire in the switch.

but if I use the command "if pinc.1 = 1 then sek0 “ then I can activate the piaxe with a switch without problem.

Try to see a little bit of the program:

main:
readadc C.0,b0 ; read value into b1

let dirsB = %11111111 ‘ switch pins 0 and 1 to outputs
high c.7

if b0 < 5 then led0 ' if bigger than 150 jump
if b0 < 30 then led1 ' if bigger than 150 jump
if b0 < 60 then led2 ' if bigger than 100 jump
if b0 < 90 then led3 ' if bigger than 100 jump
if b0 < 120 then led4 ' if bigger than 100 jump
if b0 < 150 then led5 ' if bigger than 100 jump
if b0 < 180 then led6 ' if bigger than 100 jump
if b0 < 210 then led7 ' if bigger than 100 jump
if b0 < 240 then led8 ' if bigger than 100 jump
if b0 < 265then led9 ' if bigger than 100 jump

goto main

led0: let pinsB = %00111111 ; digit 0
if pinc.1 = 0 then sek0
goto main
led1:
let pinsB = %00000110 ; digit 1
if pinc.1 = 0 then sek1
goto main
led2:
let pinsB = %01011011 ; digit 2
if pinc.1 = 0 then sek2
goto main
led3:
let pinsB = %01001111 ; digit 3
if pinc.1 = 0 then sek3
goto main
led4:
let pinsB = %01100110 ; digit 4
if pinc.1 = 0 then sek4
goto main
led5:
let pinsB = %01101101 ; digit 5
if pinc.1 = 0 then sek5
goto main
led6:
let pinsB = %01111101 ; digit 6
if pinc.1 = 0 then sek6
goto main
led7:
let pinsB = %00000111 ; digit 7
if pinc.1 = 0 then sek7
goto main
led8:
let pinsB = %01111111 ; digit 8
if pinc.1 = 0 then sek8
goto main
led9:
let pinsB = %01101111 ; digit 9
if pinc.1 = 0 then sek9
goto main

sek0:
high C.3
low C.7
pause 100
goto main
sek1:
high C.3
pause 1000
low C.7
pause 100
goto main
sek2:
high C.3
pause 2000
low C.7
pause 100
goto main

And so on to sek9

can someone explain to me why piaxe activate when I approach with my finger without pressing a switch?

From Tonny - Denmark
 
Last edited:

geoff07

Senior Member
What is the circuit? Do you have pullup/downs? Sensing a finger at a distance implies capacitive coupling which implies very high impedance which implies no input conditioning.

By the way, you might like to look up the select/case statement, which would make your code a lot less repetitive and easier to maintain. Add a do/loop command and you could probably do away with gotos entirely (goto = bad practice if avoidable).
 

BrendanP

Senior Member
Use 100n and 10n ceramic decoupling caps on the V supply pins to the picaxe and also across the reset pins. I have had similar strange problem occur with picaxe projects and this fixed it.

I now add these parts as a matter of course on all pcb designs and even bread board layout if the circuit is complex. ie., multiple IC's, servos etc.
 

Dippy

Moderator
Based on the information presented, I tend to agree with Geoff on this. Sounds like a floater (ooer!) , unsuitable component values, poor physical design or wiring or something come adrift.
Unless Tonny is operating his circuit next to some noisy power device??? (lousy PSU?).

Post your schematic circuit diagram and if possible a photo of your PCB and wiring. And describe your power supply.
People often forget that construction and installation can be as important as design - and sometimes more important.


On a side-note I also agree with Brendan. Decoupling/filtering for supply and MCLR is my default design setting. It is something that doesn't seem to get a mention in the Manuals but is so darned important that it deserves a whole paragraph of it's own.
After all, Microchip mention it all in their documentation.
Hopefully, we will be getting a Tutorial on this subject.
.ooh , something just flew past my window....;)
 

John West

Senior Member
Also, click on the # symbol on the formatting line at the top of the reply window to get the commands for placing your code in a scrolling window. Makes for a more compact post.

BTW, I NEVER put an IC on a board without both ceramic and electrolytic filter capacitors on the IC power supply pins. I consider it the minimum starting point in building any IC circuit, either analog or digital.

Good houses are built on good foundations.
 
Last edited:

geoff07

Senior Member
Not sure about 'same rating' but the big ones (electrolytics) supply the chip with instantaneous power without depressing the board voltages for other components, and the little ones keep the HF noise from getting in or out to other chips by shorting it locally. You want the supply rails to be effectively shorted at all relevant frequencies. Some fabrication technologies are better than others at different frequencies. I would say a small bypass was essential but an electrolytic would only be needed if a digital chip is handling power. Otherwise a few strategically placed around the supply rail would do it.
 

John West

Senior Member
geoff07 pretty much answered the question of why have two different types of capacitors, but didn't answer the question you posed of different types of the same rating.

The reason they are of different types is because these particular different types do not have the same ratings. Electrolytic capacitors are created by an electrolysis process occurring between the two conductive plates. This makes for a thinner dielectric between the plates, thus higher capacitance.

A typical 1000 uFd electrolytic cap will fit comfortably alongside an IC and will cost a few cents. A 1000 uFd ceramic capacitor (if they even exist) would likely cover the entire circuit bd, and cost more than most entire electronic projects.

In short, we need to use different types of capacitors to meet different goals at reasonable prices.

As geoff07 indicated, a high value electrolytic capacitor acts as a reservoir for charge, like a tiny battery. It steadies the power supply voltage and supplies the momentary power surges the chips demand when they change output states or attempt to drive high capacitances, such as power MOSFET inputs. What a high value electrolytic cap is not good at doing is filtering out very high frequency pulse noise or RF, which can wander all over such devices without becoming filtered out.

A low value ceramic (as the dielectric between the capacitor plates,) or mylar, or such capacitor does that job best. So two capacitors of different types are typically used in well designed circuits to aid each other in keeping power supply voltages smooth and stable.

Other types of capacitors are used for other jobs, silver mica for thermal stability, polypropylene for precision, polystyrene for sample and hold circuits, etc. These are generalizations, but you get the idea. Each type or material of capacitor has its own attributes, and it's our job to pick the right one for the task at hand.
 
Last edited:

Dippy

Moderator
Absolutely. All of the above

Electrolytics are for rumpy pumpy.
Ceramics and some other types are for tinky winky.

When you transients etc. use both.
When it's sparkly noise use a ceramic.
If it's complex RF then often you have to have various values paralleled.
And you have to start looking at the dielectric properties.
Certain values will have desirable and undesirable properties in certain Fq ranges.
 

premelec

Senior Member
@Dippy - sparkly noise? thinking of the New Years bubbly already - don't forget the pop noise too... that's a big one with flying particles too :)
 

Dippy

Moderator
Rumpy pumpy = low frequency.
diddlydiddlydiddly = medium frequency
tinkywinky = medium/high
sparklynoise = high
zizzywhizzy = very high
RF = effing high
jumping electrons Batman = even higher


These are all Internationally accepted technical terms defined in Microchip's Application Note AN74531. Date: 4/1/11 advance notice.
 

Mejlby

Member
Hello everyone and thanks for all the answers in this thread I started
I will first explain what I want to do.

I have make a timer where I can adjust the time by the command READADC, and on a 7-segment I can see the time I wish the relay must be turned.

I use 3 pieces of 7-SEG and 3 pieces PIAXE18M2. I can read out up to 9 minutes and 59 seconds - it works fine if I use the command "if pinc.1 = 0 then sek0"

In the beginning of this thread I wrote wrong.

WHAT I meant was if the command is “ if pinc.1 = 1 then sek0 “ so activating the switch before I touch it - actually 1 inch before I touch the switch.

BUT if the command is “ if pinc.1 = 0 then sek0 “ then the program works.

I have created a circuit diagram - but only wiht one 7-SEG and one Piaxe18m2 - ( there are three of each)

Maybe someone can explain why I don´t can use the command “ if pinc.1 = 1 then sek0 “ without it causing problems with electrical noise

I use an expensive professionally power supply - but although I use a battery, I have the same problem.

BrendanP wrote:
Use 100n and 10n ceramic decoupling caps on the V supply pins to the picaxe and also across the reset pins. If you see my Circuiet maybe you will explain how to do ?

Best regards
Tonny ( From Denmark )
 

Attachments

Last edited:

BeanieBots

Moderator
Carry out the suggestions made and your problems should go away.
It would also be a good idea to fit series resistors for the seven segment displays.

In particular, a pull-up for the switch.
 
Last edited:

Mejlby

Member
Thanks Martin

BrendanP wrote :

"Use 100n and 10n ceramic decoupling caps on the V supply pins to the picaxe and also across the reset pins. I have had similar strange problem occur with picaxe projects and this fixed it."

Can you out from my diagram tell me where and how I place the 100n and 10n ceramic decoupling caps
 

Attachments

Last edited:

Dippy

Moderator
This is just a general thing.

I'll make no comments about having Mains power near low voltage digital circuits. i.e. if you have problems (not issues) then it may require noise suppression techniques in the mains side.
In any event , your PCB physical layout is important. Esp so that EMI doesn't get into signal and power lines.

Attached is a modded version with some suggestions.
It's a rush job so it is not a full 'analysis' of your design - just something to get you started.

Sometimes you have ceramic capacitors paralleled (//'d) to provide wide band decoupling/bypassing - it depends on the App and Design.
Anyway, have a look.
 

Attachments

Mejlby

Member
Thanks Dippy, it was a really good information you give me - it is easier to understand when I see it on a diagram - many thanks

Tonny
 

John West

Senior Member
Rumpy pumpy = low frequency.
diddlydiddlydiddly = medium frequency
tinkywinky = medium/high
sparklynoise = high
zizzywhizzy = very high
RF = effing high
jumping electrons Batman = even higher


These are all Internationally accepted technical terms defined in Microchip's Application Note AN74531. Date: 4/1/11 advance notice.
Very funny. Will find good use for these terms in future. Thanks, and happy new year.
 
Top