0% found this document useful (0 votes)
266 views35 pages

Iot Unit6

This document provides instructions for creating an IoT sensor project using a Raspberry Pi. It involves 6 main steps: 1) setting up a console application, 2) configuring hardware and sampling sensor values, 3) adding HTTP server capabilities, 4) handling data persistence, 5) adding authentication, and 6) sending events from the server to client. Sensors will measure light, temperature, and motion. The project is developed remotely in C# and deployed to the Raspberry Pi. Hardware interfaces like LEDs, motion detector, temperature sensor, and light sensor are configured. Sensor data is stored in an object database and represented in an XML format for interchange between devices.

Uploaded by

Krishna Dolas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
266 views35 pages

Iot Unit6

This document provides instructions for creating an IoT sensor project using a Raspberry Pi. It involves 6 main steps: 1) setting up a console application, 2) configuring hardware and sampling sensor values, 3) adding HTTP server capabilities, 4) handling data persistence, 5) adding authentication, and 6) sending events from the server to client. Sensors will measure light, temperature, and motion. The project is developed remotely in C# and deployed to the Raspberry Pi. Hardware interfaces like LEDs, motion detector, temperature sensor, and light sensor are configured. Sensor data is stored in an object database and represented in an XML format for interchange between devices.

Uploaded by

Krishna Dolas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 35

Learn IoT creating a sensor project with

Raspberry Pi and sensors


Learn how to create a sensor project
The development of a Raspberry Pi sensor project is broken down into six steps. Here’s a
simple overview:
1. Firstly, you will set up the basic structure of a console application.
2. Then, you will configure the hardware and learn to sample sensor values and maintain
a useful historical record.
3. After adding HTTP server capabilities and other useful web resources to the project,
you will publish the sensor values collected on the internet.
4. You will then handle the persistence of sampled data in the sensor, so it can resume
after outages or software updates.
5. The next step will teach you how to add a security layer requiring user authentication
to access sensitive information on top of the application.
6. In the last step, you will learn how to overcome one of the major obstacles in the
request/response pattern used by HTTP, that is, how to send events from the server to
the client.

Preparing Raspberry Pi for sensor project


.
In this tutorial, you will see the use of Raspberry Pi Model B with the following:
 An SD card with the Raspbian operating system installed
 A configured network access, including Wi-Fi, if used
 User accounts, passwords, access rights, time zones, and so on, all configured
correctly
The sensor project will be developed on a remote PC using C#, as it’s a modern
programming language that allows complete flexibility with IoT. It also allows you to
interchange code between Windows, Linux, Macintosh, Android, and iOS platforms.
Once a project is compiled, executable files are deployed to the corresponding Raspberry Pi
and then executed. Since the code runs on .NET, any language out of a large number of CLI-
compatible languages can be used.

To prepare Raspberry for the execution of the .NET code, you need to install Mono, which
contains the Common Language Runtime for .NET that will help you run the .NET code on
Raspberry. This can be done by executing the following commands in a terminal window in
Raspberry Pi:
[bash] $ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install mono-complete
[/bash]
Your device is now ready to run the .NET code.
Hardware: Sensor used in Raspberry Pi IoT project
The sensor prototype will measure three things: light, temperature, and motion. To
summarize, here is a brief description of the components:
 The light sensor is a simple ZX-LDR analog sensor that will connect to a four-channel
analog-to-digital converter (Digilent Pmod AD2). This is then connected to an I2C bus
that will connect to the standard GPIO pins for I2C. Note that The I2C bus permits
communication with multiple circuits using synchronous communication, employing
a Serial Clock Line (SCL) and Serial Data Line (SDA) pin. This is a common way to
communicate with integrated circuits.
 The temperature sensor (Texas Instruments TMP102) connects directly to the same
I2C bus.
 The SCL and SDA pins on the I2C bus use recommended pull-up resistors to ensure
they are in a high state when nobody actively pulls them down.
 The infrared motion detector (Parallax PIR sensor) is a digital input that can be
connected to GPIO 22.
 Four LEDs will also be added to the board. One of these is green and is connected to
GPIO 23. This will show when the application is running. The second one is yellow
and is connected to GPIO 24. This will show when measurements are done. The third
one is yellow and is connected to GPIO 18. This will show when an HTTP activity is
performed. The last one is red and is connected to GPIO 25. This will show when a
communication error occurs.
 The pins that control the LEDs are first connected to 160 Ω resistors before they are
