MetallicGR

DIY: Smartphone controlled Mood Light

Recommended Posts

[NEWS_IMG=DIY: Smartphone controlled Mood Light]http://www.hwbox.gr/members/2195-albums497-picture34931.jpg[/NEWS_IMG] Χρησιμοποιήστε το LightBlue Bean για να αλλάξετε τα χρώματα μιας λάμπας!

Σε αυτό το DIY με τη βοήθεια ενός LightBlue Bean και ενός NeoPixel ring με 16 LED θα μπορέσουμε να φτιάξουμε ένα "φως διάθεσης" ή Mood Light, το οποίο θα ελέγχεται από το iPhone σας μέσω του ειδικού λογισμικού. Προσοχή δεν υπάρχει λογισμικό για Android. Για την κατασκευή του θα χρειαστούμε εκτός των δύο παραπάνω και ένα voltage regulator, δύο αντιστάσεις 2.2 kΩ και μια 10 kΩ, ένα NPN transistor και ένα ακρυλικό κάλυμμα λάμπας.

Βήμα 1. Ξεκινάμε κολλώντας το voltage regulator όπως φαίνεται στην φωτογραφία. Προσοχή στις κολλήσεις που πρέπει να γίνουν στο πίσω μέρος του Bean.

[img_alt=DIY: Smartphone controlled Mood Light]http://www.hwbox.gr/members/2195-albums460-picture38779.jpg[/img_alt]

Βήμα 2. Συνεχίζουμε με την κόλληση του τρανζίστορ.

[img_alt=DIY: Smartphone controlled Mood Light]http://www.hwbox.gr/members/2195-albums460-picture38780.jpg[/img_alt]

Βήμα 3. Σειρά έχουν οι δύο αντιστάσεις. Η 2.2 kΩ θα συνδεθεί στα μεσαία ποδαράκια του τρανζίστορ και του VR ενώ η 10 kΩ θα κολληθεί στα τελευταία ποδαράκια, όπως βλέπουμε στην εικόνα.

[img_alt=DIY: Smartphone controlled Mood Light]http://www.hwbox.gr/members/2195-albums460-picture38781.jpg[/img_alt]

Βήμα 4. Ύστερα ανοίγουμε τρύπα στο κάλυμμα της λάμπας για να περάσουν τα καλώδια των NeoPixels. Μετά κολλάμε τα NeoPixels επάνω στο Bean. Δύο πόλοι και μια γείωση είναι αυτά που θα χρειαστούμε για την σύνδεση! Στη τελευταία φωτογραφία του βήματος φαίνονται όλες οι κολλήσεις.

[img_alt=DIY: Smartphone controlled Mood Light]http://www.hwbox.gr/members/2195-albums460-picture38782.jpg[/img_alt]

[img_alt=DIY: Smartphone controlled Mood Light]http://www.hwbox.gr/members/2195-albums460-picture38783.jpg[/img_alt]

[img_alt=DIY: Smartphone controlled Mood Light]http://www.hwbox.gr/members/2195-albums460-picture38784.jpg[/img_alt]

[img_alt=DIY: Smartphone controlled Mood Light]http://www.hwbox.gr/members/2195-albums460-picture38785.jpg[/img_alt]

[img_alt=DIY: Smartphone controlled Mood Light]http://www.hwbox.gr/members/2195-albums460-picture38789.jpg[/img_alt]

Βήμα 5. Για να φαίνεται όμορφη η λάμπα φτιάχνουμε έναν πάτο. Για τον σκοπό αυτό μπορούμε να χρησιμοποιήσουμε απλό φελιζόλ το οποίο θα κόψουμε με ένα μαχαίρι και θα κολλήσουμε με κόλλα.

[img_alt=DIY: Smartphone controlled Mood Light]http://www.hwbox.gr/members/2195-albums460-picture38786.jpg[/img_alt]

Βήμα 6. Ανεβάζουμε τον κώδικα στο Bean και είμαστε έτοιμη να ελέγξουμε το φως από το smartphone μας! Παρακολουθήστε και το σχετικό βίντεο στην πηγή του άρθρου.

Κώδικας

/*

This sketch reads the values of the LightBlue Bean's onboard LED

and sets a NeoPixel ring connected to pin 5 to the same color.

This code is in the public domain.

*/

#include

// The pin that is connected to the NeoPixels

#define PIN 5

// The amount of LEDs in the NeoPixels

#define NUMPIXELS 16

// LedReading is the type we get when we call Bean.getLedValues();

// For example, to get the amount of red in the Bean's LED,

// we use ledColor.red to get a value from 0 to 255

LedReading ledColor;

// previousLedColor will be used to check if the LED's color has changed

LedReading previousLedColor;

// Set up the NeoPixel library

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

void setup() {

// Initialize the NeoPixels

pixels.begin();

// Program the Bean to wake up when connected

Bean.enableWakeOnConnect(true);

}

void loop() {

// Check if the Bean is connected to another device

// to avoid the NeoPixels from turning off when it's disconnected

if(Bean.getConnectionState()){

// Get the values from the Bean's onboard LED

ledColor = Bean.getLed();

// Check if the color has changed

if(ledColor.red != previousLedColor.red || ledColor.green != previousLedColor.green || ledColor.blue != previousLedColor.blue){

//Set the NeoPixels to the same color as the Bean's LED

for(int i=0;i<=NUMPIXELS;i++){

pixels.setPixelColor(i, pixels.Color(ledColor.red, ledColor.green, ledColor.blue));

pixels.show();

}

// Update previousLedColor for the next loop

previousLedColor = ledColor;

}

}

else{

// Sleep unless woken);

Bean.sleep(0xFFFFFFF);

}

}

[img_alt=DIY: Smartphone controlled Mood Light]http://www.hwbox.gr/members/2195-albums460-picture38787.jpg[/img_alt]

[img_alt=DIY: Smartphone controlled Mood Light]http://www.hwbox.gr/members/2195-albums460-picture38788.jpg[/img_alt]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now