2018年3月22日 星期四

Building a Phidget Network Server on Raspberry Pi

1.Download Required Files:

  • Download Raspbian Stretch Lite, the minimum system required to run the Phidgets network server. Download here.
  • Download Etcher to make a bootable SD card. Download here.

2.Making Bootable SD Card

Run Etcher and burn Raspbian Stretch Lite to SD card(4GB or above).

3.Bootup Raspberry Pi

Inserted the sd card into Pi and power it on.
Login to Pi with default id "pi" and password "raspberry". At this stage you need a screen and keyboard attached to Pi so that you can do the initial setups.

4.Initial setups:

sudo raspi-config
You will see configuration screen and we will do the some initial setups from here.
  • Enable SSH: 5 Interfacing Options>P2 SSH>Yes then Ok back to main menu.
  • Change password:  1 Change password> enter new password twice then Ok back to main menu.
  • Enable Wifi: 2 Network Options>N2 Wi-fi>Enter the SSID of you wifi network>Enter the password then OK back to main menu>push tab button to select Finish back to command line and run the following command to reboot.
sudo reboot

5.System Update/Upgrade


  • After the system is rebooted, it should be able to connected to the wifi system. Login the system with pi id and the new password, then run the following command to update the system.

sudo apt-get update
sudo apt-get upgrade

  • Find the ip address of pi run the following command:

hostname -I (capital i)
Pencil down the ip address and we will login Pi by SSH from remote PC/Mac. From now on the attached keyboard and screen will no longer be needed. :)

6.SSH into Pi

You can access Pi through SSH by Putty(Windows) or Terminal(Mac).
Take Mac for example: Open Terminal window and type the following command
ssh pi@192.168.1.132 (This is the ip address of my Pi, replace it with the one you got from hostname -I command)
Type yes to ssh into Pi for the first time logging with SSH,  then enter the password of Pi to get access to Pi.
 

7. Phidget Drivers

Install required Phidgets 22 drivers.
After the drivers are successfully installed, reboot Pi.

8. Auto-start the Phidgets Network Server

We would like to autostart the server every time it is booted. Editing the rc.local file is one way of doing it.
sudo nano /etc/rc.local
Then add the following command before exit0.
sudo phidget22networkserver -D

Then save the change by control+X > Y > press enter

9. Fixed IP address

Since the ip address of Pi was assigned by dhcp of your wifi router,  it could change when your router is rebooted. It is recommended that we make the ip address static by doing the following:
sudo nano /etc/dhcpcd.conf
Copy the following to the end of the file. (replace the ip address with yours)
interface wlan0
static ip_address=192.168.1.132
static routers=192.168.1.1
static domain_name_servers=8.8.8.8 8.8.4.4
Then save the change by control+X > Y > press enter. Then run sudo reboot to reboot Pi. We are almost done.

10. The Test

How do I know the Phidget network server is working?
  • Connect Phidget 1048 to Raspberry Pi. Boot up Pi.
  • Download and install Phidgets control panel on PC/Mac. Download here.


Run Phidget Control Panel and you will see that the Phidget 1048 thermometer connected if everything is doing OK.

沒有留言:

張貼留言