How to Read Inputs Using Signal in Raspberry Pi

The Raspberry pi is a mini computer which is designed in a single board with all the essential components required for running an operating system. 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.

How to Read Inputs Using Signal in Raspberry PiThe Raspberrypi is a board actually designed for helping computer education for remote schools but it is a good platform for programmers especially beginners to explore various coding techniques. The Raspberry pi is a device which uses the Broadcom controller chip which is a SoC (System on Chip). This SoC has the ARM11 processor which runs on 700 MHz at its core. This powerful processor and the controller having the peripherals like timers, interrupt controller, GPIO, PCM / I2S, DMA controller, I2C, SPI slave, PWM, UART, USB etc. The immediate advantage of having an Operating System like Ubuntu running on such an embedded system device is multitasking.

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 the C library “bcm2835” has been downloaded and installed.

There are eight general purpose IO pins on the 13*2 pin connectors of the Raspberrypi board and among them four pins has been selected as input and then remaining four pins as output. The input pins are connected to push button and are pulled down using 1K resistors. The output pins are connected to the LEDs through another set of 1K resistors.

Four separate input reading processes has been created as Child process using the fork () function for each of the input pins. This Child processes continuously reads the particular input pin and sends a signal to the Parent process using kill () function whenever the status of the pin changes.How to Read Inputs Using Signal in Raspberry Pi schematic

In this particular project a Parent creates 4 Childs processes which are then used to read the status of the four input pins independently. The Child processes are made to send a signal ‘SIGUSR1’ to the Parent process whenever the status of the input pin changes. As soon as the Parent process receives a signal, it reads the value of all the four input pins and writes the same to the corresponding output pins. This forms a Process System made up of 4 Child process and a Parent process where the Parent is free to do its work, but the Child can get the attention of the Parent by sending signal.

 

For more detail: How to Read Inputs Using Signal in Raspberry Pi


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top