Cooking Hacks Forum
https://www.cooking-hacks.com/forum/

Raspberry Pi Connection Bridge intallation from scratch
https://www.cooking-hacks.com/forum/viewtopic.php?f=19&t=8912
Page 1 of 1

Author:  libelium-dev [ Thu Jun 16, 2016 11:59 am ]
Post subject:  Raspberry Pi Connection Bridge intallation from scratch

--------------------------------------------------------------------------------------------------------
Materials:
--------------------------------------------------------------------------------------------------------
    PC with windows
    Raspberry Pi 1/2/3 + SD 8G card
    Connection Bridge
    LoRaWAN module (as example)
    Ethernet patch cord
    Power supply for RPi
--------------------------------------------------------------------------------------------------------
Programs:
--------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------
Step 1: Format your SD card.
--------------------------------------------------------------------------------------------------------
Download and install SDFormatter (1) for Win. Format your SD card with this options
Code:
FORMAT TYPE: FULL(if your SD is without format)
FORMAT TYPE: QUICK(if your SD has been foremated previously)
FORMAT SIZE ADJUSTMENT: OFF


--------------------------------------------------------------------------------------------------------
Step 2: Download the latest Raspbian distribution
--------------------------------------------------------------------------------------------------------
Download from: https://downloads.raspberrypi.org/raspbian_latest
uncompress the downloaded image

--------------------------------------------------------------------------------------------------------
Step 3: Burn the image into the SD
--------------------------------------------------------------------------------------------------------
Download and install Win32DiskImager (2). Run the program and write the image.
Code:
Image File: image previously downloaded in step 2
Device: select the SD unit (WARNING select the correct unit)

Write the image.

-------------------INSTALLATION WITHOUT KEYBOARD AND WITHOUT SCREEN-------------------
This procedure is to install from another PC, without keyboard and screen attached to your Raspberry.

--------------------------------------------------------------------------------------------------------
Step 4: first initialization
--------------------------------------------------------------------------------------------------------
Make a first initialization in the RPI to allow SD system expansion. Wait about 1 to 2 minutes.

--------------------------------------------------------------------------------------------------------
Step 5: Configure a fixed IP for your RPI.
--------------------------------------------------------------------------------------------------------
Insert again your expanded SD in the PC and edit the file cmdline.txt in the unit boot with your prefered editor.
Code:
sudo nano /boot/cmdline.txt


Disable shell and kernel messages on the serial connection and add your RPi IP address.
This is the original file:
Code:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

And you must change to this one:
Code:
dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait ip=192.168.1.160:::255.255.255.0

As an example, we have set the ip=192.168.1.160 and netmask=255.255.255.0
The expected format is: ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>

IMPORTANT: do not forget disable shell kernel messages over UART deleting all references to serial and tty in this line.

--------------------------------------------------------------------------------------------------------
Setep 6: Connect to Raspberry
--------------------------------------------------------------------------------------------------------
Connect your PC to your RPI through Ethernet patch cord, and open a SSH communication using PuTTY(for windows users) or ssh in line command for Linux users.
For Windows users in PuTTY:
Code:
Host Name (or IP address): 192.168.1.160 (the IP assigned to your raspberry in preview step)
Port: 22
Connection type: SSH


For Linux users in Linux terminal:
Code:
ssh pi@192.168.1.160

User: pi
Password: raspberry

--------------------------------------------------------------------------------------------------------
Step 7: Update your system
--------------------------------------------------------------------------------------------------------
In command line open in SSH connection, update your system to ensure the latest Raspbian updates.
Update your system:
Code:
sudo apt-get update
sudo apt-get upgrade

Actualize your distribution:
Code:
sudo apt-get dist-upgrade
sudo rpi-update


This may take a while...

--------------------------------------------------------------------------------------------------------
Step 8: Enabling interfaces
--------------------------------------------------------------------------------------------------------
Edit the config.txt file:
Code:
sudo nano /boot/config.txt


Add for RPi3:
Code:
#map mini-UART to internal bluetooth an free-up main UART to handle CookingHacks modules
dtoverlay=pi3-miniuart-bt

#enable uart interface
enable_uart=1

#enable spi interface
dtparam=spi=on

#enable i2c interface
dtparam=i2c_arm=on

Add for RPi2:
Code:
#enable uart interface
enable_uart=1

#enable spi interface
dtparam=spi=on

#enable i2c interface
dtparam=i2c_arm=on

Reboot your RPi
Code:
sudo reboot


--------------------------------------------------------------------------------------------------------
Step 9: Installing libraries
--------------------------------------------------------------------------------------------------------
Connect again as indicate in step 6.
Install arduPi library
For RPi1:
Code:
wget http://www.cooking-hacks.com/media/cooking/images/documentation/raspberry_arduino_shield/raspberrypi.zip && unzip raspberrypi.zip && cd cooking/arduPi && chmod +x install_arduPi && ./install_arduPi && rm install_arduPi && cd ../..

For RPi2 and RPi3
Code:
wget http://www.cooking-hacks.com/media/cooking/images/documentation/raspberry_arduino_shield/raspberrypi2.zip && unzip raspberrypi2.zip && cd cooking/arduPi && chmod +x install_arduPi && ./install_arduPi && rm install_arduPi && cd ../..

--------------------------------------------------------------------------------------------------------
Step 10: Install your module library
--------------------------------------------------------------------------------------------------------
This depends of your module, take a view to our tutorials.
In this procedure, we will install the LoRaWAN library as example:
Code:
wget http://www.cooking-hacks.com/media/cooking/images/documentation/tutorial_kit_lorawan/arduPi_api_LoRaWAN_v1_2.zip && unzip -u arduPi_api_LoRaWAN_v1_2.zip && cd cooking/examples/LoRaWAN && chmod +x cook.sh && cd ../../.. 

--------------------------------------------------------------------------------------------------------
Step 11: Run your example
--------------------------------------------------------------------------------------------------------
compile your example:
Code:
cd cooking/examples/LoRaWAN/
./cook.sh example.cpp

run your example:
Code:
sudo ./example.cpp_exe


Regards

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/