0

I have built a raspberry pi powered rc car which i currently control through ssh on my computer. this works but it isn't great. I'd like to use a second raspberry pi with a joystick to control the car. I've looked into wireless communication between pis and all i can find are people talking about how to read data from sensors.

I'd like to be able to do this using python as that's what I'm familiar with, does anyone have any suggestions?

2

1 Answer 1

1

As long as you have both Raspberry Pis connected to a WiFi router, then you can do it. I don't think you can just communicate between two WiFi devices without a router (that is, the router can receive/send all the signals, the Pis can only communicate with a router).

Here is a post on the raspberrypi forum that talks about that issue. They do mention about an AdHoc mode which I would imagine is what you're interested in. It's probably quite a bit of work to make it functional.

First I'd test with a router and make it work that way, then I'd look at making the AdHoc version if you're still interested...

As for the communication, SSH uses TCP, so any TCP or UDP sockets would be enough to communicate. It depends on whether you want to have encryption. If so, then using an HTTPS could be one of the simplest way (i.e. the encryption comes free to you). It's a bit heavier because of the rather large header, but it's a small price to pay for the mostly complete interface.

As CoderMike mentioned, there is also websockets. This is an extension of HTTP which is a permanent bi-directional connection.

2
  • thanks for the answer. i have a third raspberry pi (independent from this project) set up as a wireless access point, if i setup one of the raspberry pis that way would i still be able to use sockets ?
    – euan
    Mar 27, 2021 at 20:32
  • The sockets are part of the Network environment. The way the connection works will not affect how the network sockets function. As long as you can get the network connection to work, the rest will be just fine. Mar 29, 2021 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.