Bluetooth Controlled, 3D Printed Sims Plumbob Costume

For the last Purim festivities I made a Sims Plumbob that’s controlled via an android application through Bluetooth to simulate the Sim mood.
In this article I’ll show you what I’ve done and why so you can make one yourself.

The Plumbob

The Plumbob itself was 3D printed. The shape is very simple and it can be modeled very easily, It’s just two hollow hexagonal pyramids glued to each other.
Lazy me didn’t want to start modeling so I found a pre-made model on thingiverse. The shape was perfect and I had the perfect material for the job – a translucent green PLA filament. I chose this material because I wanted to put lights inside that would illuminate the Plumbob in different colors, the material was translucent enough for colors to penetrate and be seen at night and it was green so it would be recognizable in the day, when the lights are not very visible.
The downloaded model has a stem on one side, but it’s not hollow (I needed a stem to mount the Plumbob and it needed to be hollow for electrical wires to go through it). I needed to drill through the stem, which is not an easy task, I ended up breaking it and using another method to secure the Plumbob to its mount.

The Plumbob was printed out of Translucent Green PLA at 190 degrees C. 0.3mm layer height and 100% infill. The print took about 3 hours for each half.

The Mount
I needed a way to mount the Plumbob a few inches from my head, I wanted it to look at night as if it was floating, like in the game. I figured a hair bow with a rod on top painted black could do the trick.
I needed a wide bow for stability, a narrow or thin one would just fall from the weight and movement. I thought about 3D printing a custom mount but I didn’t have enough time to measure, model and make one so I went to the nearest store and tried some bows on.
I didn’t find a wide enough bow, but I found a bow that looked like three bows connected at both ends, it was flexible enough so I can pull them apart to make the whole structure wide enough. Moreover, when I pulled them apart the entire structure was stiffer, less flexible, which is exactly what I needed.
On top of the bow I put a piece of tin I cut to shape with some tin sheers, the tin provides a strong base for the stem and will hold the stretched bow parts in place. I used two part Epoxy glue for all connections.
The stem is an aluminium tube cut to length with the ends split and bent to follow the contour of the hexagon pyramid to be attached to it on one side, and the tin base plate on the other.

Before gluing the Plumbob half to the stem, I spray painted the whole thing black.

I used RGB LEDs for lighting and a 5V Arduino pro mini for control. The Arduino supports about 40mA of current draw from each pin and the LEDs are common Anode and draw about 20mA per color (I used 6 LEDs, that’s 120mA total current for each color of all LEDs on full brightness), so I had to use 2N3906 transistors to switch power to the LEDs (I could have connected each Cathode of each of the LEDs to another pin in the Arduino to avoid the current problem, but the Arduino doesn’t have enough PWM pins and that would require me to modify the code).
To save space on the circuit board, I shortened the Cathode leads of the LEDs and 150Ohm resistors and soldered them together inline.
To make life easier, I made a jig by fixing a 5mm LED bezel with vice grips, this made soldering very easy.

I used a HC-05 Bluetooth module for communication and a U1V11F5 5V step-up converter so I could power the whole thing with 2xAAA batteries.

The Bluetooth module operates at a 3.3V logic level while the Arduino operates at 5V, the arduino would understand the 3.3V from the Bluetooth module fine, but 5V to the Rx pin of the module could fry it. for this I connected the module’s Rx pin to the Arduino’s Tx pin via a voltage divider (a dedicated logic level converter circuit would have been ideal but I didn’t have one nor did I have time to wait for one to arrive).

The circuit had to be mounted to a post made of aluminium tube, so I had to insulate the tube to prevent shorts. The circuit was held in place with zip ties, the LEDs were wrapped around and hot glued in place so that they point in different directions to illuminate the whole shape (in retrospect, I could have used shorter leads for the LEDs).
The aluminium tube was held in place with hot glue and then secured with Epoxy.
The battery holder was mounted on the stem for lack of a better place to put it. I thought about putting it in my pocket with wires running inside my shirt, but they proved to be too long and the resistance was too high so the Arduino would reset when the current draw was high and the voltage dropped.
I needed the batteries on the outside because the power switch was on the holder and I wanted to be able to change batteries. If I had more time I would have probably installed a rechargeable li-po battery inside the plumbob with a small switch and a charging port poking from the side.

Untitled Sketch_bb

The Code
I didn’t have time to write an android application, so I found a free one on the Play Store that fit my needs exactly. There are a lot of applications that do similar things and much more, but this one had a friendly interface and did just what I wanted.
In the description of the app there’s a link to a free example code (and a full code for purchase). I used the free example and modified it to fit my setup.
I also had to use the Software Serial library because, for some reason, the Bluetooth module refused to work with the Arduino’s Serial pins. I used pins 10 and 11 for serial communication with the module (this also allowed me to upload sketches to the Arduino without disconnecting the module).

//pins for the LEDs:
const int redPin = 6;
const int greenPin = 9;
const int bluePin = 5;

#define REDPIN 9
#define GREENPIN 6
#define BLUEPIN 5

#define FADESPEED 5

char serialByte = '0';
#include <SoftwareSerial.h>
SoftwareSerial BTserial(10, 11); // RX | TX

void setup() {
// initialize serial:

// make the pins outputs:
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);

Serial.print("Arduino control RGB LEDs Connected OK ( Sent From Arduinno Board )");

void loop() {

// if there's any serial available, read it:
while (BTserial.available()) {
 // look for the next valid integer in the incoming serial stream:
 int red = BTserial.parseInt();
 // do it again:
 int green = BTserial.parseInt();
 // do it again:
 int blue = BTserial.parseInt();

for(i=0; i<3; i++)
 int waste = BTserial.parseInt(); //the app sends data for two sets of LEDs, we don't need this
 // look for the newline. That's the end of your
 // sentence:
 if ( == '\n') {
   // constrain the values to 0 - 255 and invert
   // if you're using a common-cathode LED, just use "constrain(color, 0, 255);"
   // This is for COMMON ANODE
   //red = 255 - constrain(red, 0, 255);
   //green = 255 - constrain(green, 0, 255);
   //blue = 255 - constrain(blue, 0, 255);
   red = constrain(red, 0, 255);
   green = constrain(green, 0, 255);
   blue = constrain(blue, 0, 255);
   // fade the red, green, and blue legs of the LED:
   analogWrite(redPin, red);
   analogWrite(greenPin, green);
   analogWrite(bluePin, blue);

   // print the three numbers in one string as hexadecimal:
    //BTserial.print("Data Response : ");
   //BTserial.print(red, HEX);
   //BTserial.print(green, HEX);
   //BTserial.println(blue, HEX);
   //Serial.print(" "+green);
   //Serial.println(" "+blue);


Additional Thoughts
After the awesome experience with OpenBCI and EEG technology in my previous project, I thought about making this a truly interactive and realistic Plumbob that’ll work in real life. The OpenBCI could sample your brain waves and through machine-learning detect your emotion, this can be then translated into triggers for the Arduino to change the color of the LEDs according to your REAL mood! but that’s a whole other project that will take much more time.

BrainiHack 2015 – Blue GSD with Brain Controlled Labyrinth Game

This weekend (13-14.3) two of my friends (Gal Weinstock and Maxim Altshul) and I participated in the BrainiHack 2015 event hosted at the AutoDesk offices in Israel.
BrainiHack is a neuroscience themed Hack-A-Thon, where makers come to compete in a day-and-a-half long neuroscience-related project building marathon.

My group is called Blue GSD, we are two Communication Systems Engineering students and a Computer Science student. we came with absolutely no background in Neuroscience and tried to make something awesome. We brought an arsenal of tools, electronic components and a home-built 3D Printer.
We ended up winning the special OpenBCI prize for the best project in the open source category. The prize was an OpenBCI Starter Kit valued at 500USD.

Our project is a Labyrinth game controlled via brain waves (EEG). We are using OpenBCI, an arduino based open source bio-sensing microcontroller, It’s brilliant and with some initial assistance from Conor, one of the founders of OpenBCI, it’s really easy to work with.

The Labyrinth
The game itself was entirely 3D printed, it’s movement is provided via two micro servo motors controlled with an Arduino Uno.
The mechanism consists of three nested frames that are anchored in different places to achieve two degrees of freedom – roll and pitch.
We had no time for strong glue and I didn’t want to make any permanent connections (I’m designing on the fly so a lot can go wrong, and some did) so my design had to be zip tie friendly, the motors and motor arms are all attached with zip ties to the frames. The hinges are M3x16 screws and nuts with some washers to keep the frames in place relative to each other and press them onto the motor.
In the end we noticed we didn’t have enough clearance under the device for the frames to move all the way and we had no time to print another outer frame, so we had to make lifters for the legs which actually worked out perfectly.
Models for all 3D printed parts can be downloaded free at

As mentioned before, OpenBCI is an open source EEG device (and more, but that’s not relevant right now, I might explore more of it’s capabilities in the future) which was handed out to whoever wanted to use it.
With OpenBCI we could attach electrodes wherever we wanted (as opposed to some of the other fixed position alternatives), that way we could experiment with different methods and brain waves and choose the ones that work for us.
Conor from OpenBCI was kind enough to give us a little guidance and showed us another project done with OpenBCI, a five-person controlled shark balloon by chip, from which we learnt a lot about the system.
In addition to all of its advantages, it’s Wireless! It includes an RFduino that transmits the data to a dedicated USB dongle that plugs into the computer.

Brain Waves
We wanted to explore more than one type of brain waves. The shark balloon project was based purely on Alpha waves, a 7.5-12.5Hz wave our brain produces in the Occipital Lobe when we close our eyes and relax, that’s neat but we wanted more. Alpha waves are very easy to detect but there’s only one type of Alpha wave per person, this means that in order to control 2 axis we would need 4 people or 2 if we use direction toggling (more on that next).
After some research we found out about SSVEP (Steady State Visually Evoked Potential), a phenomenon where the brain produces a frequency (and/or harmonies of a frequency) that matches the frequency that excites the retina. This means that if we look at a light that blinks at a constant frequency, the brain will produce the same frequency. After some experimentation, we found that the range 5Hz-20Hz was easiest to detect and that 16Hz was far enough from the Alpha waves so they don’t get mixed up.
By combining Alpha and SSVEP we have 2 types of waves we can control and anticipate, which gives us the ability to control the game with just one person.

Controlling the Game
The problem with this technology is that it’s very slow, it’s not real-time by any standard. It may take a few seconds for the wave to generate and be detected while the Labyrinth game requires finesse and delicate movements to balance the ball, this is impossible with 2 or 3 second delay between reaction and actual movement of the platform.
To overcome this challenge we decided to simplify the game, instead of continuous control of the position of the platform, each axis would only be fully tilted to one side or the other, for this to work we created a super-simple maze layout, no holes, no balancing, just walls with straight angles.
As mentioned, we wanted to control the whole thing with one person and we had two different signals we could extract. Left-right position toggle was controlled via Alpha wave and up-down position toggle was controlled via SSVEP.


Data Analysis and Translation
OpenBCI provides a neat GUI that allows you to visually see the data and analyse it more easily. The interface provides time-domain and frequency-domain (FFT) graphs as well as a map of the head with electrode activity.
Once the data is captured with OpenBCI, it is transferred to the computer for analysis, the computer runs a Processing program that computes the Fourier Transform of the signal over a defined interval of time, filters the spectrum to look at relevant frequencies and finds the most powerful frequency in the range. If the peaked frequency is the one we are looking for, a command is sent to an Arduino board via serial port. The Arduino then controls the servos according to the command received.
In our project, we were looking for peaks at around 10Hz (Alpha) and 16Hz (SSVEP) and had to ignore the very high peak at 50Hz that is caused by the AC power frequency here in Israel.

Screenshot from 2015-03-13 13_27_35

The code running on the computer is a modified version of the shark baloon’s code. Since they already figured out the Alpha wave capturing and translation, we had to modify it for one person (they used 5) and add the SSVEP frequency capturing. The shark balloon code was taken and modified from another project (which modified the original code from OpenBCI) so it’s already a little messy and we probably made it messier (with a day and a half to get the whole thing to work we had no time to waste on making it pretty).
The code running on the Arduino is fairly simple, just a loop polling input and controlling the servos. We made the servo movement slow and continuous so that the ball doesn’t jump around.
The code will be uploaded to GitHub in a few days.

Special thanks to Conor over at OpenBCI for helping us and introducing us to the technology.

Phone-In-Car Reminder

I hate forgetting my phone in the car. I used to put the phone on my lap, in my pocket or on the passenger seat, but since I’ve installed a dock, I keep forgetting the phone because I’m not used to it being there – There must be a solution.

After some thought I got it – An alert system similar to that of the car’s headlights, which beeps if you forget to turn them off. I wanted the solution to work on any phone and any car so It mustn’t run on the phone (software combined with NFC, for example, needs a lot of maintenance to support all devices).

Generally, there are two conditions that have to be met in order to trigger the alert – The engine must be off and the phone must be docked.
Determining whether or not the phone is docked can be done in many ways, I chose the burglary alarm approach – a ray of light being broken by the phone. This is implemented via an IR LED and an IR photodiode.
Engine-off detection is a little more tricky, I didn’t want to tap into any of the car’s systems because I wanted a simple implementation and model independence. Finally, I noticed that when the engine is off, the 12V power socket is disconnected (and that’s true for most cars). This provided a solution to one problem but created another – I still need a way to power the system when the engine is off.
Rechargeable batteries are one way to go, but they will die very soon because they will be kept at 100% most of the time (not good for Li-ion batteries and I don’t want to get into charging circuits). Supercapacitors were the ideal solution for me, constant charging doesn’t effect lifespan, they can hold enough charge for a few seconds after power is cut and they are inexpensive and small enough.
Eventually, I used four 3.3F capacitors rated 2.5V in sieries, providing 0.825F and 10V rating (it’s recommended that the rating of the capacitor be about double the operating voltage)

Initially, I thought about using an Attiny85 running Arduino, that will be a very simple implementation with very few components and just a couple of lines of code, but since i’m using capacitors as a power source I need to conserve as much power as I can.
A few iterations in, I came up with the circuit in the pictures.

This slideshow requires JavaScript.

I used very inexpensive and simple components, no IC’s, no controllers, no code. Minimum power consumption.
The circuit will be connected to a 5V USB car charger with a current limiting resistor.

The LED and photodiode will be positioned on each arm of the dock’s clamp. When the phone is docked, it blocks the light and the photodiode opens making the transistor close (there are two implementations shown in the drawing for the same circuit based on the transistor type). The green LEDs in the prototype indicate that the voltage source is connected and that the light is broken, a kind of hardware debugging.
The beep will come out of a piezo-electric buzzer.

The system hasn’t been installed in the car yet because I’m going to replace my car in a couple of months. rest assured it’ll be installed in the next and a post will follow.

If you want more information regarding the circuit and the job of each part, leave a comment or Email me.