산업 제조
산업용 사물 인터넷 | 산업자재 | 장비 유지 보수 및 수리 | 산업 프로그래밍 |
home  MfgRobots >> 산업 제조 >  >> Manufacturing Technology >> 제조공정

IoT 주변 조명:제린스 램프

구성품 및 소모품

제린스 방패
× 1
Arduino Due
× 1
STM32 Nucleo ST NUCLEO
× 1
입자 광자
× 1
UDOO DUAL
× 1
Adafruit NeoPixel
× 1

앱 및 온라인 서비스

제린스 스튜디오
Zerynth 앱

이 프로젝트 정보

저전력 무선 표준과 저비용, 초소형 LED, 센서 및 통신 장치가 결합되면서 스마트 조명은 사물 인터넷 및 홈 자동화를 위한 촉매제가 되었습니다.

이 튜토리얼에서는 Zerytnh 앱을 사용하여 모바일을 통해 NeoPixel LED 스트립을 제어하는 ​​방법을 살펴보겠습니다. Zerytnh 앱은 색상 선택기와 다양한 사전 구성된 애니메이션 선택을 위한 메뉴를 보여줍니다.

1단계:필수 자료

프로젝트에는 몇 가지 요소가 필요합니다.

<울>
  • 제린스 스튜디오 :클라우드 동기화 및 보드 관리 기능을 갖춘 다중 플랫폼 및 브라우저 기반 Python 개발 환경입니다. 어떤 OS를 사용하든 Zerynth는 실행됩니다! Zerynth를 다운로드하여 설치하십시오(http://www.zerynth.com/zerynth-studio/).
  • <울>
  • Zerynth 앱: 스마트 개체 및 IoT 시스템을 위한 Zerynth 모바일 인터페이스. 모든 모바일은 개체 디스플레이 및 원격 컨트롤러가 됩니다. 다운로드:http://www.zerynth.com/zerynth-app/
  • <울>
  • 제린스 방패 (여기에서 사용 가능:https://store.open-electronics.org/index.php?_route_=Shield_ZERYNTH&search=toi ). 일상 생활의 사물에 스마트 기능을 추가하는 즉시 사용 가능한 멀티 센서 보드
  • <울>
  • Arduino DUE 또는 ST Nucleo F401RE 또는 ParticlePhoton . 또는 UDOO 또는 뒤집고 자르기 Mikroelektronika 작성 . 어떤 보드를 사용하든 Zerynth는 멀티 보드와 호환됩니다! 지원되는 모든 보드 세부 정보는 http://www.zerynth.com/zerynth-studio/
  • 에서 찾을 수 있습니다. <울>
  • Wi-Fi 모듈이 내장된 Particle Photon을 사용하지 않는 경우 wi-fi 실드와 같이 보드를 웹에 연결하는 요소가 필요합니다. Adafruit . 그러나 Wi-Fi 칩 CC3000 Texas Instruments를 장착하는 다른 어댑터를 사용할 수 있습니다. (http://www.ti.com/product/cc3000).
  • <울>
  • NeoPixel 스트립(또는 링) Adafruit의 LED (여기 https://www.adafruit.com/products/1426에서 사용 가능)
  • <울>
  • 유리 또는 3D 인쇄 램프 . 선택은 여러분의 몫입니다.
  • 2단계:조립

    <울>
  • wifi Shield와 Zerynth Shield를 Arduino(또는 ST Nucleo 또는 UDOO)에 연결하기만 하면 됩니다. Particle Photon을 사용하는 경우 Zerynth Shield의 전용 커넥터에 연결하기만 하면 됩니다.
  • <울>
  • Zerynth Shield의 관련 포트에 NeoPixel LED를 연결합니다.
  • <울>
  • 모든 보드와 LED를 램프에 넣습니다.
  • 3단계:프로그래밍

    Zerynth를 사용하는 것은 매우 쉽습니다!

    <울>
  • 보드 연결 및 "가상화"(이미 설명된 http://bit.ly/Hackster-VIPER-Themin)
  • <울>
  • Zerynth에서 새 프로젝트를 만듭니다(http://bit.ly/Hackster-IoT-Notes-Printer에서 이미 설명). 주의:main.py, animation.py, template.html(및 project.md)의 3개(+1) 파일을 만들어야 합니다.
  • <울>
  • 게시된 코드 복사
  • <울>
  • 보드의 코드를 업링크하면 완료됩니다!
  • 램프를 켜면 미리 설정된 네트워크에 자동으로 연결됩니다.

    그런 다음 네트워크에 연결된 Zerynth 개체를 검색할 Zerynth 앱을 열고 관심 개체(이 경우 "Zerytnh Lamp")를 선택하면 상호 작용할 수 있습니다. 이 경우 Zerynth 앱은 미리 구성된 다양한 애니메이션을 선택할 수 있는 색상 선택기와 메뉴를 보여줍니다.

    코드는 매우 간단하고 많은 주석이 있습니다. 질문이나 제안 사항이 있으면 Zerynth 커뮤니티 포럼에 자유롭게 게시하십시오. http://community.zerynth.com/

    4단계:IoT를 더 밝게 만드세요!

    마음에 드셨나요? 하드코어하자!

    Zerynth Shield는 터치 감지용 센서, 적외선 LED, 마이크, 광 센서 및 온도 센서를 포함한 센서 및 액추에이터 세트를 제공합니다. 이 매우 간단한 예제 코드에서 시작하여 원하는 동작을 개발할 수 있습니다. Zerynth Shield를 사용하여 램프의 기능을 확장하세요!

    Luigi F. Cerfeda(@L_F_Cerfeda) - Zerynth 팀

    <섹션 클래스="섹션 컨테이너 섹션 축소 가능" id="코드">

    코드

    <울>
  • 메인.py
  • 템플릿.html
  • animation.py
  • main.py파이썬
    <사전>################################################# ################################### Zerynth Lamp## Created by Zerynth Team 2015 CC# Authors:G. Baldi , 디 마제이############################################### ################################### 필요한 모듈 가져오기 toishield# 및 zerynthapp 모듈에서 zerynthapp 가져오기 import zerynthappstreams.serial()# wifi 네트워크에 연결:wifi_driver.auto_init() print("링크 설정...") wifi.link("SSID",wifi.WIFI_WPA2,"password ") print("Ok!") 예외 e:print(e)# new_resourcenew_resource("template.html")#### ZerynthApp Setup# ::Javascript to Python 을 사용하여 보드 플래시에 template.html을 저장합니다. :# 버튼을 누르면 다음 함수가 호출됩니다.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_a nim_speed(n)# 이름, 설명 및 템플릿으로 Zerynth 앱을 구성합니다. urlvp =zerynthapp.ZerynthApp("Zerynth Lamp", "Try me!", "resource://template.html")# Javascript가 이벤트를 생성할 때마다 해당 함수를 호출합니다.vp.on("change_color", change_color)vp.on("change_animation", change_animation)vp.on("change_speed", change_speed)# vp.run 시작 이후 ZerynthApp!vp.run()# 실행 새 스레드, 여기에서 원하는 대로 무엇이든 할 수 있습니다!# ledsanimation.start(D6, 24)를 제어합시다.
    template.htmlHTML
             

    제린스 램프

    <버튼 클래스="ui-btn UI-btn-inline ui-shadow" onclick="ZerynthApp.call('change_color',cur_color.r,cur_color.g,cur_color.b)">색상 지정!
    Zerynth 제공(www.zerynth.com)
    animation.py파이썬
    <사전>################################################# ################################### Zerynth Lamp## Created by Zerynth Team 2015 CC# Authors:G. Baldi , 디 마제이############################################### ####################################네오픽셀 가져오기 ledstrips의 램프 애니메이션 기능 neoimport threadinglock =threading.Lock() # Zerynth 색상 :)color =[0x54,0x9a,0x97]anim =0anim_speed =50leds =Nonelayer0 =Nonelayer1 =Nonelayer2 =Nonenpins =0 stoped=Falsestopcolor =[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] 무지개 =[(0xFF로, 0x00,0x00) ( 0xff,0x7f,0x00), (0xff,0xff,0x00), (0x00,0xff,0x00), (0x00,0x00,0xff), (0x4b,0x00,0x82), (0x8f,0x00,0xff)]d n):전역 layer0,layer1,layer2,anim # 초기 값 l로 레이어 채우기 ock.acquire() leds.clear() layer2.clear() layer0.clear() layer1.clear() n=n%4 if n==0:layer0[0]=(100,0,0) layer0[ 1]=(100,0,0) 레이어0[2]=(100,0,0) 레이어1[0]=(0,100,0) 레이어1[1]=(0,100,0) 레이어1[2]=(0,100, 0) elif n==1: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:layer1.clear() pstep=0 for x in range(npins):step =x*len(무지개)/npins rx =(무지개[int(step)][0]+무지개[int(pstep)][0])//4 gx =(무지개[int(step)][1]+무지개[int(pstep)][ 1])//4 bx =(무지개[int(step)][2]+무지개[int(pstep)][2])//4 layer0[x]=(rx,gx,bx) pstep=step elif n==3:layer0.clear() layer1.clear() anim=n lock.release() def setup_anim_speed(n):전역 anim_speed anim_speed=n def setup_color(r,g,b):전역 색상 #print(" Color:",r,g,b) color[0]=r color[1]=g color[2]=b# 배경을 처리하는 함수 만들기 animationdef animate_background(delay):global color step=0 while True:if ( anim==3 또는 anim==0) 및 중지되지 않음:lock.acquire() layer2.setal l(int(color[0]*animation_coefficients[step]/2),int(color[1]*animation_coefficients[step]/2),int(color[2]*animation_coefficients[step]/2)) lock.release () 단계 +=1 if 단계>=len(animation_coefficients):단계=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):동안 True:중지되지 않은 경우: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):전역 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:# LED 지우기 leds.clear() # 이제 잠금을 획득합니다. lock.acquire() # 첫 번째 레이어와 두 번째 레이어를 병합합니다. leds.merge(layer0) leds.m erge(layer1) # led가 투명한 곳에서만 배경 레이어를 병합합니다. (0,0,0) leds.merge(layer2,neo.first_color) # 잠금 해제 lock.release() # 그리고 불을 켭니다! leds.on() sleep(50)def stop(r,g,b):전역 정지 전역 stopcolor stopcolor[0]=r stopcolor[1]=g stopcolor[2]=b 중단됨=True def resume():전역 중지됨 중지됨 =거짓 setup_anim(anim)

    회로도


    제조공정

    1. 회로와 빛의 속도
    2. 가스 랜턴
    3. 레이저 포인터
    4. 손전등
    5. 할로겐 램프
    6. 교통 신호
    7. 전구
    8. Raspberry Pi 온도 및 광 센서
    9. 스마트 신호등
    10. 디지털 광 센서