Tapatalk

Talk2 Contact: Sensor Nodes + RPI Base Station

Talk2 Contact: Sensor Nodes + RPI Base Station

1885
1885

PostAug 04, 2016#1

From time-to-time we'll grab a few contacts and queries from our Site and/or Store and publish here. We believe that some questions are quite common and can help others with their own projects. We'll make sure all private information is removed, keeping it anonymous.

:?: Question from Talk² Store on 02/Aug/2016:
Hi there,

Before I buy some nodes, I have a few questions... Basically I want to put a bunch of sensors in and around the building, while collecting data in a central place. The current idea is to have whisper nodes on battery's collecting the sensor data and a (powered) Raspberry PI processing everything.

1. Will the Whisper nodes work with concrete walls? This building is full of them...
2. If you have a dozen Whisper nodes (talking) and a single Raspberry PI receiving, will that work? (I assume I do get some packet loss / interference, which is fine.)
3. What should I buy to create a Raspberry PI receiver? I can of course connect a whisper node through Serial/USB, but I'm unsure if that's the best way.
4. I assume sensors should work on 3.3V?
5. Given I intend to send 1 sample per minute (but collect every second), how long will the node probably run on a pair of AA batteries?

Thanks,
<name>
:arrow: Reply:
Hi <name>, Thanks for getting in contact.

I'll try to answer your questions on the same order, but please let me know if you still have any question.

1. Short answer is Yes. But as any radio signal, there are limitations. On local tests we currently have a node talking with a base station and thought 3 brick walls in a range of approximately 35 meters away and the signal quality still quite good. On open spaces the range is over 500m during tests. We also have a node inside a "Fridge", which is a metal box and it works fine reporting temperature and other data.

2. Yes, there's no limitation on the number of nodes. What might happen is a package collision if more than one node tries to transmit exactly at the same time. But given that the transmission is quite fast and you'll be transmitting only sensor data it shouldn't be much of a trouble. In the worst case, it's just a matter of implementing a send+ack. If no ack is received back, the node re-transmits the package.

3. We do have the Raspberry PI HAT, but that might take while until we have it in full production. On our experiments, we normally hook a Whisper Node directly to the Raspberry PI Serial Port (not via USB). Doing that it's just a matter of creating a protocol to "route" messages from/to the serial port over the Radio. The base node can be very "dummy" and all the intelligence is done by the Raspberry Pi using any other language, like Python.

4. The board is 3.3V, but if you have any special requirement, the MCU supports 5V. Just need to pay attention to the SPI pins as they're shared with the RFM69, which is 3.3V only. Bear in mind that the step-up from the battery will supply only 3.3V, so if 5V is required an external supply needs to be used. For example, powering it from the microUSB using a phone charger will provide the 5V and you could power sensors or actuators with it.

5. That's very difficult to answer without knowing the consumption of each sensor and the time required to read/process the data. Saying that you could try to estimate it by using some simple calculations, for example:

A - If your full cycle is 1 minute, you need to calculate the average consumption for this period.
B - You'll be performing 60 readings and to power the MCU and the sensor let's assume you'll consume 25mA for 10ms.
C - You also need to include the transmission cycle, that will happen every full minute, and we can suppose it'll consume 50ma for others 10ms.
D - All other time, everything should be sleeping and we can estimate something around 15uA (0.015ma).

Now need to calculate the whole average consumption, here the figures:
Reading Sensors: 600ms @ 25mA
Transmitting: 10ms @ 50mA
Sleeping: (60000ms - (600ms + 10ms)) = 59390ms @ 0.015mA

Here how we calculate average:
(600ms * 25mA) + (10ms * 50mA) + (59390ms * 0.015mA) = 15000 + 500 + 890.85 = 16390.85
16390.85mA*ms / 60000ms = 0.273mA

So the average consumption is 0.273mA or 273uA. Considering two AA will provide 2700mA/h @ 3.0V, we can round down it to 2000mA/h already discounting some voltage-drop, self-discharging and the step-up efficiency.

2000mA/h means that if your circuit consumed 2000mA, it would last only one hour running. Now your circuit consumes only 0.273mA so we need to divide 2000mA/h per 0.273mA:

2000mA/h per 0.273mA = 7326h or 7326h / 24h = 302 days!

As you can see above, the reading every second is by far the biggest consumption. If you plan to have the sensor nodes running for longer, you could reduce the reading frequency or maybe try to reduce the power usage during this the reading, maybe slowing down the MCU. All comes down to a strategy now.

Well, hopefully I answered your questions... and sorry as sometimes it's difficult to give a short answer.

Cheers,
Talk²

5

PostSep 28, 2016#2

Firstly many congrats on a fantastic product
I have 5 of these beauty's transmitting various states of pumping equipment housed in a power station here in the UK.
All are transmitting to a 6th node and the next stage is to collate all this into a web based display.
So, picking up on your comment in point 3, do you have a connection diagram and possibly some sample code to enable a node to talk to the Raspberry PI.

5

PostSep 28, 2016#3

SeanFell wrote:Firstly many congrats on a fantastic product
I have 5 of these beauty's transmitting various states of pumping equipment housed in a power station here in the UK.
All are transmitting to a 6th node and the next stage is to collate all this into a web based display.
So, picking up on your comment in point 3, do you have a connection diagram and possibly some sample code to enable a node to talk to the Raspberry PI.
HI there, the way I'm currently connecting the "main whisper node" receiving all the data to my ESP8266 is through serial communication. You could do the same thing with a raspberry pi. Just connect the RX of the node to the TX of the PI and the TX of the node to the RX of the PI.

The way I do it is by a certain start character ($) and end character (#) to my string with data.

For instance I send a sensor measured distance and my node ID and voltage to the main whisper node, then my main whisper node sends it over serial to my ESP:

Code: Select all

Serial.println(String('$') + String(nodeID) + String(':') + String(distance) + String(':') + String(batVoltage) + String('#'));

And then my esp listens to this, and posts it to my webserver, which in term will parse the string further:

Code: Select all

//Listen for begin of message
  if(Serial.read() == '$')
  {
    int Message[100];
    for(i=1; i<100; i++)
    {
      delay(10);
      Message[i] = Serial.read();
      if(Message[i] == '#')
      {
        break;
      }
    }
// Post your received message?

I'm not saying this is the best way, I've just started using these types of devices, but this works great for me :)

5

PostSep 28, 2016#4

Seems straight forward enough
It's safe to cross connect TX/RX between a node and the Raspberry PI then without any sort of 'isolation/voltage conversion' ?
The only reason I mentioned it was because I was attempting to research 'arduino to raspberry pi' connectivity using serial port and a lot of them mention doing 'voltage conversion' on the connections.
I'm guessing this is because a standard arduino nano works at 5v signal levels and the raspberry pi at 3v
Your nodes are at 3v so no sort of conversion/protection needed, is this correct ?
Many thanks for your previous prompt response

1885
1885

PostSep 28, 2016#5

Hi SeanFell,

Glad to hear that things are working fine! Regarding the WhisperNode <--> RPI via Serial, it's safe to connect both as they run on 3.3V.

You only need to consider any kind of isolation if your Whisper Node is in contact with some high voltage equipment, but in this case I would say that the isolation should be on that side. For example, never controlling a relays or solid-state relays directly, always using optocoupler.

For Web displaying, I like to user "Grafana" very much (https://talk2.wisen.com.au/2016/05/24/influxdb-grafana/). I'll clean-up some code I have a post a complete end-to-end example how to collect data, send to a PC/RPI via serial and display it... just need few days ;)

Cheers

4

PostMar 01, 2017#6

Do we need to connect Whisper ground to RPI ground or will just TX/RX suffice?

1885
1885

PostMar 01, 2017#7

You need to connect Ground as well, as this will be the reference for the TX and RX signals. If you're going to use the built-in UART port from RPI, don't forget to disable the Linux Serial Console so you can use if for communication.

313

PostMar 02, 2017#8

Up to now I have not done anything with ground and have not seen any issues with just using TX/RX. Depending on if you are using a Pi1/2 or Pi3 there is a little difference in disabling the Serial Console, but there are lots of documentation on how to do it.

Utilizing it with a whisper node works nicely (will have to revisit using the ground as well).

1885
1885

PostMar 02, 2017#9

Hi xnih13,

That's very curious... How are you powering the RPI and Whisper Nodes? The Serial TX and RX are not a differential signal, so they use ground as reference. For example, to send "1" the voltage on the TX will raise for a few micro-seconds, if there's no common ground (or a return path somehow) the electricity will not flow.

Give a try and put a Multimeter measuring the resistance between the RPI ground and the Whisper Node ground on your setup, it's very likely it'll be something smaller then "infinite" (L).

313

PostMar 03, 2017#10

Pi powered from micro USB, Whispernode powered from the USB from Pi.

TX on Whispernode to RX on Pi
RX on Whispernode to TX on Pi

Will check with multimeter this weekend when I get a chance.

Any chance it is using the ground through the USB?

Read more posts (1 remaining)