Closed kulbir-ahluwalia closed 2 years ago
Considering the pinout references: https://genesis.farm.bot/v1.5/Extras/reference/pinout-references.html
Could you please help us with the following questions if possible:
Sorry for too many questions but I want to make sure that we do not fry up the raspberry pi or the farmduino board.
Thank you so much!
Regards, Kulbir
For FarmBot Genesis v1.5, UTM pins F
through L
are not connected to anything (and UTM pin E
is connected to D48
, which is available for use). See this UTM pin mapping table for details. (For the latest FarmBot Genesis version, refer to the pin mapping table on this page.)
To connect any of the UTM pins to Farmduino pins of your choice:
2, 3, 18, 19, 38, 42, 48, 60(A6), 61(A7), 62(A8)
. For other models, refer to the IO pin labels on your board.Any of the available Farmduino pins in the IO and UTM sections can safely be used as digital read/write pins (bot.read_pin(pin_number)
and bot.write_pin(pin_number, pin_value)
in this library or the READ SENSOR and CONTROL PERIPHERAL commands in the web app).
You may need to add a LUA command (where pin_number
can be replaced with your choice of Farmduino pin number, i.e., 48
) before reading the pin value if it seems like it's not behaving properly. If needed, it can be added as a LUA command in the web app or bot.lua(lua_string)
in this library. For additional information about the Lua function, see this page.
set_pin_io_mode(pin_number, "input_pullup")
Good luck with your project, and consider sharing it in the forum!
Thank you so much for your help. We really appreciate it. We will try this and get back asap. Thanks again!!!
Hi Gabriel,
We were able to use 2 pins, F and G which were connected to pins D19 and D42 respectively. This helps us to identify the tools when they are mounted.
but surprisingly, the "read pin" function does not really update the value the first time we call it. It only updates the value when we call it for a second time. Even then, the value is very unstable and is true only 7 out of 10 times.
Do you know what might be going on here? Is D19 a pin we can use?
Looking forward to your help. Thank you!!
D19 is a pin you can use, but an unstable value might mean the pin needs to be pulled. Did you set the pin IO mode for that pin to "input_pullup"? Do the correct values reflect that mode (0 for connected and 1 for disconnected)?
Thanks for your help. It would be great if you could help us with some questions:
Is there a function from farmbot-py that can achieve the lua version of result, error = set_pin_io_mode(19, "input_pullup")
?
Do we have to set the input mode to "input_pullup" before reading a pin everytime? We already added 3.3 kilo-ohm pullup resistors in series to limit the current to 1.5mA.
As of now, when we do self.bot.read_pin(pin, pin_mode="digital")
, we have to do it two times in a row in order for the pin values to actually update. It does not update the first time. Any suggestions for this?
We highly appreciate your prompt support. Thank you!
bot.lua('result, error = set_pin_io_mode(19, "input_pullup")')
read_pin
command, does every bot state update sent after that have old data, or is it just the first bot state update that has old data?
Hi,
Currently, FarmBot uses pin C (Digital pin 63) for identifying whether a tool is mounted or not.
However in our case, sometimes the sequence is not completed fully and hence the "mounted_tool" variable does not have the correct value.
Since L and K would effectively give us 2-bit encoding with the combinations 00, 01, 10 and 11, we can identify the nozzle, weeder, seeder and soil sensor. It would be helpful for our case. (Credits for the idea ==> Michael)
Many thanks for considering my request.
Regards, Kulbir