UPDATE !! UPDATE !! UPDATE !! UPDATE !!
New fresh install instructions based on the new RASPBIAN Jessie: Raspberry PI2 + Thingspeak Server on RASPBIAN Jessie
-------------------------------------------------------------------------------------------------
Original Article
As you might read already in my previous ESP8266 Battery Monitor System post I was using Thingspeak.com, because of it's flexibility, as a logger for live data uploading.
In the latest week I was exploring deeper Thigspeak capabilities.
As you know, Thinspeak.com it's a open source project, and you have full access to the project sources on Github
What I was interested for was to check the possibility to build/configure and use a standalone Thingspeak Server that can run independently of Internet infrastructure on a small footprint, low power consumption platform.
The interesting part regarding the Thingspeak Server deployment is the chosen platform, the new RASPBERRY PI 2 Board!
I will present you below the step-by-step process to install your own RPI Thingspeak Server that can be tailored on your own needs and ofcourse, not affected by Internet connection availability and uptime if installed in the same physical location/LAN as your ESP8266 BMS or any sensor grid/array you might want to use with!
INSTALLATION PROCESS:
1. Install a Raspberry Pi Operating System image on SD card
- Download the Raspbian image from RPI website
- Write image to SDCard
I was using the Win32DiskImager utility under W7Pro for that, worked like a charm.
2. First RPI RUN with the new SDCard:
- Inset card in RPI2
- Boot
- From raspi-config:
- Set hostname: RPIMON1
- Enable SSH Server
- Write down your new RPI IP: 192.168.2.xx
- Reboot for apply new hostname & settings
3. System Update & required packages install
- Switch over to SSH remote access with Putty - accept new key
- Change "pi" account password:
- Set ROOT password, so you can then use root (just for very, very special things!)
- System Update & upgrade :
pi@RPIMON1~$sudo apt-get upgrade
pi@RPIMON1~$sudo apt-get dist-upgrade
pi@RPIMON1~$sudo sync
- Reboot:
- Required packages:
libmysqlclient-dev libxml2-dev libxslt-dev libssl-dev libsqlite3-dev
4. MySQL Database configuration
pi@RPIMON1~$mysql --user=root mysql -p useyourpasswd here
pi@RPIMON1~$mysql> CREATE USER 'thing'@'localhost' IDENTIFIED BY 'speak’;
pi@RPIMON1~$mysql> GRANT ALL PRIVILEGES ON *.* TO 'thing'@'localhost' WITH GRANT OPTION;
pi@RPIMON1~$mysql> commit;
pi@RPIMON1~$mysql> exit;
5. Ruby & Rails install
pi@RPIMON1~$wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz
pi@RPIMON1~$tar xvzf ruby-2.1.5.tar.gz
pi@RPIMON1~$cd ruby-2.1.5
pi@RPIMON1~$./configure
pi@RPIMON1~$make
pi@RPIMON1~$sudo make install
pi@RPIMON1~$cd ..
pi@RPIMON1~$echo "gem: --no-rdoc --no-ri" >> ${HOME}/.gemrc
pi@RPIMON1~$sudo gem install rails
6. THINGSPEAK SERVER INSTALL
pi@RPIMON1~$git clone https://github.com/iobridge/thingspeak.git
pi@RPIMON1~$cp thingspeak/config/database.yml.example thingspeak/config/database.yml
pi@RPIMON1~$cd thingspeak
pi@RPIMON1~$bundle install
pi@RPIMON1~$bundle exec rake db:create
pi@RPIMON1~$mysql --user=root mysql -p
pi@RPIMON1~$mysql> show databases;
pi@RPIMON1~$mysql> exit;
IF all OK continue with loading Thingspeak DB configuration
pi@RPIMON1~$bundle exec rake db:schema:load
RUN the THINGSPEAK SERVER:
pi@RPIMON1 ~/yourthingspeak $ rails server webrick
And the result in Browser:
Running Thingspeak on RPI Board |
Create new Thingspeak USER:
Thingspeak Signup page |
Create new CHANNEL
Create new channel for ESP8266 BMS data upload |
Live Data update:
ESP8266 BMS - Live data upload |
UPDATE !! UPDATE !! UPDATE !! UPDATE !!
New fresh install instructions based on the new RASPBIAN Jessie: Raspberry PI2 + Thingspeak Server on RASPBIAN Jessie
16 comments:
hello,
did you manually updated gcc?
Before anything else, on a fresh new RPI install, has been done a System update & upgrade :
pi@RPIMON1~$sudo apt-get update
pi@RPIMON1~$sudo apt-get upgrade
pi@RPIMON1~$sudo apt-get dist-upgrade
pi@RPIMON1~$sudo sync
pi@RPIMON1~$ sudo reboot
which raspbian version did you use ? wheezy or jessie ?
Sorry for noob questions but i got so far to this point :
6. THINGSPEAK SERVER INSTALL
pi@RPIMON1~$bundle install
then he stucks at
"Installing libv8 3.16.14.7 with native extensions"
what can i do especially for this thingspeak installation ? I googled but i dont know if these solutions help for this thingspeak installation proces.
Wheezy
pi@RPIMON1 /etc $ uname -a
Linux RPIMON1 3.18.11-v7+ #781 SMP PREEMPT Tue Apr 21 18:07:59 BST 2015 armv7l GNU/Linux
Be sure that you have done system update&upgrade anb installed all required packages before starting installation.
Is RUBY properly installed? Any error ?
i made these steps with 2 raspberry pi´s. one normal(first version) and one b+ ( no second edition ). On one i installed raspbian Wheezy and on the other i installed Raspbian Jessie. Then i made every step of your Tutorial without any error till that error "Installing libv8 3.16.14.7 with native extensions" .
are there any packages that are not listed on this site which i need ?
6. THINGSPEAK SERVER INSTALL
pi@RPIMON1~$git clone https://github.com/iobridge/thingspeak.git
pi@RPIMON1~$cp thingspeak/config/database.yml.example thingspeak/config/database.yml
pi@RPIMON1~$cd thingspeak
pi@RPIMON1~$bundle install<---- after this both also stucked and the following came
Gem files will remain installed in /tmp/bundler20151101-2258-siza8vlibv8-3.16.14.13/gems/libv8-3.16.14.13 for inspection.
Results logged to /tmp/bundler20151101-2258-siza8vlibv8-3.16.14.13/extensions/armv6l-linux/2.1.0-static/libv8-3.16.14.13/gem_make.out
An error occurred while installing libv8 (3.16.14.13), and Bundler cannot
continue.
Make sure that `gem install libv8 -v '3.16.14.13'` succeeds before bundling.
sudo gem install libv8 -v '3.16.14.13'
Without sudo:
gem install libv8 -v '3.16.14.13'
Fetching: libv8-3.16.14.13.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/local/lib/ruby/gems/2.1.0 directory.
With sudo:
sudo gem install libv8 -v '3.16.14.13'
Building native extensions. This could take a while...
Yes, it might be a permissions issue, how is working with sudo, it's installing OK?
Yes it is installed perfectly
Have done a follow-up, a freash new install, this time based on RASPIAN Jessie:
http://www.esp8266-projects.com/2015/11/raspberry-pi2-thingspeak-on-jessie.html
Everything works fine~!
thanks you so much!
Fot those that want to make Things speak systemd service here is the service file. Presumably you run it with pi user
/lib/systemd/system/thingspeak.service
[Unit]
Description=ThingSpeak server
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=pi
Group=pi
WorkingDirectory=/home/pi/thingspeak
ExecStart=/home/pi/thingspeak/bin/rails server webrick
Restart=always
[Install]
WantedBy=multi-user.target
Post a Comment