« Back to home

The Bluebell, a Bluetooth Notification Device

After more than three weeks, numerous interruptions and delays the project I though would take a few days is finally finished. Finished enough to publish at least.

This post describes the Bluebell - a small Bluetooth controlled ambient device built around an ATtiny85 CPU. This is one of the first complete projects based around my ATtiny85 template library which is a bit of a milestone for that project.

The Hardware

The project pulls together a number of things I've spoken about in recent posts such as the software based UART, a HC-05 Bluetooth module and RGB LEDs driven by PWM so I won't discuss them in detail here.

I've put those components together in a simple circuit, added support for battery powered operation and wrote some firmware to provide a very simple serial protocol for remote control. The whole thing is then packaged in a 3D printed case. As usual, the entire project is available on GitHub under a Creative Commons License if you would like to build your own.

You can see the schematic of the logic board in the image to the left. To make things fit more neatly in the final case I split the LEDs out on to a separate board and use male and female pin headers to join the two together. Although the schematic shows NPN BJT transistors driving the LEDs I am actually using 2N7000 N-channel FETs for this task - I couldn't find a suitable Fritzing footprint for them but the generic NPN transistor was the closest matching component with a compatible PCB layout.

The only part of the circuit that I haven't discussed in previous posts is the power supply. Previously I have used AA battery packs (4 batteries for a total of 6V output) for my projects but I wanted to try and minimise the size of this one so I opted for a 9V battery as the main source of power instead.

There are two regulators in the circuit - a 5V switching regulator and a 3.3V LDO regulator. I'm using a RECOM DC/DC converter for the 5V supply, it is a drop in replacement for the classic 7805 regulator but far more efficient and more suitable for a battery powered device. The output from this regulator is used to drive the LEDs and provide the input to the next regulator. The 3.3V regulator is a MCP1702 LDO regulator which can provide up to 200mA - more than enough for what we need.

To monitor the battery voltage I pass it through a voltage divider and into an analog input. We want to report this back over the Bluetooth connection so it's easy to know when the battery is going to need replacing.

The Firmware

The firmware that is currently in the repository is very simple and doesn't use all the features available on the device - there is no read of the battery level for example even though it is available on an analog input.

Essentially all it does is listen on the serial port for incoming commands from the controlling PC. Each command consists of 6 bytes - a start byte (I'm using the '!' character for this), the red, green and blue values for the LEDs, a time period (in seconds) and a termination byte (the newline character). The use of start and termination characters makes it easier to identify a valid command and to re-sync with incoming commands if there is any noise on the line.

Rather than simply set the requested colour the LEDs will cross fade from their current colour to the requested one, hold it for the specified number of seconds and then fade back to off. This serves two purposes - it means the device is not always glowing at you so you are more likely to pay attention when it does start glowing and it improves the battery life.

There are two RGB LEDs in the device, both of which always display the same colour. In the worst case (the LED's are full white) that means a current draw of 120mA (20mA per colour for two LEDs).

To establish the serial connection you simply connect to the Bluetooth device as a virtual serial port. I have pre-configured the HC-05 module as described here so no additional work is required on the firmware side.

Controller Software

To drive the device I wrote a simple Python wrapper that uses pySerial to communicate with the serial port. I separated that out into a separate class that you can use in your own applications. There is a sample command line tool that simply takes the serial port name, the colour values and (optionally) the time and sends that to the device.

Next Steps

Although I have something up and working it is still very much the seed of an idea rather than the complete fulfilment of one. The whole idea of an ambient device is great and I would really like to spread them through my house like confetti. Currently available implementations seem too overpriced for my liking and lack an easy interface.

The current iteration is very clunky, to say the least, and the position of the two LEDs isn't the most appealing when they are lit. I would really like to shrink it down to a much smaller size. Improving the power consumption or moving to a different power source would help - it's the battery and supporting power management circuit that takes up a lot of room.

The boxy form factor needs to go as well. I recently came across some small LED lights at a dollar store that are fairly appealing - you can see one of them in the image to the right. If I replaced the clear plastic top cover with something that provide a bit more diffuse light it would be a perfect size and easy to mount unobtrusively around the house and the garage.

The Bluetooth based connection works well (and the HC-05 module is very easy to use) but requires a controller that is always on so the connection remains established. It also means you need a separate virtual serial port for each device you have connected - not bad if there is only one or two of them but I would like to have the ability to use a larger number than that.

The biggest improvement would not be related to hardware at all but a simple communications protocol that could be used to control devices such as this as well as reading data from remote sensors that makes it easy to integrate everything together. That however, is a much larger project.