![]() |
| Remote-control |
Next up we need a processing base station for WiFi integration.
![]() |
| Remote-controlled Socket |
![]() |
| Basically just an ASIC |
I need some sort of isolation between the two circuits. Something like a optocoupler or a relay. I just happen to have two dual-relay-modules laying around so why not use them. A really quick solder-job later the tactile switches had a wire attached as well a a wire to short one of the channel-selectors. Now all six sockets can be operated with one remote module. the all-off switch is not connected. So I can not switch them all off at once. For now. A look inside the socket adapters show that they also consist of an ASIC. This one isn't even labeled! A switch mode power-supply and an antenna.
The socket-module seems not to answer the command in a way to determine of the signal was received. I will have a look into this later. For now one-way communication will have to be sufficient.
Everything hooked together like this:
5V -> Relay supply
3.3V -> Relay driver
GPIO -> Relay switch signal
The relays short the tactile switches ans one of the channel-selectors.
The next step is software. The Pi I use has Raspbian installed. This is a Linux based on the Debian distribution and comes with python and bindings to access the GPIO directly from the script. With Python you get a HTTP-server up and running in no time.
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
import RPi.GPIO as GPIO
class myHandler(BaseHTTPRequestHandler):
#Handler for the GET requests
def do_GET(self):
self.send_response(200)
self.send_header('Content-type','text/html')
self.end_headers()
# Send the html message
self.wfile.write("Hello World")
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.OUT, initial=1)
GPIO.output(4, 1)
return
try:
#Create a web server and define the handler to manage the
#incoming request
server = HTTPServer('', 8000), myHandler)
print 'Started httpserver on ', server.server_address
#Wait forever for incoming http requests
server.serve_forever()
except KeyboardInterrupt:
print '^C received, shutting down the web server'
server.socket.close()
With little additions the first version of Herbert was built. Have look at the git if you want.



