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.

3
  • Why so complex? Isn't it much simple to use standard RC control with RX (PPM, PWM, SBU, Serial or any other from millions)? In case of RPi you can run something know as Hosted Network (ad-hoc or WiFiDirect mode). Mar 14, 2019 at 12:22
  • Good question. Honest answer: I don't know. Well I tried using some 433Mhz chips I still had lying around and managed to send data through them, but the signal was quite unstable (many data errors), that's why I switched to trying bluetooth or WiFi. I need a stable connection between the RC and the Pi that can communicate in both directions and doesn't require line of sight (like infrared). WiFi was the first that came to my mind.
    – Stefan
    Mar 14, 2019 at 13:15
  • Well. There are lot of 433/915MHz radio modems. They are not too fast but enough for such projects. I used one from 3D Robotics (915MHz) with long range FPV (about 3 km) without any problem. Of course the range will be shorter on the ground but long enough. If you need bi-directional connection for telemetry only there is something know as "audio telemtry" (when telemetry data is transmitted by audio channel of video downlink. 2.4 or 5.8Ghz video link (800mW) is enough for even ground connection. Mar 14, 2019 at 16:03

2 Answers 2

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.

8
  • Wrong. Android and WinPhone (or any other OS) can connect to ad-hoc because it appears as Soft AP. It does not matter is this Soft AP based on ad-hoc or on WiFiDirect. Mar 14, 2019 at 12:21
  • No, you're wrong. Soft AP and Ad-Hoc mode are two very different things: stackoverflow.com/q/6592215/9911657. Many wireless radios do not support ad-hoc and many operating systems do not support connecting to it. Soft AP means that one node is the designated server and all other nodes are clients, while ad-hoc means that all nodes are peers - they are fundamentally different ideas and different 802.11 modes. Mar 14, 2019 at 12:30
  • It depends on terms you use. In terms or RPi with modern OS Soft AP can act as ad-hoc (legacy mode) and as WiFi Direct Soft AP (Legacy mode). The same if you run Win 10 IoT. And even in classic ad-hoc (legacy WFD) any cell can connect to it (through WFD in legacy mode). Mar 14, 2019 at 12:35
  • No, not all devices support Ad-hoc. Android doesn't support it at all without rooting your phone: stackoverflow.com/q/5100928/9911657. And the OS on the Pi shouldn't matter because Ad-hoc is a standard mode across operating systems. WiFi-direct and Ad-Hoc are not the same thing. Mar 14, 2019 at 12:40
  • To correct the comment from Wesley Chalmers: "Many wireless radios do not support ad-hoc ..". This is not true. Every device compliant to IEEE 802.11 must implement IBSS (independent basic service set) which is the ad-hoc (peer-to-peer) mode wikpedia - Wireless LAN.
    – Ingo
    Mar 14, 2019 at 12:44
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.

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.