Digital Larry
Posts: 73
Joined: Tue Jul 24, 2012 9:10 pm
Location: Silicon Valley, CA

Connecting Wordpress to GPIO

Sat Jan 12, 2013 8:05 pm

Sometimes it's amazing what you can accomplish without really knowing what you're doing. And other times it's amazing how an old dog such as myself actually can learn a new trick or two.

So, long story short, I started with Raspbian "Pisces" image and installed lighttpd, MySQL, and PHP. Got the basic "Hello world", or... sorry "It works!" and then some basic php functions told me it was working OK. I installed Wordpress this morning and after just a couple false starts it actually works! That's kind of amazing.

Now, I want to integrate the Adafruit project to connect to a DHT series temperature and humidity sensor with Wordpress.

http://learn.adafruit.com/dht-humidity- ... g/overview

As written, this integrates with Google Docs and OK that's pretty cool. But I want to give this to my brother who's way less geeky than I am and allow him to use this thing in conjunction with his indoor exotic flower growing thing so that he can make observations in the Wordpress posts and automatically insert the temperature, or eventually a photo of the plant taken with a USB camera.

I think the sensor interface code is written in C. How do I get that info out of there and into Wordpress?

Without knowing any better, I can think of:

1) Have the C code write some OS environment variables which Wordpress can pick up somehow (PHP?).

2) Have the C code interface with MySQL and then WordPress can call PHP to get the stuff out of MySQL.

Any brilliant ideas or caveats?

Thanks!

DL

Chapindad
Posts: 23
Joined: Wed Dec 26, 2012 1:21 am

Re: Connecting Wordpress to GPIO

Sun Jan 13, 2013 10:46 pm

I have done wordpress and built templates but that was a few years ago in a different life. I would look for a Wordpress plugin that will allow you to pull MYSQL fields into a post and then write the C code to insert the data into the fields.

User avatar
KiltedPi
Posts: 29
Joined: Sun Nov 04, 2012 9:06 pm

Re: Connecting Wordpress to GPIO

Thu Jan 17, 2013 10:18 pm

When you say:
1) Have the C code write some OS environment variables which Wordpress can pick up somehow (PHP?)
I would do it that way since its more secure.

I'd write BASH scripts that would write to an SQL database from my Pi-side. Dunno how to do the web dev tho.

technion
Posts: 238
Joined: Sun Dec 02, 2012 9:49 am

Re: Connecting Wordpress to GPIO

Fri Jan 18, 2013 5:20 am

KiltedPi wrote: I would do it that way since its more secure.
.
Just to spell out why that's important...

GPIO access, such as accessing temperature monitors, must be done as the root user due to access to /dev/mem.

Your webserver definitely should not be running as root user.

Return to “Networking and servers”