0

I'm planning to build a remote controlled car based on either a Raspberry Pi 3 or a Raspberry Pi Zero (the one with bluetooth and WiFi).

Currently I'm struggeling with how to communicate with the Pi. My first try was using bluetooth but I had some problems getting the bluetooth module to run and connect to it with my mobile phone. What I'm more experienced with is simply using WiFi. It's (in my opinion) much easier to develop for, both server and client, and use existing libraries, protocols etc.

The only problem I have with it now: Raspberry Pi and the mobile phone need to be in the same network, which wouldn't work if I take the Pi outside to run the car in the park for example.

I'm wondering if it is possible to make the Pi a "router" so any device can connect to the Pi's WiFi and start communicating with it (of course it's not a real router, I know)? I read about ad-hoc networks and access-points, but I'm not sure which one would suit my requirements best.

Stefan
  • 113
  • 2

2 Answers2

1

Ad-hoc networks, or "mesh" networks, aren't really designed for your purpose at all. Many devices don't support them (Android phones and Windows laptops can't connect to Ad-hoc networks).

You need an "access point" - this behaves much like a normal router. There's a tutorial here on the official Raspberry Pi website that accomplishes it. It uses a program called hostapd to broadcast the network and another called dnsmasq to assign IP addresses.

Brooke Chalmers
  • 368
  • 2
  • 7
1

I confirm to the answer from @Wesley Chalmers but let me elaborate it a bit.

You asked for the best solution to connect to your remote controlled car. Using peer-to-peer (ad-hoc) or WiFi-direct connections isn't optimal for your needs. It is mostly used for mobile devices that want easy to connect to fixed devices on different locations, for example printer.

What you need is a connection that is provided by the RasPi on the car so remote controls can connect to it. There is no need to be very flexible because remote controls for the car are special devices and I think you do not have much of them. So I mean a simple isolated access point running on the cars RasPi is a good solution. Any remote control, even your friends one, can connect to the access point as far as it is able to connect to managed wireless networks (the most used one nowadays) in general. How to setup a simple isolated access point you can look at Setting up a Raspberry Pi as an access point - the easy way, Section: Setting up a stand alone access point.

Ingo
  • 42,961
  • 20
  • 87
  • 207