gev_u
Posts: 1
Joined: Thu May 06, 2021 8:27 pm

Access raspberry via ethernet cable + html interface

Thu May 06, 2021 9:30 pm

Hello everyone in the forum!

I'm a new user of Raspberry Pi, I have a Raspberry Pi 4 and I would like start playing with it.

I would like to be able to connect the raspberry to my pc (I'm using ubuntu as operating system) through an ethernet cable and then accessing an user interface in form of a web page opening a browser and typing an ip address. The idea is to create a webpage coded in html that shows some data and make the user able to interact with the raspberry pressing buttons and seeing the effect on the stuff connected to the raspberry (a simple led for now...).

So the buttons on the webpage should be connected to some code in the raspberry that activate a led when a button is pressed and the webpage should show data for example from a temperature sensor or other sensor.

The webpage will be coded in html, while the code inside the raspberry will be c++. I know C++ and a bit of html, but I'm not expert of server and web programming at all. Could you please point me in the right direction providing a tutorial or maybe pointing me to a thread of this forum?

I searched the web a lot and it seems I have to implement a web server, but I'm not sure if it is correct and I don't know how to access the raspberry through the ethernet cable.

jbudd
Posts: 1828
Joined: Mon Dec 16, 2013 10:23 am

Re: Access raspberry via ethernet cable + html interface

Fri May 07, 2021 12:20 pm

It is possible to connect your Pi and PC directly using an ordinary (not cross-over) ethernet cable. You have to have suitable static IP addresses defined on each device. But it's likely to be much simpler to connect both the Pi and the PC to your home router.

There is information about setting up a web server at https://www.raspberrypi.org/documentati ... r/nginx.md

But you might like to take a look at Node-Red for rapidly getting sensor readings, displaying the result on a web page and switching LEDs, all without installing a web server or writing code.
https://circuitdigest.com/microcontroll ... spberry-pi

drgeoff
Posts: 12049
Joined: Wed Jan 25, 2012 6:39 pm

Re: Access raspberry via ethernet cable + html interface

Fri May 07, 2021 12:27 pm

jbudd wrote:
Fri May 07, 2021 12:20 pm
It is possible to connect your Pi and PC directly using an ordinary (not cross-over) ethernet cable.
The ethernet interface is auto-sensing. Works equally with a straight or a cross-over cable.
Quis custodiet ipsos custodes?

jbudd
Posts: 1828
Joined: Mon Dec 16, 2013 10:23 am

Re: Access raspberry via ethernet cable + html interface

Fri May 07, 2021 12:38 pm

Yes. I didn't mean to suggest a cross-over cable wouldn't work, just that it's not necessary.

Return to “Beginners”