Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Installation on Raspberry Pi
Installation of Acuparse on Raspberry Pi
What is a Raspberry Pi
Raspberry Pi's are a small single board microcomputer, that are fairly inexpensive (most kits are under 40USD) and are powerful enough to run Acuparse sufficiently. The OS used in this document will be Raspbian Stretch Lite (a version of Debian Linux). Standard Raspbian Stretch can also be used, if you are wanting a full X-Windows based environment, but this will also add memory and processing overhead that can impact the overall performance.
The two current versions of Raspberry Pi that are available are the Raspberry Pi Zero W (RPi0W) and the Raspberry Pi 3 (RPi3). While the RPi0W will work, its not recommended for performance reasons and limited ports (a single MicroUSB port and built in WiFi). The RPi3 performs very well, and also provides 4 standard USB 2.0 ports and a built in 10/100 Mbps ethernet port and WiFi.
Overview of the set up
- Raspberry Pi 3
- MicroUSB power supply (2.1A or higher, a powered USB hub can also work)
- Case (Optional but recommended)
- MicroSD card (16GB or 32GB, Class 10 recommended)
- MicroSD to SD card adapter
- USB Ethernet adapter (optional if you want a wired connection to your router instead of WiFi)
Note: MicroSD cards are not created equal. Choose a fast performing card to use with Acuparse. It does a large amount of reading and writing! See microSD Card Benchmarks for assistance selecting the right MicroSD card.
In addition to the above parts, you will need an Acurite SmartHub or Acurite Access, and a computer with a SD card reader (either built in or a USB adapter. This is for the initial set up of the MicroSD card).
NOTE: RPi3 kits can be purchased from sites such as Amazon that include the Pi, power supply, case, and even MicroSD card. Here are some example Amazon links for the items above:
- Raspberry Pi 3 Kit - Includes Pi, Power Supply, and Case
- 32 GB MicroSD with SD adapter
- USB Ehternet Adapter - This is optional if you want a wired connection to your router instead of WiFi
If you decide to use a Pi Zero W instead of a Pi 3 (not recommended as noted above), then you will have to have a MicroUSB Ethernet Adapter like this to connect your SmartHub / Access as described in this project.
Hardware set up description
The SmartHub or Access will be connected directly to the RPi3 via an ethernet cable to the RPI3's built in ethernet port. The RPi3 will then connect to your local LAN either via the built in WiFi, or via a wired ethernet cable to your router using a USB Ethernet adapter. The RPi3 will be "headless" (i.e. no monitor, keyboard, or mouse attached) in this setup.
Install Raspbian Stretch Lite onto MicroSD
Follow this guide for setting up your MicroSD card: Install Raspbian Stretch Lite Headless. This guide is for a Raspberry Pi Zero W, but will work fine for setting up the Raspberry Pi 3. I do recommend when doing the wpa_supplicant file, that you add a new line with scan_ssid=1 that is between the ssid= and psk= lines. If you are going to connect your Pi directly with a wired network cable (not using WiFi), then you can skip the wpa_supplicant file creation altogether. Also, if you are using a Windows computer to connect to your Pi, you will need to Download PuTTY for the terminal program to access it via SSH. For most modern PC's you will choose the 64bit MSI Windows Installer, and then double click / run the downloaded file to install PuTTY.
Pi networking setup
Now we need to do some setup of the networking on the Pi. In a terminal window connected to your Pi, do the following command:
sudo apt-get update && sudo apt-get -y install dnsmasq iptables-persistent
A couple of screens will come up during the iptables-persistent part of the install. Choose "No" (use the tab key to select the NO option) on each of these and hit enter to confirm.
At this point, make sure your SmartHub / Access is powered on and connected to your Pi via a network cable to the built in ethernet port. Also, if you are going to use a wired connection for your LAN, make sure the ethernet adapter is connected to your Pi and a network cable is connected and attached to your local network.
Now, we need to determine the network adapter names. Run the following command on your Pi:
Look at the left most column for the names of your adapters. Wired network adapters will have names similar to eth0 and eth1. WiFi will have a name similar to wlan0. (NOTE: Depending on initial configuration, sometimes the names will be longer and include the MAC address for the device). In our set up, eth0 will be the built in network port on our Pi and where we will plug in the SmartHub or Access. If you are using WiFi to connect to your LAN, then wlan0 will be for your LAN connection. If you are using an ethernet adapter, then that should be like eth1 for your LAN connection.
Now issue the following commands:
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
sudo nano /etc/dnsmasq.conf
This will put you into a new file you are creating. Now copy and paste the following:
server=18.104.22.168 # Use Google DNS
interface=eth0 # Use interface eth0
dhcp-range=eth0,192.168.6.50,192.168.6.100,255.255.255.0,24h # IP range and lease time
If you using wired LAN, then change the 4th line to:
Hit Ctrl-X to exit and choose Y and hit enter on the file name that comes up.
Now do the following:
sudo nano /etc/dhcpcd.conf
Go to the bottom of the file and add the following lines. You will want to make sure that the first two static lines, match your LAN address for your router. If your router is not 192.168.1.1 you will need to change both of those lines so that the address of your Pi and your Router address are in the same subnet (usually 192.168.0.x or 192.168.1.x for most routers). Also, if you are using wired network adapter then change the line with wlan0 to eth1. Don't change the static IP under the eth0 line (this is setting up a new network for the Acurite Hub device). Then Ctrl-X to save your changes.
# Home LAN
interface wlan0 # Change to eth1 if using wired adapter
static ip_address=192.168.1.70 # Set the Pi IP address
static routers=192.168.1.1 # Your router's IP
# SmartHub / Access network
Now we need to edit the hosts file:
sudo nano /etc/hosts
At the bottom of the hosts file add the line for whichever Acurite device you are using:
192.168.1.70 hubapi.myacurite.com # If you are using a SmartHub
192.168.1.70 atlasapi.myacurite.com # If you are using an Access
NOTE that the IP needs to match what you set for the Pi IP address in the dhcpcd.conf file previously.
Now run the following commands (if you are using a wired connection for your LAN, change wlan0 to eth1 in the 4th and 6th command:
sudo iptables -F
sudo iptables -X
sudo iptables -t nat -F
sudo iptables -A FORWARD -o wlan0 -i eth0 -s 192.168.0.0/24 -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sudo netfilter-persistent save
At this point the editing and network configuration is all complete. To make sure there are no issues, do the following commands:
sudo systemctl restart networking.service
sudo systemctl restart dnsmasq
If there are no errors, reboot your Pi as follows:
sudo reboot now
Wait a minute or two for the Pi to reboot. Now when you ssh to it, you will be connecting to the static IP you set up for it (in the above edits, it would have been 192.168.1.70 unless you changed this).
Run the following commands:
sudo sh install.sh
You will be prompted through the install for passwords and such. As long as there are no errors, after the install completes you will need to open a browser to point to your Pi's address (example: http://192.168.1.70). Then follow the prompts to complete the setup of your Acuparse environment.