Sie sind auf Seite 1von 32

Abstract

During the past decade, water needs have increased unpredictably in India. Increasing
demand of water supply has become a major challenge for the world. Wasteful usage of water,
climatic changes and Urbanization has further depleted the resource. Conservation and
management of the resource must be given utmost importance. In this project, we present an IoT
design for water monitoring and control approach which supports internet based data collection
on real time bases. The system addresses new challenges in the water sector -flow rate measuring
and the need for a study of the supply of water in order to curb water wastage and encourage its
conservation. The traditional water metering systems require periodic human intervention for
maintenance making it inconvenient and often least effective. For shortcoming of the existing
models for a ubiquitous usage of wireless systems for water flow rate measuring and
communicate data wirelessly

INTODUCTION
According to recent survey, water has become a big issue because of less rain fall, increase in
population many cities are facing this problem people have to suffer from this problem they
don’t have sufficient amount for their daily needs. Due to lack of monitoring water can’t be
supplied properly, some areas in city get water while other some areas can’t so, there is a need of
continuous monitoring, water supply scheduling and proper distribution another problems are
excessive consumption, overflow of tanks, leakage in pipeline, interrupted water supply. Water is
a basic need of every human being everyone has to save the water many times with lack of
monitoring, overflow of these overhead tanks can occur because of this lots of water get wasted,
another thing because of overflow in the pipelines with more pressure there is possibility of
pipeline damage, leakage detection is one more problem all these problems are because of lack
of monitoring, manual work, less man power. By focusing on problems in traditional methods
our system design and develop a low cost embedded system device for real time monitoring of
water distribution system in Internet of things (IOT) platform. IOT is a world where billions of
objects can sense, communicate and share information , all interconnected over public or private
Internet Protocol (IP) networks. These interconnected objects have data regularly collected,
analysed and used to initiate action, providing a wealth of intelligence for planning, management
and decision making. The Internet Of Things (IOT) is the inter-networking of physical devices,
vehicles (also referred to as "connected devices" and "smart devices"), buildings, and other items
embedded with electronics, software, sensors, actuators, devices many more and network
connectivity which enable these objects to collect and exchange data. In 2013 the Global
Standards Initiative on Internet of Things (IOT-GSI) defined the IOT as "a global infrastructure
for the information society, enabling advanced services by interconnecting (physical and virtual)
things based on existing and evolving interoperable information and communication
technologies" and for these purposes a "thing" is "an object of the physical world (physical
things) or the information world (virtual things), which is capable of being identified and
integrated into communication networks". The IOT allows objects to be sensed or controlled
remotely across existing network infrastructure, creating opportunities for more direct integration
of the physical world into computer-based systems, and resulting in improved efficiency,
accuracy and economic benefit in addition to reduced human intervention. When IOT is
augmented with sensors and actuators, the technology becomes an instance of the more general
class of cyber-physical systems, which also encompasses technologies such as smart grids,
virtual power plants, smart homes, intelligent transportation and smart cities. Each thing is
uniquely identifiable through its embedded computing system but is able to interoperate within
the existing Internet infrastructure. Experts estimate that the IOT will consist of about 30 billion
objects by 2020.

Objectives of project
Now a days wastage of water is increasing day by day, by using this we get to know where most
of water is consumed as well as wasted (appartments). The water meters are situated in the
houses, offices and factories etc . The meter reading is given automatically to the authorized
person of flat or house enabling payment for basic water billing services via notification when
online or a text based message when he is offline. Water flow can be analysed every time and
give directly to connected devices. To measure the water flow according to the consumption of
water per user.

EXISTING SYSTEM

Same cost for any type of using ie., less or more usage of water flow. In the present scenario
water meters are deployed in all houses. The current procedure with regard to the billing process
for water is not a fully automated system. It involves manual processes from the time the Meter
reader starts reading the meter until the system is updated with the current reading. A meter
reader visits a house, does the meter reading, and then manually calculates the amount
considering the units consumed. Back in the office a data entry officer enters the meter readings
into the system manually and a bill generated and given to customers. Then the customer must
go to the water supply service to pay the bill according to their usage. The procedure is far from
satisfactory and it is believed a better system using availabletechnologies would definitely be an
advantage.

Present scenario
2. Block diagram and description

2.1 block diagram

Water tank

Flow control valve

Water flow sensor

CLOUD
THINGSPEAK
ADC
REVERSE
ANALYSIS
WIFI

Optional Enhancement

RASPBERRYPI 3
GPS

MYSQL DB

SERVER
INTERNET OF THINGS (IoT)

Internet of Things (IoT) is the networking of physical objects that contain electronics
embedded within their architecture in order to communicate and sense interactions amongst each
other or with respect to the external environment. In the upcoming years, IoT-based technology
will offer advanced levels of services and practically change the way people lead their daily
lives. Advancements in medicine, power, gene therapies, agriculture, smart cities, and smart
homes are just a very few of the categorical examples where IoT is strongly established.

Figure 1.2.1 Internet of Things

Internet of things on IoT agenda- The Internet of Things (IoT) is a system of interrelated
computing devices, mechanical and digital machines, objects, animals or people that are
provided with unique identifiers and the ability to transfer data over a network without requiring
human-to-human or human-to-computer interaction.The globally ruling technology acting as a
single key to shrinking this whole universe to a tiny globally connected village, whereas IoT
comprises of just two words which precisely depicts its definition.
Internet: Inter connectivity-For global connection
+
Things: Embedded system devices-sensors, actuators, RFID tags, QR code and so many.

THINGSPEAK

Thing Speak is a platform providing various services exclusively targeted for building
IoT applications. It offers the capabilities of real-time data collection, visualizing the collected
data in the form of charts, ability to create plugins and apps for collaborating with web services,
social network and other APIs. We will consider each of these features in detail below.

The core element of Thing Speak is a ‘Thing Speak Channel’. A channel stores the data
that we send to ThingSpeak and comprises of the below elements:

 8 fields for storing data of any type - These can be used to store the data from a sensor or
from an embedded device

 location fields - Can be used to store the latitude, longitude and the elevation. These are
very useful for tracking a moving device

 1 status field - A short message to describe the data stored in the channel

To use ThingSpeak, we need to signup and create a channel. Once we have a channel, we
can send the data, allow ThingSpeak to process it and also retrieve the same. Let us start
exploring ThingSpeak by signing up and setting up a channel.

2.8.1 CREATING ACCOUNT AND CHANNEL IN THINGSPEAK

Open "https://thingspeak.com/" and click on the ‘Get Started Now’ button on the center
of the page and you will be redirected to the sign-up page (you will reach the same page when
you click the ‘Sign Up’ button on the extreme right). Fill out the required details and click on the
‘Create Account’ button.
Figure 2.8.1.1 Account opening in ThingSpeak

Figure 2.8.1.2 Creating a new channel in Thing Speak

Go ahead and click on ‘New Channel’. You should see a page like in the figure 2.8.1.2

You can change the name to fit your need and you can add a description corresponding to
the channel. You can add any other useful description into the metadata field. In the figure
2.8.1.3, you should see the fields for Latitude, Longitude and Elevation. Also, when you scroll
down you should see a check box that says ‘Make Public?’. Let us consider the significance of
the various fields and the tabs:
 Latitude, longitude and elevation - These fields correspond to the location of a ‘thing’
and are especially significant for moving things.

 Make Public? - If the channel is made public, anyone can view the channel's data feed
and the corresponding charts. If this check box is not checked, the channel is private,
which means for every read or write operation, the user has to pass a corresponding API
key.

 URL - This can be the URL of your blog or website and if specified, will appear on the
public view of the channel.

 Video ID - This is the ID corresponding to your YouTube or Vimeo ID. If specified, the
video appears on the public view of the channel.

 Fields 1 to 8 - These are the fields which correspond to the data sent by a sensor or a
‘thing’. A field has to be added before it can be used to store data. By default, Field 1 is
added. In case you try posting to fields that you have not added, your request will still be
successful, but you will not be able to see the field in the charts and the corresponding
data. You can click on the small box before the ‘add field’ text corresponding to each
field to add it. Once you click the ‘add field’ box, a default label name appears in the text
box corresponding to each field and the ‘add field’ text changes to ‘remove field’. You
can edit the field text that appears by default when a field is added to make more sense.
For example, in the below screen, I have modified the text for Field 2 to ‘SensorInput’.
To remove a field which is added, just check on the ‘remove field’ box. Once you click
this, the text ‘remove field’ changes back to ‘add field’ and the corresponding field text is
cleared.

Figure 2.8.1.3 Channel description


Figure 2.8.1.4 Adding fields in channel

Once you have edited the fields like in figure 2.8.1.4, click on ‘Save Channel’ button. You should
now see a page like the below figure 2.8.1.5 in which the ‘Private View’ tab is defaulted:

Figure 2.8.1.5 Private view tab


The Private View shows a chart corresponding to each of the fields that we have added.
Now click on the ‘Public View’ tab. This should look exactly similar to the what we see in the
‘Private View’ tab since our channel is public. In case your channel is not public('make public'
check box not checked in the ‘channel settings’ tab), the public view tab shows a message that
‘This channel is not public’.

Now click on the ‘API Keys’ tab. You should see a screen similar to the below. The write
API key is used for sending data to the channel and the read API key(s) is used to read the
channel data. When we create a channel, by default, a write API key is generated. We generate
read API keys by clicking the ‘Generate New Read API Key’ button under this tab. You can also
add a note corresponding to each of the read API keys.

Note: Please note that clicking on the ‘Generate New Write API Key’ will over-write the
previous key. You will only have one Write API key at any point of time. Also, in case your
channel is private, others can only view the channel’s feed and charts by using a Read API key.
Please share the Read API keys with people who are approved and authorized to view your
channel.

3.1 Raspberry Pi:


Introduction:

The Raspberry Pi is a tiny computer designed in the United Kingdom and sold around the
world at a very low price. The Pi ships as a bare circuit board with standard connections for a
keyboard, mouse, monitor, and power supply. You must add these extras yourself. To keep costs
down, the Pi uses an SD card, a small memory card, as a hard drive.

The Pi also includes extra connections you can use in your own electronic projects, and two
software applications, Python[5] and Scratch, for learning programming. The Pi is much less
powerful than a PC or Mac. You cannot run Microsoft Office on it. However, you can use it as a
small media centre and for programming games. You can also create network based projects
such as a web server, file server, or even a home automation system.
3.1.1 Understanding the Linux OS:
As of summer 2013, some Pi kits ship with a tool called NOOBS (New Out of the Box
Operating System) which gives users a choice of operating systems. This book describes the
most popular and best-supported operating system — Raspbian Wheezy, a version of the popular
free Linux operating system, often represented by a penguin mascot known as Tux. Linux is
more challenging and hands-on than Windows and OS X, but is ideal for customization and for
building hardware and software projects around the Pi. For information about getting started with
NOOBS, see you can choose two models of the Pi board. The Model A has half the memory of
the Model B +(256MB versus 512MB), lacks the B's Ethernet network connector, and has a
single USB socket instead of the B+'s stacked pair. It consumes a third less power. Many users
develop a project with a Model B+ and build the finished version around a Model B.

Figure 3.1: Raspberry Pi

A) Micro USB power


Connects your RPi to an external 5V power supply.
B) Audio&composite video jack
A new 3.5mm audio jack which also includes the composite video signal. Connects your RPi to
headphones, ear buds, or external speakers. Connects your RPi to an old TV using a legacy
composite video signal.
C) HDMI socket
Connects your RPi to a monitor or TV using a modern HDMI signal.
D) Ethernet socket
Connects your RPi to a network.
E) FourUSB socket
Four stacked sockets connect the RPi to a keyboard, mouse, or other accessories.
F) Status LEDs
Light up to display the RPi's power, network, and disk status.
G) GPIO pins
Pins for general-purpose external connections, including optional add-ons and your own custom
electronics.
H) Camera connector
Connects the RPi to an optional camera board.
I) Display connector
Connects the RPi to an optional external LCD display.
J) SD card socket
The socket for the SD card, shown here in blue, is under the board at the right. The Pi is
designed to work with an SD card — a small plastic memory card — instead of a hard drive. The
card holds the Pi's operating system (OS) and software. Beginners should buy a card with the OS
preinstalled. More experienced users can buy a blank card, which you can choose from the list at
http://elinux.org/RPi_VerifiedPeripherals,You can enclose your Pi in a case to protect it from
accidents and improve its looks. A case for your Pi is optional, but recommended. You can
choose a case based on design and colour, but for electronic projects pick a case with easy access
to all connectors, including the GPIO pins. Standard cases are plastic boxes with connector
holes. A more sophisticated option is a VESA mount case, with four screws and a plate for
mounting your Pi on the back of a TV or monitor with pre-fitted VESA (Video Electronics
Standards Organization) screw holes. Open a web browser and visit http://elinux.org/RPi_Cases
to view more than 50 case options.
Figure 3.1.1:ARM11 board
3.1.2. Requirements:
SD card:
We recommend an 8GB class 4 SD card – ideally preinstalled with NOOBS. You can
buy a card with NOOBS pre-installed, or you can download it for free from our downloads page.
Display and connectivity cables:
Any HDMI/DVI monitor or TV should work as a display for the Pi . For best results, use
one with HDMI input, but other connections are available for older devices. Use a standard
Ethernet cable for internet access.
1) Keyboard and mouse
2) Anystandard USB keyboard and mouse will work with your Raspberry Pi.
Power supply:
Use a 5V micro USB power supply to power your Raspberry Pi. Be careful that whatever
power supply you use outputs at least 5V; insufficient power will cause your Pi to behave in
strange ways.
Not essential but helpful to have:
• Internet connection
To update or download software, we recommend that you connect your Raspberry Pi to
the internet either via and Ethernet cable or a Wi-Fi adapter.
• Headphones
Headphones or earphones with a 3.5mm jack will work with your Raspberry Pi.

3.1.3 Plugging in your Raspberry pi:


Before you plug anything into your Raspberry Pi, make sure that you have all the
equipment listed above to hand. Then follow these instructions:
1. Begin by slotting your Micro SD card into the SD card slot on the Raspberry Pi, which will
only fit one way.
2. Next, plug in your USB keyboard and Mouse into the USB slots on the Raspberry Pi.
3. Make sure that your monitor or TV is turned on, and that you have selected the right input
(e.g. HDMI 1, DVI, etc)
4. Then connect your HDMI cable from your Raspberry Pi to your monitor or TV.
5. If you intend to connect your Raspberry Pi to the internet, plug in an Ethernet cable into the
Ethernet port next to the USB ports, otherwise skip this step.
6. When you are happy that you have plugged in all the cables and SD card required, finally plug
in the micro USB power supply. This action will turn on and boot your Raspberry Pi.
7. If this is the first time your Raspberry Pi and NOOBS SD card have been used, then you will
have to select an operating system and configure it. Follow the NOOBS guide to do this.

3.1.4 Logging into Raspberry pi:


1. Once your Raspberry Pi has completed the boot process, a login prompt will appear. The
default login for Raspbian[6] is username pi with the password raspberry. Note you will not see
any writing appear when you type the password. This is a security feature in Linux.
2.After you have successfully logged in, you will see the command line prompt
pi@raspberrypi~$
3.To load the graphical user interface, type startx and press Enter on your keyboard.
Preparing your SD card for the Raspberry Pi.
In order to use your Raspberry Pi, you will need to install an Operating System (OS) onto
an SDcard. An Operating System is the set of basic programs and utilities that allow your
computer to run; Examples include Windows on a PC or OSX on a Mac.
These instructions will guide you through installing a recovery program on your SD card that
will allow you to easily install different OS’s and to recover your card if you break it.
1. Insert an SD card that is 4GB or greater in size into your computer
2. Format the SD card so that the Pi can read it
a. Windows
i. Download the SD Association's Formatting Tool1
fromhttps://www.sdcard.org/downloads/formatter_4/eula_windows/
ii. Install and run the Formatting Tool on your machine
iii. Set "FORMAT SIZE ADJUSTMENT" option to "ON" in the "Options" menu
iv. Check that the SD card you inserted matches the one selected by the Tool
v. Click the “Format” button
b. Mac
i. Download the SD Association's Formatting Tool from
https://www.sdcard.org/downloads/formatter_4/eula_mac/
ii. Install and run the Formatting Tool on your machine
iii. Select “Overwrite Format”
iv. Check that the SD card you inserted matches the one selected by the Tool
v. Click the “Format” button
c. Linux
i. We recommend using parted(or the command line version parted)
ii. Format the entire disk as FAT
3. Download the New Out Of Box Software (NOOBS) from:
downloads.raspberrypi.org/noobs
4. Unzip the downloaded file
a. Windows ­ Right click on the file and choose “Extract all”
b. Mac - Double tap on the file
c. Linux - Run unzip[downloaded filename]
5. Copy the extracted files onto the SD card that you just formatted
6. Insert the SD card into your Pi and connect the power supply
Your Pi will now boot into NOOBS and should display a list of operating systems that you can
choose to install. If your display remains blank, you should select the correct output mode for
your display by pressing one of the following number keys on your keyboard;
1. HDMI mode - this is the default display mode.
2. HDMI safe mode - select this mode if you are using the H
3.1.5 Simplified architecture:
Features:

Dimensions 85mm x 56mm


Chip Broadcom BCM2835 SoC full HD multimedia applications
processor
CUP 700 MHz Low Power ARM1176JZ-F Applications Processor

GPU Dual Core VideoCore IV® Multimedia Co-Processor

Power Source 1x Micro-USB


Ethernet 1x 10/100mb Ethernet RJ45 Jack
Supported 640×350 to 1920×1200, including 1080p, PAL & NTSC standards
Resolutions
Other Connectivity 1x CSI-2 for Raspberry Pi camera modules
1x DSI for Raspberry Pi displays
Operating Systems Raspbian, RaspBMC, Arch Linux, RISC OS, OpenELEC, Pidora

RAM 512 MB SDRAM @ 400 MHz


Storage MicroSD
USB 2.0 4x USB Ports
Video Connections HDMI, Composite RCA (shared with audio jack)
Audio Multi-Channel HD Audio over HDMI, Stereo from 3.5 mm jack
Power Draw / voltage 600mA up to 1.8A @ 5V
GPIO 40
Mounts 4 in the corners

3.1.6 Raspberry Pi hardware specifications:


We will briefly go over some of the core components that make up the Raspberry Pi to
give you a better feel for what it is capable of the Raspberry Pi is built off the back of the
Broadcom BCM2835. The BCM2835 is a multimedia application processor geared towards
mobile and embedded devices. On top of this, several other components have been included to
support USB, RCA, and SD card storage. We will now look at some of the core-components of
the Raspberry Pi board. The following figure highlights some of these with a description of each
provided: GPIO Pins CPU/GPU SD card port Micro USB Power USB Ethernet Audio RCA
HDMI.

Dimensions:

The Raspberry Pi is a small device coming in at 85mm x 56mm x 17mm and weighing
only 45g. This makes it perfect for home automation, where a small device can be placed in a
case and mounted inside an electrical box, or replace an existing thermostat device on a wall.

3.5mm analog audio & composite video jack:


The 3.5mm analog audio jack allows you to connect headphones and speakers to the
Raspberry Pi. This is especially useful for audio and media player based projects.
You are probably familiar with the composite cables used to hook up your DVD player to the
TV. Connects your RPi to an old TV using a legacy composite video signal.
Four USB 2.0 ports plus one micro USB:

Figure 3.1.6: USB ports


USB is one of the most common methods for connecting peripherals and storage devices
to a computer. The Raspberry Pi comes equipped with two of them, allowing you to hook up a
keyboard and mouse when you get started and a micro USB port for powering your device.

HDMI port:

The High Definition Multi-media Interface (HDMI) port allows the Raspberry Pi to be
hooked up to high-definition televisions and monitors that support the technology. This provides
an additional option to the composite RCA port for video and additionally supports audio.

SD card port:
The main storage mechanism of the Raspberry Pi is via the SD card port. The SD card will be
where we install our operating system and will act as our basic hard disk. Of course, this storage
can be expanded upon using the USB ports.

256 MB/512 MB SDRAM shared with GPU:


The Raspberry Pi comes equipped with 256 MB of SDRAM on older versions of the
model B and 512 MB on the newer revisions. This isn't a huge amount, and much less than you
would expect on a PC, where RAM is available in gigabytes. However, for the type of
applications we will be building, 256 MB or 512 MB of RAM will be more than enough.
CPU:
Early in this chapter we touched upon ARM – the British manufacturers of central
processor unit (CPU) cores. The Raspberry Pi comes equipped with a 700 MHz,ARM1176JZF-S
core – part of the ARM 11 32-bit multi-processor core family.
The CPU is the main component of the Raspberry Pi, responsible for carrying out the
instructions of a computer program via mathematical and logical operations. The Raspberry Pi is
in good company using the ARM 11 series and has joined the ranks of the iPhone, Amazon
Kindle, and Samsung Galaxy.

GPU:

The graphics-processing unit (GPU) is a specialized chip designed to speed up the


manipulation of image calculations. In the case of our Raspberry Pi, it comes equipped with a
Broadcom VideoCore IV capable of hardware accelerated playback and support for OpenGL.
This is especially useful if you want to run games or video via your Raspberry Pi, or work on 3D
graphics in an open source application such as Blender.

Ethernet port:
The Ethernet port is the Raspberry Pi's main gateway to communicating with other
devices and the Internet. You will be able to use the Ethernet port to plug your Raspberry Pi into
a home router such as the one you currently use to access the Internet, or a network switch if you
have one set up.
GPIO pins:
Figure 3.1.7: GPIO pin functionality of Raspberry Pi

The General Purpose Input/output (GPIO) pins on the Raspberry Pi are the main way of
connecting with other electronic boards such as the Arduino. As the name suggests, the GPIO
pins can accept input and output commands and thus can be programmed on the Raspberry Pi.

The SD card – our Raspberry Pi's storage device:


Figure 3.1.8: SD cards for Raspberry memory slot

An SD (secure digital) card is a form of portable high performance storage medium


available for electronic devices ranging from cameras to PCs.

The Raspberry Pi comes equipped with an SD card slot allowing us to insert an SD card
and use it as our devices' main storage mechanism, much like a hard disk on a PC.While you can
use other storage mechanisms such as a USB drive or USB external hard drive, the SD card is
small and thus lends itself better to embedded devices such as those found in home automation
projects.

There are a variety of brands of SD cards on the market, and they come in a range of
sizes. The Raspberry Pi supports larger SD cards such as those with 64 GB of storage space. For
the projects in this book, you should be using an SD card with a minimum of 2 GB storage. We
will now look at the options available with regards to purchasing an SD card pre-installed with
the operating system and formatting and installing it ourselves.

