Sunday, January 22, 2012

The PCBs

Finally, the boards arrived. They look ok, but I have notices I made some small errors (a few holes could be larger). I can use the and I will fix this in my files. I've already managed to assemble a board. Now off to testing ...

The PCBs
The board without the OpenPicus module
The board without the OpenPicus module 
The board with the OpenPicus board
The circuit presented could be used for several usages, it features 10 digital inputs and 10 digital outpus (via Solid State Relays). This one will be used to control 5 blinds connecting buttons and blinds.

Friday, January 20, 2012

Optically Isolated Zero Crossing Detector

Since I am still waiting for my PCBs to arrive, I decided to take some time to design a proper and accurate zero crossing detector, that can be used to create a microcontroller based dimmer.

Proper zero crossing detection is essential when creating a dimmer with a triac controlled by a microcontroller. The circuits I encountered online either used transformers or were not optically isolated towards the microcontroller (like http://ww1.microchip.com/downloads/en/AppNotes/00521c.pdf).


The "heart" of the circuit are two operational amplifiers (in one package) with an open collector. Transistors C1-C4 and diodes D1-D4 represent the tranformless dual voltage power supply, which powers the operational amplifiers. Resistors R1-R4 provide the reference voltage of about 3V.

When the input voltage (sensed over the R5) exceedes +3V or is lower than -3V the IC1A or IC1B output transistors are connected towards the negative voltage and no current is running through the led in the optocoupler.
When neither of op amps is active (sense voltage is between -3V and +3V) the optocoupler led is active and the optocoupler's output transistor connects the external INT pin to the ground, triggering the interrupt.

The circuit was only tested on a protoboard, so take caution when implementing it in your design.

Saturday, January 14, 2012

WiFi

I wrote about the reasons for using WiFi in my previous post. Let me cover it in more details.

The Pros
1. WiFi is already present in most homes, the only thing you need is a wireless router.
2. Security can be taken care on a network level, no need for additional security on the end devices.
3. Simple interface from the PC/mobile to the end device (no need for bridges or border routers)
4. It is quite easy to extend the range by adding more routers to the network level.

The Cons
1. No mesh network, the end devices are directly dependent on the router
2. Slightly higher power consumption than in 802.15.4 network

The Hardware
I have set the following goals for the electronics; the circuit should be easy to build, it should contain little or no SMD components (two layer PCB board is acceptable), the circuit size should fit inside some standard size wall boxes (the largest should go inside Gewiss GW 48 003 junction box)
The use of a WiFi module was a logical choise and I spent quite a lot of time searching for the right one, until I stumbled upon this one:
It is called openPicus and it is a spin-off project of Eikon company.  It features 22 I/O pins, which can also be remapped to different functions. The default config has 5 digital input, 5 digital output and 4 analog ports, but this can be changed. It is based on a PIC microcontroller and uses the Microchip TCP/IP stack.
The team has prepared a wizard based development environment, which "hides" the complexity from the developer. You can find more about it at: http://www.openpicus.com.

The first PCB board I will build will support 5 blinds with commands, so the board will feature 10 digital inputs (5xUP and 5xDOWN) and 10 digital outpus (via Solid State Relay).

The schematics and the PCB are already designed. When I get the boards, place the components and test them, I'll publish the designs for the hardware.

Tuesday, January 10, 2012

Automating my home

What is a computer worth if it is not connected to the real world? When I got my first computer in elementary school (the famous Commodore 64), I took some optocouplers and triacs and created a light show. I even used the Analog Joystick Input to sync the lights to the music.


That was so great! I thought of all the things I could do with my Commodore. Controlling robots, cars ... But the coolest of all, was automating my house (which was, of course, far from reality in that time). Now, more than two decades later, it is finally time to do something about it.


In the past two years, I have evaluated quite a few options, when it comes to the home automation protocols:
  • X10
  • Zigbee
  • ZWave
  • "simple" 802.15.4
  • KNX/EIB
  • Central wiring
  • 6LowPan
  • WiFi

The first question I had to answer, was whether to buy the whole system off the shelf or to build it on my own. The price tag of the built systems and my interest in electronics helped me to go for the DIY aproach. I didn't want to rush, I took my time studying all available options. I thought about cost, complexity, simplicity, extensibility, adaptability ...

The Protocol
After quite a lot of consideration, I decided to use WiFi for communication. I've looked at Zigbee for a long time, but it is far too complex, even for vendors. 6LowPan has low power consumption and mesh network, but power was not such a big issue for me and I could deal with the range by adding extra WiFi routers.

The Concept
I don't want to put too much logic onto devices. That complicates their code and communication protocols. That is what Zigbee does and that is the main reason I didn't like it. So the system should have a centralized server for complex operations like Scene management and User interface. 
The devices should be simple, but still able to operate independently from the central server. I decided not to split the command (like button) from the actuator (ex. lights, blinds, ...). They are connected to the same board and don't need a server to operate. The devices respond to simple REST commands with a status XML file.

I will post more details of the system as it gets built. I will publish the schematics, PCB and source code (some kind of open source licence). Feel free to comment and to use my work if you find it useful.