For science fair I need to know how to transfer data constantly from a sensor, to a raspberry pi, to a web browser in HTML for part of my project, but I can’t figure out how to do this.
There are many ways to do this, which might be why you’ve not been able to find one answer. Will this be just for the fair and not used afterwards, or will you be looking to use it later?
Will you be the only person looking at the data or could there be hundreds, thousands, or more people looking at the data?
I’ve been meaning to reply with a more complete answer but been really busy and tired. Here it is at last:
Read values from sensors
Most electronic circuits poll the sensor for values. That means they read the value from the sensor over and over at regular intervals. Most hobby projects probably do this far more frequently than necessary but there’s so little power used by most that the cost is negligible. So that resolves getting the value/s from the sensor/s to the controller (Pi, Arduino, ESP, MSP, etc.)
Display values in a browser
By far the simplest for this is to make the Pi/ESP a web server. There are libraries for this so you don’t have to write your own. It won’t scale well because, as you can imagine, these little devices are not designed to host sites for millions of users. But they’ll do a fair job if the pages you serve are small and simple.
The most complex option is to send the sensor data from the Pi/ESP to the cloud. All of the top cloud providers have specific IoT features for this sort of thing and will have web app features to let you provide a website that can show that data. This will require a good deal of cloud configuration knowledge as well as programming knowledge but it will let you have a site that billions of people can view (at a cost).
I hope that makes it easier to understand.