# EMI Shielding



## Dave Koller (Nov 15, 2008)

Have you put a .1 or .01 cap at the pot terminals? Have you scoped it to see if you have noise? Does it cause run away as long as key is on or does it settle down... Have you a diagram of hookup and wires used in the Arduino... I have not looked at your code closely but need to see the physical setup to see more.... little more please...


----------



## Snakub (Sep 8, 2008)

Could you recommend a drawing program? By putting a cap across the terminals do you mean across the 5v and ground? Because if you do I have a 10 uf electrolytic across the 5v and ground supply of the Arduino but not directly on the pot should that make a difference? I am scoping out the output of the arduino tomorrow. It causes runaway as long as the key is on.
Diagram is pretty simple though the outside pot wires are hooked to 5v and ground and the middle wire goes to analog pin 1 and pin 11 is the 
pwm output. I think it may be in the code though because the old code did not do this with the same pot


----------



## Dave Koller (Nov 15, 2008)

The .1 or .01 was meant to be between the ground side and wiper of the pot AT the pot... But it may not be noise but in the code - like I said I like to see more of the inputs and outputs in a drawing...

Make sure your code has no PWM on start - I will try to look at it closer as something does not jive. Key on is sensed on what pin? 

Use the schematic draw part of PCB Express - nice free proto software and quick board turn-a-round....


----------



## Dave Koller (Nov 15, 2008)

Just curious but if you divide numbers 0 to 3 by 4 in code what are you getting in your loop void as a OCR2A value?


----------



## Snakub (Sep 8, 2008)

By dividing analogRead by 4 I am converting analog values of 0 to 1023 to digital of 0 to 255. Is that what you are asking? There is no key sense to the micro.


----------



## illuminateddan (Dec 19, 2009)

Snakub said:


> By dividing analogRead by 4 I am converting analog values of 0 to 1023 to digital of 0 to 255. Is that what you are asking? There is no key sense to the micro.


A better way of doing this is to use the map command to remap your input from one range to another. This gets round any /0 errors which result in fatal crash. - info on function here... http://arduino.cc/en/Reference/Map

Also, may well be worth looking at providing a hardware cutoff of the PWM output until the chip has fully booted as sometimes the chip can output strangeness until its all fully booted.


----------



## Dave Koller (Nov 15, 2008)

Doing a whole lot inside an interrupt is usually a bad idea. I'd suggest setting a flag in the interrupt, and testing the flag in loop().

and as suggested - let things settle before any setting of :
// set dutycycle == 50 
OCR2A = 128 ; 

"


----------



## illuminateddan (Dec 19, 2009)

A simple 555 could be setup as a monostable, and combined with an Nand gate this could allow you to do a 'x' second lockout of hardware while the arduino boots. as most nand gates come in a 4xnand package, you could use the rest to do either over I or over V lockouts too...


----------

