April 2014

Original post date: Sat, 2011-03-05 16:45 by Francis

Home automation or domotics is the dream of every microcontroller hobbyist. Although a lot of information can be found on the web it is difficult to make the first steps. In this article we explain how you can build a simple module which can be connected to an electrical device such as a TV, a lamp or a washing machine in order to remotely switch on or off the device. The possibilities are endless: switching lights on or off based on the amount of light in a room, just-in-time powering the coffee machine ...

The idea

In this article I explain how you can build a simple module to control electrical devices with a pc using for example bluetooth. In this movie I'm switching a light bulb on and off.


The construction has three important parts:
1. an electrical circuit with relay to control the connected device
2. a microcontroller board with bluetooth module
3. a pc to send commands to the microcontroller over bluetooth

The electrical circuit

The first step is to build a circuit that can interrupt the electrical current. This can be done easily with a relay. I used a standard 12 V DC relay. The relay is switched by a transistor that is connected to one of the pins of the Dwengo microcontroller (RB4 in this example). The Dwengo board, the transistor and the relay, form the control circuit. This control circuit is powered by 12 V DC.
I also added a power supply circuit that converts the 220 VAC to 12 VDC needed for the control circuit. The power circuit consists of a transformer, four diodes that form a diode bridge rectifier and a voltage regulator (7812).



I have used these components for the electrical circuit:
  • Omron 12VDC relay
  • BC547 transistor
  • Transformer (230 V AC primary, 9 Vrms AC secondary)
  • Some diodes, capacitors, resistors and a voltage regulator such as a 7812
  • Plastic box to keep everything safe
  • Bluetooth module
  • The Dwengo board and breadboard

Putting the components together

Caution: working with high voltages can be very dangerous! Do not work on live circuits and keep everything safe in the insulation box. Neither the author nor Dwengo vzw can be held responsible for injuries.
Try to solder the circuit in such a way that there is a clear distinction between the high voltage zone (220 VAC), which mainly contains the relay and the transformer, and the 12 VDC zone which contains the voltage regulating circuit, the transistor, cables to the microcontroller board. Make sure there is a large insulation space between all the 220 VAC soldering paths or wires. This is what my domotics box looks like:

Connecting this to the microcontroller is a simple task. The green wire is connected to pin RB4 of the Dwengo board while the red and black wire (giving the 12 VDC power) are connected with a power plug to the Dwengo board.

Program and play

Now the domotics box is connected to the microcontroller you can start writing a program to control any electrical device. Therefore you can switch the relay by setting pin RB4. One idea could be to attach a light sensor and switch a light bulb on and off based on the amount of daylight measured at the window.
Another possibility is to connect the microcontroller to the computer. The Dwengo board I used can be easily connected to any computer using a serial cable, USB or a bluetooth module. I bought a bluetooth module that can be connected to the RS232 pins (RC6 and RC7) of the Dwengo board and thus my setup can be controlled remotely.
On the PC side, tools such as Tera Term Pro or Minicom can be used to send instructions over bluetooth (or any other serial connection) using any operating system. With slightly more effort you can write a Java program that does the trick using the RXTX library External link. In this way you can master all the electronics into one Java application.
And now you can impress your friends and family with your own domotics system!

Original post date: Sat, 2011-03-05 16:45 by Francis

Home automation or domotics is the dream of every microcontroller hobbyist. Although a lot of information can be found on the web it is difficult to make the first steps. In this article we explain how you can build a simple module which can be connected to an electrical device such as a TV, a lamp or a washing machine in order to remotely switch on or off the device. The possibilities are endless: switching lights on or off based on the amount of light in a room, just-in-time powering the coffee machine ...

The idea

In this article I explain how you can build a simple module to control electrical devices with a pc using for example bluetooth. In this movie I'm switching a light bulb on and off.


The construction has three important parts:
1. an electrical circuit with relay to control the connected device
2. a microcontroller board with bluetooth module
3. a pc to send commands to the microcontroller over bluetooth

The electrical circuit

The first step is to build a circuit that can interrupt the electrical current. This can be done easily with a relay. I used a standard 12 V DC relay. The relay is switched by a transistor that is connected to one of the pins of the Dwengo microcontroller (RB4 in this example). The Dwengo board, the transistor and the relay, form the control circuit. This control circuit is powered by 12 V DC.
I also added a power supply circuit that converts the 220 VAC to 12 VDC needed for the control circuit. The power circuit consists of a transformer, four diodes that form a diode bridge rectifier and a voltage regulator (7812).



I have used these components for the electrical circuit:
  • Omron 12VDC relay
  • BC547 transistor
  • Transformer (230 V AC primary, 9 Vrms AC secondary)
  • Some diodes, capacitors, resistors and a voltage regulator such as a 7812
  • Plastic box to keep everything safe
  • Bluetooth module
  • The Dwengo board and breadboard

Putting the components together

Caution: working with high voltages can be very dangerous! Do not work on live circuits and keep everything safe in the insulation box. Neither the author nor Dwengo vzw can be held responsible for injuries.
Try to solder the circuit in such a way that there is a clear distinction between the high voltage zone (220 VAC), which mainly contains the relay and the transformer, and the 12 VDC zone which contains the voltage regulating circuit, the transistor, cables to the microcontroller board. Make sure there is a large insulation space between all the 220 VAC soldering paths or wires. This is what my domotics box looks like:

Connecting this to the microcontroller is a simple task. The green wire is connected to pin RB4 of the Dwengo board while the red and black wire (giving the 12 VDC power) are connected with a power plug to the Dwengo board.

Program and play

Now the domotics box is connected to the microcontroller you can start writing a program to control any electrical device. Therefore you can switch the relay by setting pin RB4. One idea could be to attach a light sensor and switch a light bulb on and off based on the amount of daylight measured at the window.
Another possibility is to connect the microcontroller to the computer. The Dwengo board I used can be easily connected to any computer using a serial cable, USB or a bluetooth module. I bought a bluetooth module that can be connected to the RS232 pins (RC6 and RC7) of the Dwengo board and thus my setup can be controlled remotely.
On the PC side, tools such as Tera Term Pro or Minicom can be used to send instructions over bluetooth (or any other serial connection) using any operating system. With slightly more effort you can write a Java program that does the trick using the RXTX library External link. In this way you can master all the electronics into one Java application.
And now you can impress your friends and family with your own domotics system!

Kogonuso

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget