SIMCOM A7670C GSM sensor data printing on website using Arduino Uno

SIMCOM A7670C GSM sensor data printing on website using Arduino Uno.

This is the code of data :-

#include <Wire.h>

// Constants
const int analogPin = A0;    // Analog input pin for voltage measurement
const float voltageReference = 5.0;   // Reference voltage used for ADC
const float pressureMin = 0.0;   // Minimum pressure value in psi
const float pressureMax = 100.0;  // Maximum pressure value in psi
const float pressureBarMin = 0.0; // Minimum pressure value in bar
const float pressureBarMax = 25.0; // Maximum pressure value in bar
const float psiToBar = 0.0689476; // Conversion factor from psi to bar
const char deviceID[] = "AKN"; // Device ID

// Variables
float pressure;              // Pressure value

void setup() {
  Serial.begin(115200);        // Initialize Serial communication
}

void loop() {
  // Read the voltage from the analog pin
  int sensorValue = analogRead(analogPin);

  // Convert the voltage to pressure
  float voltage = sensorValue * (voltageReference / 1125.0);
  pressure = ((voltage - 0.5) / (4.5 - 0.5)) * (pressureMax - pressureMin) + pressureMin;

  // Check if pressure is below the minimum threshold
  if (pressure < pressureMin) {
    pressure = pressureMin;
  }

  // Map pressure value to the range of 0-25 bar
  float pressureBar = map(pressure, pressureMin, pressureMax, pressureBarMin, pressureBarMax / psiToBar);

  // Get the current time and date
  String currentTime = String(__TIME__);
  String currentDate = String(__DATE__);

  // Create the output string
  String outputString = "$$$ | " + currentDate + " & " + currentTime + ", " + deviceID + ", " + String(pressure) + ", " + String(pressureBar) + " ###";

  // Print the output string
  Serial.println(outputString);

  delay(100);  // Delay for 1 second before taking the next reading
}

i want to print this data on my website using GSM module how can i do this?

What do you mean by that?

Is that a website running on your Arduino, or hosted elsewhere?

If hosted elsewhere, it's a two-step process:

  1. Send the data from your Arduino to somewhere that the website can "see" it;
  2. Get the website to retrieve the data & present it as required.

Only the first part involves the Arduino.

How to do the first part will depend on what the server(s) involved can support - you will have to consult the documentation for your server(s) to find out.

That does not really mean anything. You don't print data on a website..

a website is a bunch of file or programs, accessed through HTPP and presenting content in various forms, mainly HTML pages. (most of the time - can do other stuff)

do you want to send this data to your server so that it's collected in a database or do you want to be able to answer a request from a webpage to show this information?

1 Like

or perhaps investigate the banner across the top of the forum:

yes i want to send data to the server so it can be collected in database

can you give me more info on that?

Not really - because we have no idea what server(s) you're using, nor what protocols/services it/they support for receiving & storing data.

Again, you will have to consult the documentation for your server(s) to find this out.

Did you look at this:

So what server, what database interface etc… basically it will likely be a GET or POST request over HTTP

I wouldn't be so sure; eg, could be MQTT, or many other possibilities.

Fair point indeed (most projects we see around here have a small MySQL backend and the Arduino speaks to a PHP or Python script over HTTP)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.