Bluetooth control with 12F675


This is a simple control via Bluetooth. The thing is fast to deploy using those modules available on the market. With a HC-06 and a few components it creates a easy control with communication via serial data.

The project is a module that allows control of 2 relays on the board. You can control multiple devices scattered around the house without having to go wireless, via a smartphone or computer with Bluetooth.
I can only say that the distance is not great, and we must be content to have the notice within the same room.


A project consists of a Microchip microcontroller (exactly 12F675, 8 feet), a Bluetooth module and a few discrete component.

There will be a slightly smoothed input power of 12 Vdc. From power 12 V then there is a regulator 5 Vdc on the board, for the microcontroller. While for controlling the relay coils just the 12 Volts.

Also included is a divider for the’ entrance of the HC module-06, for compatibility to 3,3 Volts used by the module.

The project includes some special features :

  • The number of 2 outputs. The program would allow you to configure the’ use of a.

  • The outputs are configurable high or low active. In the default program has taken active high outputs. To control the relay board. It may be necessary in some cases the’ active option in the low or reverse logic relay.

  • The outputs can be configured either as fixed or as timed. The 12F675 takes care of keeping count. whomsoever, once you started a count, who sent the command may also be absent.

  • The commands are issued with a short message and expects all have been sent i six characters required to complete the transmission.

  • Intended use of quartz 16 MHz or 20 MHz. Just change the declaration at the beginning of the program with $define XTAL16 (and to 16 MHz) or
    $define XTAL20 (and to 20 MHz).

Electric Scheme

Obviously the transistors are not critical, any NPN makeat the his work, however they must have legs as the 2N2222, of the type BC547, for example.
L’ power supply must be from 12 Volt slightly filtered and somewhat robust to power the relay, if powered from the card. Better than both an Ampere.
In this diagram it denotes a connector (4 poli) to accommodate the’ HC-06.

material List

Position Value
2 C1-C2 22 pF
2 C3-C4 100µF 16V
1 R1 1k8
1 R2 3Q3
2 R4-R5 1k5
integrated Circuits
1 U1 PIC12F675
1 U2 78L05
2 Q1-Q2 2N2222
2 D1-D2 1N4148
1 H1 100 µH
1 J1 Per HC-06
1 J2 For Power
2 J3-J4 To command relay
1 X1 Quartz 16 MHz

Printed circuit




The printed below is reversed, to put it on the copper face via transfer with the photoresist or hot toner.

Si can download the entire package who.

the functionality of the program description

The variables that are used to configure the following:

$define ACTIVE_LOW

If the line is commented, the outputs become active high. The relays I used instead work in positive logic. So the modified program could only be outside of this card.

symbol BufLen

You are altered if you can use a different capacity d 'input from the serial. For those wishing to modify the firmware for different purposes, within limits.


It defines those outputs that will not be influenced by a generale.Questo ignition to prevent commands that require only a pulse, can be set to permanent condition continues.


The module 2 relay, so there put one ( which is counted from’ index zero). In case you want to install only a relay, you could modify this parameter.

As you might guess the values ​​have been put on a list to’ start firmware. For those who understand the programming it will be easy to spot.

The commands to be sent to the control are such:

  1. For ignition of a fixed output is controlled with the letter capital A O B. intervene’ the limit imposed by how many outputs hath been configured with NUMTIMER.

  2. To turn off using the letter miniscola a O b . What will operate on the channel.

  3. To turn off all outputs using the letter x tiny including timed outputs.

  4. For the’ Ignition of all outputs, using a letter X capital. They will be excluded those defined not accessible from the output mask.

  5. For commands with timers using the following string:
    (Fixed initial character) definition to indicate a timer, no matter whether upper or lower case.

    0 O 1
    (second fixed character) defined by the firmware. CAUTION that l’ HEX charge for 2 outputs. Indexing starts at zero.

    s O m or h
    (third fixed character) definition of the united’ measures to set. With s It indicates the seconds, m It will indicate the minutes and h the hours. No matter whether upper or lower case.

    by a three-digit
    the valora to set the timer with the previous size desired. For hours is the limit in 9 ore.

    Filling the string with spaces
    He concludes the received string. then with the program DCmote and will set commands with a filling with spaces up to 6 characters received.

For example "t1s45 “, results with’ Exit 2 active for 45 seconds. Quotation marks excluded and a space after five.

borderline case, by sending a zero value to a timer, this is conclusO

There is another program package, I used to send a pulse to the gate controls, since it does not need hold continuous.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply