This page is intended for the participants of 'Using Raspberry Pi as Data Server for Embedded Systems' training course (April 3-4, 2018).
Updated20180402: The course has been postponed to April 4-5, 2018.
Raspberry Pi has gained considerable interest among researchers, specifically in using it as a platform for systems development. Most research projects are currently leaning towards having some kind of data collection and processing system, that is also preferably capable of serving the information on the internet. A Raspberry Pi board has the perfect set of features that fits into that category - it has sufficient general purpose I/O (GPIO) pins for interfacing, 32-bit ARM processor for processing data, and capable of running server applications.
This is actually an intermediate-level course that requires participants to have some basic understanding of various system-level hardware and software knowledge of a practical application. However, this course will try to present the absolute necessary knowledge that will hopefully allow a project (that requires such setup) to get started.
This course covers fundamental ideas related to the following topics:
This course is designed to provide some basic insights on how a Raspberry Pi can be used as a data server.
Upon completion of this course, the participants should be able to:
This course is designed for engineers, researchers, system designers, technical specialists, graduate students and individuals who are interested in developing fundamental skills on embedded systems development, especially towards IoT compliance.
Related keywords: Raspberry Pi, Data server, API server, server-side programming, Web Server, client-side programming.
Sessions | Details | Materials | Notes |
---|---|---|---|
Session 1 |
| Playtimes 1 - 4 Some basic socket programming here |
|
Session 2 |
| lecture slides preparation in progress… | Playtimes 5 - 8 Some basic SQL coding here |
Session 3 |
| lecture slides preparation in progress… | |
Session 4 |
| lecture slides preparation in progress… |
Most of the things here will be prepared by the instructor. This is basically for your reference in case you would like to fully experience building the system.
Note: The term SD card mentioned here generally covers/means the microSD card.
We will be using Raspbian (the official Linux distribution for Raspberry Pi). This enables us to run web servers and other network-related stuffs.
[201804011654] Note: I just noticed there is now an option to use Windows10 IOT Core (which is prepared by Microsoft as a third party option), but I will not be using that here. Maybe in the future? Checkout this page for other options
dd if=2018-03-13-raspbian-stretch.img of=/dev/sdb
and wait…Some notes:
fdisk /dev/sdb
e2fsck -f /dev/sdb2
resize2fs /dev/sdb2
sudo apt update
and upgrade sudo apt upgrade
if necessarysudo apt install raspberrypi-kernel-headers
sudo apt install sqlite3 libsqlite3-dev
sudo apt install apache2
/var/www/html
sudo apt-get install php libapache2-mod-php
sudo apt install avahi-daemon
mkdir -pv /home/pi/Work && cd /home/pi/Work git clone git://github.com/azman/my1codelib.git git clone git://github.com/azman/my1webapp.git git clone git://github.com/azman/my1apisrv.git git clone git://github.com/azman/my1linuxpi.git git clone git://github.com/my1matrix/my1goose.git
These are the code snippets / instructions for the practical (playtime) sessions!.
Note: sysfs interface for GPIO is marked DEPRECATED! Useful variable - assume we want to access GPIO26 (26 is NOT pin number) # export GPIO=/sys/class/gpio # export GPIO_NUM=26 # export GPIO_PATH=$GPIO/gpio$GPIO_NUM To capture/enable GPIO access (IF still disabled) # [ ! -d $GPIO_PATH ] && echo $GPIO_NUM > $GPIO/export To check if the interface has been created # ls -l $GPIO_PATH By default, a GPIO pin acts an input. To configure a GPIO pin as output # echo out > $GPIO_PATH/direction To set a GPIO pin to logic HI (Vdd) # echo 1 > $GPIO_PATH/value To set a GPIO pin to logic LO (GND) # echo 0 > $GPIO_PATH/value To blink it (press CTRL-C to stop) # while true ; do echo 1 > $GPIO_PATH/value ; sleep 1 ; echo 0 > $GPIO_PATH/value ; sleep 1 ; done To configure a GPIO pin back as input # echo in > $GPIO_PATH/direction To read current value # cat $GPIO_PATH/value To release/disable GPIO access (IF enabled) # [ -d $GPIO_PATH ] && echo $GPIO_NUM > $GPIO/unexport
Get to my1codelib folder # cd /home/pi/Work/my1codelib Compile test socket program # make my1sock_test To run the server test program # ./test_my1sock --server At the browser, type "https://localhost:8080/test/this/path" To run the client test program (in another terminal) # ./test_my1sock --port 8080 --host localhost --path /test/that/path To show the client can control the server, # ./test_my1sock --port 8080 --host localhost --path /exit We can also do that at the browser, type "https://localhost:8080/exit"