Dynamic Wireless Decorative Lights

Similar documents
Project Final Report: Directional Remote Control

EE 314 Spring 2003 Microprocessor Systems

νµθωερτψυιοπασδφγηϕκλζξχϖβνµθωερτ ψυιοπασδφγηϕκλζξχϖβνµθωερτψυιοπα σδφγηϕκλζξχϖβνµθωερτψυιοπασδφγηϕκ χϖβνµθωερτψυιοπασδφγηϕκλζξχϖβνµθ

IST TSic Temperature Sensor IC. Technical Notes ZACwire Digital Output

EE445L Fall 2014 Quiz 2A Page 1 of 5

DESCRIPTION DOCUMENT FOR WIFI / BT HEAVY DUTY RELAY BOARD HARDWARE REVISION 0.1

Instruction Sheet UPS SERIES. Serial Control Protocol. I Rev E

B Robo Claw 2 Channel 25A Motor Controller Data Sheet

UART2PPM. User s Guide. Version 2.04 dated 02/20/16. Gregor Schlechtriem

Table of Contents. HWIO-Gateway User Manual

I-7088, I-7088D, M-7088 and M-7088D User Manual

EE445L Fall 2014 Quiz 2A Page 1 of 5

Jaguar Motor Controller (Stellaris Brushed DC Motor Control Module with CAN)

Catalog

B RoboClaw 2 Channel 30A Motor Controller Data Sheet

BlinkRC User Manual. 21 December Hardware Version 1.1. Manual Version 2.0. Copyright 2010, Blink Gear LLC. All rights reserved.

Measuring Distance Using Sound

Brushed DC Motor Control. Module with CAN (MDL-BDC24)

Lab 2.2 Custom slave programmable interface

Figure 1: One Possible Advanced Control System

DESCRIPTION DOCUMENT FOR WIFI SINGLE DIMMER ONE AMPERE BOARD HARDWARE REVISION 0.3

AT-XTR-7020A-4. Multi-Channel Micro Embedded Transceiver Module. Features. Typical Applications

Tarocco Closed Loop Motor Controller

Interfacing Sensors & Modules to Microcontrollers

RPLIDAR A2. Introduction and Datasheet. Low Cost 360 Degree Laser Range Scanner. Model: A2M5 A2M6 OPTMAG. Shanghai Slamtec.Co.,Ltd rev.1.

Course Introduction. Purpose. Objectives. Content 26 pages 4 questions. Learning Time 40 minutes

WTDOT-M. eeder. Digital Output Module. Technologies FEATURES SPECIFICATIONS DESCRIPTION. Weeder Technologies

BV4112. Serial Micro stepping Motor Controller. Product specification. Dec V0.a. ByVac Page 1 of 18

Using Z8 Encore! XP MCU for RMS Calculation

Low Power with Long Range RF Module DATASHEET Description

Home Automation, Inc. Omnistat2. RC-1000 and RC-2000 Communicating Thermostat. Serial Protocol Description

PAK-Vb/c PWM Coprocessor Data Sheet by AWC

I hope you have completed Part 2 of the Experiment and is ready for Part 3.

DS Wire Digital Potentiometer

EVDP610 IXDP610 Digital PWM Controller IC Evaluation Board

RPLIDAR A2. Introduction and Datasheet. Model: A2M3 A2M4 OPTMAG. Shanghai Slamtec.Co.,Ltd rev.1.0 Low Cost 360 Degree Laser Range Scanner

AN ARDUINO CONTROLLED CHAOTIC PENDULUM FOR A REMOTE PHYSICS LABORATORY

DS1621. Digital Thermometer and Thermostat FEATURES PIN ASSIGNMENT

EE445L Fall 2014 Quiz 2B Page 1 of 5

Training Schedule. Robotic System Design using Arduino Platform

Standard single-purpose processors: Peripherals

Radio Module for MHz. Band RMCx4-1 ; RMCx9-1

RC-WIFI CONTROLLER USER MANUAL

Hardware Flags. and the RTI system. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

Pulse-Width-Modulation Motor Speed Control with a PIC (modified from lab text by Alciatore)

WTDIN-M. eeder. Digital Input Module. Technologies FEATURES SPECIFICATIONS DESCRIPTION. Weeder Technologies

CMU232 User Manual Last Revised October 21, 2002

RPLIDAR A3. Introduction and Datasheet. Low Cost 360 Degree Laser Range Scanner. Model: A3M1. Shanghai Slamtec.Co.,Ltd rev.1.

Programming and Interfacing

Hello and welcome to this Renesas Interactive Course that provides an overview of the timers found on RL78 MCUs.

Pololu TReX Jr Firmware Version 1.2: Configuration Parameter Documentation

Directions for Wiring and Using The GEARS II (2) Channel Combination Controllers

Introduction to Using the PIC16F877 Justin Rice IMDL Spring 2002

um-pwm1 Pulse-width Modulation Servo Coprocessor Datasheet Release V100 Introduction Features Applications

Hello, and welcome to this presentation of the FlexTimer or FTM module for Kinetis K series MCUs. In this session, you ll learn about the FTM, its

Cost efficient design Operates in full sunlight Low power consumption Wide field of view Small footprint Simple serial connectivity Long Range

Artifex LIV 110. Laser Diode Characterization System. Engineering

isma-b-w0202 Modbus User Manual GC5 Sp. z o.o. Poland, Warsaw

PIC Functionality. General I/O Dedicated Interrupt Change State Interrupt Input Capture Output Compare PWM ADC RS232

Stensat Transmitter Module

Remote Switching. Remote Gates. Paging.

Cost efficient design Operates in full sunlight Low power consumption Wide field of view Small footprint Simple serial connectivity Long Range

Electric Bike BLDC Hub Motor Control Using the Z8FMC1600 MCU

Houngninou 2. Abstract

DNT2400. Low Cost 2.4 GHz FHSS Transceiver Module with I/O

Controlling DC Brush Motor using MD10B or MD30B. Version 1.2. Aug Cytron Technologies Sdn. Bhd.

Remote Switching. Remote Gates. Paging.

Serial Servo Controller

RPLIDAR A1. Introduction and Datasheet. Low Cost 360 Degree Laser Range Scanner. Model: A1M8. Shanghai Slamtec.Co.,Ltd rev.1.

Programming Parameter Guide

DNT900. Low Cost 900 MHz FHSS Transceiver Module with I/O

RFID Integrated Teacher Monitoring

IST TSic Temperature Sensor IC Application Notes ZACwire Digital Output

School of Engineering Science Burnaby, BC V5A 1S6. November 2, 2009

WiMOD LR Base Plus Firmware

WWVB Receiver/Decoder With Serial BCD or ASCII Interface DESCRIPTION FEATURES APPLICATIONS

Castle Creations, INC.

16 Channels LED Driver

JDY-08 Bluetooth transparent transmission module

DS1075. EconOscillator/Divider PRELIMINARY FEATURES PIN ASSIGNMENT FREQUENCY OPTIONS

HOMANN DESIGNS. DigiSpeed. Instruction manual. Version 1.0. Copyright 2004 Homann Designs.

USER'S MANUAL. Model : K

Embedded Systems and Software

EITF40 Digital and Analogue Projects - GNSS Tracker 2.4

ZKit-51-RD2, 8051 Development Kit

Application Note: Demonstrating CAN with nqbasic

EE 308 Spring S12 SUBSYSTEMS: PULSE WIDTH MODULATION, A/D CONVERTER, AND SYNCHRONOUS SERIAN INTERFACE

Motor Control. CTIO 60 inches CHIRON CHI60HF 8.1

Project Name Here CSEE 4840 Project Design Document. Thomas Chau Ben Sack Peter Tsonev

Course Introduction Purpose: Objectives: Content Learning Time

Roland Kammerer. 13. October 2010

Electronics Design Laboratory Lecture #9. ECEN 2270 Electronics Design Laboratory

High Performance Microstep Systems

Special Sensor Report: CMUcam. David Winkler 12/10/02 Intelligent Machines Design Lab Dr. A. A. Arroyo TAs: Uriel Rodriguez Jason Plew

Preliminary Design Report. Project Title: Search and Destroy

' The PicBasic Pro Compiler Manual is on line at: '

RFBee User Manual v1.0

CALIFORNIA SOFTWARE LABS

IP1 Datasheet PWM OUTPUT WITH SINGLE CHANNEL ADC MODULE FEATURES DESCRIPTION CONNECTOR DETAILS

Channels that are not occupied by temperature sensors, can take over alternative functions:

Transcription:

Dynamic Wireless Decorative Lights John W. Peterson March 6 th, 2008 Updated August 2014 Overview Strings of holiday lights add a nice accent to indoor and outdoor spaces. Many businesses use them to create a festive look. Setting up holiday lights used to be simple. You d get out the lights in December, set them up for the Christmas season, and then take them down early the next year. But the light manufacturers wised up, and started selling lights for every holiday they could think of. In addition to Christmas lights, now we have Valentine s lights (pink, red & white), St. Patrick s day lights (green, of course), red white & blue Independence day lights and Halloween lights in orange (or perhaps a ghoulish purple and green). That s a lot of lights to take up and down. For a large business (say, a big department store) changing all these lights involves a considerable amount of labor. Curilights solves this problem. By using multi-colored LEDs instead of light bulbs, the colors are programmed on the fly. And by using the Lantronix MatchPort b/g Wireless Embedded Device server, no additional network wiring is necessary to control the lights you just broadcast the desired pattern to change it as often as you like. Design Overview Figure 1 below shows an overall block diagram of the system. Each LED has an associated PIC microcontroller (MCU) driving it. All of the LED / MCU pairs are connected to a three wire bus with power (+5V / GND) and a serial data channel. The start of this serial daisy-chain is connected to one of the serial output ports of the MatchPort b/g. Curilights J. Peterson 1

Curilights J. Peterson Page 2 RGB LED PIC MPU Serial I/O 3.3v 5v Power Supply GND Figure 1 - System Block Diagram At first it may seem like overkill to have a microcontroller dedicated to each LED, but this design has a lot of advantages. First, because the data is encoded serially, only three wires are needed to connect the string of lights. Trying to control that may color LEDs from a central location otherwise requires a large number of wires (each LED requires four). The local storage and programmability of the microcontroller enables advanced applications such as animating the lights. And the MCU provides excellent facilities for managing the current drive required by the LEDs. The serial output from the MatchPort b/g is fed to the input of the first LED s MCU. The output of this goes to the input of the second, and so on in a daisychain fashion. This structure makes it easy to uniquely identify each MCU, without the overhead of custom programming each MCU (see below). A power supply converts AC power into the 3.3v required by the MatchPort b/g and the 5v used by the MCU/LED string. Hardware For the prototype, the 14-pin Microchip PIC16F688 microcontroller was chosen. Although in theory it s possible to use an eight pin MCU such as the PIC12F series or the Atmel AVRtiny, the larger MCU has a couple of useful features. First, it has an on-board UART hardware for transmitting and receiving serial data. This enormously simplifies the software and timing for serial

Curilights J. Peterson Page 3 communications. Second, the additional memory on board eases the protocol implementation and enables features like animation. Figure 2 - Photo of the prototype Curilights system Figure 3 - Close-up of the MCU/LED light

Curilights J. Peterson Page 4 Each light has just the MCU, LED and circuit board, no other hardware is required. The current limiting resistors typically associated with LEDs are avoided by using pulse-width modulation to keep the average current draw per LED below the 20mA rated maximum. Doing this in software adds little overhead and saves dozens of components in the finished product. The MCUs only draw 250µA, a tiny fraction of the 75-80mA used by a fully lit RGB LED. U3 1 V+ 2 RA5 3 RA4 4 MCLR 5 RX 6 TX 7 RC3 GND RA0 14 RA1 13 RA2 12 RC0 11 RC1 10 RC2 9 8 PIC16F688 1 R 4 G 3 B C 2 U1 1 V+ 2 RA5 3 RA4 4 MCLR 5 RX 6 TX 7 RC3 GND RA0 14 RA1 13 RA2 12 RC0 11 RC1 10 RC2 9 8 PIC16F688 1 R 4 G 3 B C 2 U2 1 V+ 2 RA5 3 RA4 4 MCLR 5 RX 6 TX 7 RC3 GND RA0 14 RA1 13 RA2 12 RC0 11 RC1 10 RC2 9 8 PIC16F688 Figure 4 - Light String Schematic 1 R 4 G 3 B C 2 Because the MCU s UART implements the standard 9600 baud serial protocol, no additional hardware is necessary to connect the MatchPort b/g to the string of lights the MatchPort simply transmits the same protocol the lights use to communicate with each other.

