Smart LED holiday Bow Tie with Neopixel Jewel and Feather Huzzah esp8266

This year I wanted something geek-ish for the holiday seasons, so I created a smart led bow tie which shows animations in all possible RGB variations and can be controlled with your smartphone.

For this project I got my inspiration from Adafruit’s Tony Dicola tutorial “MicroPython Smart Holiday Lights“. It holds all the information you need to know for this project. Definitely check it out.

The hardware for this project consists of my favorite IoT board the Feather Huzzah, NeoPixel Jewel (7 LED’s), a flat powerbank and of course, a really neat bow tie. The one I sacrificed was a Tommy Hilfiger one.

First I soldered the electrical wires on the Neopixel Jewel, than, and this is the reason the Jewel is great for this kinds of projects, I sewed it on my bow tie. Next, I soldered the other end of the three wires to the prepared Feather Huzzah.

Preparing the Feather Huzzah ESP8266 board is really easy if you follow this tutorial or my previous post [dutch].

The code I used is written in MicroPython and part in HTML. You can find it here. You just have to change the static configuration in the main MicroPython code to the correct values. In my case I only changed the number of pixels (leds). This is also the place for more advanced programmers to change or add more animations. In the HTML file I added some more colors. Basically, you can vary infinitely.

Meet de watertemperatuur met een DS18B20 temperatuur sensor en een Arduino Uno

Een simpele badwater-thermometer die door middel van 3 LED’s aangeeft of het badwater op de juiste temperatuur is (voor baby’s 36-38 graden Celsius). De blauwe LED staat voor te koud, de rode LED voor te warm en als de groene LED brandt dan is het water op de juiste temperatuur.

De temperatuur sensor is een DS18B20 waterbestendige sensor met een nauwkeurigheid van 0.5 C. Meer info over dit product op de website van Adafruit.

Installeer in de Arduino IDE de bibliotheek van OneWire én Dallas Temperature Control Arduino.

De code:

// Include the libraries we need
#include <OneWire.h>
#include <DallasTemperature.h>

// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 2

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);

// arrays to hold device address
DeviceAddress insideThermometer;

/*
 * Setup function. Here we do the basics
 */
void setup(void)
{
 // start serial port
 Serial.begin(9600);
 Serial.println("Dallas Temperature IC Control Library Demo");

// locate devices on the bus
 Serial.print("Locating devices...");
 sensors.begin();
 Serial.print("Found ");
 Serial.print(sensors.getDeviceCount(), DEC);
 Serial.println(" devices.");

// report parasite power requirements
 Serial.print("Parasite power is: "); 
 if (sensors.isParasitePowerMode()) Serial.println("ON");
 else Serial.println("OFF");

// Method 1:
 // Search for devices on the bus and assign based on an index. Ideally,
 // you would do this to initially discover addresses on the bus and then 
 // use those addresses and manually assign them (see above) once you know 
 // the devices on your bus (and assuming they don't change).
 if (!sensors.getAddress(insideThermometer, 0)) Serial.println("Unable to find address for Device 0"); 

// show the addresses we found on the bus
 Serial.print("Device 0 Address: ");
 printAddress(insideThermometer);
 Serial.println();

// set the resolution to 9 bit (Each Dallas/Maxim device is capable of several different resolutions)
 sensors.setResolution(insideThermometer, 9);
 
 Serial.print("Device 0 Resolution: ");
 Serial.print(sensors.getResolution(insideThermometer), DEC); 
 Serial.println();

//initialise LED pins
 for(int pinNumber = 3; pinNumber < 6; pinNumber++){
 pinMode(pinNumber, OUTPUT);
 digitalWrite(pinNumber, LOW);
 }
}

// function to print the temperature for a device
void printTemperature(DeviceAddress deviceAddress)
{
// method 2 - faster
 float tempC = sensors.getTempC(deviceAddress);
 Serial.print("Temperatuur: ");
 Serial.println(tempC);
 
}

/*
 * Main function. It will request the tempC from the sensors and display on Serial.
 */
void loop(void)
{ 
 // call sensors.requestTemperatures() to issue a global temperature 
 // request to all devices on the bus
 //Serial.print("Requesting temperatures...");
 sensors.requestTemperatures(); // Send the command to get temperatures
 //Serial.println("DONE");
 delay(100);
 
 
 // It responds almost immediately. Let's print out the data
 printTemperature(insideThermometer); // Use a simple function to print out the data

float tempC = sensors.getTempC(insideThermometer);
 if(tempC < 36.00){
 digitalWrite(3, LOW);
 digitalWrite(4, LOW);
 digitalWrite(5, HIGH);
 } else if(tempC >= 36.00 && tempC <= 38.00){
 digitalWrite(3, LOW);
 digitalWrite(4, HIGH);
 digitalWrite(5, LOW);
 } else if(tempC > 38.00){
 digitalWrite(3, HIGH);
 digitalWrite(4, LOW);
 digitalWrite(5, LOW);
 }
 delay(1);
}

// function to print a device address
void printAddress(DeviceAddress deviceAddress)
{
 for (uint8_t i = 0; i < 8; i++)
 {
 if (deviceAddress[i] < 16) Serial.print("0");
 Serial.print(deviceAddress[i], HEX);
 }
}