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 …
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.
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
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.
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.
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
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 …
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.
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.
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
So i don’t really now what happened but I’m happy that it works
Thanks a lot for your time