more notes for a bad memory - - -
Setting up the Raspberry Pi with a 3.5 inch colour LCD and Epiphany browser in Kiosk mode
Show a web page in full screen (Kiosk mode) that is controlled by CGI scripts to show solar water heater performance etc.
I bought a 3.5 inch 320x400 display for a Pi for under £9 from eBay
It is pin sharp and colorful - I thought that 1 or 2 pixels were dead (hence the price?)
but their location is random - perhaps a data comms problem?
I loaded the img file -
Load the image with Apple Pi-Baker
Set a fixed IP address in /etc/interfaces/network
# The loopback network interface - always needed here
# this one for dhcp
# this one for WIFI D-Link DWL-G122
# The primary network interface - use this for ethernet cable if WIFI above not used
# set these for the LAN address
# set this for the Internet modem gateway to the LAN
# my gateway acts as a local dns-nameserver (not needed?)
Do not change the bootloader during the update
sudo apt-mark hold raspberrypi-bootloader
Update/upgrade the PI image
sudo apt-get update && sudo apt-get upgrade -y
Create a webserver that will be used to create the local web page at 127.0.0.1 for the Kiosk mode
sudo apt-get install apache2 -y
Note - I tried to load PHP at various point in this procedure. After all seeming to work I backed up the image with PiBake (Mac).
On the next boot I could not see the GUI screen - just a black screen tha accepted typing from the keyboard.
This happend several times.
Epiphany browser - Boot to a web page and set Kiosk mode,
Create full screen as if key F11 pressed
sudo aptitude install xautomation
# launch the web page of choice (this one is the default that Apache creates in /var/www
# this does the same job as pressing the F11 key to force Kiosk mode
then do -
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
@lxpanel --profile LXDE-pi
# kill the screen saver
and the Pi will show the normal GUI followed by the Apache default web page in full screen mode at /var/www/index.html
This is the default web page for this server.
The web server software is running but no content has been added, yet.
There are no borders and no way to poweroff cleanly other than hitting the "Windows" key on the keyboard.
I aim to create the page from a script and add a poweroff button.
First prepare the Raspberry Pi
I need a ramdisk for changing data so as to not burn out the flash memory
Place this with 755 permissions into
Every time the Raspberry Pi is booted the temporary RAM disk will be created - 2M means 2 Mega Bytes
it could be much larger - I use it for the output of bash scripts and the input of Blassic basic programs.
(Blassic basic acts as great glue to hold together other software including C, bash etc and can save and read files as needed.
It handles and manipulates text string in ways I can understand and remember - (unlike C !!!!).
Learn Python and C++ if you can but if you only program a couple of times a year consider Blassic as a tool to get the job done.
See a few notes at pull down menu item 12 at -> http://www.sunspot.co.uk/Projects/sweexproject.htm )
# Now carry out specific functions when asked to by the system
# make a ramdisk to save the flash
Setting up the Pi as a webserver
Get the latest software and links
apt-get install apache2
There should be a simple webpage index.html in /var/www/
see it at http://192.168.0.82
CGI scripting in bash
echo -e "Content-type: text/html\n\n"
echo "<h1>Hello World</h1>"
then create a link to cgi-bin in the www folder :-
ln -s /usr/lib/cgi.bin /var/www/cgi-bin
see it at http://192.168.0.82/cgi-bin/hello.cgi
Add PHP - works - but it was not stable. . . .
sudo apt-get install php5 libapache2-mod-php5 -y
To test PHP put into /var/www/php_test.php
echo "<b>Hello World!</b><BR><BR>The date is ";
echo date('Y-m-d'), "<BR>and the time is ", date('H:i:s');
echo "<BR><BR>Now for some information about PHP :-<BR><BR>", phpinfo();
see it at http://192.168.0.xxx/php_test.php
If there are several Raspis on the network change their host names
sudo nano /etc/hosts
sudo nano /etc/hostname
me if you want to swap notes
- especially if you do a better job !!!!
and/or add i2c port expanders, thermometers, displays etc
(my next learning exercise)
more to come . . .