A tiny Bluetooth-enabled ghetto blaster
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
img
LICENSE
README.md

README.md

bluetoothghetto

BluetoothGhetto – A tiny Bluetooth-enabled ghetto blaster

Arnaud Droulers & Martin Hintzy

CentraleSupélec, Rennes campus, 2016/2017

This project has been realized by Arnaud Droulers and Martin Hintzy for a short-term project under the supervision of Dr. Pascal Cotret.

Goals of this project

It was a personal idea we had for our short-term project. Even if we're born in the 1990s, we always remember people with ghetto blasters near a basketball playground when we watched American sitcoms on TV. We wanted to make a modern version of such a device with some wireless connection and a few RGB LEDs in order to make it shiny as f###.

After some searches on the Internet, we have found two interesting tutorials (thanks Instructables !):

Our BluetoothGhetto was born! We just had to gather those two projects and to add a microcontroller with a LED strip to make our project. In the next parts of this tutorial, we will write a few notes about existing project and some details about the microcontroller/LED enhancement.

box

Bluetooth speaker

Bill of material

schemablue Just connect as it is done in the schematic: that's it, you have your own Bluetooth speaker! montageblue

LED color organ

fritzing spice

How does it work?

This electronic circuits is basically a combination of 3 filters (sections with transistors) with 3 different cutoff frequencies. We start by the highest frequencies.

  • [2500-...] Hz
  • [120-2500] Hz
  • [0-120] Hz

We wanted to do a SPICE simulation to check the behavior of each filter. However, it failed for an unknown reason. We took values as it was written in the original tutorial.

BluetoothGhetto is born :) bg

Make it shine!

rgb

The next idea was to put a few WS2812 RGB LEDs on the wooden box instead of basic RGB LEDs in the circuit. As a consequence, we had to use a microcontroller to drive such a LED strip. Of course, the whole processing may be performed on the microcontroller... We decided to use an Arduino Nano as in the schematic below, it turns out that even a Lilypad would do the trick.

strip

The Arduino code implemented in the Arduino is available here: https://github.com/pcotret/BluetoothGhetto/blob/master/docs/ledstrip/ledstrip.ino

// Libraries
#include <Adafruit_NeoPixel.h>

// Constants
#define PIN 13
#define BFSENSOR 2
#define HFSENSOR 1

// Initialize the WS2812 LED strip for 70 LEDs
Adafruit_NeoPixel strip = Adafruit_NeoPixel(70, PIN, NEO_GRB + NEO_KHZ800);

// Global variables
int hf_read=0;
int bf_read=0;
int hf_voltage=0;
int bf_voltage=0;

// Setup (executed only once)
void setup()
{
  Serial.begin(9600);
  strip.begin();
  strip.show();
}

// Main loop (infinite)
void loop()
{
  int i;
  // Measuring voltage on HF pin
  hf_read=analogRead(HFSENSOR);
  // Converting voltage in mV
  hf_voltage=map(hf_read,0,1023,0,1800);  
  // Measuring voltage on BF pin
  bf_read=analogRead(BFSENSOR);
  // Converting voltage in mV
  bf_voltage=map(bf_read,0,1023,0,1800);
  // Printing both values  
  Serial.print(hf_voltage);
  Serial.print(" ");
  Serial.print(bf_voltage);
  Serial.println();
  // High frequencies
  // 1st level reached (red, black, black)
  if((300<hf_voltage)&&(hf_voltage<500))
  {
    for(i=14;i<25;i++) // Intensity level 1
      strip.setPixelColor(i,255,0,0);
    for(i=9;i<14;i++)  // Intensity level 2
      strip.setPixelColor(i,0,0,0);
    for(i=25;i<31;i++) // Intensity level 2
      strip.setPixelColor(i,0,0,0);
    for(i=5;i<9;i++)   // Intensity level 3
      strip.setPixelColor(i,0,0,0);
    for(i=31;i<35;i++) // Intensity level 3
      strip.setPixelColor(i,0,0,0);
  }
  // 1st and 2nd levels reached (red, red/orange, black)
  else if((500<hf_voltage)&&(hf_voltage<600))
  {
    for(i=14;i<24;i++) // Intensity level 1
      strip.setPixelColor(i,255,0,0);
    for(i=9;i<14;i++)  // Intensity level 2
      strip.setPixelColor(i,255,102,102);
	for(i=24;i<31;i++) // Intensity level 2
      strip.setPixelColor(i,255,102,102);
    for(i=5;i<9;i++)   // Intensity level 3
      strip.setPixelColor(i,0,0,0);
    for(i=31;i<35;i++) // niveau d'intensité 3
      strip.setPixelColor(i,0,0,0);
  }
  // 1st, 2nd and 3rd levels reached (red, red/orange, orange)
  else if(600<hf_voltage)
  {
    for(i=14;i<24;i++) // Intensity level 1
      strip.setPixelColor(i,255,0,0);
    for(i=9;i<14;i++)  // Intensity level 2
      strip.setPixelColor(i,255,102,102);
    for(i=24;i<31;i++) // Intensity level 2
      strip.setPixelColor(i,255,102,102);
    for(i=5;i<9;i++)   // Intensity level 3
      strip.setPixelColor(i,255,128,0);
    for(i=31;i<35;i++) // Intensity level 3
      strip.setPixelColor(i,255,128,0);
  }
  // Low frequencies
  // 1st level reached (yellow, black, black)
  if((300<hf_voltage)&&(hf_voltage<500))
  {
    for(i=68;i<57;i--) // Intensity level 1
      strip.setPixelColor(i,255,255,0);
    for(i=62;i<69;i++) // Intensity level 2 
      strip.setPixelColor(i,0,0,0);
    for(i=57;i<39;i--) // Intensity level 2
      strip.setPixelColor(i,0,0,0);
    for(i=38;i<34;i--) // Intensity level 3
      strip.setPixelColor(i,0,0,0);
    for(i=0;i<5;i++)   // Intensity level 3
      strip.setPixelColor(i,0,0,0);
  }
  // 1st and 2nd levels reached (yellow, yellow/orange, black)
  else if((500<hf_voltage)&&(hf_voltage<600))
  {
    for(i=68;i<57;i--) // Intensity level 1
      strip.setPixelColor(i,255,255,0);
    for(i=62;i<69;i++) // Intensity level 2 
      strip.setPixelColor(i,255,204,153);
    for(i=57;i<39;i--) // Intensity level 2
      strip.setPixelColor(i,255,204,153);
    for(i=38;i<34;i--) // Intensity level 3
      strip.setPixelColor(i,0,0,0);
    for(i=0;i<5;i++)   // Intensity level 3
      strip.setPixelColor(i,0,0,0);
  }
  // 1st, 2nd and 3rd levels reached (yellow, yellow/orange, orange)
  else if(600<hf_voltage)
  {
	for(i=68;i<57;i--) // Intensity level 1
      strip.setPixelColor(i,255,255,0);
    for(i=62;i<69;i++) // Intensity level 2 
      strip.setPixelColor(i,255,204,153);
    for(i=57;i<39;i--) // Intensity level 2
      strip.setPixelColor(i,255,204,153);
    for(i=38;i<34;i--) // Intensity level 3
      strip.setPixelColor(i,255,128,0);
    for(i=0;i<5;i++)   // Intensity level 3
      strip.setPixelColor(i,255,128,0);
  }
  strip.show();            // Displaying everythin'!
  strip.setBrightness(50); // Set the strip brightness
  delay(1000); 
}

References