Skip to main content
WordPress Support

WPTavern: Blog in a Box Project Integrates WordPress with Raspberry Pi

By 03/04/2017October 24th, 2017No Comments

WPTavern: Blog in a Box Project Integrates WordPress with Raspberry Pi

The original Raspberry Pi was released five years ago and the micro computer product line is still going strong. The Raspberry Pi Foundation sold its ten millionth Pi last year and just released the Pi Zero W in February 2017 with built-in WiFi and Bluetooth.

If you are among the millions of Raspberry Pi owners who like to tinker with software, check out Automattic’s new Blog in a Box project. It currently offers the easiest way of installing WordPress onto a Raspberry Pi.

Although RaspberryPi.org has documentation for how to run WordPress as a local website on your Raspberry Pi, its recommended method requires you to install and configure Apache, PHP, and MySQL to create a LAMP web server.

Blog in a Box makes it simpler with a GUI installer that puts everything you need for installing WordPress onto an SD card. It comes bundled with PHP7, Nginx, and the latest version of WordPress. It automatically installs the Blog In A Box WordPress plugin, which provides an interface for the Blog In A Box CLI tool and widgets for SenseHAT readings. It also includes a full Node development environment. The project’s creators call it “a complete system for interfacing Pi hardware with WordPress.”

Blog in a Box enables users to publish data captured by the Raspberry Pi camera and SenseHAT, like photos or temperature readings, to a WordPress site that can be accessed on your local network at bloginabox.local. It is not yet capable of publishing to the web, but John Godley, an Automattic developer who worked on the project, said the team is open to adding this.

“Part of the fun of a Pi is having this device in front of you that you can play and experiment with, and we wanted to have WordPress running right there inside the Pi too – it really is a blog in a box!” Godley said.

“We hope that having it local will encourage people to tinker with WordPress and use it to learn programming, or to run experiments in classrooms.”

There are currently no live examples of blogs on the web that are receiving posts from a Raspberry Pi. However, fellow Automattic developer and Pi enthusiast Nick Momrik has created a device called Blog in a Box Paparazzi that extends the project with additional sensors to take a photo when anyone walks past it. His circuit diagram and a full list of sensors and other electronic components are available on GitHub. It’s one example of how Blog in a Box can be used as a base for other fun use cases.

image credit: Nick Momrik – Blog in a Box Paparazzi GitHub repo

Although the project doesn’t come packaged with functionality that would allow it to work as a livecam, Godley said it’s certainly a possibility.

“We created a system to make it easy to interface the Pi hardware with WordPress – there’s a plugin and a set of server tools that are all extensible,” Godley said. “With a bit of work a livecam system could be added. If you add the sensor mentioned above you could livestream your cat whenever it’s nearby. Add some different sensors and you can see what affects a plant’s growth in a biology experiment and have the data ready to be viewed through WordPress, add a touchscreen and you have an interactive WordPress-powered display.”

Since the system uses the REST API internally, Godley it wouldn’t be difficult to configure it to send data to a remote WordPress site. The team has looked at the possibility of doing this and may revisit it in the future if there’s enough interest.

“Making it really easy to set up was a primary aim – we didn’t want people to have to setup MySQL and web servers and all the complexities involved in connecting this to Pi sensors. Just a few clicks and a fully working system is copied to an SD card,” Godley said. “Once you boot your Pi it appears on your local network and can be used immediately.”

The site runs on the local network but the box ensures that WordPress and its plugins stay updated. The ability to run the box without an internet connection is one of the main advantages of Blog in a Box.

“The fact you can run it without an internet connection means it can be used in situations where a remote WordPress may not be appropriate — in your home, in schools, etc,” Godley said. “If someone sends WordPress into space on a rocket, then we’d love to hear about it!”

The project is an exciting example of how WordPress can be deeply integrated with various hardware components to automatically capture and publish environmental data in a way that’s easy to view. Godley and his team at Automattic hope that Blog in a Box will put WordPress into the hands of more like-minded tinkerers. The entire project, including the installer, the companion WordPress theme, and the plugin, are all open source.

“As well as people connecting the real world to their Pi, we hope that just having a full web development environment ready to go will encourage people to tinker with WordPress and try out programming or theming,” Godley said.



Source: WordPress

Leave a Reply