Tag Archives: raspberry

Raspberry Pi Cheat Sheet – Learning Basic Linux Commands

PDF24    Send article as PDF   
A big part of using a Raspberry Pi is also using the terminal. The terminal is something that a lot of people try to avoid, because they feel like it is a bit hard to use. But it doesn’t need to be that that way, because in reality we can break it down to just a few basic commands that you need to know to do code, tty, and most everything else.

Using Flask to Control Raspberry Pi GPIOs

PDF24    Send article as PDF   
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

Raspberry Pi 3

Raspberry Pi 3 (best option)

Basic Raspberry Pi Setup

Before you continue reading this project, please make sure you have Raspbian Operating System installed in your Raspberry Pi.

Installing Flask

We’re going to use a Python microframework called Flask to turn the Raspberry Pi into web server.

To install Flask, you’ll need to have pip installed. Run the following commands to update your Pi and install pip:

pi@raspberrypi ~ $ sudo apt-get update pi@raspberrypi ~ $ sudo apt-get upgrade pi@raspberrypi ~ $ sudo apt-get install python-pip

Then, you use pip to install Flask and its dependencies:

pi@raspberrypi ~ $ sudo pip install flask




The schematics for this project are fairly straightforward. Simply connect two LEDs to pins GPIO 23 and GPIO 24, as the figure below illustrates.

RPi Web Server outputs_bb

Creating the Python Script

This is the core script of our application. It sets up the web server and actually interacts with the Raspberry Pi GPIOs.

To keep everything organized, start by creating a new folder:

pi@raspberrypi ~ $ mkdir web-server pi@raspberrypi ~ $ cd web-server pi@raspberrypi:~/web-server $

Create a new file called app.py.

pi@raspberrypi:~/web-server $ nano app.py

Copy and paste the following script to your Raspberry Pi (this code is based on Matt Richardson great example).

Creating the HTML File

Keeping HTML tags separated from your Python script is how you keep your project organized.

Flask uses a template engine called Jinja2 that you can use to send dynamic data from your Python script to your HTML file.

Create a new folder called templates:

pi@raspberrypi:~/web-server $ mkdir templates pi@raspberrypi:~/web-server $ cd templates pi@raspberrypi:~/web-server/templates $

Create a new file called main.html.

pi@raspberrypi:~/web-server/templates $ nano main.html

Copy and paste the following template to your Pi:

<br />

RPi Web Server

{% for pin in pins %}

{{ pins[pin].name }} {% if pins[pin].state == true %} is currently on

{% else %} is currently off

{% endif %} {% endfor %}

Launching the Web Server

To launch your Raspberry Pi web server move to the folder that contains the file app.py:

pi@raspberrypi:~/web-server/templates $ cd ..

Then run the following command:

pi@raspberrypi:~/web-server $ sudo python app.py

Your web server should start immediately!

python launch web server


Open your Raspberry Pi address in your browser by entering its IP address, in my case:

rpi web server browser


Ensure the Latest Node.js on Your Raspberry Pi

www.pdf24.org    Send article as PDF   
This is just a quick tutorial explaining how you can install the latest version of Node.js on your Raspberry Pi.

How to connect & use a VGA Monitor with Raspberry PI

Raspberry Pi to VGA Mnitor
en.pdf24.org    Send article as PDF   
For a while I have been looking into a compact Video Monitor to use with a Raspberry or Banana PI. Whilst in a opportunity shop looking for a couple of 12V, 2A+ plus powersupply, I discovered what appeared to be a brand new Dell E196FPf 19″ LCD Computer Monitor for a mere $10. I couldn’t resist. Although it is a 19″ Monitor, the display isn’t widescreen and measures 410mm x 340mm. This results in a reasonably compact footprint.

Using OpenCV with the Raspberry Pi Camera

OpenCV RasPi CSI Camera
PDF24    Send article as PDF   
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.

Raspberry Pi Network File Share Using Samba (SMB)

PDF24    Send article as PDF   
You can share your Raspberry Pi’s files and folders across a network using a piece of software called Samba, a Linux implementation of the Server Message Block protocol. The following instructions will set your RPi to share its files on your local network and be accessible by Windows.

Give the Raspberry Pi B+ SATA, Wi-Fi, Bluetooth & More..

Supstronics X300
www.pdf24.org    Send article as PDF   
I have been patiently waiting the release of the new Raspberry Pi B+ Expansion Board from Suptronics, the X300 for the last couple of months.The X300 is Raspberry Pi B+ Expansion Board that adds WiFi, Bluetooth, RTC, Microphone input, 3.3W Stereo Audio & SPDIF output, IR receiver, SATA and More.

Connecting an Arduino to a Raspberry PI using I2C

Raspberry Pi connected to Arduino via I2C
en.pdf24.org    Send article as PDF   
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’.

Raspberry Pi ‘Plate’ or Add-on with 16 Ch. Servo & 16 Ch. GPIO

Pridopia Pi-9685-23017
PDF24    Send article as PDF   
Over 12 months ago I came across a “I2C: 16 Channel, 12 bit PMW Servo & I2C 23017, 16 GPIO” add-on board for the Raspberry Pi made by a U.K. company called, Pridopia. At the time I thought too myself, “What a great idea”, but I had no immediate use for one. That has since changed thanx to my Raspberry Pi powered ‘LEGO Train Layout‘ I’m currently constructing.

Using 16-Channel I2C, Servo Module with Raspberry Pi

Servo Board
PDF24    Send article as PDF   
You want to make a cool robot, maybe a hexapod walker, or in my case I want to use 9g Micro Servos to switch the points on my LEGO Train Layout I’m constructing. Or maybe you want to drive a lot of LEDs with precise PWM output. Then you realize that your Raspberry Pi only has a single PWM output on GPIO-18! What now?

New A+ Model Raspberry Pi and Touch Screen LCD Announced…

www.pdf24.org    Send article as PDF   
It’s time to get excited all you Raspberry Pi enthusiasts as pretty soon, you’ll be able to pick-up an official touch screen to connect to your Raspberry Pi. Plus, a beefier new Raspberry Pi Model A+ is incoming, according to Eben Upton, CEO of Raspberry Pi Ltd. Upton made the announcements during a recent interview at TechCrunch Disrupt Europe in London.

Waveshare DVK512 Expansion Board for Raspberry Pi B+

 Waveshare DVK512
en.pdf24.org    Send article as PDF   
Whilst searching DX.com, I came across the Waveshare DVK512 Expansion Board suitable for both Raspberry Pi B+ and Banana Pro. The Waveshare DVK512 Expansion Board comes equipped is 4x user defined buttons and LEDs, plus interfaces sockets for add-on Modules of almost any type you can think of.

Using a PS2 Dualshock Controller with Raspberry Pi

PDF24    Send article as PDF   
I have spent the weekend experimenting with my Raspberry Pi’s. One challenge I set myself was to get a Sony PS2 Dualshock Controller working with Raspberry Pi. The main reason for this, was to allow me to control a BrickPi Robot without using a Mindsensors PS2 Controller Adapter connected to the Brick Pi. This leaves access to the maximum number of four NXT Sensor Ports on the BrickPi Board.

Raspberry (Banana) Pi to PC using a Serial Connection

USB-to-serial Console Cable
PDF24    Send article as PDF   
Using a Connection via a Serial Port is a low-level way to send data between the Raspberry (Banana) Pi and another computer system. There are two main ways in which it can be used:
  • Connecting to a PC to allow access to the Linux console. This can help to fix problems during boot, or to log in to the Pi if the video and network are not available.
  • serial interface. This can be useful if you want the Pi to control another device.

The Banana Pi: Upgraded Alternative to the Raspberry Pi

www.pdf24.org    Send article as PDF   
As the name implies, the Banana Pi is a clone of the Raspberry Pi. Just like its predecessor it has 2 USB ports, 26 GPIO pins and draws a tiny amount of power. However, with Dual Core 1GHz A20 CPU, 1GB Ram, Gigabit Ethernet, Infrared receiver and SATA adapter, it packs a powerful punch.

Do NOT follow this link or you will be banned from the site!
error: Content is protected !!