Install Snap7 in a cheap NAS for building a datalogger
(or whatever you want)
Sometime could be useful to gather “long-time” unattended data from a
plant without involve a PC.
There are many systems affordable for this task, but we need compactness,
reliability and the option to access to this data from remote.
And, last but not least, cheapness..
As always, you don't need to be a Linux guru, just follow the
instructions.
Recipe ingredients:
·
Hardkernel ODROID HC1 or HC2
·
An Hard Disk (2.5” or 3.5”, depending on the HCx
model)
·
A fast uSD card (16Gb is good enough)
·
Openmediavault 4 XU4/HC1/HC2 image from here , (download OMV_4_Odroid_XU4_HC1_HC2.img.xz)
·
Snap7-iot-arm 1.4.2
·
Your favorite development tool to build your application.
I suggest OVM (Openmediavault) because it’s
an open source full-featured NAS system running on standard Armbian,
which already contains g++, make and so on, but you are free to use Ubuntu from
here.
(But remember that, as every NAS, the system is headless, i.e. there is
no video output, so a desktop OS is meaningless).
Just some info about HC1/HC2 from Hardkernel
site:
ODROID-HC2 : Home Cloud Two
ODROID-HC2 is a mini PC which can
be an affordable solution for a network attached storage (NAS) server. This
home cloud-server centralizes data and enables users to share and stream
multimedia files to phones, tablets and other devices on a network. Ideal for a
single user on many devices, sharing between family members, developers or a
group. Tailor the ODROID-HC2 to your specific needs. Plenty of software is
available with only simple configuration. Determine the storage capacity of
your server with a higher HDD/SSD. Depending on your needs, the frame is made
to be stackable.
The HC2 is based on the very
powerful ODROID-XU4 platform and it can run Samba, FTP, NFS, SSH, NGINX,
Apache, SQL, Docker, WordPress
and other server software smoothly with full Linux distributions like Ubuntu, Debian, Arch and OMV. Available and ready-to-go OS
distributions are on our WiKi. Any OS for XU4 is
fully compatible with the HC2.
Installed with a high performance
SATA port and a Gigabit Ethernet port, to build a faster network storage
device. Engineered metal frame body is designed to store a 2.5 inch HDD/SSD or 3.5inch
HDD with great heat dissipation.
Key features
* Samsung Exynos5422 Cortex-A15
2Ghz and Cortex-A7 Octa core CPUs
* 2Gbyte LPDDR3 RAM PoP stacked
* SATA-3 port for 3.5inch or
2.5inch HDD/SSD storage up to 27mm
thickness
* Gigabit Ethernet port
* USB 2.0 Host
* UHS-1 capable micro-SD card slot
for boot media
* Size : 197 x 115 x 42 mm approx.(Aluminium cooling frame size)
* Linux server OS images based on
modern Kernel 4.14 LTS
HC1 |
HC2 |
|
|
|
|
Let’s start.
Setup the NAS with Openmediavault
Follow this excellent tutorial, it contains everything you need,
no more no less. At the end you will have a perfect working NAS.
Skip the chapter “Disable SSH for root”, at beginning it
will be useful to have root rights or, alternatively, you should add “sudo” before every command that you will find into the next
section.
Download and build Snap7
At this point you should have an SSH channel ready, login to HCx with your favorite SSH Client (e.g. Putty).
1.
Go to home
root@odroidxu4:~#
cd /home
2.
Download Snap7
root@odroidxu4:/home#
wget https://sourceforge.net/projects/snap7/files/Snap7-IoT/snap7-iot-arm/snap7-iot-arm-1.4.2.tar.gz
3.
Unpack it
root@odroidxu4:/home#
tar xzf
snap7-iot-arm-1.4.2.tar.gz
4.
Go to the build folder
root@odroidxu4:/home#
cd snap7-iot-arm-1.4.2/build/unix
5.
Build Snap7
root@odroidxu4:/home/snap7-iot-arm-1.4.2/build/unix# make -f arm_v7_linux.mk
install
That’s all.
Now you are ready to write your application which could save its data
in a folder shared by the NAS, so you can retrieve them from remote.