[Home]Raspsberry Pi

HomePage | RecentChanges | Preferences | My Website home page

Showing revision 7

The Raspberry Pi

https://www.raspberrypi.com/

I like the PC version that runs off a USB memory stick in an old laptop.

some Raspberry Pi enabled ideas

Reading the DS18B20 temperature chip is made simple on the Raspberry Pi.

http://ccgi.dougrice.plus.com/cgi-bin/wiki.pl?Plotting_DS18S20_Temperature_Readings_Using_SVG

It would be nice if the RPi could be made to start up logging on Reboot.

How do you get the readings off the Pi?

Use a Cron job to poll the DS1820 every minute and log to a file.

Maybe limit the size of the file by appending the date in a structured way.

temp_DS_YYYYMMDD.log

I had an idea of storing the samples in a simple function call in a file ending in .js and putting this file in the web server folder.

A remote webpage could include these, and is covered in my Guestbook idea is great for a simple experiment.

http://www.dougrice.plus.com/

It is possible to run a web server on the ESP01 devices and use it to poll the DS18B20 temperature chip.

http://ccgi.dougrice.plus.com/cgi-bin/wiki.pl?Function_Calls

wget can be used to get a web page.

curses can also be used.

Starting a simple Busybox Webserver

https://oldforum.puppylinux.com/viewtopic.php?t=115252

 sudo busybox httpd -p 0.0.0.0:8086 -h /home/pi/www

I changed the hostname of my raspberry pi to patrickpi

 http://patrickpi:8086/

 http://patrickpi.local:8086/

The Broadband router, I have has a useful frontpage

 http://192.168.1.254/

A Way to start a web server when the RPi boots:-

cron -A super-simple way to run scripts on boot

https://learn.pimoroni.com/article/running-scripts-at-boot

 crontab -e
 Add:

 @reboot python /home/pi/Pimoroni/blinkt/examples/rainbow.py &

A way to start a web server

A Way to start a web server when the RPi boots:-

A way to start a web server using rc.local

 # Howevery this already has two web servers you can use.
 #  *  busybox httpd
 #  *  python -m httpd.server 8080 &
 # 
 # To get it to boot on power up set up /etc/rc.local
 #
 # scp pi@patrickpi:/etc/rc.local rc.local.txt
 #
 #=================================================
 #!/bin/sh -e
 # owned by root
 # chmod 755 /etc/rc.local
 #!/usr/bin/ env python
 #
 # You could start a webserver using:-
 # python -m http.server 8080  &

 # log last boot time for debug purposes
 date > /home/pi/rclocal.txt

 # log env to file for debug purposes
 /usr/bin/env  >> /home/pi/rclocal.txt

A way to start a web server using system.d

 python dhr.py

 sudo nano /lib/systemd/system/dhr.service

 sudo systemctl start dhr.service

 sudo systemctl stop dhr.service

 sudo systemctl enable dhr.service

 sudo systemctl disable dhr.service

 sudo nano /lib/systemd/system/dhr.service

 [Unit]
 Description=dhrPythonScript.
 After=network.target

 [Service]
 ExecStart=/usr/bin/python3 /home/pi/dhr.py
 Restart=always
 User=pi

 [Install]
 WantedBy=multi-user.target

Python Web server

This will start a webserver. this can be very useful for getting files off the Raspberry Pi.

 python -m http.server 8080 --directory /home/pi

dhr.py - python web server

 sudo nano /home/ip/dhr.py

 import http.server
 import socketserver

 PORT = 8080
 DIRECTORY = "/home/pi"

 class Handler( http.server.SimpleHTTPRequestHandler ):
	def __init__(self, *args, **kwargs):
 		super().__init__(*args, directory=DIRECTORY, **kwargs)

 # Handler = http.server.SimpleHTTPRequestHandler

 with socketserver.TCPServer(("", PORT), Handler ) as httpd:
    print("serving at port", PORT)
    httpd.serve_forever()

some Raspberry Pi enabled ideas

http://ccgi.dougrice.plus.com/cgi-bin/wiki.pl?Plotting_DS18S20_Temperature_Readings_Using_SVG

http://ccgi.dougrice.plus.com/cgi-bin/wiki.pl?Function_Calls

http://ccgi.dougrice.plus.com/cgi-bin/wiki.pl?ESP01

http://ccgi.dougrice.plus.com/cgi-bin/wiki.pl?Esp8226

some Raspberry Pi enabled ideas

Reading the DS18B20 temperature chip is made simple on the Raspberry Pi.

http://ccgi.dougrice.plus.com/cgi-bin/wiki.pl?Plotting_DS18S20_Temperature_Readings_Using_SVG

It would be nice if the RPi could be made to start up loging on Reboot.

How do you get the readings off the Pi?

Use a Cron job to poll the DS1820 every minute and log to a file.

Maybe limit the size of the file by appending the date in a structured way.

temp_DS_YYYYMMDD.log

I had an idea of storing the samples in a simple function call in a file ending in .js and putting this file in the web server folder.

A remote webpage could include these, and is covered in my Guestbook idea is great for a simple experiment.

http://www.dougrice.plus.com/

It is possible to run a web server on the ESP01 devices and use it to poll the DS18B20 temperature chip.

http://ccgi.dougrice.plus.com/cgi-bin/wiki.pl?Function_Calls

wget can be used to get a web page.

curses can also be used.

A long time ago, in 2012, before the Raspberry Pi I brought one of these:-

http://www.phaedrusltd.com/index.html -

http://www.phaedrusltd.com/acatalog/Netiom_Produtcs.html

 Netiom Web enabled boards. 
 Standard Netiom
 Ref: Netiom-std
 Netiom is a stand-alone network aware Input / Output module which can be controlled over most networks including the Internet. It can be accessed from the Internet over a standard ADSL or other always 
 on connection making remote monitoring and control a cost effective option.

You could upload a web page of your own design and read the state of switches and analogue inputs.

I uploaded this file so I could include it into my web pages and read the values.

http://www.dougrice.plus.com/dev/js2_new.cgi

 ioF( "%31,analogue,%01,%02,%03,%04,"); %99

 ioF( "%31,digital1,%05,%06,%07,%08,"); %99

 ioF( "%31,digital2,%27,%28,%29,%30,"); %99

 ioF( "%31,counts,%11,%12,%13,%14,"); %99

 ioF( "%31,digital3,%41,%42,%43,%44,%47,%48,%49,%50,%51,%52,%53,%54,%55,%56,"); %99

 ioF( "%31,serial,%00,%12,%13,%14"); %99

http://www.dougrice.plus.com/dev/netiom.svg included the file and try and plot them:-

 < script  language = "JavaScript" type = "text/javascript" src = "_http://192.168.1.22/js2.cgi" >  < / script >


HomePage | RecentChanges | Preferences | My Website home page
This page is read-only | View other revisions | View current revision
Edited February 17, 2025 8:07 am by dougrice.plus.com
Search: