You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
217 lines
6.3 KiB
217 lines
6.3 KiB
= Sensor node/mote Connect2Server
|
|
Apostolos rootApostolos@swarmlab.io
|
|
// Metadata:
|
|
:description: IoT Διαδίκτυο των Αντικειμένων
|
|
:keywords: iot, imu, AHRS
|
|
:data-uri:
|
|
:toc: right
|
|
:toc-title: Πίνακας περιεχομένων
|
|
:toclevels: 4
|
|
:source-highlighter: highlight
|
|
:icons: font
|
|
:sectnums:
|
|
|
|
include::header.adoc[]
|
|
|
|
|
|
{empty} +
|
|
|
|
== Create a mote with Raspberry Pi
|
|
|
|
The Raspberry Pi is a low-cost credit-card sized single-board computer. The Raspberry Pi was created in the UK by the Raspberry Pi Foundation. The Raspberry Pi Foundation's goal is to "advance the education of adults and children, particularly in the field of computers, computer science and related subjects."
|
|
|
|
https://simple.wikipedia.org/wiki/Raspberry_Pi[Wikipedia]
|
|
|
|
|
|
.Raspberry Pi 2 Model B
|
|
image:./Raspberry_Pi_2_Model_B_v1.1_top_new.jpg[alt="Raspberry Pi 2 Model B"]
|
|
|
|
[NOTE]
|
|
.Remember
|
|
====
|
|
A mote is a node but a node is not always a mote!
|
|
|
|
image:./arduino-connect-pi.jpg[alt="Raspberry Pi and Arduino"]
|
|
|
|
====
|
|
|
|
|
|
=== Install Raspberry Pi
|
|
|
|
==== Step 1: Download Raspbian
|
|
|
|
https://www.raspberrypi.org/downloads/raspbian/[Download] the Raspbian disc image - Choose Raspbian Lite
|
|
|
|
[NOTE]
|
|
.Why Raspbian Lite?
|
|
====
|
|
Because it is a lightweight version of the Raspbian and it doesn’t have a graphical user interface installed.
|
|
|
|
This means that it doesn’t have any unnecessary software installed that we don’t need for our projects, so this makes it the perfect solution for future automation projects.
|
|
====
|
|
|
|
==== Step 2: Unzip the file
|
|
|
|
|
|
- Windows users, you’ll want 7-Zip.
|
|
- Linux users will use the appropriately named Unzip.
|
|
|
|
|
|
==== Step 3: Write the disc image to your microSD card
|
|
|
|
Next, pop your microSD card into your computer and write the disc image to it. You’ll need a specific program to do this:
|
|
|
|
- Windows users, your answer is https://sourceforge.net/projects/win32diskimager/[Win32 Disk Imager].
|
|
- Linux people, https://www.balena.io/etcher/[Etcher – which also works on Windows – is what the Raspberry Pi Foundation recommends.]
|
|
|
|
The process of actually writing the image will be slightly different across these programs, but it’s pretty self-explanatory no matter what you’re using.
|
|
|
|
- Each of these programs will have you select the destination (make sure you’ve picked your microSD card!) and the disc image (the unzipped Raspbian file).
|
|
- Choose, double-check, and then hit the button to write.
|
|
|
|
|
|
==== Step 4: Enabling SSH
|
|
|
|
- Windows users
|
|
|
|
.Create ssh file (no extension)
|
|
image:./ssh-file-to-sd-card.jpg[alt="Create ssh file"]
|
|
|
|
- Linux Users
|
|
|
|
.sketch Create ssh file
|
|
[source,bash]
|
|
----
|
|
sudo fdisk -l
|
|
# find dev and Boot partition
|
|
sudo mkdir /mnt/sdcardP1
|
|
sudo mount /dev/device_partion_boot /mnt/sdcardP1 -rw
|
|
cd /mnt/sdcardP1
|
|
sudo touch ssh
|
|
----
|
|
|
|
==== Step 5: Put the microSD card in your Pi and boot up
|
|
|
|
Your default credentials are username **pi** and password **raspberry**
|
|
|
|
|
|
==== Step 6: Access via SSH
|
|
|
|
|
|
- The boot protocol for the ethernet interface is set to DHCP by default
|
|
|
|
You can find the open SSH ports on your network using the nmap utility:
|
|
|
|
|
|
.find ports on Network
|
|
[source,bash]
|
|
----
|
|
nmap -p 22 --open -sV 192.168.1.0/24
|
|
----
|
|
|
|
You should find your pi listed in the output along with the IP assigned to the pi.
|
|
|
|
|
|
- You can change the boot protocol to static and define a static IP address for the pi by editing the ifcfg-eth0 file:
|
|
|
|
.static IP address
|
|
[source,bash]
|
|
----
|
|
sudo fdisk -l
|
|
# find dev and Boot partition
|
|
sudo mkdir /mnt/sdcardP1
|
|
sudo mount /dev/device_partion_ext /mnt/sdcardP1 -rw
|
|
cd /mnt/sdcardP1
|
|
vi /etc/sysconfig/network-scripts/ifcfg-eth0
|
|
----
|
|
|
|
Then edit the file to suit your needs
|
|
|
|
.static IP address
|
|
[source,bash]
|
|
----
|
|
DEVICE=eth0
|
|
BOOTPROTO=static
|
|
ONBOOT=yes
|
|
NETWORK=192.168.1.0
|
|
NETMASK=255.255.255.0
|
|
IPADDR=192.168.1.200
|
|
GATEWAY=192.168.1.1
|
|
----
|
|
|
|
|
|
==== Step 7: Configure your Raspberry Pi.
|
|
|
|
**raspi-config** is the Raspberry Pi configuration tool
|
|
|
|
|
|
.config Pi
|
|
[source,bash]
|
|
----
|
|
sudo raspi-config
|
|
----
|
|
|
|
It has the following options available:
|
|
|
|
.config options
|
|
[source,bash]
|
|
----
|
|
|
|
┌───────────────────┤ Raspberry Pi Software Configuration Tool (raspi-config) ├────────────────────┐
|
|
│ │
|
|
│ 1 Change User Password Change password for the current user │
|
|
│ 2 Network Options Configure network settings │
|
|
│ 3 Boot Options Configure options for start-up │
|
|
│ 4 Localisation Options Set up language and regional settings to match your location │
|
|
│ 5 Interfacing Options Configure connections to peripherals │
|
|
│ 6 Overclock Configure overclocking for your Pi │
|
|
│ 7 Advanced Options Configure advanced settings │
|
|
│ 8 Update Update this tool to the latest version │
|
|
│ 9 About raspi-config Information about this configuration tool │
|
|
│ │
|
|
│ │
|
|
│ │
|
|
│ <Select> <Finish> │
|
|
│ │
|
|
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
----
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[appendix]
|
|
== Config
|
|
|
|
- https://www.raspberrypi.org/documentation/configuration/raspi-config.md
|
|
|
|
|
|
|
|
|
|
|
|
:hardbreaks:
|
|
|
|
{empty} +
|
|
{empty} +
|
|
{empty}
|
|
|
|
:!hardbreaks:
|
|
|
|
'''
|
|
|
|
.Reminder
|
|
[NOTE]
|
|
====
|
|
:hardbreaks:
|
|
Caminante, no hay camino,
|
|
se hace camino al andar.
|
|
|
|
Wanderer, there is no path,
|
|
the path is made by walking.
|
|
|
|
*Antonio Machado* Campos de Castilla
|
|
====
|
|
|