4.1 Operating systems:


The Raspberry Pi primarily uses Linux-kernel-based operating systems.
The ARM11 chip at the heart of the Pi (pre-Pi 2) is based on version 6 of the ARM. The current
releases of several popular versions of Linux, including Ubuntu, will not run on the ARM11. It is
not possible to run Windows on the original Raspberry Pi, though the new Raspberry Pi 2 will be
able to run Windows 10. The Raspberry Pi 2 currently only supports Ubuntu Snappy
Core, Raspbian, OpenELEC and RISC OS.

The install manager for the Raspberry Pi is NOOBS. The operating systems included with
NOOBS are:

 Archlinux ARM
 OpenELEC
 Pidora (Fedora Remix)
 Puppy Linux
 Raspbmc and the XBMC open source digital media center
 RISC OS – The operating system of the first ARM-based computer
 Raspbian (recommended for Raspberry Pi 1) – Maintained independently of the
Foundation; based on the ARM hard-float (armhf) Debian 7 'Wheezy' architecture port
originally designed for ARMv7[4] and later processors (with Jazelle RCT/
ThumbEE, VFPv3, and NEON SIMD extensions), compiled for the more
limited ARMv6 instruction set of the Raspberry Pi. A minimum size of 4 GB SD card is
required. There is a Pi Store for exchanging programs.
 The Raspbian Server Edition is a stripped version with fewer software packages bundled
as compared to the usual desktop computer oriented Raspbian.
 The Wayland display server protocol enable the efficient use of the GPU for hardware
accelerated GUI drawing functions. on 16 April 2014 a GUI shell for Weston
called Maynard was released.
 PiBang Linux is derived from Raspbian.
 Raspbian for Robots - A fork of Raspbian for robotics projects with LEGO, Grove, and
Arduino.

Getting Raspbian onto your SD card:


Getting Raspbian onto your SD card isn’t as easy as simply copying across the file.
Remember we downloaded animage that is a direct representation of what should be on the card.
If you just copy the image onto the card, it will still just be a card with a copy of the Raspbian
image on it. What we need to do is write the image directly to the card,
Using Image Writer on Windows:

The tool recommended for writing images on Windows is the somewhat predictably
named Image Writer. You can find the link on the Raspberry Pi downloads page

Figure 4.1:Win32 Disk imager

4.1.1 Configuring Raspberry Pi:

To open the configuration tool after this, simply run the following from the command line:

sudo raspi-config

The sudo is required because you will be changing files that you do not own as the pi user.
Figure 4.1.1: Raspberry Pi configuration tool

Raspberry Pi Software Configuration Tool (raspi-config) Setup Options

1 Expand Filesystem Ensures that all of the SD card storage is available to the OS

2 Change User Password Change password for the default user (pi)

3 Enable Boot to Desktop/Scratch Choose whether to boot into a desktop environment,

Scratch, or the command line

4 Internationalisation Options Set up language and regional settings to match your

location

5 Enable Camera Enable this Pi to work with the Raspberry Pi Camera

6 Add to Rastrack Add this Pi to the online Raspberry Pi Map (Rastrack)

7 Overclock Configure overclocking for your Pi

8 Advanced Options Configure advanced settings

9 About `raspi-config` Information about this configuration tool

<Select><Finish>
Figure 4.1.1: Booting of Raspberry Pi

4.1.2 SD Formatter:

Figure 4.1.2:SD formatter

Format your SD card:

It is best to format your SD card before copying the NOOBS files onto it. To do this:
Visit the SD Association’s website and download SD Formatter 4.0 for either Windows or Mac.
Follow the instructions to install the software. Insert your SD card into the computer or laptop’s
SD card reader and make a note of the drive letter allocated to it, e.g. G:/

In SD Formatter, select the drive letter for your SD card and format it.

Drag and drop NOOBS files. Once your SD card has been formatted, drag all the files in the
extracted NOOBS folder and drop them onto the SD card drive. The necessary files will then be
transferred to your SD card. When this process has finished, safely remove the SD card and
insert it into your Raspberry Pi.

First boot Plug in your keyboard, mouse and monitor cables. Now plug in the USB power cable
to your Pi. Your Raspberry Pi will boot, and a window will appear with a list of different
operating systems that you can install. We recommend that you use Raspbian – tick the box next
to Raspbian and click on Install. Raspbian will then run through its installation process. Note this
can take a while. When the install process has completed, the Raspberry Pi configuration menu
(raspi-config) will load. Here you are able to set the time and date for your region and enable a
Raspberry Pi camera board, or even create users. You can exit this menu by using Tab on your
keyboard to move to Finish. Logging in and accessing the graphical user interface. The default
login for Raspbian is username pi with the password raspberry. Note you will not see any writing
appear when you type the password. This is a security feature in Linux. To load the graphical
user interface type startx.

