B4R Tutorial [B4R & B4J] DHT11 Data via RF24 to display as Google Chart

Hi,

please find a B4R & B4J HowTo Project: DHT11 Sensor Data send via RF24 Client to RF24 Gateway which routes to a Webserver displaying the Data in Google Chart

B4R RF24 Client
  • DHT11 sensor and a nRF24L01 radio module connected to an Arduino (MEGA used for this experiment).
  • RF24 client sends in regular intervals (defined by a timer) the DHT11 sensor data via a RF24 event to the RF24 Gateway.
  • RF24 client uses the RF24 new data event to set the interval time as given by the B4J server via the RF24 Gateway. If the "interval" function is received, the timer interval is changed.
  • Libraries used: rRF24, rRandomAccessFile, rDHT
B4R RF24 Gateway
  • Ethernet Shield and nRF24L01 radio module connected to an Arduino (MEGA used for this experiment).
  • RF24 gateway uses the RF24 new data event to handle data coming from the RF24 client. The data is send via websockets to the B4J server.
  • RF24 gateway uses websocket new message event to send the interval time as given by the B4J server to the RF24 client.
  • Libraries used: rRF24, rRandomAccessFile, rWebSocketClient, rEthernet
B4J Server
  • The B4J server (port 51042) uses two websockets, one for the Arduino RF24 gateway connected (as sending the DHT11 data provided by the RF24 client) and the other for the webclients via browser.
  • The Arduino class handles first the update of the chart data: stores the values in a data file located in the dirapp folder (with a limited number of data entries).
  • Secondly the line charts for all connected browsers are updated (a great feature - tested on 3 clients simultanously including Raspberry Pi). This requires no extra timer for the clients.
  • The webinterface has in addition to the line chart, a button to show an About modal dialog and a button to set the interval via a modal inputdialog - the interval is taken by the RF24 gateway and changed accordingly.
  • The footer of the webinterface shows the last update and the refresh interval.
  • W3.CSS is used for the webinterface.
  • Libraries used: jServer, JSON, jNetwork
Read the project notes in the various project files. These are well documented. See attached.

Notes
  • Experienced communication drop outs when using different nRF24L01 manufacturers. Some time comminucation hangs. No issues when using same manufacturers.
  • Ensure to place the nRF24L01's as high up as possible to get a range of 50 - 80 meters. To consider using nRF24L01 with an antenna (NRF24L01-antenna).
  • Building this experiment, was a good opportunity to use various B4X tools and libraries and glue the building blocks together.

upload_2016-5-25_12-1-47.png


upload_2016-5-25_12-3-1.png

v2016.05.25
 

Attachments

  • B4RHowToDHT11RF24GoogleChart.zip
    98.8 KB · Views: 392
Top