The Raspberrypi is called a mini-computer because the SoC has the powerful ARM11 processor which runs on 700 MHz at its core and having the peripherals like timers, interrupt controller, GPIO, PCM / I2S, DMA controller, I2C, SPI slave, PWM, UART, USB, graphical processing unit (GPU) which includes VideoCore, MPEG-2 and MPEG-4 and a 512 MB SDRAM. The Raspberrypi board is powerful enough to run large operating systems like Linux, Mac and Windows.
Linux operating systems especially Ubuntu is preferred for all kind of programming and development. The operating systems like Archlinux ARM, OpenELEC, Pidora, Raspbmc, RISC OS and the Raspbian and also Ubuntu versions are available for the Raspberrypi board. The immediate advantage of having an Operating System like Ubuntu running on an embedded system device is multitasking.
All Linux OS provides Multi-user Multitasking feature which means more than one user can login to the device at a time and all of the logged in users can perform multitasking. This article discusses how to create a new user and performing Multi-User-Multitasking in a Raspberrypi board.
In this project the Raspberrypi board is loaded with Ubuntu and is remotely accessed using VNC. The Raspberrypi board is also connected to the internet. There are 26 connectors which can be taken out from the connector port of the Raspberrypi board. All the connector pins are taken out using 13*2 pin female connectors and at the other end of their wire 26 pin Burg stick male connectors are attached. The Burg stick male connectors allow each pin out from the Raspberrypi board to be plugged into the holes of a breadboard. To access the pins that coming out of the Broadcom controller of the Raspberrypi board using C language, a C library is available called “bcm2835” which has been downloaded and installed.
The default user present in the Ubuntu OS loaded in the Raspberrypi is ‘pi’. Creating new users is an easy task using the commands in Ubuntu. Use ‘sudo’ when using the current login is other than root. The current login can be found out by typing the following command
whoami
Fig. 2: Command for Current login in Ubuntu OS loaded in Raspberrypi
To create a new user say ‘new_pi’ the user can use ‘adduser’ commands as given below;
addusernew_pi
The password for the new login will be asked and the user has to enter the password and enter the same when asked for confirmation password.
Fig. 3: Password Confiramtion for new user
The user can fill-up the following information if required, otherwise simply keep on hitting the enter key.
This creates a new user login in the Ubuntu running in the Raspberrypi board. Now to perform tasks like executing a code etc., the new user has to be provided with ‘sudo’ root power.To enable the ‘sudo’ on the newly created user, one has to edit a file. Simply type the following command and a new window opens up:
visudo
In the newly opened window add the entry for newly created user “new_pi” under “# User privilege specifications” and “#includedir /etc/sudoers.etc” as shown in the following image:
Fig. 4: User privilege specifications in Ubuntu loaded in Raspberry pi
Now reboot the Raspberrypi and the one can login as “new_pi”. This way the user can create as many as user logins in the Raspberrypi.
A system in which Multi-User-Multitasking is taking place is represented by the following block diagram. As the Raspberrypi board is also connected to the internet those who know the IP can login to the board using PUTTY with different username and password.
Fig. 5: Block Diagram of Multiuser Multitasking in Raspberry Pi
Assume that four users namely ‘pi_1’, ‘pi_2’, ‘pi_3’ and ‘pi_4’ are logged into the Raspberrypi at the same time and are doing multitasking by blinking two LEDs each. There are eight general purpose IO pins on the 13*2 pin connectors of the Raspberrypi board and to each one of them a LED is connected through 1K resistor. Separate code has been written to blink the LEDs individually and made them into executable files named blink2, blink3, blink4, blink5, blink6, blink7 and blink8. It is suggested to keep all the .c files and the executable files in a single folder for this particular project.
Any user can run any of the LED blinking programs from the command line. For example to execute the file ‘blink1’, the user can use the following command:
./blink1
Any user can perform multi-tasking on them by entering the following commands one after the other. The user can perform multi-tasking with the eight LED codes by entering the following eight commands one after the other.
./blink1 &
./blink2 &
./blink3 &
./blink4 &
./blink5 &
./blink6 &
./blink7 &
./blink8 &
To try out Multi-User-Multitasking the user is suggested to create two different logins as explained earlier in this article and login to the Raspberrypi from two different PCs which are in the same network or connected to the internet and blink four LEDs as Multi-tasking within each user.
For user 1:
./blink1 &
./blink2 &
./blink3 &
./blink4 &
For user 2:
./blink5 &
./blink6 &
./blink7 &
./blink8 &
***Note that in this project the latest version of library “bcm2835” is used with an old version of Raspberrypi board. It is not possible to access the pin number 13 of the old board with the latest library version and hence in the code “blink3.c” the pin number 24 is used to blink the 3rd LED. The circuit diagram is also drawn accordingly. Those who have the latest version of the board can use the pin 13 without any trouble.
To find the ‘Revision’ and other important details about the Raspberrypi board, use the following command:
cat /proc/cpuinfo
*******************************************************************************
Circuit Diagrams
Project Components
Project Video
Filed Under: Raspberry pi
Filed Under: Raspberry pi
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.