Curilights J. Peterson Page 5 Software There are two major pieces of software for this project, the low-level microcontroller code and the high level host software. Let s look at the microcontroller first. The MCU has two functions: driving the LEDs and interpreting the protocol on the serial line. After initialing the MCU s configuration registers, the MCU software enters the main loop controlling the LED s with pulse-width modulation (PWM). For each color LED, a variable keeps track of it s on duty cycle. When the PWM counter exceeds this value, the LED is shut off. When the counter reaches it s maximum, it s reset and the process starts over. The LEDs are strobed at approximately 1000Hz. The control protocol allows four brightness levels for each of the red, green and blue LEDs, ranging from 0 (off) to 3 (maximum brightness). The maximum brightness is not 100% on, but instead is a percentage found to keep the average current draw of the LED at a safe level (below 20ma) and to keep the output of the LEDs balanced, so 3,3,3 approximates white. Getting this right requires some trial and error to find the appropriate values. Red Green Blue { { { X X 0 1 1 0 1 1 7 6 5 4 3 2 1 0 0 1 2 3 Red 0 1 30 85 Green 0 1 20 105 Blue 0 1 20 80 { PWM Count Figure 5 - Table used to convert color byte into PWM count values The PWM counter value for each of the four levels (for each LED) is kept in a table. The protocol specifies a color as the lower six bits of a single byte, where bits 5:4 specify the red brightness, bits 3:2 specify green, and 1:0 specify blue. Software on the MCU unpacks these bit fields and uses them as an index into the table to find the proper PWM count value. When new color values are received, a flag is set to tell the PWM loop to unpack and use the new values. The MCU fires an interrupt when a character is received on the serial port. The interrupt service routine (ISR) implements a simple state machine to interpret the protocol commands.

Curilights J. Peterson Page 6 Serial Protocol The protocol has a simple format. The first byte is a command, followed by up to three parameters. Each of the parameters within angle brackets is a single byte; <color> is the six bit color specification described above, <ID> is the number (starting from zero) of the MCU/LED light. Name Specification Description Init I<ID> Sets the IDs of this and subsequent lights Color C<ID><color> Sets LED at <ID> to <color> Frame F<ID><frame ><color> Sets <frame > of LED <ID> to <color> Step S Steps one forward in the animation Time T<ticks> Sets the duration of each animation step Run R Starts the animation at frame 0 Halt H Stops the animation Number N<count> Broadcasts the light count The Init command is given as I<0> to the first light. This sets the ID of the first light to zero. This light then increments the ID, and sends that to the next light, giving that one an ID of one. The light after that gets an ID of 2, etc. This way the lights are all given unique IDs. When a command with an <ID> parameter is sent, each light compares the <ID> in the command with the ID assigned by the Init command. If a command doesn t apply to this particular LED, the MCU rebroadcasts the command on the serial output port, where it s fed to the receiver of the next light s MCU. Some commands, such as Time, Run and Halt, are only run on the light with ID zero. Animation 1 Several frames of different color values may be stored on each light via the Frame command. The first light in the string (with ID = 0) takes care of sending out the Step commands to advance the lights to the next frame at regular intervals to produce animated effects. This is controlled by the Time, Run and Halt commands. Since the Step command must propagate from light to light, the following scheme is used to synchronize the animation. First, the Number command is used to broadcast the total number of lights to all the MCUs in the string. When the first light in the string (light 0) begins a frame, it immediately sends a Step command to the other lights, but delays for the number of lights times 2ms (the time to receive and send a step command) before actually changing the light color, to give the command time to propagate down the string. Each subsequent 1 The animation feature is designed but not fully implemented in the prototype.

Curilights J. Peterson Page 7 light delays for (N - ID) * 2ms, and the last light changes as soon as it receives the S command; this way all the lights change their colors at the same time. Host Software On the host side, the lights are easily controlled by a short program with access to TCP/Sockets. The host first initializes the lights by sending the I<0> command, so the lights give themselves unique IDs. Because the lights are controlled over the network, it makes a natural web application tool. A simple Python script for controlling the lights is included as an appendix. Fabrication The current prototype implements a string of four LEDs, these are connected directly to the MatchPort b/g Demonstration board. Each MCU/LED pair was assembled on a small piece of perfboard. The TXD1 output of the MatchPort b/g is connected directly to the serial input of the first light s MCU. A MAX756 based boost regulator was added to the Demonstration board to convert its 3.3v power to the 5v supply used by the string of lights. For a finished product, the MCU and LED could easily be molded into a small plastic shell. MCUs like the PIC16F688 are available in very small surface mount packages. A control box at one end would house the power supply and the Lantronix MatchPort b/g. A simple configuration port may also be desirable to enable configuring the MatchPort. The technology is well suited to strings of about 25 lights. Although the protocol supports up to 127 lights, beyond 50 or more, the animation speed becomes limited because of the required serial propagation time. This can be mitigated by using the same MatchPort b/g to control two separate strings of lights on the two separate serial ports provided. Care must be taken to ensure adequate power is supplied; each LED uses up to 80mA, so a 50 light string uses approximately four amps at 5V (20 watts). Conclusion Curilights is a design capable of revolutionizing the way decorative lights are used, opening many new creative possibilities in both interior and exterior design. By using the Lantronix MatchPort wireless technology, these lights may be deployed anywhere existing lights are with no additional network wiring.

Curilights J. Peterson Page 8 Sample Host Control Script!/usr/bin/python Simple Python script to demo controlling Curilights from a TCP host. Project WDC143 import socket, time Must be changed to the IP address of your Curilights LtxHost = '192.168.0.121' LtxSerialPort = 10001 def opencurilights(): s = socket.socket(socket.af_inet, socket.sock_stream) s.connect((ltxhost, LtxSerialPort)) return s Send a command to the light string def sendcommand( ltxsock, cmd, id = None, arg2=none, arg3=none): msg = cmd; if (id!= None): msg += chr(id) if (arg2!= None): msg += chr(arg2) if (arg3!= None): msg += chr(arg3) ltxsock.sendall(msg) Set the colors of the lights. Each color is assumed to be a three digit integer, where each digit is between 0..3, and the digits correspond to RGB respectively. Thus 300 would be full on red, and 001 would be blue, and 333 full bright white. When you pass a list like [300, 30, 3], the first number controls light 0, the next 1, etc. Note: do *NOT* write numbers with a leading zero, or else Python will interpret them as being in octal! (i.e., "010" ==> 8) def setcolors(ltx, colorlist, sleeptime = 0): def colortochar(color): r = color/100 g = (color % 100) /10 b = color % 10 return (r << 4) (g << 2) b i = 0 for c in colorlist: sendcommand(ltx, 'C',i, colortochar(c) ) i += 1 time.sleep(sleeptime)

Curilights J. Peterson Page 9 def CurilightTest(): ltxsocket = opencurilights() sendcommand( ltxsocket, 'I', 0 ) setcolors(ltxsocket, [0, 0, 0, 0]) setcolors(ltxsocket, [111, 111, 111, 111], 1) setcolors(ltxsocket, [ 30, 30, 30, 30], 1) setcolors(ltxsocket, [300, 300, 300, 300], 1) setcolors(ltxsocket, [ 11, 11, 11, 11], 1) setcolors(ltxsocket, [300, 30, 300, 30], 1) setcolors(ltxsocket, [222, 3, 222, 3], 1) setcolors(ltxsocket, [111, 111, 111, 111], 1) ltxsocket.close() CurilightTest() def RotationTest(): ltxsocket = opencurilights() sendcommand( ltxsocket, 'I', 0 ) speed = 0.15 for i in range(0,10): setcolors(ltxsocket, [300, 3, 3, 3], speed) setcolors(ltxsocket, [ 3, 300, 3, 3], speed) setcolors(ltxsocket, [ 3, 3, 300, 3], speed) setcolors(ltxsocket, [ 3, 3, 3, 300], speed) setcolors(ltxsocket, [ 3, 3, 300, 3], speed) setcolors(ltxsocket, [ 3, 300, 3, 3], speed) ltxsocket.close() RotationTest()