Typical applications where:
With cheaper and more powerful micro-controllers devices can communicate with each other
or with centralized servers over the network and they can observe their environment
with dedicated sensors.
This is what we call the Internet of Things (IoT)
containing just a single CPU and address and data lines + a few control lines to interface
to external memory and I/O interfaces, typically : a serial and a parallel port.
The price for the chip was 176 US $.
The development board was sold for 300 US $.
You got 256 bytes of RAM, 2kBytes of EPROM and the serial and parallel port.
Programming was done in assembly language or even straight machine code.
No Internet!
The user community is huge and is now increased by another 15 users!
An enormous wealth of information on all sorts of subjects using the Raspberry Pi
can be found on the WEB.
The official site is
TWiki uses the same documentation format as Wikipedia.
This makes it very simple for the lecturer to provide on-line documentation,
which can be extended by students.
This is our Twiki server:
https://afnog.iotworkshop.africa/do/view
And this is what you get:
On the micro SD card (or a memory stick on one of the USB slots) you can install
a full-blown Linux operating system
(for the Windows gurus: there is also a Windows version)
All you need to have a stand alone computer is
keyboard and mouse and use it in stand-alone mode
but we can also make use of the PC resources and access it remotely
There are several ways to access the RPI remotely:
Using the VNC server on the Pi you can access it with a remote desktop from the PC
The secure shell (ssh) allows you to get a remote terminal in the Pi
With scp you can copy files back and forth between the Pi and the PC
With nfs you can mount part of the Pi file system into the PC file system tree
and access the PI SD card as if it was a local PC disk.
connected to the RPI and the keyboard by this computer's keyboard. The connected computer
acts like a graphics terminal for the RPI.
You see on the computer exactly what you would see on a directly connected screen.
The command is:
Where piIPaddress can be the Pi’s IP address or host name.
If you specify the -X option you can run X-11 based programs where
the X protocol is run over the ssh connection.
For Windows computers you need PuTTY in conjunction with
an X server (e.g. Xming) to connect to the RPi
started an emacs session on the Pi
We use a flat cable and a “cobbler” to bring these signals onto a bread board
where we can build our own electronic circuits for acquisition or control by the Rpi.
Libraries in C/C++, Java and Python are available easing software access to these signals.
a large number of programming languages.
One of the most fashionable languages is Python.
Python is an interpreted language and code can be entered into a Python interpreter
which executes it immediately. Like this, Python can e.g. be used as a calculator.
It is however also possible to write whole programs (scripts) which the interpreter executes
Want to learn Python? Try the Python tutorial!
We will attempt to learn the language in 2 h!
an Integrated Development Environment (IDE) created specifically for Python instead.
Try idle
Here you see the 2 idle windows.
The top one contains the editor, the second the Python shell
python scriptName
or we can make it executable and run it like we would run
any compiled C program or any bash script:
However, in Python you do not need to declare the variables.
The interpreter finds the right type by itself.
Here an example:
As you can see, there are no braces around the conditional block but it is indented
# indicates an comment
In addition to the if statement above we have elif and else
Here is the example of a while loop which calculates the Fibonnaci series:
This program uses multiple assignments a,b are assigned in the same line
Again you can see that the block starts with “:” and is indented.
Lists may contain different data types but usually all members of lists have the same type.
Lists have similar properties as strings:
Append, extend, remove, pop, index, count, sort … Have a look at the tutorial for details
The are also further complex data structures which we don’t have the time to go into:
Using the range function you can create the same type of for loops we know from C.
Keywords like continue and break have the same meaning.
pass does nothing and is used only where a statement is syntactically needed
... and the result:
and use these definitions in several main programs.
In our example of the Fibonacci numbers we can save the definitions in a file called fibo.py
In order to use the definitions we must import them with
import fibo
In order to call the functions we have to all the module name:
fibo.fib(20)
or if we we want to import a single function:
from fibo import fib
fib(20)
The module name is found in the variable __name__
I | Attachment | History | Action | Size | Date | Who | Comment |
---|---|---|---|---|---|---|---|
![]() |
RASPBERRY-PI-3_sml.jpg | r1 | manage | 300.6 K | 2018-04-24 - 17:49 | UliRaich | |
![]() |
assignment.png | r1 | manage | 15.9 K | 2018-04-24 - 19:42 | UliRaich | |
![]() |
babylon.py.txt | r1 | manage | 0.3 K | 2018-04-24 - 19:15 | UliRaich | |
![]() |
broadcom.png | r1 | manage | 52.9 K | 2018-04-24 - 18:38 | UliRaich | |
![]() |
cabling.png | r1 | manage | 1315.7 K | 2018-04-24 - 20:50 | UliRaich | |
![]() |
cobbler.png | r1 | manage | 23.8 K | 2018-04-24 - 19:10 | UliRaich | |
![]() |
cobblerPinout.png | r1 | manage | 281.5 K | 2018-04-24 - 20:50 | UliRaich | |
![]() |
conditions.png | r1 | manage | 19.3 K | 2018-04-24 - 19:47 | UliRaich | |
![]() |
conditions.py.txt | r1 | manage | 0.3 K | 2018-04-24 - 19:15 | UliRaich | |
![]() |
esp32.png | r1 | manage | 109.8 K | 2018-04-24 - 17:53 | UliRaich | |
![]() |
esp32price.png | r1 | manage | 172.0 K | 2018-04-24 - 17:49 | UliRaich | |
![]() |
fib1.py.txt | r1 | manage | 0.4 K | 2018-04-24 - 19:15 | UliRaich | |
![]() |
files.png | r1 | manage | 27.1 K | 2018-04-24 - 20:50 | UliRaich | |
![]() |
for.png | r1 | manage | 12.2 K | 2018-04-24 - 20:06 | UliRaich | |
![]() |
forLoop.py.txt | r1 | manage | 0.2 K | 2018-04-24 - 19:15 | UliRaich | |
![]() |
forResult.png | r1 | manage | 3.4 K | 2018-04-24 - 20:06 | UliRaich | |
![]() |
functionDef.png | r1 | manage | 24.4 K | 2018-04-24 - 20:09 | UliRaich | |
![]() |
idle.png | r1 | manage | 317.8 K | 2018-04-24 - 19:31 | UliRaich | |
![]() |
lists.png | r1 | manage | 35.0 K | 2018-04-24 - 19:54 | UliRaich | |
![]() |
m6800.png | r1 | manage | 26.3 K | 2018-04-24 - 17:49 | UliRaich | |
![]() |
moduleCall.png | r1 | manage | 13.0 K | 2018-04-24 - 20:50 | UliRaich | |
![]() |
moduleCallResult.png | r1 | manage | 17.3 K | 2018-04-24 - 20:50 | UliRaich | |
![]() |
moduleRun.png | r1 | manage | 14.2 K | 2018-04-24 - 20:50 | UliRaich | |
![]() |
modules.png | r1 | manage | 30.8 K | 2018-04-24 - 20:14 | UliRaich | |
![]() |
pythonBash.png | r1 | manage | 108.7 K | 2018-04-24 - 19:42 | UliRaich | |
![]() |
pythonInterpreter.png | r1 | manage | 38.8 K | 2018-04-24 - 19:31 | UliRaich | |
![]() |
pythonScript.png | r1 | manage | 35.3 K | 2018-04-24 - 19:31 | UliRaich | |
![]() |
pythonShell.png | r1 | manage | 32.4 K | 2018-04-24 - 19:31 | UliRaich | |
![]() |
remoteDesktop.png | r1 | manage | 378.8 K | 2018-04-24 - 18:47 | UliRaich | |
![]() |
simpleForLoop.py.txt | r1 | manage | 0.2 K | 2018-04-24 - 19:15 | UliRaich | |
![]() |
ssh.png | r1 | manage | 293.5 K | 2018-04-24 - 18:47 | UliRaich | |
![]() |
strings.png | r1 | manage | 77.6 K | 2018-04-24 - 19:46 | UliRaich | |
![]() |
strings.py.txt | r1 | manage | 1.0 K | 2018-04-24 - 19:15 | UliRaich | |
![]() |
twiki.png | r1 | manage | 373.8 K | 2018-04-25 - 07:26 | UliRaich | |
![]() |
while.png | r1 | manage | 7.6 K | 2018-04-24 - 19:54 | UliRaich | |
![]() |
while.py.txt | r1 | manage | 0.1 K | 2018-04-24 - 19:15 | UliRaich |