4.1.3 PuTTY:
PuTTy is a stand-alone tool, so you can run it as soon as you’ve downloaded it; you don’t
have to install anything on your machine. This is generally pretty useful because it means you
can stick it on a USB stick and carry it around with you, and you can run it on other machines
without needing Administrator privileges. If you keep losing track of PuTTy (it’s amazing how
easy it is to do), you might want to download the “Installer” version, which will install it on your
machine and set up the Start menu and Desktop shortcut icons for you.
For accessing Pi through command line on windows PC we needed PuTTY. PuTTY
is a free and open-source terminal emulator, serial console and network file transfer application.
It supports several network protocols, including SCP, SSH, Telnet, rlogin, and raw socket
connection.

Figure 4.1.3: PuTTy Configuration

4.1.4 Remotely accessing the Pi:


Probably one of the hardest things to get used to when working in a Linux environment
when coming from a Windows or an OSX environment is working in the shell. For starters, it’s
not pretty, but more importantly humans are creatures who are very much used to manipulating
things to achieve an outcome. This means that a GUI-based environment is much more intuitive
at first. Having come from a Windows environment, I can say for certain that the command line
is such a great environment to work in. The amount you can do with a few deft keystrokes
compared with keyboard and mouse work, clicking, dragging, and performing context actions is
amazing. Being able to work within a system purely from the command line is a great asset
indeed.
But you need to become familiar with it, and the only way to do this is practice! Why am
I talking about the command line when we need to talk about managing your Pi? Because most
Linux management is achieved through the command line, with most if not all of the system
functions you want to use being available from the command line. Moreover, it is far easier and
less resource-intensive to access your system via the command line than it is to access it via the
GUI. To access your system remotely via the command line, you simply need to use Secure Shell
(or SSH for short), system’s network access is available on boot as well. These two functions
serve the basics of being able to manage your system from anywhere as you have network
enabled and then can use SSH to connect to your system. So, let's examine these two functions a
little more closely so that you understand how to ensure you can always access your Pito manage
it.
In addition to having your SD card loaded with a copy of Raspbian, you will want to ensure that
your version ofRaspbian has been upgraded because the September release included significant
improvements in how Wi-Fi access is managed. To get this system up, you first need to run a
few quick commands:
$ sudo apt-get update
$ sudo apt-get upgrade
These two commands will first tell your apt-get instance to update to know which versions of the
software are available to you for usage. The second will tell apt-get to compare and then install
every upgraded version of all software currently installed on the system. As you can imagine,
running these commands on a regular basis is a very good idea because it allows you to keep
your system running the latest version of the software.
Adding a remote GUI:
Alright, while I will readily admit that there are some true benefits from working within a
console–only remote environment there are some people who just cannot get their head around
it. And there are a number of cases where it is impractical for whatever reason. In these
situations, it’s best to use a tool called Virtual Network Computing(VNC) to give you the ability
to interact with your Pi’s desktop from another machine.
To do this, you will need to install a VNC server on your Pi and you will need a client on your
machine. There are numerous different VNC solutions out there, and as long as they obey the
VNC protocol, they should all be compatible. For your Pi, you will be using tightvnc because it
aims to be efficient and “tight.” You can download the clients for both Windows and Linux
systems at www.tightvnc.com. But before you go jumping into clients, start by installing the
server on your Pi. Run the following command:
$ sudo apt-get install tightvncserver
Once you have Tight VNC Server installed, you need to power it up and start it running so you
can connect. So go ahead and execute this command:
$ tightvncserver
You will then be prompted for a pair of passwords: one is the actual VNC password that allows
you to use themouse and keyboard to manipulate the screen; the second is the optional “View
Only” password that allows you to view what’s on the screen but not interact. This is what you
should expect to see after executing:
You will require a password to access your desktops.Password:
Warning: password truncated to the length of 8.Verify:
Would you like to enter a view-only password (y/n)? n
New 'X' desktop is raspberrypi:1
Creating default startup script /home/pi/.vnc/xstartup
Starting applications specified in /home/pi/.vnc/xstartup
Log file is /home/pi/.vnc/raspberrypi:1.log
Now all you need to do is go ahead and connect with the tightvnc client on the machine you wish
to browse from. Go ahead and fire up the client. I am working from a Windows environment

Figure 4.1.4: TightVNC Client


4.2 Python:
Python is considered one of the best First Programming languages due the ease and
clarity for any beginner to start coding in the language. Since the Python developer community
has grown huge we always will have someone to help out in times of need. Python is an
interpreted language. Meaning we don’t need to compile the code before running as the program
executed directly without being compiled to a machine level language. These kind of languages
are a bit quicker to program with. There are also some hidden benefits with the interpreted
languages like elimination of the need to declare variable types. For example we need not tell the
program explicitly if my variable is a string or a number or a list, these are figured out by the
interpreter during execution. The Python interpreter can be invoked in two different ways:
1. We can run python interpreter as an interactive shell, where we execute individual commands
2. We can also run as a command line program to execute standalone scripts written in Python.
The IDE for Python on Raspian OS is called the IDLE. See below image to find out where to
locate the same.

Installing Python Packages:

APT:

Some Python packages can be found in the Raspbian archives and can be installed using APT,
for example:
sudo apt-get update
sudo apt-get install python3-picamera
This is a preferable method of installing software, as it means that the modules you install can be
kept up to date easily with the usual sudo apt-get update and sudo apt-get upgrade commands.

Python packages in Raspbian which are compatible with Python 2.x will always have a
python- prefix. So, the picamera package for Python 2.x is named python-picamera Python 3
packages always have a python3-prefix. So, to install rpi.gpio for Python 3 you would use:

sudo apt-get install python3-rpi.gpio

Uninstalling packages installed via APT can be accomplished as follows:


sudo apt-get remove python3-rpi.gpio

or completely remove with --purge:

sudo apt-get remove python3-rpi.gpio –purge

You should have something like this:

home
- pi
- myproject
- python
- html

Python script:

 Create a script.py file in your python folder, eg. /home/pi/myproject/python/script.py.


This file will be loaded and executed by the WebIOPi server.
 HTML/JavaScript
 Create a index.html file in your html folder,
eg. /home/pi/myproject/html/index.html. The WebIOPi Javascript library allows you to make your
own interface easily with buttons bound to GPIO. You only need a single <script> tag to
include /webiopi.js. It will then automatically load jQuery, a nice JS library.

 You don't need to put webiopi.js and jquery.js in your project html folder. You just need
the <script> tag in your index.html. The WebIOPi server filters browsers requests to serves both
webiopi.js and jquery.js files from the default WebIOPi resource folder.

The index.html is composed of few HTML tags, including a little Javascript part and few
CSS lines. The most important to take care about is the anonymous Javascript function passed to
WebIOPi JS library with webiopi().ready(). This ensure WebIOPi and jQuery libraries are
loaded before modifying the UI. Also take of the parenthesis when prefixing functions calls
with webiopi(). After the button creation, we use a jQuery function to append it to a HTML
element, declared later in the <body> tag.
YF-S201 Hall Effect Water Flow Meter / Sensor

This sensor sits in line with your water line and contains a pinwheel sensor to measure how
much liquid has moved through it. There's an integrated magnetic hall effect sensor that outputs
an electrical pulse with every revolution. The hall effect sensor is sealed from the water pipe and
allows the sensor to stay safe and dry.

The sensor comes with three wires: red (5-24VDC power), black (ground) and yellow (Hall
effect pulse output). By counting the pulses from the output of the sensor, you can easily
calculate water flow. Each pulse is approximately 2.25 milliliters. Note this isn't a precision
sensor, and the pulse rate does vary a bit depending on the flow rate, fluid pressure and sensor
orientation. It will need careful calibration if better than 10% precision is required. However, its
great for basic measurement tasks!

We have as example Arduino sketch that can be used to quickly test the sensor, it will calculate
the approximate flow of water in liters/hour.
The pulse signal is a simple square wave so its quite easy to log and convert into liters per
minute using the following formula.

Pulse frequency (Hz) / 7.5 = flow rate in L/min.

Features:

 Model: YF-S201
 Sensor Type: Hall effect
 Working Voltage: 5 to 18V DC (min tested working voltage 4.5V)
 Max current draw: 15mA @ 5V
 Output Type: 5V TTL
 Working Flow Rate: 1 to 30 Liters/Minute
 Working Temperature range: -25 to +80℃
 Working Humidity Range: 35%-80% RH
 Accuracy: ±10%
 Maximum water pressure: 2.0 MPa
 Output duty cycle: 50% +-10%
 Output rise time: 0.04us
 Output fall time: 0.18us
 Flow rate pulse characteristics: Frequency (Hz) = 7.5 * Flow rate (L/min)
 Pulses per Liter: 450
 Durability: minimum 300,000 cycles
 Cable length: 15cm
 1/2" nominal pipe connections, 0.78" outer diameter, 1/2" of thread
 Size: 2.5" x 1.4" x 1.4"

Connection details:

 Red wire : +5V


 Black wire : GND
 Yellow wire : PWM output.

Das könnte Ihnen auch gefallen