Arduino to Raspberry Pi wireless communication

Hello all,
I am thinking to separate arduino mega board and Raspberry Pi and let them communicate wirelessly vai NRF24l01 module. Does anybody have such solution already in place or any experiences with it on Farmbot? There is for example this module for USB to NRF communication. I have same experiences with NRF24l01 moduls for arduino to arduino communication but now I would like to use it on Farmbot to keep the Raspberry Pi at home and have only the Arduino mega with Ramps an the garden. Any help or experiences will be appreciated. Thanks and have a good farming day.

1 Like

I forget to attach the link to the module, so here it is:
USB to NRF24l01 module

It would be great if the Raspberry Pi could stay at home and control the Arduino Mega + Ramps shield wirelessly. It could also save some energy when Farmbot works with solar panels. There could be even more options for wireless communicaton which would extend the distance where farmbot is able to operate.

@boylucky This might be technically possible, but I would be concerned about signal loss- the platform was designed for a reliable wired serial connection and does not offer error correction or checksums that would most likely be needed for such a setup.

We can’t provide support beyond basic advice, but I would be interested to see your progress if you decide to move forward with the idea.

@RickCarlino Thanks for your comment. You are right. It is not going to be as easy as just plug the NRF24l01 to both devices. But I see quite big potential in such solution. I really like the farmbot idea. It is absolutely amazing project which can change the availability of fresh and healthy vegetable with reduction of manual work but also reduce CO2 emissions. Vegetable can be grown localy with less work inputs. Then it can also attract young people to farming because now from boring looking garden work, it become high tech stuff :slightly_smiling_face:

I see some limitations which could be worked out and which could add then new possibilities to farmbot. One of them is the necessity of direct internet connection. That is why I would like to give a try to the solution with nrf24l01. Then the farmbot can manage areas where not direct wifi connection is available. But nowdays there is even more possibilities. IoT is going to make a huge shift in technologies. I was also playing a bit with Sigfox solutions and similar things. It is definitely not going to suit the farmbot design for now as it is designed for really small amount of data transfer. I just want to say that solution where the farmbot could operate without Raspberry Pi directly connected to it could add new possibilities. I can also imagine that one RPi could then serve more then one farmbot. It would also save some energy for farmbot in case it is powered by solar panels.

It is just idea. Nothing more :slightly_smiling_face: I just wanted to see if somebody already went this direction :slightly_smiling_face: I started to work on low cost farmbot which I would like to use for educational purposes and for vegetable production on place with no connection to electricity and with limited wifi connection. That is why I am thinking about solution with nrf24l01. The place which I have for growing is also quite far from place where I live so additional hands on in form of farmbot :slightly_smiling_face: would be great to implement. For now I did only automation about watering which also helped a lot. I have some experiences with designing low cost 3D printers, so farmbot looks very interesting for me with practical benefit of producing more fresh food.

1 Like

What do you think about following idea:
I would attache one more arduino between Farmbot and Raspberry Pi. I mean I would plug this arduino to Raspberry Pi normally with the USB cable. On this Arduino I would write code which would manage the USB communication and transfer the data to Farmbot via NRF24L01. I would write there code which would manage the checksums and error hendling. Same modification would be needed on the Farmbot side (idealy directly in the Farmbot firmware to don’t plug one more arduino there too). I do not have experiences with programming Raspberry Pi but have experiences with programing Arduino. So I am thinking about this solution. Such solution could be then used for any other wireless module if needed.

Please can I ask you for your recomandation if this would be the right source for Farmbot Genesis v1.2 firmware which I could be based on and where I would try to do the required modification on Farmbot side?

or better to use

I would like to ask you what do you think about such solution.

Thank you and have a good day.

@boylucky The source code to the firmware (for the sake of modification) is here, but the source code you probably want to modify is FarmBot OS, which is here. Currently FBOS was built to handle exactly one microcontroller. To modify FarmBot to support multiple microcontrollers, the majority of the work would need to happen in FBOS. It would be a high level of effort and I would not be able to provide you with support. Although it is technically possible, it would be extremely difficult to modify FBOS handle more than one microcontroller.

Before you get started, it would be best to read the entirety of the developer documentation to get a better understand of the platform’s architecture.

@RickCarlino - thanks for this info and links. I choose for now the most easy way for me. It means I will add two Atmeg328p chips connected to nrf24l01. One of them will be connected to Farmbot and second one to Raspberry Pi. It will listen for incomming serial data and transfer it via nrf. I will try to implement checksum also. Will let you know about the results. I won’t be able to work on it nowdays but hopefully will test it soon. Thanks for your help.

2 Likes

@boylucky Sounds fun! Please share your progress - I am very interested to see how it turns out.

@RickCarlino - I went through some documentatio and also red some parts of firmware on the link you provided. Thanks for it. Please can I ask you about couple of pinouts if used in Farmbot firmware? I am interested about MOSI 50, MISO 51,SCK 52, SS 53 pins if they are used for some Farmbot functionality. I found them defined in pins.h as following:
#define UTM_K 52
#define UTM_L 53
#define AUX3_50 50
#define AUX3_51 51

Please can I ask you if they are really used for some device or functionality in the firmware? Or they are just defined without real usage? Thanks in advance.

@boylucky Since you’re running custom firmware, yes, you most likely could. You would probably need to comment out these lines, also: https://github.com/FarmBot/farmbot-arduino-firmware/blob/6cbdb66bb125f585ecb0fc10fe2afe086b0c23ee/src/farmbot_arduino_controller.cpp#L371-L372

@RickCarlino - perfect. I see some more lines to be commented there but thanks for pointing this out and for your help.

1 Like

Hi. You can use some of wireless UART bridges. For example these https://www.banggood.com/500mW-3DR-Radio-Telemetry-AirGround-Module-433MHz-915-MHz-For-MWC-APM-PIXHAWK-Pirate-p-982005.html?ID=510650&cur_warehouse=CN

1 Like

@Jane - Thanks for this UART bridge info. Looks nice with up to 1,5 km distance.

Currently I made a code for arduino which is connected to RPI and listen for incomming data on the serial port. Then when this data received it make the AES encryption and also the CheckSum and transfer the data via NRF to second arduino. Then it decrypt the message and check the CheckSum if ok. It is still work in progress but currently not much time for it. But if somebody would be interested in the code I can share it for further developement. Currently the alternative is done to have connected one more arduino on both endpoints (RPi and Arduino) but this is only for testing and developement phase. I intended to implement it later directly to Farmbot firmware for Genesis v.1.2.

But now I started to think about alternative where Raspberry Pi Zero would be used to make it a bit cheaper.

1 Like