What is Raspberry Pi Pico? Pinout, Specs, Projects & Datasheet
Hi Guys! I welcome you on board. In this post today, we’ll study What is
Raspberry Pi Pico? We’ll also detail Raspberry Pi Pico Pinout, Specs, Projects & Datasheet.
Raspberry Pi Pico is a little different from other modules introduced by Raspberry Pi Foundation. This unit is similar to Arduino Nano and is called a microcontroller board that incorporates a powerful RP2040 chip. This is different from other single-board computers that fall under the Raspberry Pi series. It is not a computer but a microcontroller board.
I suggest you buckle up as I’ll explain Raspberry Pi Pico in detail.
Let’s get started.
What is Raspberry Pi Pico?
- Raspberry Pi Pico is a microcontroller board (released on 21 Jan 2021) mainly developed for robotics and embedded applications. Unlike other Raspberry Pi modules, this board is not a full computer.
- Pico is the most economical board among other Raspberry Pi modules. At the time of writing this article, you can get this device in only $4 which is a cost-effective solution to your electronic needs.
- This tiny board incorporates 26 GPIO pins that you can configure either as an input or as output. Moreover, RP2040 is added to the board that is considered as the first in-house microcontroller introduced by Raspberry Pi.
- Mostly the RP2040 microcontroller pins are taken to the user IO pins on the right and left edge of the module. While four RP2040 IO are employed for internal functions i.e. on-board Switched Mode Power Supply (SMPS), driving an LED, power control, and sensing the system voltages.
- Dual-core Arm Cortex-M0+ processor is added to the board that comes with flexible clock frequency up to 133 MHz. This frequency is required for the synchronization of all internal functions. The SRAM of this unit is 264KB and flash memory is 2MB that is employed to store different files.
- Pico board comes with an on-board buck-boost SMPS that can produce the desired 3.3 volts (to power RP2040 and external circuitry) through a range of input voltages (~1.8 to 5.5V).
- This way you can power the module with different flexible sources including 3 AA cells in series and lithium-Ion cell. Furthermore, you can easily integrate battery chargers with the Pico power chain.
- This module comes with different communication protocols including 2x I2C, 2x SPI, and 2x UART which are employed to develop the connection with the external devices. Moreover, there are 16 controllable PWM channels and three 12-bit ADC incorporated on the board.
- The MicroPython is the official language supported for this module, however, you can also write codes in C or C++, but the former is officially recommended.
- As mentioned earlier this unit is more like a microcontroller board, it lacks Ethernet and HDMI that are included in other Pi modules like Raspberry Pi 4.
- There is one micro-USB port included in this module. Moreover, there is no wireless or Bluetooth added to this module.
- Know that, header pins can be soldered to the Pico module that you can use in a breadboard.
Raspberry Pi Pico Pinout
The following figure shows the Raspberry Pi Pico pinout.
Raspberry Pi Pico Pin Description
Hope you’ve got a brief intro to the Raspberry Pi Pico. This section is reserved for the description of each pin incorporated into this single-board computer.
Power and Ground in RPi Pico
This board comes with four types of power pins.
- PIN40 VBUS (USB input voltage, typically 5V)
- PIN39 VSYS (used to the power system, can be in range 1.8V-5.5V)
- PIN36 3V3 offers 3.3V
- Total eight ground pins on board that provide 0V.
GPIO Pins in Raspberry Pi Pico
There are 26 multifunction GPIO pins employed for connection with external devices. These pins are used either as general-purpose input or general-purpose output pins. Moreover, there are 3 analog inputs among these GPIO pins.
SPI Pins in Raspberry Pi Pico
There are two SPI (serial peripheral interface) communication protocols are included in this Raspberry Pi Pico module. This protocol is used to develop the communication between the controller and other peripheral devices like shift registers and sensors.
There are two pins for SPI communication… i.e. MOSI (master output slave input) and MISO (master input slave output). This communication protocol falls under master-slave communication protocol.
I2C Pins in Raspberry Pi Pico
- There are two I2C communication protocols included in this module. This protocol contains two pins SDL and SCL.
- The SCL is the serial clock line that guarantees the synchronization of data transfer over the I2C bus while the SDL, on the other hand, is the serial data pin that contains the data while.
UART Pins in Raspberry Pi Pico
- The Raspberry Pi Pico contains two UART serial communication protocols. The UART serial port carries two pins Rx and Tx.
- The Rx is the receiving pin that guarantees the receiving of serial data and the Tx is the transmission pin that ensures the transmission of serial data.
Raspberry Pi Pico Datasheet
Before applying this module to your electrical project, it’s wise to read the Raspberry Pi Pico datasheet. The datasheet explains the main characteristics of the device. Click the link below to download the Raspberry Pi Pico datasheet.
Raspberry Pi Pico Specs
The following are the Raspberry Pi Pico specs.
- 21 mm × 51 mm form factor
- Comes with 26 multifunction GPIO pins, including 3 analog inputs
- Features Dual-core Arm Cortex-M0+ processor, the flexible clock running up to 133 MHz
- The on-chop SRAM is 264KB
- Low-power sleep and dormant modes
- Operating temperature range -20°C to +85°C
- RP2040 microcontroller chip designed by Raspberry Pi in the UK
- Features 2 × SPI controllers, 2 × UART, 2 × I2C protocols, 16 × PWM channels
- Can support input power 1.8–5.5V DC
- Contains 1 × USB 1.1 controller and PHY, with host and device support
- On-board QSPI Flash is 2MB
- Drag-and-drop programming using mass storage over USB
- 8 × Programmable I/O (PIO) state machines for custom peripheral support
- Accurate on-chip clock
- Accelerated integer and floating-point libraries on-chip
- The castellated module allows soldering directly to carrier boards
- Temperature sensor
Raspberry Pi Pico vs Arduino
- Before the arrival of Arduino Pi Pico, there was a stark difference between Raspberry Pi and Arduino modules. The former is a single-board computer that can perform some typical functions like a regular computer while the latter is a module based on a microcontroller that uses one program at a time.
- However, with the inception of Raspberry Pi Pico in 2021 that incorporates RP2040 SoC, which is a microcontroller, the difference between these two modules is not extensive anymore. Because like Arduino, Raspberry Pi Pico is a board based on a microcontroller.
- Both Arduino and Raspberry Pi Pico units are introduced for the embedded system and automation applications that don’t involve human interference once the module is interfaced with the electronic circuitry. You can use Pico alone or with the combination with Arduino modules to develop different projects related to Artificial Intelligence.
- Million of Arduino Units have been sold since its inception in 2005. The Pico is recently introduced in the market by Raspberry Pi Foundation and the response it earned from the targeted audience is amazing. Both modules are different in terms of power consumption, value, functionality, and price.
- The Pico module supports the MicroPython language while the code for Arduino boards is written in Arduino.IDE software.
- There is another difference between Pico and Arduino boards that the former comes unsoldered while the latter comes pre-soldered except DIP Arduino boards like Nano 33 IoT and Arduino Nano Every. This is, however, not a big deal as you can solder your pins to the Pico board with the soldering iron.
- So which one to use… Pico or Arduino?
- Pico stays ahead of Arduino in terms of ease of use, price, documentation, and an amazing selection of GPIO pins. At $4 you’ll get the tiny module that you can use for your microcontroller projects.
Raspberry Pi Pico Applications
The following are the Raspberry Pi Pico Applications.
- Arduino Metal Detector
- Real-Time Face Detection
- Medical Instruments
- Android Applications
- GSM Based Projects
- Industrial Automation
- Virtual Reality Applications
- Embedded Systems
- Home Automation and Defense Systems
- Automation and Robotics
That’s all for today. Hope you’ve enjoyed reading this article. If you have any questions you can pop your comment in the section below. I’m happy and willing to help you the best way I can. Feel free to share your valuable feedback and suggestions around the content we. They help us produce quality content customized to your exact needs and requirements. Thank you for reading this article.
What is Raspberry Pi 4? Pinout, Specs, Projects & Datasheet
Hi Folks! I welcome you on board. Today, I am sharing the 2nd
tutorial in the Raspberry Pi 4 learning series. In this post today,
we’ll cover What is Raspberry Pi 4?
Raspberry Pi 4 Pinout, Specs, Projects, Datasheet etc.
Raspberry
Pi 4 is a tiny dual-display single-board computer, developed by
Raspberry Pi Foundation. This foundation has introduced a series of
Raspberry Pi boards to teach computer basics in schools.
With Raspberry Pi 4, you can control two monitors at once. Moreover, it
is incorporated with a quad-core processor that is powerful and comes
with more speed compared to its predecessors.
I suggest you read this post till the end as I’ll cover Raspberry Pi 4
in detail.
Let’s get started.
What is Raspberry Pi 4?
- Raspberry Pi 4
is a dual-display, single-board
computer (introduced on 24th June 2019) and is widely used in automation
and robotics. It is highly economical and has a leg over previous
modules in terms of speed and performance.
- This module is tiny, robust, and can fit into difficult-to-reach
places. It is laced with GPIO pins and can be employed for several
typical computer operations i.e. surfing the web, writing programs,
computing complex equations etc.
- Raspberry Pi 4 features Gigabit Ethernet, coupled with Bluetooth(BLE) and onboard wireless networking.
- This device comes with a powerful and efficient 1.5GHz quad-core processor
which is considered the brain of this device. It features everything needed to process input/output and store information.
- The CPU clock frequency
of this machine is 1.5GHz
which plays a key role in the synchronization of internal functions.
- This module is available with variants of RAM including 1GB, 2GB, 4GB and 8GB
which you can select based on your requirements. The RAM temporarily
stores the information and with the removal of the power supply from the
module, this memory is also wiped off, the reason it is called volatile
memory.
- Two mini HDMI ports
are available on the board. These ports are employed for transmitting audio and video signal between devices.
- This machine supports different communication protocols including I2C, SPI, and UART
which are used to lay out the communication with external devices.
- Raspberry Pi 4 comes with three USB ports
out of which one is a USB-C power port
used to power up the module. While others are USB 2.0 and USB 3.0 ports
.
- In these USB ports, you can connect external peripheral devices like mice, webcams, and keyboards for additional functionality.
- Using this tiny computer you can make a range of embedded
projects. Just connect this module with the computer through the USB
port and start playing with it as you like better.
- Raspberry Pi 4 is normally used in Robotics, IoT and Embedded Projects.
Raspberry Pi 4 Pinout
- The following figure represents the Raspberry Pi 4 pinout:
Raspberry Pi 4 Pin Description
This was the little intro to the Raspberry Pi 4. In this section, we’ll
cover the description of each pin incorporated into this tiny module.
Power and Ground in RPi4
This board comes with three types of power pins.
- 5V
- 3V3 (3.3V)
- Ground (0V)
For example, if you have PIR or humidity sensors, you can use these power pins to power up those sensors.
GPIO Pins in Raspberry Pi 4
- GPIO pins are general-purpose input/output pins that are used for
connection with external devices. These pins can be configured to either
general-purpose input or general-purpose output pins or as one of up to
six special settings those functions are pin-dependent.
- External labels (from GPIO2 to GPIO27) come with the Broadcom
(BCM) naming convention. This convention is useful when you are going to
program with Python libraries.
- Internal labels (from 1 to 40) project the Board naming
convention. This convention is useful when BCM is not supported. It is
used with some programming libraries.
SPI Pins in Raspberry Pi 4
- This Raspberry Pi 4 module comes with SPI (serial peripheral
interface) communication protocol. This is the type of communication
protocol that is used for master-slave communication.
- It is employed to layout the communication between the controller
and other peripheral devices like shift registers and sensors. Two Pins
are used for SPI communication… i.e. MOSI (master output slave input)
and MISO (master input slave output)
- The data synchronization is done by using a clock (SCLK at GPIO11)
from the master (RPi) and the data is conveyed to the SPI component
from the module using the MOSI pin. If the component needs to reply to
our module, then it sends back data through the MISO pin.
I2C Pins in Raspberry Pi 4
- This RPi4 module is incorporated with the I2C communication protocol. That comes with two pins SDL and SCL.
- The SCL is the serial clock line that ensures the synchronization
of data transfer over the I2C bus and the SDL is the serial data pin
that carries the data while. This communication protocol requires
master-slave roles between the devices.
UART Pins in Raspberry Pi 4
- This board also features UART serial communication protocol. The UART serial port comes with two pins Rx and Tx.
- The Tx is the transmission pin that is used for the transmission
of serial data and Rx is the receiving pin that guarantees the receiving
of serial data.
Raspberry Pi 4 Datasheet
Before incorporating this device into your project, it’s wise to scan
through the Raspberry Pi 4 datasheet. The datasheet comes with the main
characteristics of the device. You can download the Raspberry Pi 4
datasheet by clicking the link below.
Raspberry Pi 4 Specs
The following are the specs of Raspberry Pi 4.
- Comes with Broadcom BCM2711, Quad-core Cortex-A72 (ARM v8) 64-bit SoC 1.5GHz processor
- 4 GHz and 5.0 GHz IEEE 802.11ac wireless, Bluetooth 5.0, BLE
- Carries Gigabit Ethernet to connect computers in physical space
- RAM is available with different memories. Pick from 2GB, 4GB, or 8GB LPDDR4-3200 SDRAM (depending on model)
- 2-lane MIPI DSI display port
- 2-lane MIPI CSI camera port
- One USB 3.0 port; One USB 2.0 port and One USB-C power port.
- 2 × micro-HDMI ports that can support a 4K display
- 4-pole stereo audio and composite video port
- H264 (1080p60 decode, 1080p30 encode), H.265 (4kp60 decode)
- OpenGL ES 3.0 graphics
- Raspberry Pi standard 40-pin GPIO header (which is compatible with previous modules)
- Contains a Micro-SD card slot for loading the operating system and data storage
- 5V DC via GPIO header (minimum 3A*)
- Power over Ethernet (PoE) enabled (requires separate PoE HAT)
- Operating temperature: 0 – 50 degrees C ambient
- 5V DC via USB-C connector (minimum 3A*)
Difference between Raspberry Pi Zero and Raspberry Pi 4
- You’ll find a range of tiny computers in the Raspberry series.
They are used to develop embedded systems and automation projects.
- Raspberry Pi Zero is the earlier version of the Raspberry Pi
series that was introduced in Nov 2015. This machine is incorporated
with a single-core 1GHz processor with no Ethernet and WiFi modules on
the board. Moreover, there is only one mini HDMI port available on the
board. And the RAM of this module is 512MB.
- While Raspberry Pi 4 is the advanced version of the Raspberry Pi
series and was introduced in June 2019. It is better in terms of speed
and performance compared to the Pi Zero module.
- RPi4 features a quad-core dual display processor with a CPU clock
speed of 1.5GHz. Plus, it also incorporates an Ethernet port which is
the traditional way to connect devices in a wired local
area network (LAN) or wide area network (WAN), allowing devices to
communicate with each other via a protocol. An Ethernet is a physical
wire on which the data is transmitted.
- Raspberry Pi 4 comes with two HDMI ports that can support two 4K
displays. Plus, the RAM of this module comes in variant i.e. pick from
1GB, 2GB, and 4GB LPDDR4.
Raspberry Pi 4 Applications
The following are the Raspberry Pi 4 Applications.
- Used in making a portable game console
- Employed in-network Ad-blocker
- Used in Airplay speaker
- Used in wearable timelapse camera
- Incorporated in-home network music system
- Used in embedded system IoT projects
- Employed in making guitar pedal
- Used in making FPV robot
- Incorporated in WiFi security camera
That’s all for today. This was all about the Raspberry Pi 4 module. If
you have any questions you can pop your comment in the section below.
I’d love to help you the best way I can. Feel free to share your
valuable feedback and suggestions around the content we share so we keep
producing quality content tailored to your exact needs and
requirements. Thank you for reading this post.
What is Raspberry Pi Zero? Pinout, Specs, Projects & Datasheet
Hi Friends! Hope you’re well. In this post today, we’ll discuss What is
Raspberry Pi Zero? We’ll also cover
Raspberry Pi Zero Pinout, Specs, Projects & Datasheet.
Developed by Raspberry Pi Foundation, Raspberry Pi Zero is a tiny single-board computer, initially introduced to teach basic computers in schools. Later, it rose to popularity due to its low cost and open source design. Now it is widely used in robotics and embedded systems to develop IoT projects. This device is among the bestselling British single-board computers. I suggest you read this post all the way through as I’ll cover Raspberry Pi Zero in detail. Let’s get started.
What is Raspberry Pi Zero?
- Raspberry Pi Zero(released in Nov 2015, by Raspberry Pi Foundation) is a single-board mini computer, mainly used to design embedded systems based IoT projects. The economical price, small-size and open-source design of this module makes it a suitable pick for applications ie. weather monitoring, motion-sensing camera, tiny power supply-sized computers and much more.
- The Pi Zero module carries mini connectors containing 40-pin GPIO, making this device compact, robust and flexible. It is a credit card-sized computer that contains multiple I/O pins and can be used for various typical computer operations including writing programs, surfing the web, and document writing.
- This tiny module contains a 1GHz single-core CPU which is the brain of this module. Basic arithmetic, logic, and input and output operations are performed by the CPU which executes the instruction consisting of a computer program.
- The clock frequency of this computer is 400MHz which is required for the synchronization of all the internal functions. There is no WiFi or Ethernet connection available on the board.
- This module contains 512MB of RAM used to store running programs. It is a volatile memory which means the data stored in this memory will be lost when power is removed from the device.
- The board comes with a Micro USB OTG port that allows data to be read in the absence of a computer and the Micro USB power is used to power up the module.
- The mini HDMI port is incorporated on the board that is used for transmitting audio and video signal between devices. The board features a CSI camera connector which is used to connect the external camera with the module.
- Different communication protocols like SPI, I2C, and UART are included in the module. Using these communication protocols, you can develop communication with external devices.
- This module contains a micro SD card that offers initial storage for the different files and operating systems. This storage can be extended using USB-connected peripherals. With an SD card, you leverage enhanced storage with ease.
- Raspberry Zero contains a single USB 2.0 port that is directly connected to the module. Using this USB port, you can attach external peripheral devices like mice, keyboards, and webcams for additional functionality.
- Moreover, simply plug this module into the computer using the USB port and start playing with it. This will give you a feel like you’re operating a microcomputer with all typical functions as a regular desktop computer.
Raspberry Pi Zero Pinout
As I have metioned earlier, Raspberry Pi Zero has 40 GPIO Pins. The following figure shows the
Raspberry Pi Zero pinout:
Raspberry Pi Zero Pin Description
Hope you’ve got a brief insight into the Raspberry Pi Zero. This section is dedicated to the description of pins incorporated into this tiny module.
Power and Ground Pins in RPi0
Raspberry Pi Zero Pinout has 3 voltage levels available, which are:
So, if you are working on simple sensors i.e. humidity, PIR etc. then you can power them up using these power pins of Raspberry Pi Zero quite easily.
GPIO Pins in Raspberry Pi Zero
- GPIO pins are general-purpose input/output pins that can handle external devices.
- These pins are used to get/send commands/data to/from exrernal devices. (I hope you understood it :D )
- You can configure these pins to either general-purpose output or general-purpose input pins or as one of up to six special settings those functions are pin-dependent.
- External labels (from GPIO2 to GPIO27) represent the Broadcom (BCM) naming convention. This convention comes in handy when programming with Python libraries.
- Internal labels (from 1 to 40) represent the Board naming convention. This comes in handy when BCM is not supported. It is used with some programming libraries.
SPI Pins in Raspberry Pi Zero
The board contains one SPI communication protocol. SPI stands for a serial peripheral interface that supports master-slave communication. It is used to develop communication between the controller and other peripheral devices like sensors and shift registers. It comes with two Pins… MISO (master input slave output) and MOSI (master output slave input) for the SPI communication.
Synchronization of data is carried out by using a clock (SCLK at GPIO11) from the master (RPi) and the information is delivered to the SPI component from the module using the MOSI pin. If the component requires to reply to our module, then it sends back data using the MISO pin.
I2C Pins in Raspberry Pi Zero
This module comes with one I2C communication protocol. It contains two pins SDL and SCL. The SDL is the serial data pin that carries the data while SCL is the serial clock line that ensures the synchronization of data transfer over the I2C bus. This communication protocol needs master-slave roles between the two parts.
UART Pins in Raspberry Pi Zero
There is one UART serial communication protocol incorporated on the board. The UART serial port comes with two pins Rx and Tx. The Rx is the receiving pin that ensures the receiving of serial data while Tx is the transmission pin that is used for the transmission of serial data.
Raspberry Pi Zero Datasheet
It is wise to go through the datasheet of the module before incorporating it into your electrical project. The datasheet features the main characteristics of the device. Click the link below to download the Raspberry Pi Zero datasheet.
Raspberry Pi Zero Specs
Raspberry Pi Zero is half the size compared to model A+. This tiny module can easily fit into an electrical project of any size.
The following are the technical specs of Raspberry Pi Zero.
- Contains a 1GHz single-core BCM 2835 SOC CPU which is the brain of this module
- Comes with 512MB RAM used to store running programs
- Mini HDMI port used for transmitting audio and video signal between devices
- Micro USB OTG port that allows data to be read in the absence of computer
- Micro USB power to power up the module
- CSI camera connector (v1.3 only)
- Composite video and reset headers
- HAT-compatible 40-pin header
- Supports communication like SPI, I2C, and UART
How to Choose the Right Raspberry Pi
Choosing the right Raspberry Pi is like choosing the computer. In either case, you’ll list the requirements for accomplishing different tasks. More often than not, your requirements fall in the following list.
- Speed: The system’s processing power.
- I/O: How many I/O pins the module supports.
- Memory: How much memory RAM and ROM or HD space your system would require.
- Cost: The cost of the module.
- Size and weight: The weight and size of the module as per your requirement.
Speed is the key factor when it comes to choosing your computing system. More speed ensures more work is done in less time. The computers belong to this Pi series are more efficient and robust than microcontroller devices like PIC, Atmel, or Arduino boards.
- Similarly, memory is crucial when it comes to running large programs. Pick the RAM with more memory if you require large programs to run. The Raspberry Pi A computer comes with RAM that ranges between 256MB and 512MB of RAM. And the Pi 2 and 3B contain 1GB of RAM that is shared with the GPU. Make a final decision after analyzing the different functions you want to achieve with the Pi module.
- If you want to perform typical office tasks, like sending emails and writing a document, then a desktop PC or Laptop would be the best pick.
- Raspberry Pi modules are normally employed where there is a need for I/O. The Raspberry Pi A and B modules are suitable picks for attaching to external circuits and devices since they carry pin headers. The 1 A has 8 GPIO, while the +1 A and B computers have 17 GPIO.
Raspberry Pi Zero Applications
The following are the Raspberry Pi Zero Applications.
- Used in embedded system IoT projects
- Used in making a portable game console
- Incorporated home network music system
- Employed in network Ad-blocker
- Used in Airplay speaker
- Employed in making guitar pedal
- Used in making FPV robot
- Incorporated in WiFi security camera
- Used in wearable timelapse camera
That’s all for today. Hope you find this article helpful. Feel free to share your valuable feedback and suggestions around the content we share. They help us produce quality content based on your needs and requirements. You can approach me in the section below if you need help regarding Raspberry Pi Zero. I’m happy and willing to assist you the best way I can. Thank you for reading the article.
Introduction to Raspberry Pi 3 B+
Hi Guys! Hope you are doing well. I am back to give you a daily dose of useful information. Today, I'll discuss the details on the
Introduction to Raspberry Pi 3 B+. It is a small board computer, introduced by Raspberry Pi foundation in 14th March 2018 and is the most recent version of the Pi boards.
It is a modified form of its predecessor Raspberry Pi 3 B that was introduced in 2016 and came with CPU, GPU, USP ports and I/O pins. Both versions are almost same in terms of functionality and technical specifications; however, there are some exceptions in the B+ model as it comes with USB boot, network boot, and Power over Ethernet option that are not present in the B model.
Technology has been evolved over time with the purpose of making lives easy and convenient. This device was a major development in the technology that made computer learning too easy that anyone with little effort can make their feet wet with the process.
In this tutorial, I'll discuss each and everything related to Raspberry Pi 3 B+, its main functions and features, benefits and everything you need to know, so you find all information in one place without wrestling your mind on the web surfing. Let's dive right in.
Introduction to Raspberry Pi 3 B+
- Raspberry Pi 3 B+ was introduced by Raspberry Pi foundation on 14th March 2018. It is an advanced version of Raspberry Pi 3 B model that was introduced in 2016.
- It is a tiny computer board that comes with CPU, GPU, USB ports, I/O pins, WiFi, Bluetooth, USB and network boot and is capable of doing some functions like a regular computer.
- Features of the B+ version are almost same as B model; however, USB and Network Boot and Power over Ethernet facility only come with B+ model. Also, two extra USB ports are added to this device.
- The SoC (system on chip) combines both CPU and GPU on a single package and turns out to be faster than Pi 2 and Pi 3 models.
Improvements
- The model B+ stays ahead in terms of processing speed and comes with an improved wireless capability.
- The dual-band WiFi 802.11ac runs at 2.4GHz and 5GHz and provides a better range in wireless challenging environments and Bluetooth 4.2 is available with BLE support.
- The top side is painted with metal shielding, instead of plastic in the earlier models, that acts as a heat sink and drains the excessive amount of heat if the board is subjected to the high temperature or pressure.
- This B+ model is three times faster than Pi 2 and 3 which is a major development in terms of speed, capable of executing different functions at a decent pace.
- The ethernet port comes with 300 Mbit/s which is much faster than earlier version with 100 Mbit/s speed. It is known as gigabit ethernet based on USB 2.0 interface.
- Four pin header is added on the board that resides near 40 pin header. This allows the Power over Ethernet (PoE) i.e. provides the necessary electrical current to the device using data cables instead of power cords. It is very useful and reduces the number of cables required for the installation of a device in the relevant project.
- PoE works only in the presence of PoE hat.
Raspberry Pi 3 B+ Pinout
Following figure shows the pinout of Raspberry Pi 3 B+
- 40 Pin header is used to develop an external connection with the electronic device. This is the same as the previous versions, making it compatible with all the devices where older versions can be used.
- Out of 40 pins, 26 are used as a digital I/O pins and 9 of the remaining 14 pins are termed as dedicated I/O pins which indicate they don't come with alternative function.
- Pin 3 and 5 comes with an onboard pull up resistor which 1.8 kO and Pin 27 and 28 are dedicated to ID EEPROM. In B+ model the GPIO header is slightly repositioned to allow more space for the additional mounting hole. The devices that are compatible with the B model may work with the B+ version; however, they may not sit identically to the previous version.
Hardware Specifications
CPU: The CPU is a brain of this tiny computer that helps in carrying out a number of instruction based on the mathematical and logical formulas. It comes with a capacity of 64 bit.
Clock Speed and RAM: It comes with a clock speed of 1.4 GHz Broadcom BCM2837B0 that contains quad-core ARM Cortex-A53 and RAM memory is around 1GB (identical to the previous version)
GPU: It stands for graphics processing unit, used for carrying out image calculation. Broadcom video core cable is added in the device that is mainly used for playing video games.
USB Ports: Two more USB ports are introduced in this new version, setting you free from the hassle of using an external USB hub when you aim to join a number of peripherals with the device.
MicroUSB Power Source Connector: This connector is used for providing 5V power to the board. It draws 170 to 200mA more power than B model.
HDMI and Composite Connection: Both audio output socket and video composite now reside in a single 4-pole 3.5mm socket which resides near HDMI. And the power connector is also repositioned in new B+ model and lives next to HDMI socket. All the power and audio video composite socket are now placed on the one side of the PCB, giving it a clean and precise look.
USB Hard Drive: The USB hard drive is available on the board that is used to boot the device. It is identical to the hard drive of regular computer where windows is used to boot the hard drive of the computer.
PoE: B+ model comes with a facility of Power over Ethernet (PoE); a new feature added in this device which allows the necessary electrical current using data cables.
Other Changes: The B+ version comes with little improvement in the features and poses slightly different layout in terms of location of the components. The SD memory slot is replaced by a micro SD memory card slot (works similar to the previous version). The status LEDs now only contain red and green color and relocated to the opposite end of the PCB.
Raspberry Pi 3 B+ Technical Specifications
- CPU is 64 bit with 1GB RAM (random access memory)
- Contains Broadcom BCM2837B0 chipset
- Comes with 1.4GHz Quad-Core ARM Cortex-A53, 4 cores
- Consists of 40 pin header (26 GPIOs)
- Stereo audio and composite video is supported by 3.5mm jack connector
- 4 USB 2.0 ports
- Gigabit Ethernet
- PoE (power over Ethernet) is a major feature incorporated in this device that lacks in B model
- 2-pin reset header
- Micro SD socket, used to enhance the memory capacity of the board
- MicroUSB power connector, used for transferring power to the device
- HDMI
- CSI camera interface
- Comes with WiFi and Bluetooth facility that were not present in previous Raspberry Pi 1 and 2 versions
- DSI connector for official screen
Mechanical Dimensions
Following figure shows the dimensions of Raspberry Pi 3 B+
- The mechanical dimensions of this B+ are same as B version i.e. 85mm x 56mm. (Width x Height)
Applications
Raspberry Pi comes with a wide range of applications and works as a regular computer in some cases.
- Tablet Computer
- Home Automation
- Controlling Robots
- Coffee Projects
- Arcade Machine
- Media Streamer
- Internet Radio
- Cosmic Computer
That's all for today. I hope you have found this article useful. If you are unsure or have any question you can ask me in the comment section below. I'd love to help you according to the best of my expertise so you always keep coming back for what we have to offer. You are most welcome to keep us updated with your valuable feedback and suggestions, they allow us to give you quality work that resonates with your needs and requirements. Thanks for reading the article.
How to Control DC Motor with Raspberry Pi 3
Hello friends, I hope you all are doing great. In today's tutorial, I am going to show you How to Control DC Motor with Raspberry Pi 3. We will control both the speed and direction of DC Motor. I hope you have read the previous tutorial on How to Create a GUI in Raspberry Pi 3 as we are gonna create a small GUI in this tutorial as well and then we are gonna control our DC Motor with Buttons on GUI.
In order to control the DC Motor, we have to use some drivers in between our Microcontroller and DC Motor. This driver's functionality is to control a 12V DC Motor with a 5V signal from a microcontroller. In today's tutorial, we are gonna use L298 Motor Driver. So, let's get started with How to Control DC Motor with Raspberry Pi 3:
How to Control DC Motor with Raspberry Pi 3
- I have divided this tutorial into four parts, which are:
- Designing of 5V Power Supply.
- L298 Motor Driver Circuit Designing.
- Direction Control of Dc Motor with Raspberry Pi 3.
- Speed Control of DC Motor with Raspberry Pi 3.
- You can download this python File for Controlling of DC Motor with Raspberry Pi 3, by clicking the below button:
Download Python File
- So, let's first design our 5V Power Supply:
1. Designing of 5V Power Supply
- First of all, we need to design a power supply using Voltage Regulator 7805, which will step down our voltage from 12V to 5V.
- We need 12V for our DC Motor and 5V is also required for L298 Motor Driver.
- I am using a 12V adapter so I need to step down this voltage to 5V.
- You can use 5V from Raspberry Pi as well if you don't wanna design this power supply, although it's quite simple.
- For example, if you are designing some robot then you can't place your Laptop on it. In such cases we need to design 5V power supply for our Pi.
- Here's the list of components that are going to be used for this power supply:
- 7805.
- 100uF Capacitor.
- 1000uF Capacitor.
- 1k ohm Resistance.
- 2 Pin Socket.
- Male Header Pins.
- You can see in above figure that we have used 12V Battery and then used 7805 to get 5V at the output.
- Here's the real circuit which I have designed on wero board:
- So, now we have all three voltage levels, which are:
- 12V: White wire.
- 5V: Gray Wire.
- GND ( 0V ): Red Wire.
- The next thing we need to do is, we need to design the Motor driver circuit using L298 Motor Driver:
L298 Motor Driver Circuit
- L298 is an excellent motor driver, you can control two DC Motors with one L298 driver.
- I have used L298 Motor Driver Shield, you can read more about this shield on L298 Motor Driver Library for Proteus.
- Here's the circuit, which I have designed for controlling my DC Motor with Raspberry Pi 3:
- You can quite easily design this circuit as you just need to connect simple jumper wires.
- Here's my real setup with L298 Motor Driver & Raspberry Pi 3:
- So, now we are done with our connections and you can see in above figures that we are using these three pins of Raspberry Pi 3:
- Pin # 12: Connected to Enable A.
- Pin # 16: Connected to Input 1.
- Pin # 18: Connected to Input 2.
- The fourth wire is GND, you have to connect the GND of Raspberry Pi 3 with your power supply GND.
- +12V & 5V are provided to the L298 motor driver from our power supply.
- Now let's design our code in python, first, we will control the direction of DC Motor and after that, we will control its speed.
Direction Control of DC Motor with Raspberry Pi 3
- First of all, I am gonna place three Buttons on my GUI and then I will control the direction of my DC Motor with these buttons.
- I have already explained the code in bits in my previous tutorial LEd Blinking with Raspberry Pi 3, so I will not explain it all again but will only cover the new code.
- So, here's our first part of code, where I have done the basic configuration of our pins and GUI:
# ************************************************************************** #
# **** **** #
# *********** Code Designed by www.TheEngineeringProjects.com ************** #
# **** **** #
# ************** How to Control DC Motor in Raspberry Pi 3 ***************** #
# **** **** #
# ************************************************************************** #
# Importing Libraries
import RPi.GPIO as GPIO
import time
from tkinter import *
import tkinter.font
# Libraries Imported successfully
# Raspberry Pi 3 Pin Settings
PWMPin = 12 # PWM Pin connected to ENA.
Motor1 = 16 # Connected to Input 1.
Motor2 = 18 # Connected to Input 2.
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD) # We are accessing GPIOs according to their physical location
GPIO.setup(PWMPin, GPIO.OUT) # We have set our pin mode to output
GPIO.setup(Motor1, GPIO.OUT)
GPIO.setup(Motor2, GPIO.OUT)
GPIO.output(PWMPin, GPIO.LOW) # When it will start then all Pins will be LOW.
GPIO.output(Motor1, GPIO.LOW)
GPIO.output(Motor2, GPIO.LOW)
PwmValue = GPIO.PWM(PWMPin, 2000) # We have set our PWM frequency to 2000.
PwmValue.start(100) # That's the maximum value 100 %.
# Raspberry Pi 3 Pin Settings Completed
# tkinter GUI basic settings
Gui = Tk()
Gui.title("DC Motor Control with Pi 3")
Gui.config(background= "#0080FF")
Gui.minsize(800,300)
Font1 = tkinter.font.Font(family = 'Helvetica', size = 18, weight = 'bold')
# tkinter simple GUI created
- The above code is quite easy to understand, you have seen that I have made the PWM value to maximum as I don't want to change the speed, I just want to control its directions.
- So, now let's add the buttons and Labels on our GUI, here's the code:
Text1 = Label(Gui,text='Motor Status:', font = Font1, fg='#FFFFFF', bg = '#0080FF', padx = 50, pady = 50)
Text1.grid(row=0,column=0)
Text2 = Label(Gui,text='Stop', font = Font1, fg='#FFFFFF', bg = '#0080FF', padx = 0)
Text2.grid(row=0,column=1)
Text1 = Label(Gui,text=' ', font = Font1, fg='#FFFFFF', bg = '#0080FF', padx = 150, pady = 50)
Text1.grid(row=0,column=2)
Button1 = Button(Gui, text='Clockwise', font = Font1, command = MotorClockwise, bg='bisque2', height = 1, width = 10)
Button1.grid(row=1,column=0)
Button2 = Button(Gui, text=' Motor Stop', font = Font1, command = MotorStop, bg='bisque2', height = 1, width = 10)
Button2.grid(row=1,column=1)
Button2 = Button(Gui, text='AntiClockwise', font = Font1, command = MotorAntiClockwise, bg='bisque2', padx = 50, height = 1, width = 10)
Button2.grid(row=1,column=2)
Text3 = Label(Gui,text='www.TheEngineeringProjects.com', font = Font1, bg = '#0080FF', fg='#FFFFFF', padx = 50, pady = 50)
Text3.grid(row=2,columnspan=2)
Gui.mainloop()
- I have used three Texts in first row, the third text is just used for padding. It's easy that way. :P
- I have placed three buttons in the second row and in the last row we have our site's link.
- Here's the screenshot of this GUI:
- Now, finally, we need to add the functions for these buttons.
- Here's the code for these functions and we need to place that code above our GUI code.
def MotorClockwise():
GPIO.output(Motor1, GPIO.LOW) # Motor will move in clockwise direction.
GPIO.output(Motor2, GPIO.HIGH)
def MotorAntiClockwise():
GPIO.output(Motor1, GPIO.HIGH) # Motor will move in anti-clockwise direction.
GPIO.output(Motor2, GPIO.LOW)
def MotorStop():
GPIO.output(Motor1, GPIO.LOW) # Motor will stop.
GPIO.output(Motor2, GPIO.LOW)
- We have three functions here and simply by toggling the pins of our DC Motor, I have changed it direction.
- In order to stop the DC Motor, I have simply made both the pins LOW.
- Now run your code and if everything goes fine then you will motor will follow your command.
- Here's the screenshot of my system in running form:
- Here's our complete code for DC Motor Direction Control with Raspberry Pi 3, in one piece. :P
# ************************************************************************** #
# **** **** #
# *********** Code Designed by www.TheEngineeringProjects.com ************** #
# **** **** #
# ************** How to Control DC Motor in Raspberry Pi 3 ***************** #
# **** **** #
# ************************************************************************** #
# Importing Libraries
import RPi.GPIO as GPIO
import time
from tkinter import *
import tkinter.font
# Libraries Imported successfully
# Raspberry Pi 3 Pin Settings
PWMPin = 12 # PWM Pin connected to ENA.
Motor1 = 16 # Connected to Input 1.
Motor2 = 18 # Connected to Input 2.
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD) # We are accessing GPIOs according to their physical location
GPIO.setup(PWMPin, GPIO.OUT) # We have set our pin mode to output
GPIO.setup(Motor1, GPIO.OUT)
GPIO.setup(Motor2, GPIO.OUT)
GPIO.output(PWMPin, GPIO.LOW) # When it will start then all Pins will be LOW.
GPIO.output(Motor1, GPIO.LOW)
GPIO.output(Motor2, GPIO.LOW)
PwmValue = GPIO.PWM(PWMPin, 2000) # We have set our PWM frequency to 2000.
PwmValue.start(100) # That's the maximum value 100 %.
# Raspberry Pi 3 Pin Settings Completed
# tkinter GUI basic settings
Gui = Tk()
Gui.title("DC Motor Control with Pi 3")
Gui.config(background= "#0080FF")
Gui.minsize(800,300)
Font1 = tkinter.font.Font(family = 'Helvetica', size = 18, weight = 'bold')
# tkinter simple GUI created
def MotorClockwise():
GPIO.output(Motor1, GPIO.LOW) # Motor will move in clockwise direction.
GPIO.output(Motor2, GPIO.HIGH)
def MotorAntiClockwise():
GPIO.output(Motor1, GPIO.HIGH) # Motor will move in anti-clockwise direction.
GPIO.output(Motor2, GPIO.LOW)
def MotorStop():
GPIO.output(Motor1, GPIO.LOW) # Motor will stop.
GPIO.output(Motor2, GPIO.LOW)
Text1 = Label(Gui,text='Motor Status:', font = Font1, fg='#FFFFFF', bg = '#0080FF', padx = 50, pady = 50)
Text1.grid(row=0,column=0)
Text2 = Label(Gui,text='Stop', font = Font1, fg='#FFFFFF', bg = '#0080FF', padx = 0)
Text2.grid(row=0,column=1)
Text1 = Label(Gui,text=' ', font = Font1, fg='#FFFFFF', bg = '#0080FF', padx = 150, pady = 50)
Text1.grid(row=0,column=2)
Button1 = Button(Gui, text='Clockwise', font = Font1, command = MotorClockwise, bg='bisque2', height = 1, width = 10)
Button1.grid(row=1,column=0)
Button2 = Button(Gui, text=' Motor Stop', font = Font1, command = MotorStop, bg='bisque2', height = 1, width = 10)
Button2.grid(row=1,column=1)
Button2 = Button(Gui, text='AntiClockwise', font = Font1, command = MotorAntiClockwise, bg='bisque2', padx = 50, height = 1, width = 10)
Button2.grid(row=1,column=2)
Text3 = Label(Gui,text='www.TheEngineeringProjects.com', font = Font1, bg = '#0080FF', fg='#FFFFFF', padx = 50, pady = 50)
Text3.grid(row=2,columnspan=3)
Gui.mainloop()
- Now let's have a look at How to Control the Speed of our DC Motor with Raspberry Pi 3.
DC Motor Speed Control with Raspberry Pi 3
- I'm gonna add a slider in our GUI and with the help of this slider we are gonna change the value of PWM which in turn will change the speed our DC Motor.
- Here's the code for the slider which you need to place below our last Text.
Scale1 = Scale(Gui, from_=0, to=100, orient = HORIZONTAL, resolution = 1, command = ChangePWM)
Scale1.grid(row=2,column=2)
- Now run your GUI and you will get something as shown in below figure:
- Here's the code for the function which will execute when we change the slider value.
def ChangePWM(self):
PwmValue.ChangeDutyCycle(Scale1.get())
- Now when you will run your simulation and change the value of this slider you will feel a clear change in your DC Motor speed.
- I will also create a video which will give you better understanding of this project.
- Here's our final combined code which will control both speed & direction of our DC Motor.
# ************************************************************************** #
# **** **** #
# *********** Code Designed by www.TheEngineeringProjects.com ************** #
# **** **** #
# ************** How to Control DC Motor in Raspberry Pi 3 ***************** #
# **** **** #
# ************************************************************************** #
# Importing Libraries
import RPi.GPIO as GPIO
import time
from tkinter import *
import tkinter.font
# Libraries Imported successfully
# Raspberry Pi 3 Pin Settings
PWMPin = 12 # PWM Pin connected to ENA.
Motor1 = 16 # Connected to Input 1.
Motor2 = 18 # Connected to Input 2.
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD) # We are accessing GPIOs according to their physical location
GPIO.setup(PWMPin, GPIO.OUT) # We have set our pin mode to output
GPIO.setup(Motor1, GPIO.OUT)
GPIO.setup(Motor2, GPIO.OUT)
GPIO.output(PWMPin, GPIO.LOW) # When it will start then all Pins will be LOW.
GPIO.output(Motor1, GPIO.LOW)
GPIO.output(Motor2, GPIO.LOW)
PwmValue = GPIO.PWM(PWMPin, 2000) # We have set our PWM frequency to 2000.
PwmValue.start(100) # That's the maximum value 100 %.
# Raspberry Pi 3 Pin Settings Completed
# tkinter GUI basic settings
Gui = Tk()
Gui.title("DC Motor Control with Pi 3")
Gui.config(background= "#0080FF")
Gui.minsize(800,300)
Font1 = tkinter.font.Font(family = 'Helvetica', size = 18, weight = 'bold')
# tkinter simple GUI created
def MotorClockwise():
GPIO.output(Motor1, GPIO.LOW) # Motor will move in clockwise direction.
GPIO.output(Motor2, GPIO.HIGH)
def MotorAntiClockwise():
GPIO.output(Motor1, GPIO.HIGH) # Motor will move in anti-clockwise direction.
GPIO.output(Motor2, GPIO.LOW)
def MotorStop():
GPIO.output(Motor1, GPIO.LOW) # Motor will stop.
GPIO.output(Motor2, GPIO.LOW)
def ChangePWM(self):
PwmValue.ChangeDutyCycle(Scale1.get())
Text1 = Label(Gui,text='Motor Status:', font = Font1, fg='#FFFFFF', bg = '#0080FF', padx = 50, pady = 50)
Text1.grid(row=0,column=0)
Text2 = Label(Gui,text='Stop', font = Font1, fg='#FFFFFF', bg = '#0080FF', padx = 0)
Text2.grid(row=0,column=1)
Text1 = Label(Gui,text=' ', font = Font1, fg='#FFFFFF', bg = '#0080FF', padx = 150, pady = 50)
Text1.grid(row=0,column=2)
Button1 = Button(Gui, text='Clockwise', font = Font1, command = MotorClockwise, bg='bisque2', height = 1, width = 10)
Button1.grid(row=1,column=0)
Button2 = Button(Gui, text=' Motor Stop', font = Font1, command = MotorStop, bg='bisque2', height = 1, width = 10)
Button2.grid(row=1,column=1)
Button2 = Button(Gui, text='AntiClockwise', font = Font1, command = MotorAntiClockwise, bg='bisque2', padx = 50, height = 1, width = 10)
Button2.grid(row=1,column=2)
Text3 = Label(Gui,text='www.TheEngineeringProjects.com', font = Font1, bg = '#0080FF', fg='#FFFFFF', padx = 50, pady = 50)
Text3.grid(row=2,columnspan=2)
Scale1 = Scale(Gui, from_=0, to=100, orient = HORIZONTAL, resolution = 1, command = ChangePWM)
Scale1.grid(row=2,column=2)
Gui.mainloop()
So, that was all for today. I hope you have enjoyed today's tutorial. Let me know if you have any questions. Have a good day. :)
Raspberry Pi 3 Projects
Hey Fellas! Hope you are doing great. Our team always keeps your needs and demands on the top so you keep coming back for what we have to offer.
Based on recent comments and suggestions given by our valuable visitors, I have decided to arrange all of our Raspberry Pi 3 projects so you get a clear idea What is Raspberry Pi 3 and How it is used for the execution of many projects?
Are you feeling skeptical about learning Raspberry Pi 3 basics? Don't you worry, I have got you covered. I'll arrange all articles related to raspberry pi 3 in a sequence from beginner to pro level, so you find all information in one place and grab the main concept easily. Let's dive in and explore each and everything related to Raspberry Pi 3.
Raspberry Pi 3 - Basics
Raspberry Pi 3 is not a new device and most of the people are aware of it. In case, you are not, let me help you with the basic functions and features of this device and everything you need to know.
- What is Raspberry Pi 3??? In this tutorial, I have explained Introduction to Raspberry Pi 3 i.e. what is raspberry pi 3? how it is used for? Its main features and hardware specifications and what operating system are used to operate this device. This article proves to be very beneficial if you are new to this device.
- Installation of Rasbian on Raspberry Pi 3 SD Card This is a very important tutorial in order to make your device ready for operation. In this tutorial, you will get to know, how to install Raspbian on the SD card of Raspberry Pi 3. SD card works as a hard drive of this device and Raspbian is an operating system used to put the device in a running condition.
- How to Setup 7 inch HDMI LCD with Raspberry Pi 3??? Now, you are familiar with the Raspberry Pi 3 and you have successfully installed an operating system on this device. Now is the perfect time to use this device for controlling and running of external electronic devices. In this tutorial, you will learn easy steps how to connect 7 inch LCD with Raspberry Pi 3. In order to execute this project in real time, you need 5 main things i.e. Raspberry Pi 3, SD card, 7 inch LCD, USB mouse, and keyboard.
- How to Control Raspberry Pi 3 from Laptop ??? This tutorial includes a comprehensive read on how to control raspberry pi 3 from the laptop. You will get a quick review with images how to install VNC server on raspberry pi 3. This is a third party tool used to control raspberry pi 3 from the laptop.
- LED Blinking using Raspberry Pi 3 This tutorial is very important for the beginners who take a deep interest in embedded projects. In this tutorial, we break down everything in easy steps to interface LED with a digital pin of raspberry pi 3. We have developed simple code in Python to turn LED device ON & OFF.
- How to Create a GUI in Raspberry Pi 3??? This tutorial is linked to our previous tutorial on LED blinking. We have used the same project and added a GUI to it. This GUI gives a presentable form to your project. We have added buttons on GUI that allow our LED turn ON & OFF. You must be expert in creating a GUI before you get a hold of bigger projects.
- How to Create PWM in Raspberry Pi 3 ??? We are going to work on the same project where we have interfaced LED with raspberry pi 3 and then created GUI buttons to control the LED. In this tutorial, you will learn how to control the intensity of LED by creating PWM pulse. You'll also get an overview of how to use Scale in Raspberry Pi 3.
How to Create PWM in Raspberry Pi 3
Hello friends, I hope you all are doing great. In today's tutorial, I am going to explain How to Create PWM in Raspberry Pi 3. In our previous tutorial, we have seen How to Create GUI in Raspberry Pi 3, & we have also controlled an LED from the GUI Buttons. So, I am gonna take that project and will add PWM code in it.
So, I would recommend you to first have a look at LED Blinking with Raspberry Pi 3 in which we have designed this simple project and then check How to Create GUI in Raspberry Pi 3, where we have controlled that LED digitally with GUI. But today, we are gonna control the intensity of this LED by creating a PWM Pulse in Raspberry Pi 3. Along with that, we are also gonna have a look at How to use Scale in Raspberry Pi 3. I will add a new scale in the same GUI and when we change the value of this scale and the LED intensity will also change. So, let's get started with How to Create PWM in Raspberry Pi 3:
Create PWM in Raspberry Pi 3
- In our previous post, we have created a simple GUI to control an LED, that GUI is shown in below figure:
- I hope you have remembered the Grid system which we discussed in last lecture, we are now gonna add a new scale in our GUI and we will place it at row = 1 & column = 2.
- It's on the right side of 'LED OFF' button. Here's the code for it.
Scale1 = Scale(Gui, from_=0, to=100, orient = HORIZONTAL, resolution = 1, command = ChangePWM)
Scale1.grid(row=1,column=2)
- We have created a new slider and it's value starts from 0 and it ends at 100.
- Its orientation is horizontal, by default its vertical.
- We have assigned it a function named as ChangePWM and this function will execute whenever we change the value of this slider.
- As, we haven't yet created the function so if you will change its value then it will give error.
- If you run it, it will look something as shown in below figure:
- I have given it a value from 0 to 100 because our PWM pulse value also goes from 0% to 100%.
- If you don't know much about PWM then you should have a look at How to use Arduino PWM Pins, just read the PWM part I have discussed it in detail there.
- In raspberry Pi 3, we have Pin # 12 and Pin # 32 as PWM Pins but I have tried different I/O Pins and this PWM commands works quite fine on all of them. :P
- Anyways, I am going to use Pin # 12 of pi 3 so change this value from 11 to 12.
- So, first of all we are gonna create our PWM frequency, which I have set to 5000.
- After that I have started my PWM Pulse with a value of 0.
PwmValue = GPIO.PWM(LED, 5000)
PwmValue.start(0)
- As you can see in above code our PwmValue is 0 so which means our LED will remain OFF.
- Now, we have to create our slide function ChangePWM.
- So, add the below code after your Buttons functions:
def ChangePWM(self):
PwmValue.ChangeDutyCycle(Scale1.get())
- Just make sure to add this self in functions' name.
- Slide function works a little different than Button function, so we have to add this self. If you have ever worked on embedded then we add (void). :P
- ChangeDutyCycle is the command to change duty cycle of our PWM Pulse.
- So, we are simply getting value of our Scale and then giving this value to our pwm pulse which in turn changes the intensity of our LED.
- So, if we have 0 on slider then our LED will be at lowest intensity so means OFF and at 100 it will glow at maximum intensity or 5V.
- Here's our complete code:
# ************************************************************************** #
# **** **** #
# *********** Code Designed by www.TheEngineeringProjects.com ************** #
# **** **** #
# ****************** How to Create a GUI in Raspberry Pi 3 ***************** #
# **** **** #
# ************************************************************************** #
# Importing Libraries
import RPi.GPIO as GPIO
import time
from tkinter import *
import tkinter.font
# Libraries Imported successfully
# Raspberry Pi 3 Pin Settings
LED = 12 # pin12
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD) # We are accessing GPIOs according to their physical location
GPIO.setup(LED, GPIO.OUT) # We have set our LED pin mode to output
GPIO.output(LED, GPIO.LOW) # When it will start then LED will be OFF
PwmValue = GPIO.PWM(LED, 5000)
PwmValue.start(0)
# Raspberry Pi 3 Pin Settings
# tkinter GUI basic settings
Gui = Tk()
Gui.title("GUI in Raspberry Pi 3")
Gui.config(background= "#0080FF")
Gui.minsize(800,300)
Font1 = tkinter.font.Font(family = 'Helvetica', size = 24, weight = 'bold')
# tkinter simple GUI created
def ledON():
GPIO.output(LED, GPIO.HIGH) # led on
Text2 = Label(Gui,text=' ON ', font = Font1, bg = '#0080FF', fg='green', padx = 0)
Text2.grid(row=0,column=1)
def ledOFF():
GPIO.output(LED, GPIO.LOW) # led off
Text2 = Label(Gui,text='OFF', font = Font1, bg = '#0080FF', fg='red', padx = 0)
Text2.grid(row=0,column=1)
def ChangePWM(self):
PwmValue.ChangeDutyCycle(Scale1.get())
Text1 = Label(Gui,text='LED Status:', font = Font1, fg='#FFFFFF', bg = '#0080FF', padx = 50, pady = 50)
Text1.grid(row=0,column=0)
Text2 = Label(Gui,text='OFF', font = Font1, fg='#FFFFFF', bg = '#0080FF', padx = 0)
Text2.grid(row=0,column=1)
Button1 = Button(Gui, text=' LED ON', font = Font1, command = ledON, bg='bisque2', height = 1, width = 10)
Button1.grid(row=1,column=0)
Button2 = Button(Gui, text=' LED OFF', font = Font1, command = ledOFF, bg='bisque2', height = 1, width = 10)
Button2.grid(row=1,column=1)
Scale1 = Scale(Gui, from_=0, to=100, orient = HORIZONTAL, resolution = 1, command = ChangePWM)
Scale1.grid(row=1,column=2)
Text3 = Label(Gui,text='www.TheEngineeringProjects.com', font = Font1, bg = '#0080FF', fg='#FFFFFF', padx = 50, pady = 50)
Text3.grid(row=2,columnspan=2)
Gui.mainloop()
- You can download this PWM code by clicking the below button:
[dt_default_button link="https://www.theengineeringprojects.com/RaspberryPi3/How to Create PWM in Raspberry Pi 3.rar" button_alignment="default" animation="fadeIn" size="medium" default_btn_bg_color="" bg_hover_color="" text_color="" text_hover_color="" icon="fa fa-chevron-circle-right" icon_align="left"]Download PWM Pulse Code for Raspberry Pi 3[/dt_default_button]
- So, now let's run our code and get the results. I have shared the below image in which I have set the value of scale to 15.
So, that was all about How to Create PWM in Raspberry Pi 3. In our coming tutorial, we are gonna have a look at How to Control Direction & Speed of Dc Motor with Raspberry Pi 3. So, will meet you guys in next tutorial. Till then take care and have fun !!! :)
How to Create a GUI in Raspberry Pi 3
Hello friends, I hope you all are doing great. In today's tutorial, I am going to show you How to Create a GUI in Raspberry Pi 3. There are many different third party libraries available and the one I am going to use is tkinter. I have tried these libraries and I liked it the most so that's why I'm gonna use it in my future
Raspberry Pi 3 Projects.
In our previous tutorial on Raspberry Pi 3, we have had a look at
LED Blinking using Raspberry Pi 3. So, today I am gonna work on the same project and we will add a GUI in it. GUI is an abbreviation of
Graphical User Interface and it is used to give a presentable form to your project. We will add some buttons on our GUI and we will turn ON or OFF our LED using buttons. It's quite a basic tutorial but its essential to cover before working on bigger projects. So, let's get started with How to Create a GUI in Raspberry Pi 3:
How to Create a GUI in Raspberry Pi 3
- I hope you have already Setup your HDMI LCD with Raspberry Pi 3, as we have done in our previous tutorials.
- Here's an image of our final setup:
- So open a new File in your Python IDLE and save it, I have given it a name CreateGUI.py
- First of all we are gonna import our libraries in python, so here's the code:
# ************************************************************************** #
# **** **** #
# *********** Code Designed by www.TheEngineeringProjects.com ************** #
# **** **** #
# ****************** How to Create a GUI in Raspberry Pi 3 ***************** #
# **** **** #
# ************************************************************************** #
# Importing Libraries
import RPi.GPIO as GPIO
import time
from tkinter import *
import tkinter.font
# Libraries Imported successfully
- In the above code you can see, we have imported a new library which is tkinter library and we have also imported font from it.
- Now we are gonna do some initial settings of our Raspberry Pi 3 LED Pin, as we have have done in LED Blinking using Raspberry Pi 3.
- Here's the code for that:
# Raspberry Pi 3 Pin Settings
LED = 11 # pin11
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD) # We are accessing GPIOs according to their physical location
GPIO.setup(LED, GPIO.OUT) # We have set our LED pin mode to output
GPIO.output(LED, GPIO.LOW) # When it will start then LED will be OFF
# Raspberry Pi 3 Pin Settings
- In the above code I have set all warnings to False as I think warnings are just annoying. :P
- After that I have set our GPIO mode to Board because its lot easier to remember Pin Number as their number on board.
- You can set this mode to BCM as well.
- Next we have made our LED Pin output and have made it Low as I wanna keep my LED in OFF state when project starts up.
- Now let's place some code for GUI initialization and basic settings,here's the code:
# tkinter GUI basic settings
Gui = Tk()
Gui.title("GUI in Raspberry Pi 3")
Gui.config(background= "#0080FF")
Gui.minsize(700,300)
Font1 = tkinter.font.Font(family = 'Helvetica', size = 24, weight = 'bold')
# tkinter simple GUI created
- First of all, I have create an object named Gui, which is actually my GUI Board.
- Then I have given it a title, which will appear as name of this GUI or software.
- I have made the background light blue, it will look good.
- the minimum size, I have set is 700 x 300, its in pixels (x, y).
- Finally we have set our Font, which we are not using yet but will use in next section.
- Now if you run your code then you will get something as shown in below figure:
- You can see in above figure that we a got a simple board and the title is also there.
- So, now let's add some Labels first on our GUI in pi 3:
Text1 = Label(Gui,text='LED Status:', font = Font1, fg='#FFFFFF', bg = '#0080FF', padx = 50, pady = 50)
Text1.grid(row=0,column=0)
Text2 = Label(Gui,text='OFF', font = Font1, fg='#FFFFFF', bg = '#0080FF', padx = 0)
Text2.grid(row=0,column=1)
- I think these codes are self explanatory, I have added two texts "LED Status: " and "OFF".
- I have given them the Font1 which we created in last section and then the background is again white, and I have also added some padding in x and y direction so that it won't touch the borders.
- In this GUI tkinter coding we have grid system. The below image will clear the idea:
- We have added both our Labels in first row, so here's the output of above code:
- Now let's add two buttons below these Labels, which will control our LED and will turn it ON and OFF.
- Here's the code for adding Buttons in GUI using tkinter:
Button1 = Button(Gui, text=' LED ON', font = Font1, command = ledON, bg='bisque2', height = 1, width = 10)
Button1.grid(row=1,column=0)
Button2 = Button(Gui, text=' LED OFF', font = Font1, command = ledOFF, bg='bisque2', height = 1, width = 10)
Button2.grid(row=1,column=1)
- You have seen in above code that now these two buttons are in second row so they will come below these Labels.
- The only thing worth mentioning here is the Command, its actually a function which will execute on pressing that button.
- So, now we need to add these functions above Label codes.
- Just try to understand the code rite now, I have shared the complete file below, which you can easily download.
- So, here's these two functions' codes:
# Function for Buttons started here
def ledON():
GPIO.output(LED, GPIO.HIGH) # led on
Text2 = Label(Gui,text=' ON ', font = Font1, bg = '#0080FF', fg='green', padx = 0)
Text2.grid(row=0,column=1)
def ledOFF():
GPIO.output(LED, GPIO.LOW) # led off
Text2 = Label(Gui,text='OFF', font = Font1, bg = '#0080FF', fg='red', padx = 0)
Text2.grid(row=0,column=1)
# Function for Buttons ended here
- In some cases you need to merge your columns or rows, for that you can use below code.
- In below code, I have merged the columns of last row by using 'columnspan=2' and added our site's link.
- It has merged the first two columns of last row and here's the code:
Text3 = Label(Gui,text='www.TheEngineeringProjects.com', font = Font1, bg = '#0080FF', fg='#FFFFFF', padx = 50, pady = 50)
Text3.grid(row=2,columnspan=2)
- And finally we need to add our main loop code, which is like while(1) in python, it is given below:
Gui.mainloop()
- Now run your code and you will get something as shown in below figure:
- I have combined all the above codes and here's it's final form, it's now easy to understand:
# ************************************************************************** #
# **** **** #
# *********** Code Designed by www.TheEngineeringProjects.com ************** #
# **** **** #
# ****************** How to Create a GUI in Raspberry Pi 3 ***************** #
# **** **** #
# ************************************************************************** #
# Importing Libraries
import RPi.GPIO as GPIO
import time
from tkinter import *
import tkinter.font
# Libraries Imported successfully
# Raspberry Pi 3 Pin Settings
LED = 11 # pin11
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD) # We are accessing GPIOs according to their physical location
GPIO.setup(LED, GPIO.OUT) # We have set our LED pin mode to output
GPIO.output(LED, GPIO.LOW) # When it will start then LED will be OFF
# Raspberry Pi 3 Pin Settings
# tkinter GUI basic settings
Gui = Tk()
Gui.title("GUI in Raspberry Pi 3")
Gui.config(background= "#0080FF")
Gui.minsize(700,300)
Font1 = tkinter.font.Font(family = 'Helvetica', size = 24, weight = 'bold')
# tkinter simple GUI created
# Funtion for Buttons started here
def ledON():
GPIO.output(LED, GPIO.HIGH) # led on
Text2 = Label(Gui,text=' ON ', font = Font1, bg = '#0080FF', fg='green', padx = 0)
Text2.grid(row=0,column=1)
def ledOFF():
GPIO.output(LED, GPIO.LOW) # led off
Text2 = Label(Gui,text='OFF', font = Font1, bg = '#0080FF', fg='red', padx = 0)
Text2.grid(row=0,column=1)
# Funtion for Buttons ended here
Text1 = Label(Gui,text='LED Status:', font = Font1, fg='#FFFFFF', bg = '#0080FF', padx = 50, pady = 50)
Text1.grid(row=0,column=0)
Text2 = Label(Gui,text='OFF', font = Font1, fg='#FFFFFF', bg = '#0080FF', padx = 0)
Text2.grid(row=0,column=1)
Button1 = Button(Gui, text=' LED ON', font = Font1, command = ledON, bg='bisque2', height = 1, width = 10)
Button1.grid(row=1,column=0)
Button2 = Button(Gui, text=' LED OFF', font = Font1, command = ledOFF, bg='bisque2', height = 1, width = 10)
Button2.grid(row=1,column=1)
Text3 = Label(Gui,text='www.TheEngineeringProjects.com', font = Font1, bg = '#0080FF', fg='#FFFFFF', padx = 50, pady = 50)
Text3.grid(row=2,columnspan=2)
Gui.mainloop()
- If you got into any trouble then ask in comments.
- Now when you click on the "LED ON" Button then your LED will turn ON and when you click on the "LED OFF" button, then your LED will go OFF.
- LED status text on GUI will change from OFF to ON.
- Both Raspberry Pi 3 Screen and its hardware setup are shown in below figure: (click & zoom)
- Now when you click the LED OFF button then LED status will change from ON to OFF as shown in below figure:
- I hope you have got the main idea of How to create GUI in Raspberry Pi 3.
- In my coming tutorial, I will share many tutorials on raspberry Pi 3 in which we will create such simple GUIs and will display different sensors' values and will also control them.
- You can download this CreateGUI.py file by clicking the below button:
[dt_default_button link="https://www.theengineeringprojects.com/RaspberryPi3/CreateGUI.rar" button_alignment="default" animation="fadeIn" size="medium" default_btn_bg_color="" bg_hover_color="" text_color="" text_hover_color="" icon="fa fa-chevron-circle-right" icon_align="left"]Download CreateGUI.py File[/dt_default_button]
So, that was all about How to Create GUI in Raspberry Pi 3. I hope you have got the detailed idea of GUI creation. In my coming tutorial, we will have a look at How to Control DC Motor with Raspberry Pi 3. Thanks for reading, have fun !!! :)
LED Blinking using Raspberry Pi 3
Hello friends, I hope you all are doing great. In today's tutorial, we are gonna have a look at
LED Blinking using Raspberry Pi 3. It's our first embedded project on Pi 3 and its quite simple. In our previous tutorials on Raspberry Pi 3, we have seen How to install Rasbian on SD Card for Pi 3 and then we have also setup HDMI LCD with Pi 3. So, now our raspberry Pi 3 is ready to program.
In today's tutorial, we will interface a single LED with digital Pin of Raspberry Pi and then we will design a simple code in Python which will turn this LE ON and OFF. It will be quite simple and I will guide you step by step, but if you got into any trouble then ask in comments and I will help you out. So, let's get starteed with LEd Blinking using Raspberry Pi 3:
LED Blinking using Raspberry Pi 3
- On our previous tutorials, we have already set up our computer with raspberry Pi 3. If you haven't read those articles then you must go through them first.
- So, here's our final setup as shown in below figure:
- You must have noticed in above figure that we have an extra Bread Board, which was not present in our Previous Setup.
- I have placed an LED on this Bread board and here's its circuit diagram:
- I would recommend you to use Bread Board but if you can manage to connect legs of resistor and LED then that's fine as well. :P
- Here's a close look of this LED placed in Bread Board.
- Now we have successfully designed our simple electronic circuit.
- It's time to start moving towards coding part.
- We are gonna use Python language that's why I am gonna open pre installed tool in raspbian named as Python 3 (IDLE).
- We are gonna use this environment to design our python code.
- So click on your Menu > Programming > Python 3 (IDLE), as shown in below figure:
- Python 3 will open up, so click on File and then New File to create a seperate File for this project, as shown in below figure:
- You can give a name to this New File, as I have give it Blink.py , .py is the extension for python files.
- In this Blink.py, we are gonna write our code, which will blink the LED, here's our code:
- Copy the below code and paste it in your Blink.py file as shown in above figure.
import RPi.GPIO as GPIO
import time
LED = 11 # pin11
print(" ******** LED Blinking using Raspberry Pi 3 ********* ")
print(" **** Designed by www.TheEngineeringProjects.com **** ")
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD) # We are accessing GPIOs according to their physical location
GPIO.setup(LED, GPIO.OUT) # We have set our LED pin mode to output
GPIO.output(LED, GPIO.LOW) # When it will start then LED will be OFF
while True: #Compiler will keep on executing this loop (infinite loop
GPIO.output(LED, GPIO.HIGH) # led on
time.sleep(2) #delay
GPIO.output(LED, GPIO.LOW) # led off
time.sleep(2)
- You can also download this Blink.py file by clicking below button:
[dt_default_button link="https://www.theengineeringprojects.com/RaspberryPi3/LED Blinking using Raspberry Pi 3.rar" button_alignment="default" animation="fadeIn" size="medium" default_btn_bg_color="" bg_hover_color="" text_color="" text_hover_color="" icon="fa fa-chevron-circle-right" icon_align="left"]Download Blink.py File[/dt_default_button]
- When you run this Blink.py File by pressing F5, then your LED will start blinking. Here's the screenshot of LED in ON state:
- So, that's how you can interact with hardware pins of Pi 3.
I hope after following today's tutorial you can quite easily design this LED Blinking using Raspberry Pi 3. If you got into any troubles then ask in comments and I will sort them out. In the next tutorial, we are gonna have a look at How to Create a GUI in Python. Till then Take care and have fun !!! :)
How to Control Raspberry Pi 3 from Laptop
Hello everyone, I hope you all are doing great. In today's article, I am going to show you How to Control Raspberry Pi 3 from Laptop or Computer. In our previous tutorial, we have seen
How to setup 7 inch HDMI LCD with Raspberry Pi 3 and you must have noticed that designing your code on TFT LCD is quite difficult. So, either you have the LCD or not, its always better to work on your Laptop.
In order to control our raspberry Pi 3 from Laptop, we have to use VNC server & client. It's a third party tool designed by RealVNC. We have to install VNC server on the raspberry Pi and VNC viewer on our laptop & after that we can quite easily control our VNC Server from VNC Viewer (Client). So, let's get started with How to Control Raspberry Pi 3 from Laptop using VNC Server & Viewer:
How to Control Raspberry Pi 3 from Laptop
- As I have told earlier, in order to control Raspberry Pi 3 from Laptop, we have to install two things:
- VNC Server on Raspberry Pi 3.
- VNC Viewer on Laptop.
- If you have already setup your 7 inch HDMI LCD, then first thing you need to do is, you need to connect your raspberry Pi with your Wifi.
- Simply Click on the Internet Access in the toolbar and then connect to your Wifi as you do in your laptop.
- Now, one you are connected to internet, now you need to open your LX-Terminal and then type this command in it:
sudo apt-get update
- The above command will simply update the package, as shown in below figure:
- Now we are gonna install tightvncserver on our raspberry pi 3, by using the below command:
sudo apt-get install tightvncserver
- When you will enter the above command then VNC Server will be downloaded on your Raspberry Pi 3, and after that it will ask Do you want to continue, as shown in below figure:
- So, press Y as yes and it will install the VNC Server on your raspberry Pi 3, as shown in below figure:
- It will also ask for the password and I have given it "12345678".
- As you can see in the above figure that we have successfully installed VNC Server on your Raspberry Pi.
- Now in order to start vnc server on your raspberry pi 3, you have to use below command:
vncserver :1
- Now we have to install VNC Viewer on our laptop, so download VNC Viewer for Windows and install it on your laptop.
- Once its installed then open your VNC Viewer and then click on File in top menu bar and then New Connection.
- It will open up a new window to add new connection, as shown in below figure:
- In the IP address section you have to enter the ip address of your Raspberry Pi and then place :1 after that.
- In order to find the ip address of your raspberry pi 3, you can use the below command:
sudo ifconfig
- I have shown the results in below figure and you can see ip address of our raspberry pi is written in the second line of wlan0.
- So, we have gotten the ip address, enter it in the VNC Viewer and give it some friendly name, I am giving it pi, as shown in below figure:
- I am again mentioning this this here that you have to place :1 after your ip address.
- Now click OK button and then right click your newly created connection and then click on the Connect, and it will start connecting to your Raspberry Pi 3:
- It will show you a warning pop and you need to click Continue, as shown in below figure:
- You can also tick the checkbox, if you don't want it to appear again.
- After that, it will ask for the password, which we have set while installing it and it was "12345678", so simply enter that password, as shown in below figure:
- Now click OK and your raspberry Pi 3's desktop will open up in front of you, as shown in below figure:
- So, that's how you can quite easily control your raspberry pi 3 from laptop. Now you can write your codes from laptop.
Let me summarize everything. In today's tutorial, we have seen How to Control our Raspberry Pi 3 from Laptop and we have used VNC Server & Viewer in order to do that. But you must have noticed that in order to install the VNC server on raspberry pi 3, we have to use HDMI LCD. So, what if you don't have this HDMI LCD? In the next tutorial, we will have a look at that and we will see How to control Raspberry Pi 3 from Laptop using Ethernet. So, that's all for today. Take care and have fun !!! :)