I want to build a tool for measuring the distance between the tool head and plants or soil beneath it. I ordered a TOF10120 laser distance sensor for the task which should arrive any day. The module can communicate either via UART or i₂c.
My question is: What is the best way to transfer the measurement to the FarmBot?
I see the following options:
- Add a Arduino Nano to the tool which reads the sensor data and uses its PWM output to generate an analog signal which is transferred to the farm bot on the same analog pin which is used by the soil sensor.
- Connect some two additional pins of the UTM to connect the sensor directly via i₂c. I fear the cable needs to be too long for a clean connection. But I have never tried such long i₂c cables and there are chances that it works with very slow speed.
- Connect some two additional pins of the UTM to connect the sensor directly via UART. UART is also not designed to work over long cables and the sensors baud rate of 9600 might be too much for long unshielded wires.
- Add a Arduino Nano to the tool which reads the sensor and which transfers the measurement over a very slow serial connection on two additional pins of the UTM. This would have the benefit that the arduino could transfer additional measurements for example from a temperature sensor. Two sensors could share one tool this way.
Please let me know which of these options is the best in your eyes.
I’m also open to additional ideas how the sensor could be connected.
Why do I want such a tool?
With the laser sensor I could measure a grid of distances over the whole beet. The highest measurement in the range of a plant would be a good guess for the height of the plant (a useful information for a careful watering sequence and for evading collisions during optimized movements). The measurements in between the plants would be accurate measurements for the soil height.
I also hat problems with the weeder which easily produces dents in the soil. The new tool could measure the depth of the dent and adjust the weeding sequence accordingly.
Another usecase is more scientific: In theory the camera should be sufficient to make a depth estimation for every captured pixel in two or more images. This could be possible with unsupervised optical flow but that is hard to test with no ground-truth data. With such a sensor the FarmBot could automatically collect depth data for a dataset.
I will post my designs and schematics here as soon as I have them.