Things used in this project

Hardware components:
102110017%206
MediaTek Labs LinkIt Smart 7688 Duo
×1
Neopixel strip
NeoPixel strip
×2
Panasonic eca 1em102
Capacitor 1000 µF
×1
Mfr 25fbf52 475r sml
Resistor 475 ohm
×2
Adafruit industries ada592 image 75px
USB-A to Micro-USB Cable
×1
Power Supply 5V/40A
×1
Software apps and online services:
Ide web
Arduino IDE
Vs2015logo
Microsoft Visual Studio 2015
PuTTY
WinSCP

Schematics

Project Overview
Highlevel Overview of the used components
Kym93nglc3asd9qf35aj
Wiring Setup
How the hardware components are connected
Luim20kwo8urxpm5l9qv

Code

Arduino SketchArduino
#include <Adafruit_NeoPixel.h>

#define PIN1 2
#define PIN2 3
const int numPixels1 = 240;
const int numPixels2 = 240;
Adafruit_NeoPixel strip1;
Adafruit_NeoPixel strip2;

int countPixel = 0;
int countVal = 0;
byte r = 0;
byte g = 0;
byte b = 0;
byte w = 0;
int p = 0;
bool isOn = false;
byte command = 0;
bool isCommand = false;

void setup()
{
  strip1 = Adafruit_NeoPixel(numPixels1, PIN1, NEO_GRBW + NEO_KHZ800);
  delay(100);
  strip2 = Adafruit_NeoPixel(numPixels2, PIN2, NEO_GRBW + NEO_KHZ800);
  delay(100);
  // start serial port and wait for port to open:
  Serial.begin(115200);
  Serial1.begin(115200);
  strip1.setBrightness(255);
  strip1.begin();
  strip1.show(); // Initialize all pixels to 'off'
  strip2.setBrightness(255);
  strip2.begin();
  strip2.show(); // Initialize all pixels to 'off'
}

void fadeIn()
{
  isOn = true;
  for(int j = 0; j<=51; j++)
  {
    for(int i = 0; i<numPixels1; i++)
    {
      strip1.setPixelColor(i, 0, 0, 0, 5*j);
      strip2.setPixelColor(i, 0, 0, 0, 5*j);
    }
    strip1.show();
    strip2.show();
    delay(15);
  }
}

void fadeOut()
{
  isOn = false;
  for(int j = 51; j>=0; j--)
  {
    for(int i = 0; i<numPixels1; i++)cxdswq1
    {
      strip1.setPixelColor(i, 0, 0, 0, 5*j);
      strip2.setPixelColor(i, 0, 0, 0, 5*j);
    }
    strip1.show();
    strip2.show();
    delay(15);
  }
}

void fire()
{
    int r = 255;
    int g = r-60;
    int b = 20;
    for(int x = 0; x <numPixels1; x++)
    {
    int flicker = random(0,150);
    int r1 = r-flicker;
    int g1 = g-flicker;
    int b1 = b-flicker;
    if(g1<0) g1=0;
    if(r1<0) r1=0;
    if(b1<0) b1=0;
    strip1.setPixelColor(x,r1,g1, b1,0);
    strip2.setPixelColor(x,r1,g1, b1,0);
    }
    strip1.show();
    strip2.show();
    delay(random(10,20));
}

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< strip1.numPixels(); i++) {
      strip1.setPixelColor(i, Wheel(((i * 256 / strip1.numPixels()) + j) & 255));
      strip2.setPixelColor(i, Wheel(((i * 256 / strip2.numPixels()) + j) & 255));
    }
    strip1.show();
    strip2.show();
    delay(wait);
  }
}

// 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 strip1.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  }
  if(WheelPos < 170) {
    WheelPos -= 85;
    return strip1.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
  WheelPos -= 170;
  return strip1.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}
void handleCommand(byte Command, byte Value)
{
  switch(Command)
  {
    //Toggle
    case 1:
      isCommand = false;
      command = 0;
      if(isOn)
      {
        fadeOut();
      }
      else
      {
        fadeIn();
      }
      break;
    //Turn on  
    case 2:
      isCommand = false;
      command = 0;
      fadeIn();
      break;
    //Turn off
    case 3:
      isCommand = false;
      command = 0;
      fadeOut();
      break;
  }
}
void loop()
{ 
  if (Serial1.available()>0)
  {
    int value = Serial1.read();
    if(value == 255 && command == 0)
    {
      isCommand = true;
    }
    else if(isCommand && command == 0)
    {
      command = value;
    }
    else
    {
      handleCommand(command, value);
    }
  }
}
Python ScriptPython
#!/usr/bin/python
import serial 
import time 
import socket
import sys

# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

# Bind the socket to the port
server_address = ('10.0.3.13', 8077)
print >>sys.stderr, 'starting up on %s port %s' % server_address
sock.bind(server_address)

s = None 
def setup(): 
	global s 
# open serial COM port to /dev/ttyS0, which maps to UART0(D0/D1)
# the baudrate is set to 921600 and should be the same as the one
# specified in the Arduino sketch uploaded to ATMega32U4.
	s = serial.Serial("/dev/ttyS0", 115200) 
if __name__ == '__main__': 
	setup() 
while True:
    print >>sys.stderr, '\nwaiting to receive message'
    data, address = sock.recvfrom(4096)
    
    print >>sys.stderr, 'received %s bytes from %s' % (len(data), address)
    print >>sys.stderr, data
    for x in data:
        s.write(x);
    
#    if data:
#        sent = sock.sendto(data, address)
#        print >>sys.stderr, 'sent %s bytes back to %s' % (sent, address)
C# ClientC#
using System.Net.Sockets;

namespace phigax.Connector.NeoPixel
{
    public class NeoPixelConnector
    {
        UdpClient _client;
        public NeoPixelConnector()
        {

            _client = new UdpClient();
            _client.DontFragment = true;
            _client.Connect("10.0.3.13", 8077);
        }

        public void Toggle()
        {
            byte[] data = new byte[] { 255, 1, 0 };
            _client.Send(data, 3);
        }

        public void TurnOn()
        {
            byte[] data = new byte[] { 255, 2, 0 };
            _client.Send(data, 3);
        }

        public void TurnOff()
        {
            byte[] data = new byte[] { 255, 3, 0 };
            _client.Send(data, 3);
        }
    }
}
Startup scriptBatchFile
#!/bin/sh /etc/rc.common

SCRIPT_NAME="Neopixel Script"
SCRIPT_PATH="/root/Jarvis.Linkit.Server.py"
LOG_FILE="/root/neopixel.log"
 
START=99
STOP=99
 
start() {        
        echo "Starting $SCRIPT_NAME"
        $SCRIPT_PATH >> $LOG_FILE 2>&1 &
}                 
 
stop() {          
        echo "Stopping $SCRIPT_NAME"
	killall `basename $SCRIPT_PATH`
}

Credits

Philippe
Philippe Gackstatter

maker noob and home automation enthusiast

Contact
Thanks to Tweaking4all.

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Linkit One: Blowing an LED
Intermediate
  • 954
  • 27

Full instructions

In this tutorial I Will show you how to turn on an led with your mouth. The Led will turn on when start to blow the sound sensor.

Linkit One: Water Level Indicator
Intermediate
  • 1,063
  • 26

In this project we will learn on making water level indicator using linkit one. This project could help you save water more efficiently.

Understanding LinkIt ONE ScanNetworks
Intermediate
  • 900
  • 18

Protip

I found a sketch called "ScanNetworks" in the LWiFi library and decided to give it a try.

Vertical Hydroponic Farm
Intermediate
  • 30,843
  • 197

Work in progress

IoT Enabled Hydroponic Farm

Creating the Tweeting Viking Hat
Intermediate
  • 1,004
  • 20

Full instructions

I made a tweeting viking hat to show off that anyone could hear iBeacons.

Home Smart Home
Intermediate
  • 39,120
  • 152

Full instructions

Smart home system using MediaTek Linkit, Xbee, Arduino, Orange PI and Azure

Add projectSign up / Login