Sensor Network and rPi's onboard WiFi?



  • Warning, noob question but I couldn't find a straightforward answer to this. If I have a sensor network built on say ESP8266 modules and am using the rPi 3 as the gateway, can I use the rPi's onboard wifi to talk to the sensors, or do I have to connect eg another ESP module to the rPi to handle this? All advice welcome, thanks in advance.


  • Mod

    Welcome to the MySensors community @Charlie

    You can build one or more wifi gateways based on esp8266 module(s). You can run a controller on the rPi, which connects to the gateway(s) using the rPi's onboard wifi. If you do that, you would not need a gateway on the rPi.



  • Thanks for that! Inevitable follow-up questions: if I have a network of sensors, each connected to it's own esp8266, can one of these act as the gateway as well as collecting its sensor data, or do I need a separate dedicated gateway? Also, this network may not always have internet access: can this configuration work in the absence of an external router etc - ie is it self-contained? Thanks.


  • Mod

    @Charlie could you describe what you mean by "a network of sensors", maybe in comparison to the MySensors network concept described on https://www.mysensors.org/about/network ?



  • Ah OK: so based on your diagram each sensor node (yellow circle with an S in it) would be an ESP8266 plus a sensor (temp, humidity etc), the controller would be the rPi using onboard wifi. I'm wondering if one of the sensor nodes (yellow circle) could also act as a gateway (blue circle) to enable all the sensor nodes to talk to the rPi, or if this needs to be a separate distinct module.


  • Mod

    @Charlie No. Each esp8266 plus sensor would be a gateway.



  • @mfalkvidd now I'm confused! I thought that a sensor + MCU + wireless module = a sensor node, and that each sensor node talks via wireless to a gateway which handles network traffic and also communicates wirelessly with a controller, sending it sensor data and routing commands around the network. But you're suggesting that sensor + MCU + wireless module = a gateway, so there would be multiple gateways on the network, each of which would talk directly to the controller? And every gateway would have a sensorID of 0?


  • Mod

    @Charlie said in Sensor Network and rPi's onboard WiFi?:

    But you're suggesting that sensor + MCU + wireless module = a gateway, so there would be multiple gateways on the network, each of which would talk directly to the controller? And every gateway would have a sensorID of 0?

    @Charlie yes that is correct, if you want to use wifi for the wireless communication.



  • Got it, thanks. So I'd need to set up each ESP with gateway software (looks like the best bet would be https://www.mysensors.org/build/esp8266_gateway ?) plus the code to read/write its attached sensor? And each gateway would talk to the controller, all in the absence of an external wifi network, ie it's self-contained? I'll go away soon, promise.


  • Mod

    @Charlie said in Sensor Network and rPi's onboard WiFi?:

    Got it, thanks. So I'd need to set up each ESP with gateway software (looks like the best bet would be https://www.mysensors.org/build/esp8266_gateway ?) plus the code to read/write its attached sensor?

    Yes this is correct

    And each gateway would talk to the controller, all in the absence of an external wifi network, ie it's self-contained?

    All solutions I've seen have used an external wifi access point. But I think it is possible to let the rPi act as a wifi access point if you do not have / want to use an external wifi access point. But that sounds like an unnecessary complicated thing to build. I might be wrong though, since I so far have been unable to understand what your use case is.



  • OK, thanks. I'm looking to build a self-contained wireless network of sensors and actuators which can be deployed in a range of environments. Some of these will have external wifi access so that simplifies things, but in some cases there won't be any external wifi in which case the network must be able to operate independently and the controller can store data / logs for periodic download probably by a physical connection to eg a laptop as part of a routine maintenance schedule. Hope this helps clarify my requirement.


  • Mod

    @Charlie yes it does. Thanks. Configuring the rPi to act as access point is probably the easiest way then. There are several guides on the internet, for example https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/overview



  • Cool. Many thanks for your prompt and helpful advice, much appreciated.


Log in to reply
 

Suggested Topics

  • 87
  • 1
  • 6
  • 9
  • 7
  • 2

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts