Mental Blossoming Lamp

Mental Blossoming Lamp

Introduction

Macro-Toolbox Mental Blossoming Lamp is a mental controllable lamp.
You can use it to train your attention/concentration and meditation skills.

Mental Blossoming lamp demo image

This lamp is :

  • 3d printable with a 3d printer having a printable volume of 130x130x130.
  • filled with simple electronics hardware (Arduino board, bluetooth module, led, servo motor). No need to use a phone.
  • fully open source (design, hardware and software) and you can adapt it to your needs.
  • controllable with a EEG headset (currently a neurosky mindwave mobile headset) with Bluetooth communication.

Printing

The rendered and OpenScad files can be downloaded from Thingiverse at the following link :

http://www.thingiverse.com/thing:1161390

You should be able to print all stl files without support, except, maybe the bulb.

The bottom, clip and cover components are optional.

The 2 following components can give you some difficulties :

  • bloom : you may have to try different speed and.or different filament diameter to succeed.
  • bulb : you may need to use support, but the bulb has been reinforced at some points to allow you to remove it securely.

Once your print jobs are done you should have the following :

3dprinted-components1

 

Hardware

These instructions will use the following parts :

  • Arduino Leonardo (x1)
  • HC-05 Bluetooth Module (x1)
  • Hitec HS-311 Servo Motor (x1)
  • RGB Led with common cathode (x1)
  • 100Ω Resistor (x1)
  • 150Ω Resistors (x2)
  • 37×55 Stripboard with 55mm strips (x1)
  • 7805 Power Regulator (x1)
  • 10µF Capacitor (x2)
  • 0.1µF Capacitor (x1)
  • Female 3 pins Right Angle 2.54mm Header (x1)
  • Female 6 pins Right Angle 2.54mm Header (x2)
  • 9V or 12V 1A Power Adapter (x1)

Arduino Board

Why a Leonardo board?
Just because the USB connector is a micro one and, then, we don’t have to make a HUGE hole in our lamp 🙂

Anyway, you’ll be able to use any board that you want or have. Just be careful that the lamp 3d printed parts are physically compatible (or you’ll have to modify them).

Power and Bluetooth board

We’ll start with the creation of this dedicated board.

boardCut a part of stripboard as on the left image.

Holes have to be drilled at the vertical position of the Arduino board holes (power side).
No strip cut needed.

On the right of the stripboard is the 12V->5V converter.
C1 : 10µF
C2 : 10µF
C3 : 0.1µF

On the left, the 2×6 pins headers are to plug the HC-05 and then to connect the strips to the arduino pins.

A strap is soldered between our regulated 5V and the HC-05 5V pin.
Same for ground.

Warning!

Check that your HC-05 backboard has the same position for 5V, GND, RX and TX. Adapt the schematic if necessary.

Warning!

Your HC-05 backboard could have no 5V pin… In this case don’t solder the 5V wire. You’ll just have to connect a wire between the arduino 3.3V pin and the HC-05 3.3V pin.

Power converter

Let’s check the power we’ll need :

  • ~30mA for the arduino.
  • 160mA (running current at no load) to 700mA (stall current) for the servo.
  • ~30mA (pairing current) for the HC-05.
  • 3x20mA for the RGB led.

This gives us a total of 820mA if servo is lifting a load.

It’s generally suggested to let the Arduino board regulator dissipate no more than 1W. It means that with a 12V input, as we have a 7V between the input and output tension, we’ll just be able to have an output current of 140mA (1W/7V=140mA).

As it’s not enough we need to add a power module.
However, as we need less than 1A we can use the Vin pin of Arduino to draw 12V and 1A (if we power Arduino with a 12V adapter in it’s jack power socket).
This will allow us to avoid the soldering of wires on the DC connector.

All that said, let’s go back to our board.
Gnd pin will have to be connected to a Gnd pin on Arduino.
12V pin will have to be connected to the Vin pin on Arduino.

Bluetooth bracket

Our board will also support our HC-05 module.
You can solder the HC-05 directly on the stripboard or use a angled header for that.
I opted for the header solution.
As 5v and ground are directly soldered on the board, and the lamp will just need the TX signal of the HC-05 to operate, only 1 wire will be needed to be routed to Arduino (!).

However, during the configuration process we’ll be happy to have all HC-05 pins easily available. See that later.

board-front

board-tension

HC-05 module

Configure HC-05 as Master

You will need just one information to do the HC-05 Master configuration : Your Headset MAC address.

To find it you will need to power this headset and set in in pairing mode (you push upward the power button during about 5s until the blue led blink two times). Refer to your headset documentation if needed.

Once your headset is in pairing mode you will need to use a computer or a phone to detect your headset bluetooth device and find its MAC address. Your headset will be named ‘Mindwave Mobile’.

A MAC address looks like 20:68:9D:79:D5:51 and you can use applications to show it. Under android, I can suggest ‘Bluetooth spp tools pro’.

Once you have your headset MAC address you can go on and return to your Arduino console.

Now you can type the following commands in the console (one line at a time) .

In this command list you have to adjust AT+NAME and AT+BIND to your needs :
AT+NAME : just choose the name you want for your lamp.
AT+BIND : get your headset MAC address and reformat it as needed. Eg : If your MAC address is 20:68:9D:79:D5:51, you’ll have to send it as 2068,9D,79D551.

AT+NAME=LAMP
AT+UART=57600,0,0
AT+ROLE=1
AT+PSWD=0000
AT+CMODE=0
AT+BIND=2068,9D,79D551
AT+IAC=9E8B33
AT+CLASS=0
AT+INQM=1,9,48

HC-05 should answer [js]OK[/js] each time.

You can check if your parameters are correctly saved in HC by retyping each command without its parameter and with a ? character at the end. Example : [js]AT+UART?[/js].

Here is the full log after configuration of HC-05 :
HC-05 AT mode - console log

Notice!

It seems that some commands like AT+NAME? and AT+CLASS? don’t send back their parameter . Don’t worry about it.

You can now disconnect Arduino and unplug the HC-05 module. We have finished with it 🙂

Now to test if it works, re-plug the board, switch on your headset and set it to pairing mode. It will start to blink 2 times and you should see that the blinking on the HC-05 becomes slower : the devices are paired.

RGB LED

How to choose the good resistors?

Look at the datasheet of your LED and you will find a parameter named Forward Voltage.

LED forward voltageThere you will understand that each leg has a different value for this parameter :

  • Red : 2.0V
  • Green : 3.2V
  • Blue 3.2V

As we’ll power led with Arduino’s output at 5V max and that each output can only deliver 20mA, we can calculate the resistor for each leg:

  • Red : (5-2.0)/20=150Ω -> we’ll keep it to 150Ω
  • Green : (5-3.2)/20=91Ω-> we’ll round it to 100Ω
  • Blue : (5-3.2)/20=91Ω-> we’ll round it to 100Ω

Notice!

If you want some security, use 1×150Ω and 2×220Ω.

We will now solder those resistors at each legs of the LED.

How to know which pins are what?

Look at the datasheet and you’ll get what you need :

LED pins

Now solder those resistors on the good pins, like that :

LED-with-resistors

Before doing the last solder points, don’t forget to engage some heat shrink on each wire.

Shift the position of each resistor to avoid obstruction when you’ll slide this in the bulb.

Here is the finished device :

LED-finished

Software

If you are in a hurry you can unhide and copy the Full Code bellow, upload it to your Arduino and jump to the next chapter.
https://github.com/mtbox0/mental_blossoming_lamp

If you have time, unhide this and I’ll give you some explanation of what is done in this sketch.

Assembly

We can finally put all this together 🙂

Here are the main actors on the stage. for a have a better show, I printed a incomplete base.

assembly-main componentsThe mounting scheme to wire them all :

mental blossoming lamp_bb

 

Mental Blossoming lamp demo image