So it was delievered, my first Raspberry Pi, and I thought about what to do with it.
I've got a MediaCenter already, installing the xbmc distribution on the SD Card seems just too easy.
Then I saw my 20 year old "PowerManager" under my screen. It's a slim metal chassis with with a couple of AC outlets in the back and a couple of switches in the front to control them.
Looks like this
And I thought I should bring this (or the adaption of the idea) into 2k14.
The idea of an 8-channel IP Switch was born.
After doing some research what the GPIO's are able to, I decided to design a driver-board to switch some 5V relays, so I wouldn't need another power supply.
It's a prototype, so I used breadboards, everything could be on a single board sized 160x100mm if designed properly, but I like the special charm of the breadboards, and everybody should be able to copy it.
So I got following components
- 230Vac primary/5V secondary power supply, able to provide 6.000mA of current (not needed in this case, a normal 1.500mA to 2.000mA should do the job)
- the Raspberry Pi in a case, with connected USB Flash drive for providing the NAS functionality
- the driver board based on a ULN2803A darlington array with 5V Supply and 2 Connectors for the shutdown/restart switch under the ribbon cable
- the relay board
- a LED interface board with resistors and connectors for the status indicator LEDs in the Front Panel.
after the hardware worked fine, I've built it into a 19" 3HE Case.
The AC supply cable, a RJ45 feedthrough connector for the network and the 8 switched AC outlets in the back.
8 Status indicator LEDs, an USB feedthrough connector and the shutdown/restart switch in the front
And all the electronics on the inside.
It became quite full inside.
A wiring diagram is attached, if somebody wants to build it.
The relay contacts can also be used as potentialfree contacts to switch other things like garage door openers or electrical roller shutters, or, or, or...
I installed Apache2, PHP5, MySQL ans WiringPi on the box.
I coded a database based login system with different user levels (SuperUsers and NormalUsers)
SuperUsers are able to acces the Admin Control Panel to set/change the switching permissions and passwords for NormalUsers, and are able to add new users.
After logging in with the right credentials, a NormalUser is able to switch the permitted outputs.
The user shown below is for instance is only allowed to switch output 1
A logged in SuperUser gains access to the AdminCP (link on the right top)
the AdminCP displays all the users from the database with their permissions and SuperUser Bits, and provides administration links for changing the permissions and password or delete the user.
This is how it looks when a SuperUser changes the permissions of a user.
This is, how it looks, when a user is added
This is how it looks when a user gets deleted.
The AdminCP allows to change switching permissions and password changes for all users, except the user named "SuperUser" to prevent locking himself out of the AdminCP.
The switching commands are done with php shell exec of the "gpio write" command from WiringPi.
Clicking on the green icon will set it red and switch the output.
I'm planning a user-interface for cronjobs, so the box can be used as timer clock.