Tag Archives: control

PID Control Theory Explained

PDF24    Send article as PDF   

Overview

Proportional-Integral-Derivative (PID) control is the most common control algorithm used in industry and has been universally accepted in industrial control. The popularity of PID controllers can be attributed partly to their robust performance in a wide range of operating conditions and partly to their functional simplicity, which allows engineers to operate them in a simple, straightforward manner. 

Using Flask to Control Raspberry Pi GPIOs

www.pdf24.org    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

 

Schematics

 

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

Demonstration

Open your Raspberry Pi address in your browser by entering its IP address, in my case: http://192.168.1.100/.

rpi web server browser

Demonstration

Remotely Control the Raspberry Pi using VNC

en.pdf24.org    Send article as PDF   
Virtual Network Computing (VNC) is a graphical desktop sharing system that uses the Remote Frame Buffer protocol (RFB) to remotely control another computer. It transmits the keyboard and mouse events from one computer to another, relaying the graphical screen updates back in the other direction, over a network. VNC is platform-independent – a VNC viewer on one operating system may connect to a VNC server on the same or any other operating system. There are clients and servers for many GUI-based operating systems, including Java.
I will endeavour to explain how to install and use VNC with your raspberry Pi. This will allow you to see/use the Raspberry Pi’s graphical desktop remotely, using the mouse and keyboard as if you were sitting in front of your Pi.

Control an insect from your smartphone!

PDF24    Send article as PDF   
The RoboRoach: Control a living insect from your smartphone for $99.99!

What is the RoboRoach?

The RoboRoach is the world’s first commercially available cyborg! That’s right… A real-life Insect Cyborg! Part cockroach and part machine. This is not a gimmick…  just good ol’ fashion neuroscience, evolution and engineering

NXT2WiFi: Using Webpage Sliders to Control Motors

PDF24    Send article as PDF   
This tutorial follows on from my previous NXT2WiFi Articles. In this example [robotc] is used to program the NXT. Using Webpage Sliders to Control LEGO Mindstorms NXT Motors with your [NXT2WiFi] is relatively easy. You will need to have the latest [NXT2WiFi] Custom Webserver Source Code in order to use Slide Controls.

Android Control for Lego NXT

www.pdf24.org    Send article as PDF   
If you are the owner of a LEGO MINDSTORMS NXT set and have an Android smartphone and you want to have some fun with your robots, now you have the possibility with MINDdroid – for free!



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