Hello, i need some help in a part of my project concerning the programming.
What i want to do is that on a prototype there will be 4 parkings and on each parking there will be one ultrasonic sensor. The ultrasonic sensor will determine if the parking is taken or not (for e.g. if distance <=10cm; parking is taken) and i want to send this data on a website/server/ip or anything similar so that anyone can access it from anywhere and has a realtime status of the parking. (If possible to also create an interface as well for e.g rectangles which will determine parking 1 along with its status, parking 2 etc)
I already have microcontrollers like an arduino Mega and a nodemcu ESP8266 as well as the 4 ultrasonic sensors.
Can somebody help me please?
Thank you.
Here is a piece example of the code for the ultrasonic sensor:
if (distanceCm<30){
Serial.print("Parking is taken and Distance in cm is ");
Serial.println(distanceCm);
}
else {
Serial.println("Parking is free");}
delay(1000);
}
Yes the ultrasonic data output will be in a range of values itself in term of distance.
Then, an if condition will determine if the parking is taken or not, which i'll need to play with to trial and test.
For e.g. if distance <= 10cm; parking is taken else; parking is free.
Online, i just need to display if the parking is taken or not.
It is the sending the data online real time and accessing it remotely that i don't know how to proceed.
You should understand that if you are a beginner, this is not a beginner level project. It will require knowledge of Arduino, networking, web servers, using multiple languages such as C++, maybe PHP, SVG, etc.
So what skills and resources do you have which could be useful? Do you have experience of coding? Do you have access to a web server?
Not really a beginner, i know a bit of Arduino and C++ because this project is for my last year of engineering and i had to learn all of those from scratch on my own.
I am currently researching a bit on php and sql but on those im a complete beginner.
Yes the parking area will have a wifi acess so that the sensors can communicate with the server.
So if someone could help me in creating this code, this would be of a big help to me.
the ESP8266 could be an ESP8266 web server
when a web client connects a page showing sensor results is displayed.
Connect the ESP8266 to a network which has internet access
Configure the network router to port forward HTTP requests (usually port 80) to the ESP8266
If you have control of the router (e.g. home network) that is simple
to connect to an organisations network is not simple
network managers are not keen on people setting up servers in their networks and have holes opened in the firewall to access then - usually involves much form filling
I just need a website to be more precise or else anything similar that anyone can access remotely from his phone or pc and on this website, the status of the sensors should be displayed in real time.
For e.g if at a particular instant, if in the 4 parkings, P1 is occupied, P2 is occupied and P3 &P4 is free, it should be displaying:
I access the data produced by 13 ESP32's from "anywhere" in the world from my web site.
I run a Raspberry Pi as an MQTT Broker that communicates with the ESP32's. The RPi then, using a Python program I write on the RPi, interfaces with my web sites database. From there the data is mine to do the things. Like control the HVAC in my house.
Realtime form the internet, The best you'll get is 4 or 5 seconds delay.
If you would like help from the members of this forum, it is important that you try to answer all the questions asked of you, even if the answer is "I do not know". In English, each question ends with a query symbol "?".
If this server is a typical web server, with PHP, SQL and so on, I would suggest the simplest approach would be to set up a couple of PHP scripts. One script would display a web page showing the current status of each parking space. The other script would receive requests from the nodeMCU when a space is occupied or vacated and update a flat file on the server which the first script can read.