Getting a Conditional Controller to regulate EC and pH working

To make life easier for yourself, disable other debug logs while troubleshooting. Just makes it easier to review the log. Like the bang bang function.

Looks like you activated the conditional controller 7 sec before copy pasting the log, so it didnt have time to run and produce any debug logging

Yes, and us having to wade through to find relevant lines. Either remove non-relevant lines manually or disable any other functions or turn off debug logging for them.

i will hope i have done it right:

self.run_action(action_id_pump_4_nutrient_b) # Dispense 3 ml nutrient B
elif measure_ec > range_ec_high: # EC too high, add nutrient
msg = “EC: {}. Should be < {}. Need to add water to dilute!”.format(measure_ec, range_ec_high)
self.logger.debug(msg)
if self.variables[‘notify_ec’] < time.time(): # Only notify every 12 hours
self.variables[‘notify_ec’] = time.time() + 43200 # 12 hours
self.message += msg
self.run_action(action_id_email_notification, message=self.message) # Email alert
# If EC is in range, make sure pH is within range
elif measure_ph < range_ph_low: # pH too low, add base (pH up)
self.logger.debug(“pH is {}. Should be > {}. Dispensing 1 ml base”.format(measure_ph, range_ph_low))
self.run_action(action_id_pump_2_base) # Dispense 1 ml base (pH up)
elif measure_ph > range_ph_high: # pH too high, add acid (pH down)
self.logger.debug(“pH is {}. Should be < {}. Dispensing 1 ml acid”.format(measure_ph, range_ph_high))
self.run_action(action_id_pump_1_acid) # Dispense 1 ml acid (pH down)

2021-05-30 16:56:32,706 - DEBUG - mycodo.controllers.controller_conditional_2631d842 - Conditional check. EC: None, pH: 7.331
2021-05-30 16:56:44,736 - DEBUG - mycodo.inputs.atlas_ph_e755ff3c - pH sensor set to calibrate temperature
2021-05-30 16:56:44,814 - DEBUG - mycodo.inputs.atlas_ph_e755ff3c - Latest temperature used to calibrate: 19.5
2021-05-30 16:56:45,822 - DEBUG - mycodo.inputs.atlas_ph_e755ff3c - Calibration returned: 0,
2021-05-30 16:56:46,178 - DEBUG - mycodo.outputs.grove_motor_driver_v1_0_e3693e5f - I2C: Address: 0x14, Bus: 1
2021-05-30 16:56:46,179 - INFO - mycodo.outputs.grove_motor_driver_v1_0_e3693e5f - Initialized in 207.3 ms
2021-05-30 16:56:47,410 - DEBUG - mycodo.controllers.controller_input_e755ff3c - Adding measurements to InfluxDB with ID e755ff3c-0a54-4d87-9c5d-bf3685af032d: {0: {‘measurement’: ‘ion_concentration’, ‘unit’: ‘pH’, ‘value’: 7.327, ‘timestamp_utc’: None}}
2021-05-30 16:56:55,701 - DEBUG - mycodo.outputs.grove_motor_driver_v1_0_665ff965 - I2C: Address: 0x12, Bus: 1
2021-05-30 16:56:55,701 - INFO - mycodo.outputs.grove_motor_driver_v1_0_665ff965 - Initialized in 231.1 ms
2021-05-30 16:56:59,788 - DEBUG - mycodo.inputs.atlas_ph_e755ff3c - pH sensor set to calibrate temperature
2021-05-30 16:56:59,876 - DEBUG - mycodo.inputs.atlas_ph_e755ff3c - Latest temperature used to calibrate: 19.5
2021-05-30 16:57:00,885 - DEBUG - mycodo.inputs.atlas_ph_e755ff3c - Calibration returned: 0,
2021-05-30 16:57:02,398 - DEBUG - mycodo.controllers.controller_input_e755ff3c - Adding measurements to InfluxDB with ID e755ff3c-0a54-4d87-9c5d-bf3685af032d: {0: {‘measurement’: ‘ion_concentration’, ‘unit’: ‘pH’, ‘value’: 7.328, ‘timestamp_utc’: None}}

Well, you have debugging on for a lot of other things still:) Like the pH sensor.

Anyway, it looks like its not detecting th EC mesurement. It says “NONE” in the log. Because of this it wont start adjusting the pH either.

after deactivating the other input modules i forgot to reactivate ec,
but now i have ec and ph input activated

self.run_action(action_id_pump_2_base) # Dispense 1 ml base (pH up)
elif measure_ph > range_ph_high: # pH too high, add acid (pH down)
self.logger.debug(“pH is {}. Should be < {}. Dispensing 1 ml acid”.format(measure_ph, range_ph_high))
self.run_action(action_id_pump_1_acid) # Dispense 1 ml acid (pH down)

2021-05-30 17:06:32,773 - DEBUG - mycodo.controllers.controller_conditional_2631d842 - Conditional check. EC: None, pH: 7.324
2021-05-30 17:06:34,255 - DEBUG - mycodo.inputs.ads1115_analog_ph_ec_7c221512 - Channel 1: Gain 16, 122 raw, 0.00035157322916348765 volts
2021-05-30 17:06:34,266 - DEBUG - mycodo.inputs.ads1115_analog_ph_ec_7c221512 - No temperature corrections applied
2021-05-30 17:06:34,287 - DEBUG - mycodo.controllers.controller_input_7c221512 - Adding measurements to InfluxDB with ID 7c221512-b80d-4661-b5ca-fc976f34ae39: {1: {‘measurement’: ‘electrical_conductivity’, ‘unit’: ‘uS_cm’, ‘value’: 1.9739558936111834, ‘timestamp_utc’: None}}
2021-05-30 17:06:39,513 - DEBUG - mycodo.controllers.controller_input_e755ff3c - Adding measurements to InfluxDB with ID e755ff3c-0a54-4d87-9c5d-bf3685af032d: {0: {‘measurement’: ‘ion_concentration’, ‘unit’: ‘pH’, ‘value’: 7.331, ‘timestamp_utc’: None}}
2021-05-30 17:06:49,285 - DEBUG - mycodo.inputs.ads1115_analog_ph_ec_7c221512 - Channel 1: Gain 16, 121 raw, 0.0006406445509201331 volts
2021-05-30 17:06:49,297 - DEBUG - mycodo.inputs.ads1115_analog_ph_ec_7c221512 - No temperature corrections applied


there is a ec value, but log says no ec ?

Odd. Try and delete the measurement in the conditional controller and create a new one. Remember to correct the ID in the code.

You didn’t change anything else besides the IDs in the code right?

According to your screenshot, your EC Condition has pH selected (CH0), not EC (CH1), for your ADS1115 Input.

i have done what you said,
i havent changed anything in the code.
deleted the measurements and put the new id´s also in the code
in the condition controller i can test all actions and the 4 pumps are turning for some seconds

2021-05-30 17:24:00,150 - DEBUG - mycodo.controllers.controller_input_e755ff3c - Adding measurements to InfluxDB with ID e755ff3c-0a54-4d87-9c5d-bf3685af032d: {0: {‘measurement’: ‘ion_concentration’, ‘unit’: ‘pH’, ‘value’: 7.328, ‘timestamp_utc’: None}}
2021-05-30 17:24:06,620 - INFO - mycodo.controllers.controller_conditional_2631d842 - Activated in 101.7 ms
2021-05-30 17:24:09,312 - DEBUG - mycodo.inputs.ads1115_analog_ph_ec_7c221512 - Channel 1: Gain 16, 119 raw, 0.00034376049073763236 volts
2021-05-30 17:24:09,323 - DEBUG - mycodo.inputs.ads1115_analog_ph_ec_7c221512 - Temperature corrections will be applied
2021-05-30 17:24:09,406 - DEBUG - mycodo.inputs.ads1115_analog_ph_ec_7c221512 - Latest temperature: 19.5
2021-05-30 17:24:09,416 - DEBUG - mycodo.controllers.controller_input_7c221512 - Adding measurements to InfluxDB with ID 7c221512-b80d-4661-b5ca-fc976f34ae39: {1: {‘measurement’: ‘electrical_conductivity’, ‘unit’: ‘uS_cm’, ‘value’: 4.669861709711694, ‘timestamp_utc’: None}}
2021-05-30 17:24:12,596 - DEBUG - mycodo.inputs.atlas_ph_e755ff3c - pH sensor set to calibrate temperature
2021-05-30 17:24:12,681 - DEBUG - mycodo.inputs.atlas_ph_e755ff3c - Latest temperature used to calibrate: 19.5
2021-05-30 17:24:13,689 - DEBUG - mycodo.inputs.atlas_ph_e755ff3c - Calibration returned: 0,
2021-05-30 17:24:15,207 - DEBUG - mycodo.controllers.controller_input_e755ff3c - Adding measurements to InfluxDB with ID e755ff3c-0a54-4d87-9c5d-bf3685af032d: {0: {‘measurement’: ‘ion_concentration’, ‘unit’: ‘pH’, ‘value’: 7.329, ‘timestamp_utc’: None}}

This is not EC

yes, thats it, pump no 1 (Acid) is turning now
thank you very much for your kind help, i will stay on mycodo

1 Like

You’re welcome. Good luck and have fun in your Mycodo journey.

Hello, my journey in mycodo continues now. I have now received the calibration solutions and have tried to calibrate the EC sensor. First in 1413 solution and then for slot 2 the 12880 solution.
When calibrating the display shows 1413 and 12880. When the sensor is then in this tank a value of -24, 281.6 is displayed. The measured ec value with a bluelab ec meter shows 2400. What do I have to do so that the ec value is displayed correctly.

Are you watching the measurements while the probe is in the calibration solution and waiting for the measurements to equilibrate (i.e. stop changing) before calibrating?

Have you checked that the EC probe is not being perturbed by the pH probe?

the ec probe is in a isolated different tank,
the calibration is good, when i calibrate the 2 ec solutions are displayed correct. The first slot 1413 and the second slot 12880. W
hile in calibration process the solutions displayed correct.
Back into the tank the values, are very strange.
The ec value, i have measured with a bluelab ec meter shows2400 ec. The measured ec with mycodo shows (minus) -24000.5
This is my problem.

i am watching the measurement in calibration process and the measured values are displayed
with 1413 and 12880. Stable measurements while calibration.

It looks like the calibration is working correctly.

Again, if you have any other probe inserted into the same solution, you need to check that they aren’t affecting each other. Electrical currents and potentials can be transmitted through the conductive liquid.

Do this test:

  1. Remove all liquid sensing probes (pH, EC, ORP, temperature) from your tank.
  2. Insert the EC probe into your tank. Does it measure correctly?
  3. Insert other probes one by one until you find the one that causes the EC probe reading to change.

it´s weekend and some time for new measurements

What i have done today:
deactivated all sensors
delete ads1115 generic input,
set a new input generic ads1115,
clear ec calibraation slots,
put the ec sensor in the 1413.0 solution and calibrate,
the display shows 1389.0
then i have written 12880.0 in the Calibration standard ec box
put ec sensor in 12880.0 solution
calibrate with the second slot,
display shows values from 11664,243 - 12271.447
Put the sensor in fresh water
display shows (minus) -11304.325
what do i do wrong ?
i dont know if i have to change some more values,
trying now some time to get it working correct, but always getting strange values