Category Archives: Raspberry Pi Coding

Interfacing the Neo-6M GPS Module & Raspberry Pi with LCD Readout

One of the coolest embedded platforms like the Raspberry Pi has given makers and DIYers the ability to get location data easily using GPS module and thus build things that rely on location. With the amount of power packed by the Raspberry Pi, it certainly will be quite awesome to build GPS based projects with the same cheap GPS modules and that is the focus of this post. Today in this project we will Interface GPS module with Raspberry Pi 3.

The goal of this project is to collect location data (longitude and latitude) via UART from a GPS module and display them display on a 16×2 LCD, so if you are not familiar with the way the 16×2 LCD works with the Raspberry Pi, this is another great opportunity to learn.

Measuring Rotation and acceleration with the Raspberry Pi

MPU-6050 Module

Acceleration and rotation sensors are most known from smartphones. The rotation of the device can be detected and can be addressed directly.

With the Raspberry Pi and a Gyroscope / Accelerator sensor it is possible to measure the rotation as well as the acceleration of the 3 axes.
In this tutorial use the MPU 6050 Gyroscope / Accelerator sensor interferfaced to a Raspberry Pi, and reads the values using I2C.


For this tutorial I have used the following components:

  • Raspberry Pi
  • MPU 6050 sensor module
  • Jumper Cables

Raspberry PI: Connecting a Neo-6M  GPS Module

Neo-6M GPS Module

I built a project using a Neo-6M  GPS Module with the Raspberry PI. Now there are several USB solutions, and apps that work with them, but I wanted to show how to use a $20 GPS module with a a serial UART, and Python code to decode the NMEA strings. Then you can write your own GPS interface, or combine the data with Google Maps.

Hardware Setup:

The first step is to connect the GPS module to the Raspberry PI. There are only 4 wires involved, so it’s a simple connection.

Run a Program On Your Raspberry Pi At Startup

The method that I usually use to run a program on your Raspberry Pi at startup is to use the file rc.local. In order to have a command or program run when the Pi boots, you can add commands to the rc.local file. This is especially useful if you want to power up your Pi in headless mode (that is without a connected monitor), and have it run a program without configuration or a manual start.

Editing rc.local

On your Pi, edit the file /etc/rc.local using the editor of your choice. You must edit it with root permissions:

Add commands to execute the python program, preferably using absolute referencing of the file location (complete file path are preferred). Be sure to leave the line exit 0 at the end, then save the file and exit. In nano, to exit, type Ctrl-x, and then Y.

Make a “Safe Shutdown” Button for Raspberry Pi

Shutdown Button

Pulling the power to your Raspberry Pi can cause image corruptions & other issues that can damage your Pi! In this article, we will create a small push button that will work as a ‘Safe-Shutdown’ option. We’ll connect it to our Raspberry Pi using the GPIO pins and some jumper wires, and with a few lines of code, we will have our own power switch!

First, we are going to look at a simple way to wire a button to the Pi GPIO connector. We will then write a python script that will shut down the Pi safely. The final step will be to setup the Pi so that the button will work all the time. Let’s Get started!

Raspberry Pi as a Hotspot/Access Point using ‘DHCP’

Raspberry Pi as Wireless Access Point

The Raspberry Pi can be used as a wireless access point, running a standalone network. This can be done using the inbuilt wireless features of the Raspberry Pi and even the Raspberry Pi ‘Zero W’, or by using a suitable USB wireless dongle that supports access points.

Note that this documentation was tested on a Raspberry Pi 3, and it is possible that some USB dongles may need slight changes to their settings. If you are having trouble with a USB wireless dongle, please check the forums.

In order to work as an access point, the Raspberry Pi will need to have access point software installed, along with DHCP server software to provide connecting devices with a network address. Ensure that your Raspberry Pi is using an up-to-date version of Raspbian is “Stretch“, or better (e.g. 2018-06-27-raspbian-stretch-lite.img).

Connecting Wiimote Controllers to the Raspberry Pi

In this Raspberry Pi Wiimote controllers guide, we will walk you through the process of setting up a Wiimote on your Raspberry Pi and show you how to setup both cwiid and wminput.
Utilizing Wiimote controllers on the Raspberry Pi can be painful to deal with due to its handling of the Bluetooth stack. While they run over standard Bluetooth, their actual functionality is not picked up as a conventional joystick device like Xbox controllers and PlayStation controllers.

Instead to support the full functionality of Wiimote controllers in a way that most applications can support we must utilize two pieces of software.

These being cwiid and wminput. One acts as a library that interprets the Wiimotes actions into joystick actions, the other being somewhat of a driver that creates an input device that applications can utilize easily.

Connecting ‘Xbox Controllers’ to the Raspberry Pi

Xbox Controller

If you have ever tried to use an Xbox controller with the Raspberry Pi, you will find very quickly that they do not work correctly right out of the box. In fact to get them working you will be required to install a special driver.

With the newer Xbox One controllers that feature the Bluetooth functionality, you will also find that they will need extra work on top of the driver installation to get them to run. Namely, they are not properly supported by some of the Bluetooth functionality that is switched on by default.

This guide will show you how to get your Xbox Controllers up and running on the Raspberry Pi, while also walking you through how to get the newer Bluetooth enabled controllers to pair successfully on the Pi.

Controlling Mindstorms EV3 with a Raspberry Pi

Original Article: The MagPi, The Official Raspberry Pi Magazine

LEGO Mindstorms is a great tool to gain experience in understanding robotics, but what if you wanted to make your own input sensor? In this guide, we will show how simple it is to construct a circuit to control a Mindstorms robot through GPIO in Raspberry Pi.

We will show every step from connecting the robot to writing the code. The result will be a program in Ch, a superset interpreter of C/C++, to control the direction of the robot with a push-button.

Timelapse Photography with Raspberry Pi Zero


This tutorial will guide you through taking photos using a Pi Zero and camera, to make a simple timelapse-capturing device. Use it to make a timelapse of a plant growing with the delay set to a day, or the progress on your building work with hourly photos, or a soldering project with a photo every 5 seconds.

Enable the camera

This tutorial assumes you have already set up your OctoCam as per the instructions. If you’re using a camera and a Pi, make sure the camera is connected.

In the Terminal, type sudo raspi-config and press Enter. This will bring up a menu on the screen. You’ll need to press 5, then choose option 1 to enable the camera, and then choose yes. Once you finish with the menu you should get prompted to reboot. This needs doing!

Writing Your First Shell Script with Raspberry Pi

First Bash Script with Raspberry Pi

In this tutorial we’ll be writing our first bash script for Raspberry Pi. We’ll create a directory to keep this and future scripts, write the actual script, and set it up as something that can be executed from the shell.

Scripts are an incredibly powerful tool to have in your toolbox. In essence, a script is just a sequence of commands that you could otherwise have entered into the shell. The power of scripts is that they can be used to make decisions, and execute certain commands based off that decision. Scripts can be scheduled to run at certain times, and can execute trigger other scripts.

In this tutorial we’re assuming you’re familiar with how to use the terminal to navigate the file system and create files and directories.

24-bit, 192KHz Audio for the Raspberry Pi Zero with the pHAT

pHAT DAC for Raspberry Pi Zero

The pHAT provides a super affordable high-quality DAC for your Raspberry Pi. It pumps out 24-bits at 192KHz from the Raspberry Pi’s I2S interface on its 2×20 pin GPIO header.

Use pHAT DAC to build a tiny, lush-sounding streaming music device, or use it with Scroll pHAT to make a beautiful spectrum analyser!


  • 24-bit audio at 192KHz
  • Line out stereo jack
  • Optional landing for dual RCA phono connector
  • PCM5102A DAC over the Raspberry Pi’s I2S interface
  • pHAT DAC pinout
  • Compatible with Raspberry Pi 3B+, 3, 2, B+, A+, Zero, and Zero W
  • Female header requires soldering

WS2812 Addressable LEDs: Raspberry Pi Quick-start Guide

This tutorial is aimed at getting some instant gratification from your WS2812 LEDs (trade name: neopixels). I’ll briefly cover a bare-bones setup for Raspberry Pi.

If you’ve never used a Raspberry Pi before, we’ve got you covered with our free, online Raspberry Pi How-To’s.

Temperature Sensing With Raspberry Pi

The Raspberry Pi lacks analogue input, and while it’s possible to use an Analogue to Digital Converter (ADC), the DS18B20 is a fantastic, easy to use digital sensor that uses the Dallas 1 wire communication interface. Fortunately for us, the Raspberry Pi comes with built in software handling for 1 wire sensors which makes using sensors such as the DS18B20 pretty straightforward.

What is 1-Wire Communication

The Dallas 1-Wire protocol is a method of serial communication designed for simple communication between 1 Master and multiple Slave devices. Serial communication means that data is sent bit-by-bit along a single data line.

1 wire communication is most commonly used for temperature sensors, EEPROM chips, and other simple devices. Unlike other serial communication protocols such as I2C, which allows for device IDs/addresses to be assigned and handled by the master device, 1 wire devices have an unchangeable, factory set device ID. By differentiating between unique device IDs, you can chain multiple slave devices on a single data bus.

Using the ‘Google Cloud Vision API’ with your Raspberry Pi

What is the ‘Google Cloud Vision API’?

Google Cloud Vision API enables your robot to understand the content of an image by encapsulating powerful machine learning models in an easy to use REST API. It quickly classifies images into thousands of categories such as “robot”, “elephant”, “flower”. It detects individual objects and faces within images. It capable of finding and reading printed words contained within images, and even determines the language it is written in. You can use it to build metadata for your image collection, and can be used to moderate offensive content through image analysis.
The Vision API enables you to detect different types of inappropriate content from adult to violent content. It analyzes images uploaded by the request, or integrate with your image storage on Google Cloud Storage.

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