Problems with interference in sensor readings

I have an project which control a heat exchanger.

I read 4 temperature sensors DS18B20, a distance with HC-SR04 Ultrasonic Sensor, and a flow with YF-S201 (with attach interrupt). I can turn on and off a monophasic motor with Arduino too.

I have many interference problems with i turn on my motor, the readings of temperature fail with big frequence and i have many errors with interrupt counter.

I read many posts about interferences, and one most important factors are high impedance of floatings pins.

I use Arduino Due, then many pins are floating. I have to put a pull-down resistors in all pins?

My project looks like the architeture in the image link bellow: https://i.stack.imgur.com/glo5L.jpg

The code of my project can be found in : https://github.com/felipefonsecabh/ArduinoCode/blob/ArduinoNoNavigation/ArduinoCode.ino

Any opinion?

Thanks a lot!

There are many problems in your wiring:

  • No flyback diode for the relays.
  • No current limiting resistors for the LEDs.
  • The wiring diagram doesn't show how the wires are grouped into wires going the same way.
  • Shielding may be necessary
  • no pullup for the OneWire signal line
  • no level converter for the ultrasonic distance sensor (it runs on 5V, so the signal will be 5V too, that may fry the Due pin)

In your code:

  • DS18B20 are no set to non-parasitic mode
  • you initialize I2C slave mode although nothing is connected (in your wiring diagram)
  • "command" (and send_info as well as the switching variables) is not declared volatile although accessed in interrupt context

If you really have a problem with interferences shield the cables and try to move the motor cables away from the signal cables.

Thanks a lot @pylon!

Some resistors are been omitted in diagram to make the diagram faster.
The infrastructure was not set up by me.

I don't understand 2 things:

1 - Shielding may be necessary: What do you mean by that? What shield can be necessary?
2 - DS18B20 are no set to non-parasitic mode : How i configure correctly this option in code?

felipefonsecabh:
My project looks like the architeture in the image link bellow: https://i.stack.imgur.com/glo5L.jpg

too much Fritzy spaghetti to even try to figure out what it's supposed do do, and: "my project looks like..." sounds like this is not your project. Then don't post it, as it confuses everyone.

Please post a proper circuit diagram of YOUR project, even a rough hand-drawn one is easily better and more readable than the best Fritzy wiring diagram. Not something that "looks like" it.

As it's related to the motor/relays, flyback diodes may be part a problem, general power supply issues as well. Motors also tend to put out quite some noise, so you may need filtering caps on them as well to suppress this noise.

1 - Shielding may be necessary: What do you mean by that? What shield can be necessary?

Shielding the cables from the Arduino to the sensors.

2 - DS18B20 are no set to non-parasitic mode : How i configure correctly this option in code?

Forget that, I’ve just seen that the new version of the library automatically handles that.

Some resistors are been omitted in diagram to make the diagram faster.

When we ask for a wiring diagram that diagram should be complete, otherwise we waste our time reading it. I don’t feel that negative about fritzing diagrams (as wvmarie) but if you use a program that makes it that easy to insert components, the result must include every part that exists in the setup.