Cat Pulling Wires

Cats Love the Internet Of Things

Cat Pulling Wires on Internet of Things

Cat Pulling Wires on Internet of Things

Our cat loves the internet of things. In general Luna loves stealing little bits of things. She stole the cable installers coax cable connectors and the HVAC repair persons wire connectors. Now she is into the internet of things. These things meet her specifications they are small, easy to carry in one’s mouth and bonus there are wires to pull out.

Very small cheap computers are proliferating and are allowing companies and people to put sensors into almost anything. These things can collect many types of data and transmit it to be processed and analyzed. Artists are even using them to create new art forms. One artist; Lesia Trubat, put sensors into ballet slippers to create visual abstractions of dance steps.

https://vimeo.com/108109673

Recently Structure sent me a free Internet of Things (IoT) kit to use with their IoT Developer Platform that has an Arduino based chip at the core. It came with the Adafruit Feather Huzzah, which is a cool little thing that supports Arduino code and has WiFi built in, jumper wires, breadboard, temperature sensor, led, resistors and a micro USB cable.

Internet of Things Board

The instructions have step by step instructions on how to register the “thing” Huzzah with the Structure development platform, how to attach the components and the code to load onto the chip.

When finished I had a thing that would broadcast its temperature, accept a command to turn on the LED and send a message when someone presses the button.

 

A major feature I can appreciate is the built in encryption. When you register your thing in the Structure IoT Platform it is assigned a unique id. Then you must create an access key and a secret token. This is used to encrypt any data communicated between the thing and the Structure IoT Platform. When the thing starts with the proper interface code it will connect to Structure with its unique information. This is how your application workflow can send commands to the device thru any firewalls. Other platforms I have used do not have this level of security built in and require payment to secure the data.

The Structure IoT Platform allows one to set up events that define what the device will trigger. It also allows you to define what types of data the device will send.

Simple Work Flow

Workflow

This workflow watches to see if the temperature goes above 80 degrees fahrenheit and sends a text message if it does. The platform supports a full featured drag and drop programming interface. It is a little difficult for a programmer like me to rethink coding in a drag and drop interface but it does allow for non programmers to control and gather information from their things. A plus is that it supports geospatial features like Geofence to trigger events based on the location of your things.

Dashboard for Internet of Things

The platform also has a dashboard feature with the ability to build charts and graphs of the data coming from your things. With the workflow you can also build data aggregators that will sum up your data over time or combine data from multiple devices and store it for display in the dashboard.

My Temperature Dashboard

The dashboard and workflow are protected by individual user logins. But I wanted to expose my data to the internet so that you could see it here on this blog post.

Exporting Data

Structure has built into the workflow easy ways to push your data out of their platform into other systems. First you need some service to send your data to, a transport. I used the HTTP node to send my data to another IoT provider called dweet.io. This is a public service that charges to have your data secured, by default it becomes public. You just send your data to the url https://dweet.io/dweet/for/name_of_your_thing?parameter=value. Mine looks like https://dweet.io/dweet/for/structureIotKitBj?tempF=76.5 Dweet.io will store the last five data points for free. Be careful with this, if you do not want your data to be public.

Send data to dweet.io

Then I found a service that will display data in a public dashboard that integrates with dweet.io called freeboard.io. Freeboard allows you to build a display dashboard like Structure but it is public. You add your data feed you named on dweet.io into a datasource on freeboard.io.

This will enable the following dashboard to be seen by the world.

But if you want to protect your data the Structure Platform may be all you need. If you need custom features there are a multitude of ways in the platform to have it send data to your own database for deeper analysis. They even have directions on how to get your data into a Google spreadsheet that utilizes IFTTT (If This Then That). If you are looking to get started with the Internet of Things or have something more ambitious to build order a Huzzah and give Structure a try.

I just need to be more careful where I leave my small things that connect to the internet. I left my temperature measuring device in the window to see what kind of drafts we get. But Luna the cat decided to pull out a black ground wire. It caused the temperature report to go up to 200 degrees but I kept getting data. My next project might be connecting up a motion detector to this and see how it works in detecting our IoT loving cat.

Cat Pulling Wires

