Sunday, May 6, 2018

Build and Final Test

Building and Final Test

I have taken several steps in order to make my backpack a successful project. I decided to sketch out how I wanted to place the LED's on the bag. I also decided to sketch out the circles that I wanted to incorporate on the bag. I decided that I wanted the LED's to remain connected to illustrate an illuminated chase of light. Here's a list of items needed to build my bag:

1. painters tape
2. needle
3. white thread
4. container for Arduino
5. speaker wire tubing
6. rechargeable power supply


I wanted to re-engineer the clear backpack because it came with mesh pockets on either side of it that I felt were too distracting. I removed the mesh and began to shape the bag. The bag arrived via Amazon smashed in a box. 


I needed to measure the LED's to their corresponding sides of the backpack. I decided that labeling the cut length LED's should be numbered in order to keep there exact placement exact. I drew out the circle and began to cut individual LED sections from the strip and place them an approximate distance in order to make a circle. I also had to solder the power, ground and data wires to each individual LED to create a chain that would then be reconnected to the other two strips that I have now cut and set aside.


I now had to secure the LED's to the backpack by utilizing the painter's tape. Once, I had all the LED's in place and tape, I began to sew the LED's down to the backpack with white thread in order to keep the bag as translucent as possible and minimize any distracting colors or objects.


Once, I got the LED's sewed in, I needed to install the power supply and Arduino case (I found a portable drive case to use as the Arduino case) to the bag. I plugged everything in and I got no reaction. Oh, no...


The LED's are not working. It would seem that I somehow crossed the power wire from the circle to the main strip with the ground wire. I was very lucky to discover that this mistake did not blow out the LED strip or cause a surge in my Arduino Uno. I found the bad connection and resoldered the strip. 


Yureka, it works. The strip, code, Arduino, and radar are all working harmoniously. 
Somehow in my journey, I plugged the sensors power jumper into the 5V port on the Arduino and the LED's power jumper into the 3.3V port. I was happy that this did not cause a burnout but I discovered during my final critique in class that it was causing the Arduino to shut off everytime the LED's would fire off the first time. Thank you, Thomas, for pointing this exhausting error out. By putting the LED's on the 5V port and the sensor on the 3.3V port, my project fired up once it detected movement. Success...I am including the final code on the bottom and the final video of it working as well. Thanks for reading and viewing ...Please keep an eye out for backpack version 3 here in the future.

Here's the code:
#include <Adafruit_NeoPixel.h>
#define PIN 3
#define NUM_LIGHTS  80
// revised by Slem Lucio May 2nd, 2018
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LIGHTS, PIN, NEO_GRB + NEO_KHZ800);
const int mwPin = 2;     // the number of the pushbutton pin
      // the number of the LED/Buzzer pin

// variables will change:
int mwState = 0;         // variable for reading the pushbutton status
int motionCount = 0;     // variable 

