Soil sensor additional info

Hello BC colleagues,

I started to play with BigClown soil sensor for moisture&temperature and I have two questions:

  • I noticed that there can be connected multiple soil sensors at once e.g. It’s mentioned in sensor’s description and here as well. Could you advice how this can be done in a real scenario? does it mean that they are connected via an one sensor module?
  • Could you advise how to detect whether a sensor module and/or a soil sensor is connected in application_init()? I would like to have a different logic based on it’s presence …
    P.S.: I see a function bc_soil_sensor_get_sensor_found but i think that it returns a value after a sensor initialization + after first measurement which will happen after 10ms - see here. Therefore it isn’t exactly what i need …

Thanks a lot

Hi,
detection need some time, you cannot call bc_soil_sensor_get_sensor_found in application_init.

The first question, yes you can connect more sensor over sensor module. For long connection IS recommended is serial connection, for short (>5m) you can use engaging in a star.

Hello Adrian (Ivefoundyourname :slightly_smiling_face:),

you can connect multiple sensors in parallel to the single Sensor Module. Sensor Module R1.0 can reliably handle only 2 sensors, the new R1.1 with dedicated VCC pin (5 pin connector) can handle lot of them :slight_smile:

Autodetection could be done by checking how many addresses are filled in the sensor structure. Take a look at this thread where user would like to get device_ids
https://forum.bigclown.com/t/how-to-get-soil-sensor-address/467/4?u=hub.martin

Then after some time you could browse the structure and check how many sensors has non-zero addresses:
sensors[0]._ds28e17._device_number
you can also use flag which says the temperature is valid
sensors[0]._temperature_valid
but this can take longer time from the start, but the addresses should be read immediatelly after initialization.

Hello Martin, Karel,

Thanks for replies.
It makes more sense now.

BTW Martin are you sure that Adrian is my name ?

BR

Hey there,

I have an one more question.
Is there posibility to use other GPIO/PWM pins on a Core Module with Sensor Module connected?
It doesn’t report any error when using in code but it seems that it doesn’t work.

Thx
BR

Hello,
PWM should work perfetly fine. Just do not use P4 , P5 pins which are used on Sensor Module

Also this link might be useful How to: PWM — HARDWARIO TOWER - Industrial IoT Kit documentation

Please upload your application.c source code (file, do not paste the code) - we can find what could be wrong much quickly.

UPDATE:
P4, P5 does not have HW PWM so it must be some issue with the code.
Maybe I did not understand what you meant. Would you like to have PWM on the connecto on the Sensor Module? I’m a confused because this is Soil Sensor thread so I assume that Sensor Module has Soil Sensor connected on it.
I did a library for software PWM for servo motors. It could be used on any GPIO. What is the PWM for and what is the frequency you need?

See the bc_soft_servo.c files. It will be added in SDK later.

So to make it clear … i have a soil moisture sensor connected to a sensor module and a sensor module connected to core module :slight_smile:
AND i would like to use free GPIO/PWM pins on the core module beside P4,P5 - i think that the pins should be interconnected between the core module and sensor module - i expect e.g. that pin P17 which is situated on right top on a core module correspond to right top pin on sensor module right? So far I tried to initialize GPIO on e.g. P17 but it doen’t provided any voltage when used with sensor module.
I didn’t try the PWM yet …

I initialize pin in standard way:

bc_gpio_init(BC_GPIO_P17);
bc_gpio_set_mode(BC_GPIO_P17, BC_GPIO_MODE_OUTPUT);

Than:

bc_gpio_set_output(BC_GPIO_P17, 1);

Thx

Hi, Thanks for more detailed explanation.

The gpio code you send me is ok. And yes, the Px pins are physically interconnected 1:1 between Core and Sensor Module. Is there anything else in your code? For example if you do not initialize I2C2, which is also on P17 which would collide.

Can you try other GPIO? P8, P9?

If you send me zipped folder app then I could test your code on my device.

If you want to take a look on my in-progress project a push is here.

Which pin are we talking about in your project, there is no P17 so I assume the P6 is not working?

How do you measure the voltage on GPIO? By multimeter?

In this case it’s P7

Yep.

And what about other GPIO pins? Are they working fine?
I see in your code also:

bc_gpio_set_output(SOIL_MOISTURE_POWER_ID, 1);

Can you please try to create the minimal example code that does not work? Your project is quite complex and uses IF statements which means my code could take different path. Creating a simple project like skeleton which toggles GPIO could create a minimal code and then I can be sure what to look for when the code will be right.

Can you try to measure the GPIO directly on the Core Module SMD pad? This way we could find if there is some connector or soldering problem on the Core or Sensor Module.
image

Ok i will prepare something in the evening.
Thanks for your time.

1 Like

Hello,
I tested a basic code and I’m starting to think that my core module misbehave.
I will try to a second one today evening :slight_smile:

1 Like

update …

  • Initially i tried several GPIO ports and all didn’t reported any voltage with connected battery&sensor module - even if soil sensor reported temperature&moisture.
  • I decide to run the same code on 2nd core module and it worked.
  • I disconnected battery&sensor module from the first core module + i interconnected core module into a different raspberry pi USB port and it started to work . Now it works also with connected battery&sensor module and also in previous USB port :confused:

So i don’t really now what happened but I’m happy that it works :smiley:
Thanks a lot for your time

That’s a good news. :+1:

1 Like