Category Archives: Raspberry Pi Coding

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.

Using Flask to Control Raspberry Pi GPIOs

With this project you can create a standalone web server with a Raspberry Pi that can toggle two LEDs. You can replace those LEDs with any output (like a relay or a transistor). In order to create the web server you will be using a Python microframework called Flask.

Parts Required

Here’s the hardware that you need to complete this project:

  • Raspberry Pi (any Pi should work, I recommend using Raspberry Pi 3) – view on eBay
  • SD Card (minimum size 8Gb and class 10) – view on eBay
  • Micro USB Power Supply – view on eBay
  • Ethernet cable or WiFi dongle
  • Breaboard – view on eBay
  • 2x LEDs
  • 2x 470Ω Resistors
  • Jumper wires

Ensure the Latest Node.js on Your Raspberry Pi

This is just a quick tutorial explaining how you can install the latest version of Node.js on your Raspberry Pi.

Using OpenCV with the Raspberry Pi Camera

OpenCV RasPi CSI Camera
OpenCV doesn’t work natively with the Rasperry Pi Camera as it is not a usb-webcam. That said, the applications such as raspivid or raspistill controls the Raspberry Pi Camera using MMAL Functions. So the one needs to modify the source code of these applications, by using the Buffer Memory of the Raspberry Pi Camera Board to be feed to OpenCV as Image Objects.

Connecting an Arduino to a Raspberry PI using I2C

Raspberry Pi connected to Arduino via I2C
I’m intending to use several Arduino Boards as a cheap means of controlling a number of RFID Readers which will be used to detect the position of Locomotive Engines on my LEGO Train Layout. That said I need a way of connecting these Arduinos to the Raspberry Pi which is the Master Controller for the layout.
The easiest way of Connecting an Arduino to a Raspberry PI is using USB, however the PI’s USB ports are need for WiFi Keyboard, Mouse, etc. So in many cases USB is out, especially if you are using a Raspberry Pi Model ‘A’.

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