Raspberry Pi I2C (Synchronous Serial Communication)

Introduction:

  • I2C (Inter Integrated Circuit) is a synchronous serial protocol that communicates data between two devices.
  • It is a master-slave protocol which may have one master or many master and many slaves whereas SPI has only one master.
  • It is generally used for communication over short distance.
  • The I2C device has 7-bit or 10-bit unique address. So, to access these devices, master should address them by the 7-bit or 10-bit unique address.
  • I2C is used in many applications like reading RTC (Real time clock), accessing external EEPROM memory. It is also used in sensor modules like gyro, magnetometer etc.
  • It is also called as Two Wire Interface (TWI) protocol.

Read More

Raspberry Pi UART Communication Using Python And C

UART (Universal Asynchronous Receiver/Transmitter) is a serial communication protocol in which data is transferred serially i.e. bit by bit. Asynchronous serial communication is widely used for byte oriented transmission. In Asynchronous serial communication, a byte of data is transferred at a time.

UART serial communication protocol uses a defined frame structure for their data bytes. Frame structure in Asynchronous communication consists:

  • START bit: It is a bit with which indicates that serial communication has started and it is always low.
  • Data bits packet: Data bits can be packets of 5 to 9 bits. Normally we use 8-bit data packet, which is always sent after the START bit.
  • STOP bit: This usually is one or two bits in length. It is sent after data bits packet to indicate the end of frame. Stop bit is always logic high.

Read More

Raspberry Pi PWM Generation using Python and C

PWM (Pulse Width Modulation) is a modulation technique by which the width of pulse is varied while keeping the frequency constant. Through PWM technique, we can control the power delivered to the load by using ON-OFF signal. The PWM signals can be used for applications such as controlling the speed of DC motors, changing intensity of an LED, controlling Servo motors, etc.

Raspberry Pi PWM:

Raspberry Pi has two PWM channels i.e. PWM0 and PWM1.

PWM pins for the two PWM channels on 40-pin P1 header are as follows:

GPIO Pin PWM0/PWM1
GPIO12 PWM0
GPIO18 PWM0
GPIO13 PWM1
GPIO19 PWM1

 

Read More

Raspberry Pi GPIO Access

GPIO (General Purpose Input Output) pins can be used as input or output and allows raspberry pi to connect with general purpose I/O devices.

  • Raspberry pi 3 model B took out 26 GPIO pins on board.
  • Raspberry pi can control many external I/O devices using these GPIO’s.
  • These pins are a physical interface between the Pi and the outside world.
  • We can program these pins according to our needs to interact with external devices. For example, if we want to read the state of a physical switch, we can configure any of the available GPIO pins as input and read the switch status to make decisions.  We can also configure any GPIO pin as an output to control LED ON/OFF.
  • Raspberry Pi can connect to the Internet using on-board Wi-Fi or Wi-Fi USB adapter. Once the Raspberry Pi is connected to the Internet then we can control devices, which are connected to the Raspberry Pi, remotely.

Read More

How to use WiringPi Library on Raspberry Pi

WiringPi is a library written in C used to access GPIO pins on Raspberry for BCM2835 (Broadcom Processor) SoC (System on Chip). There are various libraries are available to access GPIO in C like bcm 2835, sysfs, pigpio, etc. Here, we are using WiringPi library for Raspberry Pi GPIO access.

To use wiringPi, first we should install it on Raspberry Pi. This installation can be done in two ways which is as follows,

WiringPi Library Installation:

This way of installing WiringPi library will use git.Read More

Do NOT follow this link or you will be banned from the site!