제조공정
| 제린스 실드 (Zerynth Shield) | 1개 |
| 아두이노 듀 (Arduino Due) | 1개 |
| STM32 Nucleo ST NUCLEO | 1개 |
| 파티클 포톤 (Particle Photon) | 1개 |
| UDOO DUAL | 1개 |
| Adafruit 네오픽셀 (NeoPixel) LED 스트립/링 | 1개 |
저전력 무선 표준과 초소형 저가 LED, 센서, 통신 모듈의 결합으로 스마트 조명이 IoT와 홈 오토메이션의 촉매제가 되었습니다.
이 튜토리얼에서는 제린스 앱으로 네오픽셀 LED 스트립을 모바일 제어하는 방법을 다룹니다. 앱에는 컬러 피커와 사전 구성 애니메이션 선택 메뉴가 표시됩니다.



제린스 사용법은 아주 간단합니다!
전원 켜면 미리 설정한 네트워크에 자동 연결. 제린스 앱 실행 → 네트워크상 제린스 오브젝트 검색 → 'Zerynth Lamp' 선택 → 컬러 피커와 애니메이션 메뉴로 제어 가능.
코드는 주석이 풍부해 이해하기 쉽습니다. 문의/제안은 제린스 커뮤니티 포럼에 남겨주세요.

제린스 실드에는 터치 감지, 적외선 LED, 마이크, 조도 센서, 온도 센서 등 다양한 센서/액추에이터가 있습니다. 이 예제를 기반으로 원하는 동작을 개발해 보세요!
Luigi F. Cerfeda (@L_F_Cerfeda) - 제린스 팀
################################################################################
# Zerynth Lamp
# Created by Zerynth Team 2015 CC
# Authors: G. Baldi, D. Mazzei
################################################################################
import streams
from bcm43362 import bcm43362 as wifi_driver
from wireless import wifi
import animation
from toishield import toishield
from zerynthapp import zerynthapp
streams.serial()
# Wi-Fi 연결
try:
wifi_driver.auto_init()
print("Establishing Link...")
wifi.link("SSID", wifi.WIFI_WPA2, "password")
print("Ok!")
except Exception as e:
print(e)
# template.html을 보드 플래시에 저장
new_resource("template.html")
#### ZerynthApp 설정
# JavaScript → Python 콜백 함수들
def change_color(r, g, b):
animation.setup_color(r, g, b)
def change_animation(n):
animation.setup_anim(n)
def change_speed(n):
animation.setup_anim_speed(n)
# 앱 구성: 이름, 설명, 템플릿 URL
vp = zerynthapp.ZerynthApp("Zerynth Lamp", "Try me!", "resource://template.html")
# JS 이벤트 발생 시 해당 파이썬 함수 호출
vp.on("change_color", change_color)
vp.on("change_animation", change_animation)
vp.on("change_speed", change_speed)
# 앱 실행 (별도 스레드 시작)
vp.run()
# vp.run()이 스레드를 시작하므로 여기서 다른 작업 가능
# LED 제어 시작
animation.start(D6, 24)
<html>
<head>
<zerynth/> <zerynth-jquery/> <zerynth-jquery-mobile/> <zerynth-jqwidgets/>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div data-role="page">
<div data-role="header"><h1>Zerynth Lamp</h1></div>
<div role="main" class="ui-content" style="text-align:center">
<div style="margin: 3px; float: left;" id="dropDownButton">
<div style="padding: 3px;">
<div id="colorPicker"></div>
</div>
</div>
<button class="ui-btn ui-btn-inline ui-shadow" onclick="ZerynthApp.call('change_color',cur_color.r,cur_color.g,cur_color.b)">Colorize!</button>
<form>
<div data-role="fieldcontain">
<label for="animselect">Animation:</label>
<select name="animselect" id="animselect">
<option value="0">Little Snakes</option>
<option value="1">Spinner</option>
<option value="2">Rainbow</option>
<option value="3">Pulse</option>
</select>
</div>
</form>
<form>
<label for="speedslider">Animation Speed:</label>
<input type="range" name="speedslider" id="speedslider" data-highlight="true" min="0" max="100" value="50">
</form>
</div>
<div data-role="footer">Powered by Zerynth (www.zerynth.com)</div>
</div>
<script>
var cur_color = {r: 0x54, g: 0x9a, b:0x97};
function getTextElementByColor(color) {
if (color == 'transparent' || color.hex == "") {
return $("<div style='text-shadow: none; position: relative; padding-bottom: 2px; margin-top: 2px;'>transparent</div>");
}
var element = $("<div style='text-shadow: none; position: relative; padding-bottom: 2px; margin-top: 2px;'>#" + color.hex + "</div>");
var nThreshold = 105;
var bgDelta = (color.r * 0.299) + (color.g * 0.587) + (color.b * 0.114);
cur_color.r = color.r; cur_color.g = color.g; cur_color.b = color.b;
var foreColor = (255 - bgDelta < nThreshold) ? 'Black' : 'White';
element.css('color', foreColor);
element.css('background', "#" + color.hex);
element.addClass('jqx-rc-all');
return element;
}
$(document).ready(function () {
console.log("ready!")
$("#colorPicker").on('colorchange', function (event) {
$("#dropDownButton").jqxDropDownButton('setContent', getTextElementByColor(event.args.color));
});
$("#colorPicker").jqxColorPicker({ color: "5a9a97", colorMode: 'saturation', width: 220, height: 220});
$("#dropDownButton").jqxDropDownButton({ width: 150, height: 22});
$("#dropDownButton").jqxDropDownButton('setContent', getTextElementByColor(new $.jqx.color({ hex: "549a97" })));
ZerynthApp.jquerymobile_scalecontent();
$("#animselect").change(function() {
ZerynthApp.call('change_animation',parseInt($('#animselect').val()));
});
$("#speedslider").on('slidestop',function() {
ZerynthApp.call('change_speed',parseInt($('#speedslider').val()));
});
});
</script>
</body>
</html>
################################################################################
# Zerynth Lamp - 애니메이션 함수들
# Created by Zerynth Team 2015 CC
# Authors: G. Baldi, D. Mazzei
################################################################################
from neopixel import ledstrips as neo
import threading
lock = threading.Lock()
color = [0x54,0x9a,0x97] # 제린스 기본 색상
anim = 0
anim_speed = 50
leds = None
layer0 = None
layer1 = None
layer2 = None
npins = 0
stopped = False
stopcolor = [0xff,0xff,0xff]
# 부드러운 애니메이션용 계수 (반 사인파)
animation_coefficients = [
0, 0.2588190451, 0.5, 0.7071067812, 0.8660254038, 0.9659258263,
1, 0.9659258263, 0.8660254038, 0.7071067812, 0.5, 0.2588190451
]
rainbow = [
(0xff,0x00,0x00), (0xff,0x7f,0x00), (0xff,0xff,0x00),
(0x00,0xff,0x00), (0x00,0x00,0xff), (0x4b,0x00,0x82), (0x8f,0x00,0xff)
]
def setup_anim(n):
global layer0,layer1,layer2,anim
lock.acquire()
leds.clear(); layer2.clear(); layer0.clear(); layer1.clear()
n = n % 4
if n == 0: # Little Snakes
layer0[0]=(100,0,0); layer0[1]=(100,0,0); layer0[2]=(100,0,0)
layer1[0]=(0,100,0); layer1[1]=(0,100,0); layer1[2]=(0,100,0)
elif n == 1: # Spinner
for x in range(npins//2):
layer0[x]=(100//(2*x+1),0,0)
layer1[npins-x-1]=(0,100//(2*x+1),0)
layer2.clear()
elif n == 2: # Rainbow
layer1.clear()
pstep = 0
for x in range(npins):
step = x * len(rainbow) / npins
rx = (rainbow[int(step)][0] + rainbow[int(pstep)][0]) // 4
gx = (rainbow[int(step)][1] + rainbow[int(pstep)][1]) // 4
bx = (rainbow[int(step)][2] + rainbow[int(pstep)][2]) // 4
layer0[x] = (rx, gx, bx)
pstep = step
elif n == 3: # Pulse
layer0.clear(); layer1.clear()
anim = n
lock.release()
def setup_anim_speed(n):
global anim_speed
anim_speed = n
def setup_color(r,g,b):
global color
color[0]=r; color[1]=g; color[2]=b
# 배경 애니메이션 스레드
def animate_background(delay):
global color
step = 0
while True:
if (anim == 3 or anim == 0) and not stopped:
lock.acquire()
layer2.setall(int(color[0]*animation_coefficients[step]/2),
int(color[1]*animation_coefficients[step]/2),
int(color[2]*animation_coefficients[step]/2))
lock.release()
step += 1
if step >= len(animation_coefficients): step = 0
else:
lock.acquire()
layer2.clear(); layer2.setall(stopcolor[0],stopcolor[1],stopcolor[2])
lock.release()
sleep(delay + 500 - 5*anim_speed)
# 전경 애니메이션 스레드
def animate_foreground(delay):
while True:
if not stopped:
lock.acquire()
if anim == 0:
layer0.lshift(); layer1.rshift()
elif anim == 1:
layer0.rshift(); layer1.rshift()
elif anim == 2:
layer0.rshift(); layer1.rshift()
elif anim == 3:
layer0.lshift(); layer1.lshift()
lock.release()
else:
lock.acquire()
layer0.clear(); layer1.clear()
lock.release()
sleep(delay + 100 - anim_speed)
def start(pin, numpins):
global leds, layer0, layer1, layer2, npins
npins = numpins
leds = neo.LedStrip(pin, numpins)
layer0 = neo.LedStrip(pin, numpins)
layer1 = neo.LedStrip(pin, numpins)
layer2 = neo.LedStrip(pin, numpins)
setup_anim(0)
setup_anim_speed(50)
thread(animate_background, 500)
thread(animate_foreground, 50)
while True:
leds.clear()
lock.acquire()
leds.merge(layer0)
leds.merge(layer1)
leds.merge(layer2, neo.first_color) # 투명(0,0,0)인 곳에만 배경 합성
lock.release()
leds.on()
sleep(50)
def stop(r,g,b):
global stopped, stopcolor
stopcolor[0]=r; stopcolor[1]=g; stopcolor[2]=b
stopped = True
def resume():
global stopped
stopped = False
setup_anim(anim)

제조공정
부품 및 소모품 부품 수량 Arduino UNO 1 PIR 모션 센서 (일반) 1 Espressif ESP8266 ESP-01 (WiFi 모듈) 1 스피커: 0.25W, 8옴 1 SparkFun 서보 - 일반 메탈 기어 (마이크로 사이즈) 1 앱 및 온라인 서비스 circuito.io - 회로 설계 및 코드 생성을 위한 매직 링크 제공 Freeboard.io - 모바일 제어용 대시보드 생성 프로젝트 소개 이 IoT 펫 피더는 circuito.io를 사용한 첫 번째 IoT 프로젝트입니다. cir
DIY LED 램프 키트는 집이나 전자 학습을 위한 완벽한 프로젝트입니다. 이 LED 램프 키트는 환경 친화적이고 에너지 효율적이며 주택 소유자가 전기 요금을 절약하는 데 도움이 됩니다. 이러한 특성 덕분에 LED 조명은 점점 더 인기를 얻고 있습니다. LED 램프는 스스로 전원을 켤 수 없습니다. 회로가 그 일을 해야 합니다. LED 키트 만들기는 배우기 쉽습니다. 이 기사를 읽고 나면 회로 기능이 어떻게 작동하여 LED 램프에 전원을 공급하는지 알게 될 것입니다. 또한 이 가이드는 납땜을 통해 모든 것을 조립하는 데 필요한 단계