connected to the LEDs, and then to ground. All the hardware of the prototype board is
powered by the 3.3 V source provided by Raspberry Pi. A 160 Ω resistor connected in
series between the pin and ground ensures that the LED emits a bright light.

Interacting with the hardware


Interaction with the hardware is done using corresponding classes defined in
the Clayster.Library.RaspberryPi library. For instance, digital output is handled using
the DigitalOutput class and digital input with the DigitalInput class. Devices connected to an
I2C bus are handled using the I2C class. There are also other generic classes, such
as ParallelDigitalInput and ParallelDigitalOutput, which handle a series of digital input and
output at once.
The SoftwarePwm class handles a software-controlled pulse-width modulation output.
The Uart class handles communication using the UART port available on Raspberry Pi.
There’s also a subnamespace called Devices where device-specific classes are available.
In the end, all classes communicate with the static GPIO class, which is used to interact with
the GPIO layer in Raspberry Pi.
Each class has a constructor that initializes the corresponding hardware resource, methods
and properties to interact with the resource, and a Dispose method that releases the resource.
Tip
It is important that you release the hardware resources allocated before you terminate the
application. Since hardware resources are not controlled by the operating system, the fact that
the application is terminated is not sufficient to release the resources. For this reason, make
sure you call the Dispose methods of all the allocated hardware resources before you leave
the application. Preferably, this should be done in the final statement of a try-finally block.
Interfacing the hardware
The hardware interfaces to be used for the LEDs are as follows:
[csharp] private static DigitalOutput executionLed = new DigitalOutput (23, true);
private static DigitalOutput measurementLed = new DigitalOutput (24, false);
private static DigitalOutput errorLed = new DigitalOutput (25, false);
private static DigitalOutput networkLed = new DigitalOutput (18, false);
[/csharp]
Use a DigitalInput class for the motion detector:
[csharp] private static DigitalInput motion = new DigitalInput (22);[/csharp]
With the temperature sensor on the I2C bus, which limits the serial clock frequency to a
maximum of 400 kHz, interface it as follows:
[csharp] private static I2C i2cBus = new I2C (3, 2, 400000);
private static TexasInstrumentsTMP102 tmp102 =
new TexasInstrumentsTMP102 (0, i2cBus);[/csharp]
We interact with the light sensor using an analog-to-digital converter as follows:
[csharp] private static AD799x adc =
new AD799x (0, true, false, false, false, i2cBus);[/csharp]
Internal representation of sensor values
The sensor data values will be represented by the following set of variables:
[csharp] private static bool motionDetected = false;
private static double temperatureC;
private static double lightPercent;
private static object synchObject = new object ();
[/csharp]
Historical values will also be kept so that trends can be analyzed:
[csharp] private static List<Record> perSecond = new List<Record> ();
private static List<Record> perMinute = new List<Record> ();
private static List<Record> perHour = new List<Record> ();
private static List<Record> perDay = new List<Record> ();
private static List<Record> perMonth = new List<Record> ();
[/csharp]
Persisting data
Persisting data is simple. This is done using an object database. This object database
analyzes the class definition of objects to persist and dynamically creates the database
schema to accommodate the objects you want to store. The object database is defined in
the Clayster.Library.Data library. You first need a reference to the object database,
which is as follows:
[csharp]internal static ObjectDatabase db;[/csharp]
Then, you need to provide information on how to connect to the underlying database. This
can be done in the .config file of the application or the code itself. Specify a SQLite database
and provide the necessary parameters in the code during the startup:
[csharp] DB.BackupConnectionString = “Data Source=sensor.db;Version=3;”;
DB.BackupProviderName = “Clayster.Library.Data.Providers.”
+ “SQLiteServer.SQLiteServerProvider”;
[/csharp]
Finally, you will get a proxy object for the object database. This object can be used to store,
update, delete, and search for objects in your database:
[csharp] db = DB.GetDatabaseProxy (“TheSensor”);
[/csharp]
After doing this, the sensor won’t lose data if Raspberry Pi is restarted.
External representation of sensor values
To facilitate the interchange of sensor data between devices, you’ll need an interoperable
sensor data format based on XML, provided in the Clayster.Library.IoT library. Here, the
sensor data consists of a collection of nodes that report data ordered according to the
timestamp.
For each timestamp, a collection of fields is reported. There are different types of fields
available: numerical, string, date and time, timespan, Boolean, and enumeration-valued
fields. Each field has a field name, field value of the corresponding type, an optional readout
type, a field status, Quality of Service value, and localization information.
The Clayster.Library.IoT.SensorData namespace helps you export sensor data
information by providing an abstract interface called ISensorDataExport. The same logic can
later be used to export to different sensor data formats. The library also provides a class
named ReadoutRequest that provides information about what type of data is desired. You can
use this to tailor the data export to the desires of the requestor.
Exporting sensor data
The export starts by calling the Start() method on the sensor data export module and ends
with a call to the End() method. Between these two, a sequence
of StartNode() and EndNode() calls are made, one for each node to export.
To simplify the export, you can call another function to output data from an array
of Record objects that contain the data. Use the same method to export the momentary values
by creating a temporary Record object that would contain them:
[csharp] private static void ExportSensorData (ISensorDataExport Output,
ReadoutRequest Request)
{
Output.Start ();
lock (synchObject)
{
Output.StartNode (“Sensor”);
Export (Output, new Record[] {
new Record (DateTime.Now, temperatureC, lightPercent, motionDetected)
},ReadoutType.MomentaryValues, Request);
Export (Output, perSecond, ReadoutType.HistoricalValuesSecond, Request);
Export (Output, perMinute, ReadoutType.HistoricalValuesMinute, Request);
Export (Output, perHour, ReadoutType.HistoricalValuesHour, Request);
Export (Output, perDay, ReadoutType.HistoricalValuesDay, Request);
Export (Output, perMonth, ReadoutType.HistoricalValuesMonth, Request);
Output.EndNode ();
}
Output.End ();
}
[/csharp]
Note that you need to check whether the corresponding readout type is desired by the client
before you export data of this type.
Learn More:
How to use OpenCV with Raspberry Pi
Raspberry Pi IoT: Sensors, InfluxDB, MQTT and Grafana
The Export method exports an enumeration of Record objects. It first checks whether the
corresponding readout type is desired by the client before exporting data of this type. The
method also checks whether the data is within the requested time interval and that the fields
are of interest to the client.
If a data field passes all these tests, it is exported by calling any of the instances of the
overloaded method ExportField(), available on the sensor data export object. Fields are
exported between the StartTimestamp() and EndTimestamp() method calls, defining the
timestamp that corresponds to the fields being exported:
[csharp] private static void Export(ISensorDataExport Output, IEnumerable History,
ReadoutType Type,ReadoutRequest Request)
{
if((Request.Types & Type) != 0)
{
foreach(Record Rec in History)
{
if(!Request.ReportTimestamp (Rec.Timestamp))
continue;
Output.StartTimestamp(Rec.Timestamp);
if (Request.ReportField(“Temperature”))
Output.ExportField(“Temperature”,Rec.TemperatureC, 1,”C”, Type);
if(Request.ReportField(“Light”))
Output.ExportField(“Light”,Rec.LightPercent, 1, “%”, Type);
if(Request.ReportField (“Motion”))
Output.ExportField(“Motion”,Rec.Motion, Type);
Output.EndTimestamp();
}
}
}
[/csharp]
You can test the method by exporting some sensor data to XML using
the SensorDataXmlExport class. It implements the ISensorDataExport interface. The result
would look something like this if you export only momentary and historic day values:
[xml] <?xml version=”1.0″?>
<fields xmlns=”urn:xmpp:iot:sensordata”>
<node nodeId=”Sensor”>
<timestamp value=”2014-07-25T12:29:32Z”>
<numeric value=”19.2″ unit=”C” automaticReadout=”true” momentary=”true”
name=”Temperature”/>
<numeric value=”48.5″ unit=”%” automaticReadout=”true” momentary=”true”
name=”Light”/>
<boolean value=”true” automaticReadout=”true” momentary=”true” name=”Motion”/>
</timestamp>
<timestamp value=”2014-07-25T04:00:00Z”>
<numeric value=”20.6″ unit=”C” automaticReadout=”true” name=”Temperature”
historicalDay=”true”/>
<numeric value=”13.0″ unit=”%” automaticReadout=”true” name=”Light”
historicalDay=”true”/>
<boolean value=”true” automaticReadout=”true” name=”Motion” historicalDay=”true”/>
</timestamp>

</node>
</fields>
[/xml]

In the learn how to create a Raspberry Pi sensor article, we demonstrated how to develop a Pi
that is able to sense light, motion and temperature. In the same article, we also discussed how
to use C# code to interact with hardware components and capture values sensed. This article
will pick up from where the previous article left. The article will focus on demonstrating how
to persist captured values in a database, exporting the data, creating an actuator and a
controller.
Functionality to support data persistence is available in the Data Clayster library. Data
persistence happens via an object database that evaluates the objects that you have designed
and creates a database schema that is able to hold the defined objects. The entry point to data
persistence is referencing an object as shown below.
internal static ObjectDatabase myDb;
After referencing an object database, information that will be used to connect to the database
needs to be provided. One approach used in passing the connection information is adding the
connection parameters in a .config file from where the application can read it. This tutorial
will demonstrate persisting data to a SQLite database. The parameters that will enable
connection to the database are shown below
DB.BackupConnectionString = "Data Source=sensor.db;Version=3;";
DB.BackupProviderName = "Clayster.Library.Data.Providers."
+"SQLiteServer.SQLiteServerProvider";
To perform data manipulation activities such as storing, updating, searching and deleting a
database, a proxy object is used as shown below. By using a database object we ensure data is
not lost when our Raspberry Pi is powered off.
myDb = DB.GetDatabaseProxy ("mySensor");
For our data to be useful we need to go beyond persisting it in a database and be able to
export it for consumption by other applications. To fulfill this requirement, the IoT library
provides an XML based sensor format. The format orders data by timestamp and for each
timestamp it is possible to have string, Boolean, date or enumeration fields. Each field has
optional and required metadata associated with it. Required metadata include name and a
value of the correct field type. Optional metadata that can be associated with a field include
the quality of service and a readout type.
The process of exporting data begins with method call of Start () and ends with a method call
of End (). The methods called to initiate and terminate the export process are available in the
data export class. The data process export is simplified by calling an intermediate function to
retrieve the data from a record object and temporarily store them in another record as an
array. The C# code used to retrieve the sensed data is shown below
private static void ExportSensorData (ISensorDataExport Output,
ReadoutRequest Request)
{
Output.Start ();
lock (synchObject)
{
Output.StartNode ("Sensor");
Export (Output, new Record[]
{
new Record (DateTime.Now, temperatureC, lightPercent,
motionDetected)
},ReadoutType.MomentaryValues, Request);
Export (Output, everySec, ReadoutType.HistoricalValuesSecond,
Request);
Export (Output, everyMin, ReadoutType.HistoricalValuesMinute,
Request);
Export (Output, everyHr, ReadoutType.HistoricalValuesHour,
Request);
Export (Output, everyDy, ReadoutType.HistoricalValuesDay,
Request);
Export (Output, everyMon, ReadoutType.HistoricalValuesMonth,
Request);
Output.EndNode ();
}
Output.End ();
}
Before any data export can happen, there are several checks done on the data. The readout
type, the time interval and fields are checked to ensure they conform to what the client
requested. Fields that meet the criteria set by the client are exported. The C# code used to
check and export fields is shown below.
private static void Export(ISensorDataExport Output,
IEnumerable<Record> History, ReadoutType Type,
ReadoutRequest Request)
{
if((Request.Types & Type) != 0)
{
foreach(Record Rec in History)
{
if(!Request.ReportTimestamp (Rec.Timestamp))
continue;
Output.StartTimestamp(Rec.Timestamp);
if (Request.ReportField("Temp"))
Output.ExportField("Temperature",Rec.TemperatureC,
1,"C", Type);
if(Request.ReportField("Light"))
Output.ExportField("Light",Rec.LightPercent, 1, "%",
Type);
if(Request.ReportField ("Motion"))
Output.ExportField("Motion",Rec.Motion, Type);
Output.EndTimestamp();
}
}
}
In an IoT project, a sensor is used to capture the state of an environment while an actuator
utilizes the sensed state to interact with the environment. Because this article is a continuation
of the ‘learn how to create a sensor project’, the hardware mentioned here is an addition of
previously used hardware. Hardware needed for the actuator includes an alarm and digital
outputs, which are connected through GPIO pins. The DigitalOutput class provides a
mechanism to interface with digital outputs. To interface with the alarm the SoftwarePwm
class will be used. The code used to interact with the outputs is shown below.
private static DigitalOutput executionLed =
new DigitalOutput (8, true);
private static SoftwarePwm alarmOutput = null;
private static Thread alarmThread = null;
private static DigitalOutput[] digitalOutputs =
new DigitalOutput[]
{
new DigitalOutput (19, false),
new DigitalOutput (24, false),
new DigitalOutput (27, false),
new DigitalOutput (22, false),// pin 21 on RaspberryPi R1
new DigitalOutput (20, false),
new DigitalOutput (15, false),
new DigitalOutput (14, false),
new DigitalOutput (12, false)
};
A controller is the intelligent link between the sensor and the actuator. The controller
processes the data captured by the sensor and communicates its output through the actuator.
If the project we have developed is deployed in a home security environment, then an alarm
would sound if there is a combination of darkness and movement. Before the controller can
do any processing, it needs to acquire the sensed data. The variables shown below will be
used to hold the sensed data:
private static bool movement = false;
private static double lightDensity = 0;
private static bool hasValues = false;
Earlier in the article, we demonstrated how to export data in an XML based format. At this
stage we need to process the data to detect differences in current and previous data. This
processing is implemented using the code shown below.
private static bool UpdateFields(XmlDocument Xml)
{
FieldBoolean Boolean;
FieldNumeric Numeric;
bool Updated = false;
foreach (Field F in Import.Parse(Xml))
{
if(F.FieldName == "Motion" &&
(Boolean = F as FieldBoolean) != null)
{
if(!hasValues || motion != Boolean.Value)
{
motion = Boolean.Value;
Updated = true;
}
} else if(F.FieldName == "Light" &&
(Numeric = F as FieldNumeric) != null &&
Numeric.Unit == "%")
{
if(!hasValues || lightPercent != Numeric.Value)
{
lightPercent = Numeric.Value;
Updated = true;
}
}
}
return Updated;
}

Latest Projects Based on Actuators


Bheru Singh

The following projects are based on actuators. This list shows the latest innovative projects
which can be built by students to develop hands-on experience in areas related to/ using
actuators.

1. IoT using Raspberry Pi


Using a Raspberry Pi computer and a DHT sensor, you will develop an electronic device that streams
temperature and humidity data over the internet. You can program the system in such a way that
say whenever the temperature exceeds a certain limit, the device will automatically send an email
notification!

2. 2 Mechatronics Projects
This course introduces you to the concept of industrial robotics through two different innovative
mechatronics projects. The first mechatronics project that you will build is the robotic arm, which
has 3 degrees of freedom and can be controlled by your smart phone using an Android App. In the
second project, you will learn to build a two legged robot or a biped walking robot that will have six
degrees of freedom with a hip, knee & foot and mimic the walking action of humans.

3. Robotic Arm
In this project, you will build a robotic arm that has 3 degrees of freedom which you can control by
your mobile phone. The robotic arm will be connected to the mobile phone through Bluetooth and
can be controlled by an Android App.

4. Gesture Based Robotics


In this project, you will learn to build your very own Gesture Controlled Robot that can be controlled
via hand gestures with the help of an ADXL-335 accelerometer sensor.

5. IoT using Arduino


In this project, you will build an IoT based weather monitoring system that streams temperature and
humidity data over the internet to the user at a remote location. You can program the system in
such a way that say whenever the temperature exceeds a certain limit, the device will automatically
send an email notification!

Build projects on latest technologies


Want to develop practical skills on latest technologies? Checkout our latest projects and start
learning for free.
6. Computer Vision - Text Scanner

In this project-based course, you will learn to develop a computer vision-based text scanner that can
scan any text from an image using the optical character recognition algorithm and display the text on
your screen.

7. Computer Vision Based Smart Selfie


In this project-based course, you will learn to develop a computer vision-based smart selfie that can
take snaps automatically when you smile using facial feature recognition algorithm and store it on
your device.

8. Automated Street Lighting


In this project, you will build an IoT based Automated Street Lighting System that automatically
switches the street light ON and OFF based on the amount of sunlight present. This is one of the key
components of smart cities where energy will be used very efficiently by turning the streetlights ON
and OFF at the right time as needed. The data will be sent to the cloud for storage and analysis.

9. Smart Irrigation System


In this project, you will work with a soil moisture sensor, ESP-8266 WiFi module, and an Arduino
board to develop a smart irrigation system project. The device can detect the change in moisture
level in the soil and controls the flow of water accordingly with a DC pump. You will also program the
system to send data to the cloud platform for storage and analysis.

10. Computer Vision Based Mouse


In this project-based course, you will learn to develop a computer vision-based mouse to control the
cursor using the object tracking algorithm. Using this project, you can carry out all the functionalities
of a mouse by just showing corresponding colors in the webcam.

11. Smart Water Monitoring


In this project, you will build an IoT based Smart Water Monitoring System that can detect the flow
of water and record the volume of water that flows through the pipe for a given period of time. The
data is then sent to the cloud for storage and analysis.

12. Smart Building using IoT


The project you develop can sense the number of occupants in the meeting room with the help of
PIR sensors and automatically switch the lights ON/ OFF based on occupancy. You will be able to
analyse the usage of the meeting room, number of persons at various times of the day, the time for
which lights are on and the power consumed.

13. 5 IoT Projects (Combo Course)


You will work on basic to advance level Arduino based IOT projects with practical exercises on key
technologies. Thereby you will gain great understanding of IOT and how IOT is going to change the
way we live in the near future.
The projects that you will build are, Weather Monitoring System, Smart Irrigation System,
Automated Street Lighting System, Smart Water Monitoring System and Smart Building using PIR.
14. WiFi Controlled Robot

In this project, you will learn to build a Wi-Fi Controlled Robot that can be operated remotely via a
computer/ website using Wi-Fi. The robot is connected to the internet with the help of ESP 8266 Wi-
Fi module and can be controlled through commands on a web page that you will design.

15. 2 IoT Projects (Combo Course)


In this course, you will learn to build 2 different types of IoT Projects. First, you will develop a
weather monitoring system to record and stream the temperature/ humidity data online. Second,
you will develop an electronic device to irrigate the field automatically based on the moisture level
present in the soil. And the data collected will sent to cloud for storage and analysis.
Tesla Bot Actuators
The Actuators are the main drive system for any Robot. You could say a robot is nothing
more than a PC with moving parts, or in other words, a Robot is a PC with Actuators and
sensors. Tesla has developed its own Actuators for the Bot, it uses 3 types of rotary actuators
and 3 types of Linear Actuators.

If you are wondering why Tesla didn't use standardized Linear Actuators like the FIRGELLI
actuator, its because they have several constraints that means they have to develop their own
systems to get the Robots to be ultimately lightweight, power efficient, high power density
and low cost. Tesla have claimed they want to get the Bot to retail for $20,000 each. This in
itself is a tall order for something that's gong to require 23 Actuators, and powerful PC, lots
of sensors and a battery pack to make it last more than a few hours, plus a strong skeleton to
hold it all together.
Tesla Bot Linear Actuators

The Linear Actuators Tesla developed are highly specific for a specific role, this means they
would not really be of much use for any other application other than a Robot. Their Actuators
employ a planetary Roller system and Tesla calls it, but this is basically code for Ballscrew
leadscrew design, and instead of a traditional magnetic armature coil in the middle of the
motor they decided to use a brushless core motor design. This means the Ball leadscrew
design is very efficient and uses less power, but also more expensive. And they use a
Brushless power system which means the live span will be significantly faster and allows
highly specific drive modes controlled by the software.

The length of travel is only about 2" long, and as the picture showed of them lifting a Piano at
500KG, this is alot of weight. You may wonder why it needs to lift so much weight?, well
that's because when installed in a metal skeleton, the actuators travel needs to amplify the
stoke of what its moving. So if its moving the Leg of a Robot, the leg needs to be able to
move about 150 degs, or over a 2 foot length the leg needs to swing from about zero to a 3-
foot arc. The huma body that has evolved over 100,000's of years allows us humans to do this
using our leg muscles, but getting a linear actuator to do this is no easy task. So the point I'm
making is that, even though The Actuator can lift 500Kg of weight over 2-inches, once that
actuators connected to a lever, the force gets reduced significantly, depending on the leverage
ratio, and but the speed increases which makes for a nice trade-off.

How to build your own IoT camera


Ever wanted to build your very own, fully functional IoT camera? Use it as a security cam,
kid’s cam, doggy cam, goldfish cam...whatever your heart desires. This project makes it easy
for you to experiment with IoT technology, while making use of old gadgets and fiddling
with basic code.
Build the camera
What you'll need to do this project

 Raspberry Pi™ (a clever little, low-cost computer that plugs into any monitor or TV)
 An old webcam
 A Joby™ tripod
 A nut (a standard 1/4” - 20 nut available from most hardware stores)
 1 SD card
 A single-use pack of Sugru
Step 1 — Mount the tripod nut to the camera

 Use just 1/5 of the Sugru pack and roll into a ball. Press firmly onto the base of the camera
and mould into a cone shape
 Put the nut onto your tripod (keep it nice and loose) then press slowly and firmly into the
Sugru
 Press the Sugru in and rub smooth
 Gently unscrew the tripod
Step 2 — Mount the camera to the Raspberry Pi
 Roll the remaining Sugru. Press it onto the back of the camera, making sure the cable is
twisted in the best direction
 Mould into a cone shape. Press the camera slowly and firmly onto the Raspberry Pi
 Press the Sugru in and rub gently where you can reach it
 Leave for 12-24 hours for the Sugru to set

Set up the code to run the Raspberry Pi


To transform your new camera into an IoT camera, just download the customised Open
Source Code we’ve built for you and follow these steps. This will run in your browser, over
your WI-FI and on any smartphone or desktop computer. No apps, no subscriptions, just
some seriously good old-fashioned technology.
Step 1 — Download the SD card image

We have made the camera setup really plug and play for you by creating a Raspberry Pi
'image'. This is essentially a snapshot of a whole operating system, along with its files,
settings and installed programs that can perfectly capture images from your webcam and
serve them up to your phone, tablet or computer. You need to download this image file and
clone it into an SD card. Since the file is a snapshot of an SD card, it’s quite large, measuring
up at 16GB. Make sure you have space for it! You can delete it afterwards. Download it here.

Step 2 — Clone image to SD card

Now, once you’ve downloaded the Raspberry Pi image, you need to clone it into an SD card.
This operation is wildly different and depends on the operating system your computer is
running. This is probably going to be the trickiest part of the operation, but don’t be scared!
The wonderful folks at the Raspberry Pi Organisation have made a great easy-to-follow guide
that shows you how to take your image file and burn it onto an SD card. Head on over here to
master image burning! Look at the section titled 'Writing an image to the SD card'.
Step 3 — Add in your WiFi details

Once you’ve written the image to your SD card, you should see two SD cards mounted on
your computer - 'boot' and 'recovery'. Go ahead and open boot. Right at the end of the file list,
you’ll find a file called 'wifi.conf'. Open that up in a text editor (TextEdit if you’re on a Mac,
or Notepad if you’re on Windows). Here’s where you add in your WiFi details so that the Pi
knows how to connect to your home network. Swap out 'YourWiFiNameHere' with whatever
your WiFi network name is, and 'YourWiFiPasswordHere' with your, you guessed it, WiFi
password! Save and close the file, and eject both SD cards from your system. You can now
remove it from your computer.
Step 4 - Connect it all up

Congratulations! You’re through to the last and most fun part. Put the SD card into the
Raspberry Pi. Connect up your webcam to one of the USB ports on the Pi. Make sure that
everything’s nicely mounted and ready to go.
Serial Port setup in Raspberry Pi OS
Configure the serial port on Raspberry Pi

The Raspberry Pi contains a UART serial port on the GPIO header on pins 8, TXD (GPIO
14) and 10, RXD (GPIO 15). The UART port can be used to connect to a wide range of
devices either directly using 3.3V UART pins or with a serial interface to convert the UART
voltages to an industry standard such as RS232 or RS485. When connecting a device to the
UART serial port always ensure your device operates at correct voltage, 3.3V. Connecting a
5V device to the UART port can damage the Raspberry Pi GPIO header.

Using the UART serial port


The UART port can be enabled using the raspi-config utility.
Step 1 - Install Raspberry Pi OS onto a SD card and boot the Raspberry Pi.
Login via terminal or desktop and shell
Configure the system with:
sudo raspi-config
Step 2 - Select “3 Interface Options”
-

Step 3 - Select “P6 Serial Port”


Step 4 - A screen will ask you if you would like a login shell to be accessible over serial. If
you want to control the Raspberry Pi through a serial port terminal, select Yes. If you are
using the serial port to control other serial devices, select No.
Step 5 - A confirmation screen should appear showing the serial port has been enabled.
Step 6 - On the main raspi-config screen select finish and reboot your Raspberry Pi. The
UART serial port should now be enabled.

https://youtu.be/w_z0BUkzbIg

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy