Displaying information on LCD and Website.

So, I have built an Air Pollution Monitor that displays the Particulate Matter Pollution on an LCD. I was wondering if it was possible to somehow display that information on a webpage while also maintaining the values on the LCD. (Note this device would be placed in the public, therefore there is no access to a laptop).

#include "PMS.h"
#include "SoftwareSerial.h"
#include <LiquidCrystal.h>
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);

SoftwareSerial Serial1(2, 3); // RX, TX

PMS pms(Serial1);
PMS::DATA data;

void setup()
{
  Serial1.begin(9600);
  lcd.begin(20,4);
  lcd.setCursor(0, 0);
  lcd.print("Warming up");
  delay(4000);
  lcd.clear();
}

void loop()
{
  if (pms.read(data))
  {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Particle Pollution");
    lcd.setCursor(0, 1);
    lcd.print("PM2.5 :" + String(data.PM_AE_UG_2_5) + "(ug/m3)");
    lcd.setCursor(0, 2);
    lcd.print("PM10  :" + String(data.PM_AE_UG_10_0) + "(ug/m3)");
    lcd.setCursor(0, 3);
    if (data.PM_AE_UG_10_0<15)
      lcd.print("Excellent Quality");
    else if (data.PM_AE_UG_10_0<20)
      lcd.print("Very Good Quality");
    else if (data.PM_AE_UG_10_0<25)
      lcd.print("Good Quality");
    else if (data.PM_AE_UG_10_0<30)
      lcd.print("Decent Quality");
    else if (data.PM_AE_UG_10_0<35)
      lcd.print("Ok Quality");
    else if (data.PM_AE_UG_10_0<40)
      lcd.print("Ok Quality");
    else if (data.PM_AE_UG_10_0<45)
      lcd.print("Not Good Quality");
    else if (data.PM_AE_UG_10_0<50)
      lcd.print("Bad Quality");
    else if (data.PM_AE_UG_10_0<55)
      lcd.print("Very Bad Quality");
    else if (data.PM_AE_UG_10_0<100)
      lcd.print("Horrible Quality");
    delay(1000);
  }
}

Kind Regards,
Ahmed

What Arduino do you have?

You will need a network connection so either a Ethernet shield or something like an ESP8266 WiFi module if the Arduino that you have has no network connection.

Why still using Strings? It may not matter now, but in a couple of weeks or a month or ... when the program starts doing weird things, locking up or resetting you will understand why I warned you about them.

If the APM is in public, do you want to see the webpage on a mobile device when you are close to the APM or do you want to check the data from "anywhere" in the world? For access from far away ou will need a means of sending the data to the internet.

Here are a few pointers to get you thinking.

For local access:

  • Bluetooth LE is very low power and could provide the data as a Bluetooth beacon to people nearby. They can see the data on an App on their phone.
  • WiFi needs more power, but you can send more data and provide a local Webserver.
    Both of these can be public, or access controlled.

For long distance access:

  • You can connect via WiFi to a nearby network and then ether send the data to the cloud or your own server.
  • LoRa is a low-power wide-area network (LPWAN) technology that would allow you to send smaller amounts of data over longer distances if there is no WiFi network around
  • There are also modules that can connect to the mobile network, but they are even more power hungry.

Also an important question. How much data do you want to display? Just the current values or collected data from hours, days, months ... ?

It is just a one time project that I will only need for about a week or two. Hence why I used strings. So to display information on a website, the arduino must be able to connect to a wireless network?
Kind Regards,
Ahmed

groundFungus:
What Arduino do you have?

You will need a network connection so either a Ethernet shield or something like an ESP8266 WiFi module if the Arduino that you have has no network connection.

Why still using Strings? It may not matter now, but in a couple of weeks or a month or ... when the program starts doing weird things, locking up or resetting you will understand why I warned you about them.

Or a wired network (Ethernet). Is the website on the Internet?

Hence why I used strings.

You used Strings. There are Strings and there are strings. They are not the same and the terms cannot be used interchangeably. I don't mean to be pedantic, but in programming details like that are very important. It is your code so you can do what you want. I just wanted to let you know about the pitfalls.