text.skipToContent text.skipToNavigation

COVID-19 & Shipping Updates

In line with government guidelines, Jaycar Auckland stores Will be CLICK & COLLECT only. All other company-owned locations outside of Auckland will be Level 2. We encourage all customers to take advantage of free delivery for online orders over $99. We thank you for your support as we continue try to keep our community and stores safe. See here for the latest on delivery delays.

Bluetooth Power Point

Download Project Resources View on Github

Control a collection of power points with your phone app

hero image

Here's a great project that lets you use your Smartphone (using Bluetooth) to turn on/off any appliance such as a TV, computer, table lamp, etc. directly from the power point without getting up off the couch or out of bed.

While it might seem simple, this project opens up the world of bluetooth possibilities for your future Arduino projects.

Bill of materials

Qty Code Description
1 XC4410 Arduino UNO Compatible Device
1 WC6028 Plug Socket Leads
1 XC4382 Bluetooth Module
1 ZW3100 433Mhz Transmitter
1 MS6149 Spare RF Mains Switch

Instructions

The assembly of this project is again, pretty simple. Hopefully you should be able to understand this to make a progress on your own designs.

Wiring diagrams

diagram

Note that the connections shown here are symbolic, they might not exactly match what is on the BT and 433 Modules; you want a simple pin connection to go between the 433Mhz module and a digital IO pin, We used A3.

Then connect up two pins for the serial connections to the bluetooth. You can change this in code but we found it easier to keep them close to each other and close the other serial port on pins 0,1.

breadboard

That's all there is to it, Here it is on a breadboard but you can just use the plug-socket leads that you bought in the bundle to connect the modules straight to the arduino; Use the 5V and VIN pins for power, but keep it powered off USB; any higher voltage you plug in will go straight through to the VIN pin and we haven't tested what might or might not work yet.

Programming the code

The code is under 50 lines and is pretty easy to understand, due to putting all the 433 module's logic into the 433Switch.h header file; You can use this file where-ever you want to use the module; and it should work anywhere that has the arduino libraries.

The Bluetooth module works like a wireless serial port that we connect up our phone to. We used an app called Arduino Bluetooth Controller (HM-10 Model) because it's specifically designed for the module we have.

play store

We don't have an iPhone to test but there should be an apple version of the same thing, we weren't able to check. Make sure you get an app specifically for the HM-10 version, or some similar BTLE controller, as the bluetooth low energy protocol works different to regular bluetooth controller versions.

The device will be called "HM-Soft" or some variant thereoff, you should be able to find it when it is on, blinking, and your phone app is searching for new bluetooth devices; ( read the next section if you get stuck).

In this program you want to set up two buttons to send the commands "on" and "off" - this will be translated by the BT module, read by the arduino, and will fire off the on/off signals respectively. You should check the code a little more to see how it works.

Bonus round, change the device name.

If you can't find the device or you just want to give it a cooler name, you can control it through AT commands; Set up the following code:

#include <SoftwareSerial.h>

SoftwareSerial Bluetooth(3, 2); // RX | TX

void setup()
{
    Serial.begin(9600);
    Bluetooth.begin(9600); //Baud Rate for AT-command Mode.
Serial.println("** Command mode **");
}
void loop()
{
    while(Bluetooth.available()) {
            Serial.write(Bluetooth.read());
    }
    while(Serial.available()){
            Bluetooth.write(Serial.read());
    }
}

Then program the uno and open the serial monitor, you should be able to get into command mode: Try the following commands:


AT

AT+NAME?

It should 1. tell you it's OK and 2. tell you it's name. if they both succeeded you can go ahead and change the name of the device: (For instance, to change it to bluey - notice we didn't use = or anything else after NAME)

AT+NAMEbluey

Note that therer's a character limit of 12 characters, so keep it short.

There's a whole bunch of commands you can type in to configure this device, here's just one list we've found on github:

https://github.com/zubial/arduino-serial/wiki/Bluetooth-HM-10-AT-Commands

Once the name is changed, you should find the device under the different name in your phone.

This repo maintains code for the project. Contributions and improvements are encouraged.