Follow this blog for more posts on IoT, robotics, Raspberry Pi and other technical topics. Be sure and check out some of our historical posts like I Code Like a Girl, War and Geospatial Mapping and one about computer history and art.

Installing Rocket.Chat on Raspberry Pi 2

Installing Rocket.Chat on Raspberry Pi 2

The goal is to get Rocket.Chat running on a Raspberry Pi 2. And what a crazy path it took me on.

Rocket.Chat is an open source chat server that is easy to use and has lots of features that support communication and sharing of links and files. It is going to be setup as a private chat platform for Volume Integration to increase collaboration.

Rocket Chat at Volume

I decided to start at the beginning with NOOBS and Raspbian OS. My research indicated that Rocket.Chat had been installed and run on a Raspberry Pi. Rocket.Chat requires node.js, npm, Meteor, MongoDB. I started by following some directions for installing Meteor. Then ran into major issues getting node and MongoDB to install. At this point I realized that I had a Pi 2 and that many popular packages did not have binaries for it. The newest MongoDB only runs on 64 bit architectures and the Pi is ARM which is 32 bit.

Raspberry Pi Logo

After much searching and compiling of different versions of MongoDb and Node, following the installation without docker instructions, the Rocket.Chat RockOnPi Community released Rocket Chat Raspberry Pi directions. They should have a build soon for the Raspberry Pi Zero. These directions worked with Raspbian. But they call for using mongolab.com for the mongo database. I could not find a build of MongoDB that worked on the Raspberry Pi 2.

But the goal was to get it all working on a single Raspberry Pi. There is a version of Linux called Arch Linux that has MongoDB 3.2. So the first step was to install it. This was a side adventure documented in Installing Arch Linux on Raspberry Pi 2. The major issue is that as of NOOBS 1.5 there was no support to install Arch Linux on the Raspberry Pi 2 using the NOOBS installer. This required me to write the package to the SDcard and boot from there.

Mongo DB

First I installed Mongo DB because it was the hardest part on Raspbian. There was not a build that would work on the Raspberry Pi 2 and support Rocket.Chat. I found instructions for an old version that did work but it was too old for Rocket.Chat.

One item of note with MongoDB on Raspberry Pi is that ARM is inherently a 32 bit OS. This means that MongoDB will support 2 GB database sizes. Sing Li who is a contributor to the Rocket.Chat project told me on their demo chat server,

“that’s by no means limitation for Rocket.Chat ???? a 2 GB mongodb database IS VERY LARGE ! For reference … this demo server with 38,000 registered users and close to 300,000 messages has a database that is less than 2 GB in size (for message storage). Hopefully the Pi server is expected to handle a little less.”

First the dependencies as root. In Arch Linux login to root. Arch Linux has the default user of alarm. If you are connecting via ssh login as alarm from there you can su root.

pacman -S npm
pacman -S curl
pacman -S graphicsmagick
pacman -S mongodb

This caused issues with incompatible versions. So I ran:

pacman -Syu mongodb

Now we need to make a data directory for Mongo.
mkdir /data/
mkdir /data/db

If your ‘/data/db’ directory doesn’t have the permissions and ownership above, do this:

First check what user and group your mongo user has:
# grep mongo /etc/passwd
mongod:x:498:496:mongod:/var/lib/mongo:/bin/false

You should have an entry for mongod in /etc/passwd , as it’s a daemon.
chmod 0755 /data/db
chown -R 498:496 /data/db # using the user-id , group-id
ls -ld /data/db/
drwxr-xr-x 4 mongod mongod 4096 Oct 26 10:31 /data/db/

The left side ‘drwxr-xr-x’ shows the permissions for the User, Group, and Others. ‘mongod mongod’ shows who owns the directory, and which group that directory belongs to. Both are called ‘mongod’ in this case.

Now try and start mongodb to see if it works. On 32 bit architectures you must start it with the mmapv1 storage engine.
mongod --storageEngine=mmapv1

In theory you should enable mongodb so it will startup on boot.

Modify the /usr/lib/systemd/system/mongodb.service file with the storage engine settings.
systemctl enable mongodb.service

But having it run as a service caused issues when starting Rocket.Chat. Rocket Chat says that the database driver version 2.7 is incompatible. So for now I run it as a regular user with the mongod command. To have it continue running on logout install screen.

pacman -S screen screen mongod --storageEngine=mmapv1

Some of these following directions are based on https://github.com/RocketChat/Rocket.Chat.RaspberryPi

Meteor and NPM install

The easiest way to get both is to clone from the Meteor universal project.

As a user that is not root follow this:
cd ~ git clone --depth 1 https://github.com/4commerce-technologies-AG/meteor.git

then

$HOME/meteor/meteor -v

Rocket Chat Install

I received some great help and encouragement from the Raspberry Pi community on the Rocket.Chat chat site.

You do not need to be root to perform this step.

Download the Rocket.Chat binary for Raspberry Pi

cd $HOME
mkdir rocketchat
cd rocketchat
curl https://cdn-download.rocket.chat/build/rocket.chat-pi-develop.tgz -o rocket.chat.tgz
tar zxvf rocket.chat.tgz

This will download and untar the app in $HOME/rocketchat

After some trial and error I discovered that some dependencies were needed. make, gcc and python2. Root must run pacman.
pacman -S python2
pacman -S make
pacman -S gcc

Now try the install procedure but use python 2.7 and –save will show any errors that happen. I used –save to figure out that I did not have gcc (g++) installed.

cd ~/rocketchat/bundle/programs/server

~/meteor/dev_bundle/bin/npm install --python=python2.7 --save

Testing to make sure it works

export PORT=3000

export ROOT_URL=http://your url or ip address:3000 export

export MONGO_URL=mongodb://localhost:27017/rocketchat

$HOME/meteor/dev_bundle/bin/node main.js

Linger

To keep session running after logout in Arch Linux use:
loginctl enable-linger alarm

Run on Startup

Unfortunately I have been unable to get Rocket Chat to recognize MongoDB when Mongo is running as a service on Arch Linux. It says that the version of the database driver is not compatible. For now I start Mongo up as a user and place it in the background.

Next Steps

The next steps are to configure the Rocket Chat server to startup on boot and run on SSL. We want to protect those chats flowing between our employees. Follow this blog and volumeint twitter to find out about the next posts on how to install Arch Linux on Raspberry Pi 2 and how to get a free SSL certificate for your chat server.

Raspberry Pi and Installing Arch Linux

Raspberry Pi and Installing Arch Linux

Getting Arch Linux installed on a Raspberry Pi 2 was a challenge for me. Hopefully this post will help you set it up.

Arch Linux is a very robust Linux version. It only installs the base default packages to get running. Everything else must be installed as it is needed. You may find yourself needing to run the package installer often. (pacman -S) It was also nice that the network interface was setup with DHCP by default. All I had to do after install was to plug it into an ethernet cable.

In the process of a successful attempt to get Rocket.Chat and MongoDB running on the Raspberry Pi 2 from CanaKit I found that the only way I could get the correct version of MongoDB 3.2 that works with Rocket.Chat was to install Arch Linux. I outlined how I installed Rocket.Chat in another post called Installing Rocket.Chat on Raspberry Pi 2.

The major issue is that as of NOOBS 1.5 there was no support to install Arch Linux on the Raspberry Pi 2 using the NOOBS installer. NOOBS does display the option to install Arch Linux but it would then tell me that it could not find the right version of Arch Linux for Raspberry Pi 2. This required me to write the package to the SDcard and boot from there.

All the directions I could find indicated that the installation of Arch Linux boot files could be done from a computer. Unfortunately the computer had to be Linux but not Macintosh OS. I have a Mac and a Windows computer.

So I started up my handy Oracle VirtualBox running Ubuntu. But now I learn that VirtualBox and Ubuntu do not support the SD card port on the Macintosh with help from Mayur Rokade. He suggested using cell phone to connect as a USB device.

Old Smartphone as USB drive

I could not get this to work but then I found I had a usb to SD card adaptor from a Eye-Fi card.

SD Card USB Adapter

But Ubuntu still would not see the device. So a post from mayurrokade.com was helpful. I ended up having to “eject” the USB device from Finder. Then start Ubuntu in VirtualBox. Then it started appearing. Ubuntu did not see it until the Mac released it.

Now following the official directions at archlinuxarm.org I continued the setup.
Replace sdX in the following instructions with the device name for the SD card as it appears on your computer. To see what your device gets named use the command in the Ubuntu terminal.

sudo lsblk

This will display the names of the drives that are attached. On my computer it was: sdb

Start fdisk to partition the SD card:
fdisk /dev/sdX
At the fdisk prompt, delete old partitions and create a new one. This will delete all data on the SD card.
Type o. This will clear out any partitions on the drive.
Type p to list partitions. There should be no partitions left.
Type n, then p for primary, 1 for the first partition on the drive, press ENTER to accept the default first sector, then type +100M for the last sector.
Type t, then c to set the first partition to type W95 FAT32 (LBA).
Type n, then p for primary, 2 for the second partition on the drive, and then press ENTER twice to accept the default first and last sector.
Write the partition table and exit by typing w.
Create and mount the FAT filesystem. These commands will create a folder called boot and root in whatever directory you are in. I recommend using /home/<username>. One partition is for booting up and has to be a FAT partition. The Root partition which is bigger needs to be a ext4 partition.

mkfs.vfat /dev/sdX1 mkdir boot mount /dev/sdX1 boot

Create and mount the ext4 filesystem:

mkfs.ext4 /dev/sdX2 mkdir root mount /dev/sdX2 root

Download and extract the root filesystem (as root, not via sudo):

wget http://archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz

You will need to install the bsdtar package with pacman:

pacman -S bsdtar

This will expand the file and put Arch Linux in the root folder which is on the SD card.

bsdtar -xpf ArchLinuxARM-rpi-2-latest.tar.gz -C root sync

Move boot files to the first partition called boot:

mv root/boot/* boot
Unmount the two partitions:
umount boot root

Insert the SD card into the Raspberry Pi, connect ethernet, and apply 5V power.
Use the serial console or SSH to the IP address given to the board by your router.
Login as the default user alarm with the password alarm.
The default root password is root.

Follow this blog and volumeint twitter to find out about the next posts on how to get a free SSL certificate for your chat server and future post on functional programming.

What Would You Make With The Worlds First $9 Computer_

What Would You Make With The Worlds First $9 Computer?

I bought a new computer today.

A tiny $9 computer.

It is being funded using Kickstarter. In order for Next Thing Co. to get down to the $9 price point they needed to order in bulk. At the point this post is written they have over 1.7 million dollars and 33,000 backers. Unfortunately they are not projecting the first shipment until December 2016.

In the tradition of Volume Labs I want to document the experiments we build with it. It is called CHIP and has features similar to the Raspberry Pi 2 but its cost is $9 verses Pi’s $35. It has a 1 GHz processor, 512 MB RAM and 4 GB storage. It comes with WiFi and Bluetooth built in with a display port, audio, microphone and USB port.

It will run mainline Linux which means we can get some code working on it right away.

CHIP is OpenSource hardware which should allow folks to build new attachments much like the Raspberry Pi has. It has a series of pins that allow for attachment of extra features like HDMI, VGA or LCD touch screens. There is support for camera sensors which would be needed for some of our experiments.

Small form factor with many interfaces

Now since we have so much time to wait for CHIP to come we are making a list of ideas. Here are a couple of ideas we are thinking about pursuing? What would you make?

  • An artwork display system that will display art, animated gifs and videos on a large screen.
  • A twitter art bot that will create artwork based on instructions from @artassignbot. It will parse the words, perform entity resolution, search the internet for images, sounds, videos and mix them into art of the genre the Art Assign Bot commands. The art will be posted to twitter.
  • Connect a camera that is programmed to take pictures when a face is detected and display it on a large screen.
  • Monitor activity on the network it is attached to.
  • Scan the network it is attached to and catalog the results.
  • Implement a VPN with it
  • Continuous integration system that will display software build and test status on a TV
  • An installation artwork titled “Still Haven’t Found It.” that randomly follows links on the internet and displays them on an old television. As it finds video content it will play it for a random amount of time.
    Early next year I will begin writing posts about my experience with CHIP and show off what we are making.

Check out more of our work at Volume Integration and follow us on Twitter.