Introduction: O-Zone: DIY Bluetooth Battery Lamp

About: I’m degree in Psychology in 2001, with a thesis in Artificial Intelligence. I’m working on Smart Object, IoT and Interactive Design. I’m developing autonomously my projects. I make autonomously programs in Ard…

O-Zone is a DIY Bluetooth lamp. You can modify the color of the lamp and also the brightness of leds. You can use your smartphone, your tablet for switch ON the light, modify the colors and the mood of your room.

The materials for the lamp are:

1 x Light BlueBean with battery

1 x Adafruit Neopixel ring (16 x leds)

Handy Bluetooth app iOS

Bluethooth Terminal for Android

The materials for the structure are:

3 mm (3.1 inch) Wood

1.5 mm (0.05 inch) White Plexiglass

Step 1: The Structure of Cube

For the structure of the lamp, I've designed a cube. A simple but linear wood cube. I've cut the wood with my laser engraver. Also, I've cut a circle inside the upper face of the cube. Inside the cutting, I've put a white plexiglass ring. I cut the plexiglass with 40W laser cutting. You can use the white plexiglass, as the Adafruit led ring, has many colors. Also, you can use a transparent Plexi, but I think the white is better for the smoothing quality of light.

For the cutting of structure, you can use your laser cutter or you can use a laser cut service like Fablab or also you can send the project to an online service like Shapeways.

Put the pieces together with a vinyl glue. After assembly the Adafruit Neopixel ring with the plexiglass ring. For the plastic parts, you can use an acrylic glue. Assembly all together.

After this step, your structure is ready!

Step 2: Program the Punch Through Light Blue Bean

For programming Light BlueBean you can use the Arduino IDE. When you charge the firmware on your Light BlueBean you must use the Bluetooth communication. You can use the Arduino IDE and combine this program with Punch Trough Light BlueBean loader. See the official site for details.

Get Started with Light BLUEBean

You can use this code for Light BlueBean:

/* ******************************************

* O-zone Bluethooth Lamp

* 31 March 2017

* Giovanni Gentile

* for Punch Through Light BlueBean

**********************************************/

#include "Adafruit_NeoPixel.h"

// The pin that is connected to the NeoPixels #define PIN 5

// The amount of LEDs in the NeoPixels #define NUMPIXELS 16 int bright = 20; boolean lumi = 1; boolean previousLumi = 1;

String command; boolean commandStarted = false; Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); LedReading ledColor; LedReading previousLedColor; void setup() { Serial.begin(); // Initialize the NeoPixels pixels.begin(); }

void loop() { getCommand(); }

/* This function reads the serial port and checks for the start character '#' if the start character if found it will add all received characters to the command buffer until it receives the end command ';' When the end command is received the commandCompleted() function is called. if a second start character is found before an end character then the buffer is cleared and the process starts over. */ void getCommand() { while (Serial.available()) { char newChar = (char)Serial.read(); if (newChar == '#') { commandStarted = true; command = "\0"; } else if (newChar == ';') { commandStarted = false; commandCompleted(); command = "\0"; } else if (commandStarted == true) { command += newChar; } } }

/* This function takes the completed command and checks it against a list of available commands and executes the appropriate code. Add extra 'if' statements to add commands with the code you want to execute when that command is received. It is recommended to create a function for a command if there are more than a few lines of code for as in the 'off' example. */ void commandCompleted() { if (command == "low") { bright = bright - 10; lumi = -lumi; Serial.print(bright); } if (command == "high") { bright = bright + 10; lumi = -lumi; Serial.print(bright); } if (command == "red") { Bean.setLed( 255, 0, 0 ); Serial.print("LED turned red"); } if (command == "green") { Bean.setLed( 0, 255, 0 ); Serial.print("LED turned green"); } if (command == "blue") { Bean.setLed( 0, 0, 255 ); Serial.print("LED turned blue"); } if (command == "yellow") { Bean.setLed( 255, 255, 0 ); Serial.print("LED turned yellow"); } if (command == "orange") { Bean.setLed( 255, 60, 0 ); Serial.print("LED turned orange"); } if (command == "purple") { Bean.setLed( 128, 0, 128 ); Serial.print("LED turned purple"); } if (command == "white") { Bean.setLed( 255, 255, 255 ); Serial.print("LED turned white"); } if (command == "off") { off(); } if(Bean.getConnectionState()){ // Get the values from the Bean's onboard LED ledColor = Bean.getLed(); } if(lumi != previousLumi || ledColor.red != previousLedColor.red || ledColor.green != previousLedColor.green || ledColor.blue != previousLedColor.blue){ for(int i=0;i

/* Use a separate function like this when there are more than just a few lines of code. This will help maintain clean easy to read code. */ void off() { Bean.setLed( 0, 0, 0 ); Serial.print("LED turned off"); }

Step 3: Connect the Light Blue Bean to Adafruit Neopixel Ring

After the firmware uploading, you can use the Light BlueBean with your smartphone. You can try the program by using the rgb led onboard. After you can connect the Adafruit 16x ring.

Pay ATTENTION, connect the VCC to Light BlueBean 5v, GND to Light BlueBean GND and the data pin on your Adafruit Neopixel ring on pin number 5.

Step 4: The Bluetooth App and Serial Communication

The code inside the Light BlueBean receives data by the serial. You can send the serial string to BlueBean by using the Bluetooth protocol. I use Handy BLE for iOS. You can use this app for sending by the Bluetooth protocol any serial string that you want. I've created a dashboard that has 6 circle colours, 1 Off circle, and two square Bright. The square commands are for putting up and down the brightness of leds ring.

The serial command that the BlueBean accept are:

For colouring the leds:

#red;
#purple;
#blue;
#green;
#yellow;
#orange;

For shut off the leds:

#off;

For regulating the brightness:

#low;
#high;
Woodworking Contest 2017

Participated in the
Woodworking Contest 2017

Microcontroller Contest 2017

Participated in the
Microcontroller Contest 2017