Web interface for the PowerSwitch project

The PowerSwitch project is a software implementation of a USB stack running on a Atmel ATtiny2313. It provides the schematics for the hardware, the firmware and a command line software to control the outputs.

We’ll use the command line software to control the PowerSwitch from the web. A dedicated machine will have the PowerSwitch plugged into a USB port. This machine needs the Apache server installed.

Download the file sajax-0.12.tgz.

Copy the file Sajax.php into the web site directory: on Ubuntu, it’s /var/www/html.

Copy also this file in the same place: control.php.

Rename it index.php or make a symbolic link to it.

In /etc/sudoers.d, make a file named powerSwitch (or other name) by using visudo:

$ cd /etc/sudoers.d

$ sudo visudo -f powerSwitch

Add this line into the file:

www-data ALL = (ALL) NOPASSWD: /usr/local/bin/powerSwitch

Note: after a reset, all outputs are set to 1, so be sure your electronics and device are in the proper state when this happens.

I’m not an expert on internet and web security, so use common sense and check for any security problem for other use than experimentation.

 

Advertisements
This entry was posted in Electronics, Software and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s