Mrunal Ahirrao
Full Member level 2
- Joined
- Nov 26, 2012
- Messages
- 133
- Helped
- 2
- Reputation
- 4
- Reaction score
- 2
- Trophy points
- 1,298
- Location
- India
- Activity points
- 2,213
The clasic symptoms of EMI on processors is they behave unpredictably and randomly. If your design is doing the same wrong action every time it suggests an electrical design fault or a software bug. My first guess at what may be different between simulation and real hardware is that your water level switch is not providing the correct logic levels to the processor. If it is a simple switch, do you have a pull-up or pull-down resistor to set a default logic level when the switch is open?
Brian.
Most likely your 'real-life' sensors aren't doing the job properly. What sort of sensor are you using ?
Post your circuit. It will help to get the problem solved
Alternate I/O functionWhat is the functionality of MCLR (pin 4) ?
If your sensors read 3V it will be seen as a logic high so they are passing enough current in their 'off' state to overcome the pull-down resistors. Either reduce the value of the pull-down resistors or if that isn't possible, add a comparator circuit to the sensor outputs so they give a clear high/low output when they operate.
I assume the MCLR pin is set to input mode and you have the reset internally tied to VDD.
To answer your question - this is not an EMI issue, it's just that the sensor outputs are not well enough defined for their logic state to be used reliably.
Brian.
It still has nothing to do with EMI. Dropping the pull-down resistor values will help but it does not explain the underlying problem.
I can think of two things to check:
1. you say you are using electrolysis probes, if this is simply two metal probes in the water, is it possible you are actually generating a voltage between them (like a battery). What are the probes made of?
2. Is there an electrical connection (maybe an Earth connection) to the pumps or the tank itself which is not at the same ground potential as your logic circuit? What I'm suggesting is that the water itself is conducting the voltage from some other connection which is above your circuits ground potential.
If idea 2 makes sense, try disconnecting the probe inputs to your circuit completely and see if any residual voltage is still on them with respect to ground.
Brian.
Its working. The error was in my code! We cannot call it as an error,as I am just switching sensors ON/OFF when needed to avoid corrosion.But this don't know why made PIC to behave strange! So I removed that instruction and made sensor to switch ON forever! and now its working... thanks .Try grounding the pump, it should be grounded for safety reasons anyway. Also, if the tank is metal, try grounding that as well.
Brian.
The clasic symptoms of EMI on processors is they behave unpredictably and randomly.
Brian.
Why not try a simplified way, using PNP transistors as sensor to water level low and high level, and ON the pump when both transistors are turned ON.
The MCU will OFF the pump, when both transistors are OFF.
The circuit is attached.
oook
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?