Weather Station, Garden Pond/Shed, Aquaponics (I2C/Dimmer)

Hi,

I'm building something to control pumps and lights and get status of some sensors.
I hope i can explain the schematic and it's not a to big mess.

The cables will be between 2-10 meters so i think I2C is the best solution.

  1. At the top is the pond pump and it's a asynchronous motor. So i need a phase control dimmer. Circuit OK?

  2. The part with the LM 358 is a water sensor and the EZO pH Circuit. The cable will be around 3 meters.

  3. A "I2C HTU21D-F Temperature & Humidity Sensor" and "I2C MCP9808 Temperature Sensor".

  4. The part with the 74HC4049 is a AC water level sensor and is based on this circuit Corrosion Free Level Sensor
    I modified it to get different levels and I'm not sure if i did it right.

  5. The two relays with the lamps are outside the shed and i want to control them with the PIR sensor but
    also want to switch them on with the two momentary switches. The two LEDs are to indicate if the lamps
    are in PIR or steady mode.

  6. There are the LDRs and neon lamps to get the state of the lamps and one for the pump.
    But after reading this: http://forum.arduino.cc/index.php?topic=128698.msg968536#msg968536
    I'm not sure if i need that for the pump or the lamps on the relays.
    The thing is that i get my readings over Ethernet/MQTT and it can happen the MQTT server is down,
    network switch off, cable disconnection, Arduino restart... - so i need the state ofter this scenarios.

  7. I need a circuit to control the speed of a 12VDC pump: Shurflo Bilge Pump

Then this is the first time doing I2C and i know i can to big distance with the P82B96.
But how do i connect the 3 P82B96 to the first one (master)?
Just parallel?

What are C37, C38, C40 and C41 ? I2C bus destroyers ?
In the datasheet they represent the capacitance of the wires/cable.

  1. Not every asynchronous AC motor can be dimmed.

220n is 4km of Cat-6 wire :slight_smile:

Why IC19.
Arduino should have enough drive capacity for 4000pf of cable.
Maybe wise to have IC20 though.

A BC557 is not an NPN transistor (Q15-20 and others).
Q22, Q23 won't work.
Leo..

Page 13: www.nxp.com/documents/data_sheet/P82B96.pdf

This pond pump is dimmable cause i have a dimmer with a pot from the same company.

Ok, i changed the BC557 symbol.

Whats wrong with Q22, Q23?

I thought for long distance I2C you need P82B96?

Hi,

  1. There are the LDRs and neon lamps to get the state of the lamps and one for the pump.
    But after reading this: Check if LED State is "HIGH" - #8 by DVDdoug - Programming Questions - Arduino Forum
    I'm not sure if i need that for the pump or the lamps on the relays.
    The thing is that i get my readings over Ethernet/MQTT and it can happen the MQTT server is down,
    network switch off, cable disconnection, Arduino restart... - so i need the state ofter this scenarios.

You could use a simple optocoupler, it would simplify your circuit.
You would not need the neon, ldr and the TL072s.
I gather you are only checking if they are ON, you could know if they are turned ON because you will have an output on the arduino turned ON.
The only advantage of monitoring is if you have a circuit failure in the relay area.

I think you have over thought the whole system, to the point in this case of using analog inputs to get a digital indication, that is, is the lamp circuit on or off.

I admire your attempt, but please I would suggest you sit down and draw a simple block diagram of what you want to do.
Forget the circuitry for the moment, and map out what you want.

Your circuit is very big and hard to follow, you may need to do it in a number of pages
Each page with the circuitry for a particular function with the cat cable as the connection between pages.

  1. Power supply
  2. Controller
  3. Pump control
  4. Water sensor and PH.
  5. Temperature and Humidity sensor
  6. Lamp Control
  7. Heater

What does the IC28 and IC25 and mass of 4093's do?

Your project is do-able but may need more planning.

Tom...... :slight_smile:

MrGlasspoole:
Whats wrong with Q22, Q23?

I thought for long distance I2C you need P82B96?

R264 is between base and +5volt. Emitter is 12volt. So Q23 will always be "on".
The collector of Q22 is only connected to +5volt.

Better to replace Q22 and Q23 for a logic fet.
Heating element between +12volt and drain.
Source to ground.
10k from P7 to ground (in case of a tristating pin).
1k between P7 and gate.

I have my Mega running I2C 24/7 with 8meters Cat-6. 3k3 pull-up resistors.
Arduino is able to sink a lot more than that.

Ok step by step :slight_smile:

The attachment is a water level sensor (6 levels).
I want one without corrosion and found this one: Corrosion Free Level Sensor
I modified it to have the 6 levels.

Connecting all the inputs and outputs parallel on the Hex-Inverter 4049 makes a balanced amplifier.
The PCF8574 AP does build the I2C signal cause this sensor will be ~10 meters away from the atmega.

Hi,
I have used that corrosion free sensor and it works well, I used it in one of my cars to let me know when the window washer reservoir was getting low, the tank was not very big.
I placed all the circuitry at the tank and just had the output wire off an opto instead of a relay.

Tom.. :slight_smile:

@Tom, but the original circuit with just one level!?

Can you explain why the oscillator is running on 12volt, the driver is running on 5volt, the detector is running on 12volt, and the I2C expander is running on 5volt.
I also have never seen a PNP emitter follower (BD557 ?) between detectors and I2C like that. Where did you get that circuit from.
Why the capacitors on the I2C lines.
Leo..

P82B96 max 18VDC
PCF8574 max 6VDC
CD4093 max 22VDC
74HC4049 max 7VDC

Third time the link to the original :slight_smile: : http://www.sentex.ca/~mec1995/circ/sensor3.htm

Capacitors page 13: www.nxp.com/documents/data_sheet/P82B96.pdf

What has max voltage got to do with is.

You can't just glue diagrams together, and expect it to work.

The detector ports have a ~7volt threshold when the IC is powered from 12volt.
5volt t/t from the driver might not be enough for reliable detection.
If you run the 4093 also on 5volt, the threshold will drop to ~3.3volt.
With 5volt supply on the 4093, you also don't need the "relay drivers".
And port outputs can be directly connected to the I2C expander.

You could replace the six detector ports for one HC hex schmitt trigger.
And the oscillator+driver for the same hex schmitt trigger.

Caps has been properly answered by Peter_n in post#1
The represent the cable capacitance in that test setup.
You don't use caps. The cable is the capacitance.
Cat-6 is ~50pF/meter.
Leo..

Here they sell I2C stuff: I2C Buffer Testplatine / I2C buffer testboard
Circuit: http://www.horter.de/doku/i2c-buffer-testplatine_db.pdf
They also use the caps?

Maybe there is more to the caps.
See figure 14 (page 13) in the datasheet of the P82B96 and text above that.
The I2C bus is specified as max 3mA pulldown and max 400pF for the SDA and SCL.
For a flat ribbon cable the slope of the SDA and SCL are made less steep by adding a capacitor at the microcontroller side and the sensor side, making use (misuse?) of the specifications of the I2C bus. They say: He, that's okay, since the bus is specified to handle up to 400pF, so we can add 100pF, 200pF and 400pF.

I noticed 220nF (nano) capacitors and called those : I2C bus destroyers.
But 220pF (pico) seems to be more or less okay when the P82B96 is used for long cables.

I think you're right, at least partially.

Correct me if I'm wrong, but I think the 220pF caps are used because there is NO cable there.

A "400pF" master directly connected to the "4000pF" bus driver.
And at the other end, the "4000pF" bus driver connected directly to the "400pF" slaves.

There are no caps on the actual bus.
Leo..

I've never heard of adding caps to a bus - termination resistors are the only thing used.
Caps only slow down edges and reduce the usable frequency.

Add the I2C pullup resistors to the end of the bus, farthest from the microcontroller.

The caps in question are not on a "bus" (wire), but on one short I2C interconnection.

CrossRoads:
Add the I2C pullup resistors to the end of the bus, farthest from the microcontroller.

Please explain.