B4R Tutorial B4R sending DHT11 data to B4J server which displays a Google Line Chart

An example of a DHT11 sensor connected to an Arduino interacting with B4J server application.
  • A B4R program gathers every 10s sensor data and sends the data in JSON format via UDP to a B4J server application.
  • The B4J server is listening to the UDP port, converts and stores the received data in a local file.
  • When connecting to the B4J Server via Webbrowser, a Google Line Chart is display and refreshed automatically every 10s.
  • The B4J server can receive data via UDP from any device, as long as data is send in JSON format. Did test the solution also with an ESP8266 running ESP8266 Basic.
  • Setting chart options can be done in the B4J application (handler chart).
  • Read the attached source for more info. The B4R DHT11 library is required.

upload_2016-5-17_10-27-6.png
 

Attachments

  • B4RHowToDHT11UDPGoogleChart.zip
    14.3 KB · Views: 664

rwblinn

Well-Known Member
Licensed User
Longtime User
One more just to close this one off - same hardware setup as previous example.
Instead of displaying as line chart, the temperature and humidity are shown in gauges and refreshed every 10s.
The gauges are seperated, means the B4J server creates a JSON string holding data & options for each of the gauges.
The index.html (in the www folder) defines each of the gauges and in addition uses w3.css stylesheets and also a nice trick to show the last update time taken from the JSON string.
Enjoy again.

upload_2016-5-17_16-10-25.png
 

Attachments

  • B4RHowToDHT11UDPGoogleGaugeChart.zip
    13.2 KB · Views: 552
Top