A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.sparkfun.com/tutorials/qwiic-hat-for-raspberry-pi-hookup-guide below:

Qwiic HAT for Raspberry Pi Hookup Guide

Introduction

This Qwiic HAT for Raspberry Pi is the quickest and easiest way to utilize SparkFun's Qwiic ecosystem while still using that Raspberry Pi that you've come to know and love. This Qwiic HAT connects the I2C bus (GND, 3.3V, SDA, and SCL) on your Raspberry Pi to an array of Qwiic connectors. It also has a few important pins on the Raspberry Pi broken out for easy access. Since the Qwiic system allows for daisy chaining (as long as your devices are on different addresses), you can stack as many sensors as you'd like to create a tower of sensing power!

Required Materials

To follow along with this hookup guide, you will need any Raspberry Pi with 2x20 male headers.

Raspberry Pi 3 B+ DEV-14643

The Raspberry Pi 3 B+ is here to provide you with the same Pi as before, but now with gigabit and PoE capable Ethernet!

A Pi Zero W will also work but you will need to make sure to solder some male headers to it.

GPIO Male Header - 2x20 PRT-14275

This 2x20 male header has the same number and spacing of pins as a Raspberry Pi but is best served when used in conjunction w…

Raspberry Pi Zero W DEV-14277

The Raspberry Pi Zero W is still the Pi you know and love, but at a largely reduced size of only 65mm long by 30mm wide and s…

Now you probably didn't buy the Qwiic HAT if you didn't have any Qwiic products to use with it, right? If you don't have any Qwiic products, the following might not be a bad place to start.

SparkFun Qwiic Adapter DEV-14495

The SparkFun Qwiic Adapter provides the perfect means to make any old I2C board into a Qwiic enabled board.

Finally, you'll need our handy Qwiic cables to easily connect sensors to your Qwiic HAT. Below are a few options.

Qwiic Cable - 100mm PRT-14427

This is a 100mm long 4-conductor cable with 1mm JST termination. It’s designed to connect Qwiic enabled components together…

Qwiic Cable - 50mm PRT-14426

This is a 50mm long 4-conductor cable with 1mm JST termination. It’s designed to connect Qwiic enabled components together …

Retired Qwiic Cable - 200mm PRT-14428

This is a 200mm long 4-conductor cable with 1mm JST termination. It’s designed to connect Qwiic enabled components together…

Retired Qwiic Cable - 500mm PRT-14429

This is a 500mm long 4-conductor cable with 1mm JST termination. It’s designed to connect Qwiic enabled components together…

Retired Required Setup Tools

As a desktop, these devices are required:

Suggested Reading

If you aren't familiar with the Qwiic system, we recommend reading here for an overview.

We would also recommend taking a look at the following tutorials if you aren't familiar with them.

I2C

An introduction to I2C, one of the main embedded communications protocols in use today.

Serial Terminal Basics

This tutorial will show you how to communicate with your serial devices using a variety of terminal emulator applications.

Hardware Overview

The Qwiic HAT has 4 Qwiic connect ports, all on the same I2C bus. In addition to this, some of the pins on the Raspberry Pi are broken out for the user.

Hardware Assembly

To get started with your Qwiic HAT, simply plug it into the headers on the Raspberry Pi, make sure that the "USB" arrow on the HAT is pointing towards the USB on the Raspberry Pi.

Once the HAT is plugged in, you can start plugging in any Qwiic enabled sensors you might have.

Getting an OS

We recommend checking out the Raspberry Pi 3 Hookup Guide to install the operating system to flash the image to your microSD card for detailed instructions.

If you're starting from scratch with a blank microSD card, you'll want to install Raspbian. If you've already got a working Raspbian system, skip ahead to the next section. Be patient — each of these steps can take a while depending on the speed of your microSD card.

  1. Download an Image — Download your favorite Linux distribution. For beginners, we recommend getting NOOBS image.
  2. Flashing the Image — Follow the instructions from the Raspberry Pi 3 Kit Hookup Guide to flash your microSD card. You can also follow the official Raspberry Pi installation instructions.
Configuring the Pi

The peripherals are not turned on by default. For those using Qwiic-enabled devices, you will want to enable I2C port. There are two methods to adjust the settings. This is outlined in our Raspberry Pi I2C tutorial.

We've included the following instructions from the tutorial. To enable it, follow the steps below.

Raspberry Pi Configuration via Desktop GUI

You can use the Desktop GUI by heading to the Pi Start Menu > Preferences > Raspberry Pi Configuration.

Click on image for a closer view.

A window will pop up with different tabs to adjust settings. What we are interested is the Interfaces tab. Click on the tab and select Enable for I2C. At this point, you can enable additional interfaces depending on your project needs. Click on the OK button to same.

Click on image for a closer view.

We recommend restarting your Pi to ensure that the changes to take effect. Click on the Pi Start Menu > Preferences > Shutdown. Since we just need to restart, click on the Restart button.

Click on images for a closer view.

raspi-config Tool via Terminal

Again, we can use raspi-config to enable it.

  1. Run sudo raspi-config.
  2. Use the down arrow to select 5 Interfacing Options
  3. Arrow down to P5 I2C.
  4. Select yes when it asks you to enable I2C
  5. Also select yes if it asks about automatically loading the kernel module.
  6. Use the right arrow to select the <Finish> button.
  7. Select yes when it asks to reboot.

Raspi-config for I2C

The system will reboot. When it comes back up, log in and enter the following command

language:bash
ls /dev/*i2c*

The Pi should respond with

language:bash
/dev/i2c-1

Which represents the user-mode I2C interface.

Scanning for I2C Devices

If you are using the Raspberry Pi to quickly connect to I2C devices, the best place to start would be to scan for an I2C device on the bus.

Utilities

There is a set of command-line utility programs that can help get an I2C interface working. You can get them with the apt package manager. Enter the following command.

language:bash
sudo apt-get install -y i2c-tools

In particular, the i2cdetect program will probe all the addresses on a bus, and report whether any devices are present. Enter the following command in the command line. The -y flag will disable interactive mode so that you do not have to wait for confirmation. The 1 indicates that we are scanning for I2C devices on I2C bus 1 (e.g. i2c-1).

language:bash
i2cdetect -y 1

You will get an output from your Raspberry Pi similar to the output below.

language:bash
pi@raspberrypi:~/$ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

This map indicates that there is a peripheral at address 0x60. Your address may vary depending on what is connected to the I2C bus. For advanced users, you can try to read and write its registers using the i2cget, i2cset and i2cdump commands.

Qwiic Py Drivers

Now that you have I2C set up on your Pi, you can start programming your Qwiic devices on your Pi or if you'd like to start with some examples, we have a host of Python drivers for Qwiic breakouts available in the GitHub repository linked below. You can read more about Python for the SparkFun Qwiic system in this blog post.

Resources and Going Further

For more information, check out the resources below:

Now that you have your Qwiic HAT ready to go, it's time to hook it up to some Qwiic enabled products.

SparkFun Qwiic Adapter DEV-14495

The SparkFun Qwiic Adapter provides the perfect means to make any old I2C board into a Qwiic enabled board.

SparkFun RTK Facet GPS-19984

The SparkFun RTK Facet is a fully enclosed GNSS receiver for centimeter-level positioning. Perfect for high precision geoloca…

But I Already Have Sensors!

If you already have a handful of SparkFun sensors and parts? SparkFun has been putting our standard GND/VCC/SDA/SCL pinout on all our I2C boards for many years. This makes it possible to attach a Qwiic Adapter that will get your SparkFun I2C sensor or actuator onto the Qwiic system.

Here is the list of the boards that have the standard I2C pinout and will work with the Qwiic adapter board:

Check out this related tutorial:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4