Raspberry Pi as SmartMesh Gateway
Gliffy Diagram is only supported by the cloud editor
Because Forge macros arent supported by the legacy editor, you'll need to convert this content to the cloud editor to display this macro properly. Find out more about converting to the cloud editor
Prepare the Raspberry Pi
We use the Raspberry Pi model B
Install Raspbian (as part of NOOBS, we use NOOBS 1.3.9)
If are connecting your SmartMesh IP Manager through the UART pins:
By default, the Raspberry Pi uses the UART pin as a command line interface for Linux. After the first boot, you need to configure Linux to not use those pins:In
/etc/inittab, replaceT0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100with
#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100In
/boot/cmdline.txt, replacedwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwaitwith
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwaitReboot the Raspberry Pi so these changes take effect
sudo shutdown -r now
Hardware Connections
You do not need to do these steps if you plan on connecting your SmartMesh IP Manager over USB.
We are connecting the serial API port of the SmartMesh IP manager to the UART on the Raspberry Pi.
Pinout of the Raspberry Pi header:
| 1 | 2 |
|
|---|---|---|---|
| 3 | 4 |
|
| 5 | 6 |
|
| 7 | 8 |
|
| 9 | 10 |
|
| 11 | 12 |
|
| 13 | 14 |
|
| 15 | 16 |
|
| 17 | 18 |
|
| 19 | 20 |
|
| 21 | 22 |
|
| 23 | 24 |
|
| 25 | 26 |
|
Connections between the Raspberry Pi and DC9003 SmartMesh IP Manager
Raspberry Pi pin | DN9903 pin name (silkscreen) |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Install DustLink
The Raspberry Pi comes with Python 2.7, so you can run any application developed using the SmartMesh SDK. Here, we will run DustLink:
Download the latest release from https://github.com/dustcloud/dustlink/releases on your computer, as a zip file.
Transfer it to your Raspbery Pi, for example using SCP.
Enter the following commands to install DustLink (you only need to do this once)
pi@raspberrypi ~ $ unzip dustlink-REL-1.0.2.63.zip pi@raspberrypi ~ $ cd dustlink-REL-1.0.2.63/ pi@raspberrypi ~/dustlink-REL-1.0.2.63 $ sudo apt-get install python-setuptools pi@raspberrypi ~/dustlink-REL-1.0.2.63 $ sudo easy_install pip pi@raspberrypi ~/dustlink-REL-1.0.2.63 $ sudo pip install -r requirements.txtStart DustLink
pi@raspberrypi ~/dustlink-REL-1.0.2.63 $ cd bin/dustLinkFullWeb/ pi@raspberrypi ~/dustlink-REL-1.0.2.63/bin/dustLinkFullWeb $ sudo python dustLinkFullWeb.pyIn your browser, open
http://<your_raspberry_pi_ip_address>:8080/
Configure DustLink
Log into the web interface using:
username:
adminpassword:
admin
Navigate to
ManagersUnder the
Addsection, enter/dev/ttyAMA0and press Enter. After 10s, this connection is activeRefer to the DustLink documentation for information on using DustLink.
Start DustLink on boot
Install
screen:sudo apt-get install screenCreate file
/home/pi/startDustLink.shwith the following content:#!/bin/bash cd /home/pi/dustlink-REL-1.0.2.63/bin/dustLinkFullWeb python dustLinkFullWeb.pyChange ownership and permission for that file and the DustLink folder:
sudo chown pi:pi /home/pi/startDustLink.sh sudo chmod 744 /home/pi/startDustLink.sh sudo chown -R pi:pi /home/pi/dustlink-REL-1.0.2.63/Have
cronstart DustLink on reboot:crontab -ethen, add the following line:
@reboot screen -dmS DustLink bash -c "/home/pi/startDustLink.sh"Reboot the Raspberry Pi
sudo shutdown -r now
Note Well
Raspberry Pi is a trademark of the Raspberry Pi Foundation. See http://www.raspberrypi.org/ for details.