Earth sensor
-
Update: The readings do not change even when I completely unplug the sensor. The display still gives me similar values above 1000. Thus, it somehow seems as of the sensor might not be providing any data at all? It makes no difference whether or not the sensor is attached to the device.
-
@rudi15 Can you post your UIFlow code?
-
@ajb2k3 Sure, thanks. Here is the code:
from m5stack import *
from m5ui import *
from uiflow import *
import time
import unitsetScreenColor(0x222222)
earth_0 = unit.get(unit.EARTH, unit.PORTB)MoistureAnalog = M5TextBox(14, 59, "Analog", lcd.FONT_Ubuntu, 0xFFFFFF, rotate=0)
while True:
MoistureAnalog.setText(str((str('Earth Sensor Analog: ') + str((earth_0.analogValue)))))
wait_ms(500)
wait_ms(2) -
@rudi15 said in Earth sensor:
@ajb2k3 Sure, thanks. Here is the code:
from m5stack import *
from m5ui import *
from uiflow import *
import time
import unitsetScreenColor(0x222222)
earth_0 = unit.get(unit.EARTH, unit.PORTB)MoistureAnalog = M5TextBox(14, 59, "Analog", lcd.FONT_Ubuntu, 0xFFFFFF, rotate=0)
while True:
MoistureAnalog.setText(str((str('Earth Sensor Analog: ') + str((earth_0.analogValue)))))
wait_ms(500)
wait_ms(2)Is your earth unit initialized? I cant see any reference to port B gpio
-
@robski said in Earth sensor:
@rudi15 said in Earth sensor:
@ajb2k3 Sure, thanks. Here is the code:
from m5stack import *
from m5ui import *
from uiflow import *
import time
import unitsetScreenColor(0x222222)
earth_0 = unit.get(unit.EARTH, unit.PORTB)MoistureAnalog = M5TextBox(14, 59, "Analog", lcd.FONT_Ubuntu, 0xFFFFFF, rotate=0)
while True:
MoistureAnalog.setText(str((str('Earth Sensor Analog: ') + str((earth_0.analogValue)))))
wait_ms(500)
wait_ms(2)Is your earth unit initialized? I cant see any reference to port B gpio
Judging by the colour blocks he’s using UIFlow 1 not UIFlow2
-
@ajb2k3 Yes, correct UIFlow 1. Should I switch to UIFlow 2? It's indeed just that piece of code so far as I found some videos that only do that and it seems to work. No initialization or so as I could not find any information or command on initialization etc. Also, I have no idea how I would calibrate the sensor and whether that would help. In case you have any hints on what to do? Thanks again!
-
And just for the sake of completeness: The sensor is on Port B.
-
@rudi15 said in Earth sensor:
And just for the sake of completeness: The sensor is on Port B.
is example which you can load from Earth unit section works?
-
@robski generally yes. I can see these examples in UI Flow and I did use them when building the code.
-
@rudi15 said in Earth sensor:
Hello,
I am a newbie to M5stack and want to use the Earth sensor to display moisture values. I followed the instructions as outlined in this video by exactly rebuilding the respective code: https://www.youtube.com/watch?v=rYi8XLe3X_c
The device now does show data, but it is constantly above 1000 even when just laying on my desk without any contact to water (up to the maximum of 1024 which, as far as I understand, indicates that the sensor detects water (fully wet)). When I put the senor into water, the readings do not change they stay above 1000.
Any idea what I did wrong?
It wont work as the RED Port is PortA I2C, you need to connect it to a Black Port B or use a PBhub to convert to I2C