void setup() {
  // initialize the LED pin as an output:
  pinMode(PIN, OUTPUT);
  // initialize the pushbutton pin as an input:
  //pinMode(buttonPin, INPUT);
  attachInterrupt(0, handler, CHANGE);

void loop() {
  // Nothing to see here :)

// The handler is called via interrupt and does all the hard work
void handler() {
  // read the state of the pushbutton value:
 uint32_t low = strip.Color(0, 0, 0); 
    uint32_t high = strip.Color(255, 255, 255);
  mwState = digitalRead(mwPin);

  // check if the Microwave sensor is HIGH.
  // if it is, set the ledPin HIGH and report the count
  if (mwState == HIGH) {
    // turn LED on:   
    digitalWrite(PIN, HIGH);
    Serial.print("Motion: ");
for( int i = 0; i<NUM_LIGHTS; i++){
        strip.setPixelColor(i, high);;
for( int i = 0; i<NUM_LIGHTS; i++){
        strip.setPixelColor(i, low);;
  }    else {
    // turn LED off:
    digitalWrite(PIN, LOW);

Please feel free to visit my Instructables

Here's the video:

Microwave Radar continued...

Microwave Radar continued...

I have tested the microwave radar and after modifying it to the specs that I needed, I was able to get 

the code, the Arduino, and the radar to successfully work together. Now, I need to check my LED's 

to make sure they still work. Oops, nope, they do not work? I discovered a break on the strip that 

prevented the LED's from lighting up.  I had to re-solder the bad connection. I used the same test

code from the proximity backpack to check them. Thank you Dr. D-Flo for the in-

depth explanation of how to properly power on your LED's. He provides a lot of useful information,

but he also explains that this information is should be adapted to your particular needs. Here's the

link to the how to connect your LEDs video: and here is the link to the

test code:

LED's Working with Radar

Radar synch with LED's

Thanks to discovering were the interrupts, I was able to successfully test my final test code.

Proximity vs Microwave Radar

Proximity vs Microwave Radar

 Phase II:
I discovered that the proximity had a limited proximity to detection of only a few centimeters and did not successfully net my end goals for the backpack. After extensive research, I found that other DIY individuals found great success with their projects utilizing microwave radar sensors. I search for the best inexpensive radar on the market and stumbled on the WHDTS 2.25GHz microwave radar detector module with a detection range 6 to 9 meter. This would prove to be exactly what I needed to and it would also change the name of my project to the microwave radar backpack.  

The XYC-WB-DC microwave chipset comes with several dedicated resistors, transistors and power regulator. The microwave radar works by sending out microwave signals that detect the movement of an object within its field of view when the signal is bounced back to the radar.  

Humor: I began to solder my components and discovered that my soldering iron was no longer working. After I tried unplugging, cleaning, and moving the heating element around, I decided to take the iron apart. I discovered that one of the wires connected to the heating element was disconnected. I taught myself;” How do I solder a soldering iron?”. Yup, it happens, but I was able to firmly push it back together and it soon started to heat up again.

I found some test code for XYC-WB-BC and I was able to check the accuracy of the radar.  I discovered that the XYC-WB-BC was under-powered and unable to detect anything within its prescribed specs of 6 to 9 meters. Instead, I got a constant register at approximately 12 inches from the sensor using the serial monitor with the Arduino software.

I now needed to figure out how to achieve the 6 to 9 meters of detection that was guaranteed by WHDTS. I found a fantastic video on youtube by Blair Thompson, ‘Modifying an XYC-WB-DC Microwave Motion Sensor for use in a Sonoff SC’, that illustrates how to basically give the chipset a boost. He adds a variable Bournes 0-100k resistor to his modification. I discovered that adding the variable resistor would not be necessary to achieve a 6-meter distance with this modification (in his defense, he does state that adding the variable resistor was over-kill).

Now, that I have my modification done, I was able to utilize Blair’s code to check the radar with the Arduino Uno. Blair’s code basically states that if the radar triggers then the LED pin 13 will go high and lights up and prints to the serial bus. If the sensor goes low then it turns the LED off.

I am happy to report that this was a successful test. Here's the link to his video: and here is the link to the test code: Thank you, Blair.
I soldered together two microwave radars with the intention of creating a 360-degree field of visual stimuli but I was running short on time and was unable to add the second radar. I am including a video that illustrates putting it together.

LED Backpack Revised

Microwave Radar Backpack

Phase1: I need to recycle any salvageable parts and accessories from the proximity backpack project.

I was able to remove most of the wiring and devices without any problems. I will be using the following from my prior project; male and female jumpers, 9V batteries, Arduino Uno, WS2812B 30 pixel (5 meters), USB power cable, breadboard, 470 Ohm resistor, 1000 uF Capacitor. I purchased a clear backpack to enhance the amount of light emitted. I also wanted to explore the bio-luminesces that are exhibited by deep-sea jellyfish. My goal is to create a visual stimulus for anyone within a 180-degree radius.  

Saturday, December 16, 2017

Final Project

Final Project

My project is designed to detect an approaching object or subject up to 20cm thanks to the Proximity IR detector provided by my 27 Egeloo sensor kit.
Here is a list of what you need: List of items: 
1. WS2812b Neo Pixel LED's 
2. Power supply ( I used a 9V battery to power my Matrix and Uno) and a 22,000mA solar power charger. 
3. 2 10k Resistor 
4.Arduino Uno R3
6. Code: ​ (go to GitHub and download the code, open using the Arduino IDE software)
7. Jumpers and small gauge wires of black(Ground), red(power), and blue(data). They only need to able to support your maximum output/input wattage.
8. A backpack 
9. Soldering Iron/ Solder
After you have tested your Arduino and downloaded the IDE software. (FYI, there are great examples such as Blinky to test your Arduino Uno with built in the downloadable IDE software provided by Arduino). Now its time to test your Neo Pixels. After the test comes back positive you can move on to building your proximity backpack.
You need to cut a piece of Worbla approximately, 4 1/2in W x 6 1/2in H. I choose Worbla because it is a very flexible material and this would come in handy being that my prop is a backpack.
The assembly of the matrix (use the 144/pixels) is pretty straightforward. All you need to do is cut 2" to 2 1/4 inch groupings of the data, power, and ground cables. you need a total of 24 of them because you will use them to connect each section of the strand in order. The 144/pixel will need to be in cut strands of 12 pixels or 2 1/4in long.
Now, the best practice while sodering your sections is to stop and check to see if they are working as you go. Trust me, this will save you a lot of time and heartache. Once your matrix is completed, it's time to test the code again to make sure it works. Success!
Time to build the rest. The 30/pixels are easier to deal with but you have 5 meters of these LED's so good luck. I did not want to trim off my LED's because I was afraid of creating too many broken connections. This is a problem if you do not soder your power, ground or data properly, so take your time and be careful. Check your code one more time to make sure all the connections work and move on to the next step.
I used brass wire to create a wired/electronic look to my backpack. I wanted it to look as much as a machine as possible. I believe that this was a successful approach, but I am considering sewing the 30/pixel LEDs onto the backpack for a clean look.
Time to splice our wires and clean-up our mess. I used a small box to hold my Arduino and 9V battery. I also used twist ties to gather my wires in groups from the front to the back of the backpack. Staying organized is very important when dealing with so many wires. I found myself mixing up wires often. The best practice is to unplug your Arduino and make sure that you are using the correct ports first before adding power.
Splitting a USB cable and pulling only the black and red cable, you can now connect your power cell to your WS2812b 30/pixels. I discovered that the additional ground to the Arduino is not needed when using this build. Only use one ground.
Time for the 144/pixels, so connect the ground, data, and power cable directly to the Arduino for the matrix. This method consumes the life of the 9V quickly, but it gave me the best results. I will try to connect it to the power cell next time.
The proximity IR detector worked successfully with my original code, but I wanted to have more cycles and a brighter experience. I discovered that I did not have enough power available to my LED's to pull this off, so I had to return to my original test code to wrap up this project. I feel that overall this was still a successful experiment and build. I hope much luck to anyone that wants to build there own and be mindful of power draws/requirements that was something that I did not discover to be a big issue until the end. I am posting my final video to show the backpacks full capability. The 9V battery does die during the video, but you will get to see the overall success of my proximity backpack. Thanks and Salute:-)

Friday, December 15, 2017

Testing the WS2812b LEDs

 Testing the WS2812b LEDs

I purchased Involt's WS2812b 144/pixels/1m and the 30/pixels/5m rolls. I was able to test the strips by modifying code provided by the author: 'Dr. D-Flo' Dr. D-Flo has a very informative YouTube Video that explains the entire testing process in detail. I will share a few troubleshooting notes as you continue reading. 

I will share the code used to make the magic happen here in a second. 
Let's start with a supply list.

List of items:

1. WS2812b Neo Pixel LED's
2. Power supply: 9V battery or computer USB port (note the 9V has a life of approximately 15mins)
3.10k Resistor
4.Arduino Uno R3
5. Arduino Uno IDE (download here:

Note: Very important to make your connections on the Arduino first before powering up the board. This will assure the LED's and the Arduino are both grounded and protected from electrical surges.

Next: Let's review the code that we are going to use to test our LED's. Again, thank you Dr. D-Lo.

int buttonpin=3; //define switch pin 
//I will be using a proximity board from Egeloo that will 
//allow me to detect an object by using Infared light reflected off the object that
//triggers the switch. Acting as a button, the proximity will cause the lights 
//to change their pattern or turn them off.
;int  val;//define digital variable val

#include <Adafruit_NeoPixel.h>  // I am using Involt WS2812b 144/pixels/1M and an Involt 30/pixels/5M //strands. This code was used with the Arduino Uno, a 22,000mA Power //Cell, a 9V battery. The maximum voltage for the Arduino and the //Neo Pixels is 5V. The code uses NEO_KHZ800 to regulate power that //worked great for my needs. You can adjust this number to suit your //needs          
#ifdef __AVR__
  #include <avr/power.h>

#define PIN 6

#define NUM_LEDS 294 //I added the numbers of pixels from both types; 1 meter of 144/pixels and 5                          //meters of 30/pixels.

#define BRIGHTNESS 50 //You can adjust this value as needed or change the color values below to control //the light intensity.

Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRBW + NEO_KHZ800); //Change //KHZ here.

byte neopix_gamma[] = {
    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  1,  1,
    1,  1,  1,  1,  1,  1,  1,  1,  1,  2,  2,  2,  2,  2,  2,  2,
    2,  3,  3,  3,  3,  3,  3,  3,  4,  4,  4,  4,  4,  5,  5,  5,
    5,  6,  6,  6,  6,  7,  7,  7,  7,  8,  8,  8,  9,  9,  9, 10,
   10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16,
   17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 24, 24, 25,
   25, 26, 27, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 35, 36,
   37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 50,
   51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68,
   69, 70, 72, 73, 74, 75, 77, 78, 79, 81, 82, 83, 85, 86, 87, 89,
   90, 92, 93, 95, 96, 98, 99,101,102,104,105,107,109,110,112,114,
  215,218,220,223,225,228,231,233,236,239,241,244,247,249,252,255 };

void  setup()
int(strip,OUTPUT);//define LED as a output port
int(buttonpin,INPUT);//define switch as a output port

  strip.begin();; // Initialize all pixels to 'off'

void loop() {
  // Some example procedures showing how to display to the pixels:
  colorWipe(strip.Color(255, 0, 0), 50); // Red
  colorWipe(strip.Color(0, 255, 0), 50); // Green
  colorWipe(strip.Color(0, 0, 255), 50); // Blue
  colorWipe(strip.Color(0, 0, 0, 255), 50); // White



  // fullWhite();
  // delay(2000);



// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, c);;

void pulseWhite(uint8_t wait) {
  for(int j = 0; j < 256 ; j++){
      for(uint16_t i=0; i<strip.numPixels(); i++) {
          strip.setPixelColor(i, strip.Color(0,0,0, neopix_gamma[j] ) );

  for(int j = 255; j >= 0 ; j--){
      for(uint16_t i=0; i<strip.numPixels(); i++) {
          strip.setPixelColor(i, strip.Color(0,0,0, neopix_gamma[j] ) );

void rainbowFade2White(uint8_t wait, int rainbowLoops, int whiteLoops) {
  float fadeMax = 100.0;
  int fadeVal = 0;
  uint32_t wheelVal;
  int redVal, greenVal, blueVal;

  for(int k = 0 ; k < rainbowLoops ; k ++){
    for(int j=0; j<256; j++) { // 5 cycles of all colors on wheel

      for(int i=0; i< strip.numPixels(); i++) {

        wheelVal = Wheel(((i * 256 / strip.numPixels()) + j) & 255);

        redVal = red(wheelVal) * float(fadeVal/fadeMax);
        greenVal = green(wheelVal) * float(fadeVal/fadeMax);
        blueVal = blue(wheelVal) * float(fadeVal/fadeMax);

        strip.setPixelColor( i, strip.Color( redVal, greenVal, blueVal ) );


      //First loop, fade in!
     if(val==HIGH)//when the switch sensor have signal, LED blink



  for(int k = 0 ; k < whiteLoops ; k ++){

    for(int j = 0; j < 256 ; j++){

        for(uint16_t i=0; i < strip.numPixels(); i++) {
            strip.setPixelColor(i, strip.Color(0,0,0, neopix_gamma[j] ) );

    for(int j = 255; j >= 0 ; j--){

        for(uint16_t i=0; i < strip.numPixels(); i++) {
            strip.setPixelColor(i, strip.Color(0,0,0, neopix_gamma[j] ) );



void whiteOverRainbow(uint8_t wait, uint8_t whiteSpeed, uint8_t whiteLength ) {
  if(whiteLength >= strip.numPixels()) whiteLength = strip.numPixels() - 1;

  int head = whiteLength - 1;
  int tail = 0;

  int loops = 3;
  int loopNum = 0;

  static unsigned long lastTime = 0;

    for(int j=0; j<256; j++) {
      for(uint16_t i=0; i<strip.numPixels(); i++) {
        if((i >= tail && i <= head) || (tail > head && i >= tail) || (tail > head && i <= head) ){
          strip.setPixelColor(i, strip.Color(0,0,0, 255 ) );
          strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));

      if(millis() - lastTime > whiteSpeed) {
        if(head == strip.numPixels()){
        lastTime = millis();

      if(loopNum == loops) return;
void fullWhite() {
    for(uint16_t i=0; i<strip.numPixels(); i++) {
        strip.setPixelColor(i, strip.Color(0,0,0, 255 ) );

// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256 * 5; j++) { // 5 cycles of all colors on wheel
    for(i=0; i< strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));

void rainbow(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256; j++) {
    for(i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel((i+j) & 255));

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if(WheelPos < 85) {
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3,0);
  if(WheelPos < 170) {
    WheelPos -= 85;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3,0);
  WheelPos -= 170;
  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0,0);

uint8_t red(uint32_t c) {
  return (c >> 16);
uint8_t green(uint32_t c) {
  return (c >> 8);
uint8_t blue(uint32_t c) {
  return (c);

Make sure that you add your resistor between the Arduino and the LED's to help regulate the electrical current through the data cable.

I was able to test both the 144/pixels and 30/pixels using the same code successfully. 

Thanks, and enjoy.