반응형
블로그 이미지
개발자로서 현장에서 일하면서 새로 접하는 기술들이나 알게된 정보 등을 정리하기 위한 블로그입니다. 운 좋게 미국에서 큰 회사들의 프로젝트에서 컬설턴트로 일하고 있어서 새로운 기술들을 접할 기회가 많이 있습니다. 미국의 IT 프로젝트에서 사용되는 툴들에 대해 많은 분들과 정보를 공유하고 싶습니다.
솔웅

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

카테고리

[AWS IoT] Getting Started with AWS IoT

2017. 8. 3. 20:05 | Posted by 솔웅


반응형



There are several ways to get started with AWS IoT depending on your use case and how you want to integrate the service into your use case. The AWS Management Console provides a web-based interface for accessing and managing all your AWS IoT resources. Programmatic access to AWS IoT is enabled by the AWS CLI and AWS SDK.



AWS IoT를 시작하는 방법은 여러가지가 있을 수 있습니다. 여러분의 필요성과 그 필요를 충족하기 위해 서비스와 어떻게 융합할 것인지 등에 따라 나눌 수 있습니다. AWS Management Console은 여러분의 모든 AWS IoT resources들에 접근하고 관리하기 위한 web-based interface를 제공합니다. AWS IoT에 프로그램으로 접근하려면 AWS CLI 와 AWS SDK 를 사용해서 개발 할 수 있습니다.



To connect your hardware device, sensor, mobile app or a thing use the AWS IoT Device SDK. Choose from one of the AWS starter kits pre-packaged to connect to AWS IoT. In addition, AWS IoT is supported by a wide range of third party tools and gateways.



여러분의 하드웨어 디바이스, 센서, 모바일 앱 이나 기타 다른 사물들에 연결하려면 AWS IoT Device SDK를 사용하세요.
AWS starter kits 세트를 사용해서 AWS IoT에 연결할 수 있습니다. 또한 AWS IoT는 광범위한 3rd party 도구와 게이트웨이들의 지원을 받습니다.



Get started with AWS IoT




Get started with devices





The AWS Management Console is a web-based interface for accessing and managing your AWS IoT resources. You can easily and securely create a thing, associate certificate, publish messages and define actions using the AWS Management Console.



AWS Management Console은 여러분의 AWS IoT resources들에 접근하고 관리하기 위한 web-based interface입니다.
여러분은  AWS Management Console을 사용해서 쉽고 안전하게 사물, associate certificate, publish messages 등을 생성하고 액션들을 정의할 수 있습니다.



Get started with AWS IoT in the console



Experiment with AWS IoT





The AWS SDK helps take the complexity out of coding by providing APIs for many AWS services including AWS IoT. All AWS SDKs are enabled for AWS IoT. The single, downloadable package includes the code library, code samples, and documentation.



AWS SDK는 AWS IoT를 포함한 많은 AWS services들에 대한 APIs를 제공함으로서 복잡하지 않게 코딩을 하도록 도와줍니다. 모든 AWS SDK들은 AWS IoT에서도 사용할 수 있습니다. 코드 라이브러리, 코드 샘플들 그리고 문서들을 포함한 단일 패키지를 다운로드 할 수 있습니다.




The AWS IoT Device SDK helps you to easily and quickly connect your hardware device or your mobile device to AWS IoT. It offers enhanced features so that you can seamlessly interact with the device gateway and the device shadow that will enable you to quick start your development. The Device SDK supports a variety types of devices, from basic to industrial hardware devices. Learn more about the AWS IoT Device SDKs.


AWS IoT Device SDK는 여러분의 하드웨어 디바이스나 모바일 디바이스를 AWS IoT에 쉽고 빠르게 연결할 수 있도록 도와줍니다.
또한 향상된 기능들을 제공함으로서 디바이스 게이트와 디바이스 쉐도우와 끊임없이 상호작용할 수 있도록 해 여러분의 신속한 개발을 도와 줄 겁니다. 이 Device SDK는 다양한 타입의 디바이스들을 지원합니다. 기본적인 것에서부터 산업용 하드웨어 디바이스 까지요. AWS IoT Device SDK에 대해 좀 더 배워 보세요.




AWS IoT Starter Kits


The AWS IoT Starter Kits enable you to move quickly from idea to prototype. These physical kits are designed to help accelerate cloud-powered prototype development of connected devices and connect securely to AWS IoT. The kits include development microcontroller development boards, sensors and actuators, the AWS IoT Device SDK, and a simple getting started guide so that you can easily find the best fit for your products. You can purchase the kits from Amazon.com. If you already have the hardware board, you can download the SDK and samples to get started in minutes. Visit the APN partner portal to learn more about partners who provide AWS IoT Starter Kits.



AWS IoT Starter Kit들은 구상에서 프로토타입(시제품) 까지 이르는 길을 앞당기도록 도와 줍니다. 이 physical kit들은 연결된 디바이스들과 이들이 AWS IoT에 안전하게 연결되도록 하는 cloud-powered prototype 개발을 빨리 할 수 있도록 도와 주도록 디자인 돼 있습니다. 이 키트들은 development microcontroller development boards, 센서 그리고 actuators 등을 포함하고 있습니다. 또한 AWS IoT Device SDK와 간단한 안내서를 가지고 있어 여러분이 쉽게 제품에 가장 알맞는 구성들을 찾을 수 있도록 도와줍니다. 이 키트들은 아마존 닷 컴에서 구입할 수 있습니다. 이미 하드웨어 보드가 있다면 SDK를 다운로드 해 몇분안에 작업을 시작하실 수 있습니다. APN partner portal에 방문해서 AWS IoT Starter Kit들을 제공하는 파트너들에 대해 좀 더 배워 보세요.





The Digi ConnectCore 6UL SBC Pro development kit delivers the ultimate connected off-the-shelf NXP i.MX6UL Single Board Computer, Pico-ITX form factor, pre-certified 802.11a/b/g/n/ac Wi-Fi, Bluetooth® 4.2, including Bluetooth Low Energy, and out-of-box cellular integration options.
 

Buy Now

Get Started

Partner Website



The Digi ConnectCore® 6UL Starter Kit is a Linux development kit for the Digi ConnectCore 6UL SOM with Wi-Fi and Bluetooth 4.2 connectivity. The kit includes the compact ConnectCore 6UL SBC Express with on-board antenna, Grove connectors, and a Pi HAT compatible breakout connector.


Buy Now

Get Started

Partner Website





The Digi ConnectCore 6 SBC development kit delivers an industrial multi-core SBC platform with scalable NXP i.MX6 performance, pre-certified Bluetooth 4.0 and Wi-Fi integration, Digi XBee and cellular connectivity options, Gigabit Ethernet support, multi display/camera and audio support, external storage, and expansion connectors.


Buy Now

Get Started

Partner Website




This kit includes Broadcom BCM4343W (Wi-Fi, BLE) and few sensors packaged by Avnet runs Broadcom WICED SDK


Buy Now

Get Started

Partner Website



This kit includes Marvell MW302 and runs Marvell EZ-Connect SDK, ported from AWS IoT Device SDK


Buy Now

Get Started

Partner Website



This kit includes MediaTek Linkit One (Wi-Fi, GPS, BLE, GPRS) and Grove Sensors and Actuators and runs AWS IoT Device SDK with mBed TLS


Buy Now

Get Started

Partner Website


This kit includes Renesas RX63N RDK and runs AWS IoT Device SDK on Micrium OS


Buy Now

Get Started

Partner Website



This kit includes Qualcomm Snapdragon 410c (Wi-Fi, GPS, BLE) packaged by Arrow and runs AWS IoT Device SDK (C and Node.js)


Buy Now

Get Started

Partner Website



This kit includes Intel Edison with Arduino Breakout Board and Grove sensors and actuators and runs AWS IoT Device SDK (C and Node.js)


Buy Now

Get Started

Partner Website


This kit includes BeagleBone Green and Grove sensors and actuators and runs AWS IoT Device SDK (C and Node.js)


Buy Now

Get Started

Partner Website



This kit includes a Microchip PIC32 microcontroller, LAN8740A Ethernet Phy, MPLAB Harmony Integrated Software Framework, FreeRTOS, is extendable thought the mikroBUS header and runs AWS IoT Device SDK


Buy Now

Get Started

Partner Website





This kit includes Arduino Yun compatible board and Grove sensors and actuators and runs AWS IoT Device SDK for Arduino


Buy Now

Get Started

Partner Website





This kit includes TI Launchpad CC3200 and runs TI-RTOS


Buy Now

Get Started

Partner Website






The Wisplet S2W IoT Kit includes a ready-to-operate out-of-the-box Wi-Fi module together with a sensor module.


Buy Now

Get Started

Partner Website





The AT&T IoT Kit includes an AT&T Global SIM, LTE modem, and access to AWS IoT.


Buy Now

Get Started

Partner Website




반응형

[Arduino] 3rd project. 4X4X4 LED Light Cube

2017. 6. 5. 10:22 | Posted by 솔웅


반응형

I've purchased 4X4X4 LED Light Cube kit from Aliexpress. ($3.79)

4X4X4 Blue LED Light Cube Kit 3D LED DIY Kit Electronic Suite for Arduino







You can get the instruction from here. but There is not enough information to complete the set.

Fortunately, got perfect info from this blog.

https://emalliab.wordpress.com/2015/07/24/icstation-4x4x4-led-cube-shield-for-arduino-hardware-build/

 https://emalliab.wordpress.com/2015/07/24/icstation-4x4x4-led-cube-shield-for-arduino-software/


So I've followed it and could complete the set like this.




This is the blog (2nd one) explained about the source code.


icStation 4x4x4 LED Cube Shield for Arduino – Software



July 24, 2015 at 10:31 pm (computers) ()


As described in my previous post, I now have a working (I’ve run the demo code!) icStation 4x4x4 LED cube shield connected up to an Arduino Uno.  Unfortunately as I started to dig around in the sample library, I just couldn’t quite work out how it was meant to address each plane of the cube.  Eventually I decided it wasn’t possible, due to a number of bugs in the code.


이전 게시물에서 설명한 것처럼, icStation 4x4x4 LED cube shield를 Arduino Uno에 연결하는 작업을 하고 있습니다. 불행하게도 샘플 라이브러리를 파고들 수록 큐브의 각 면을 지정하는 방법에 대해 이해하기가 더 어려워 졌습니다. 결국 해당 샘플 코드에 버그가 많아 제대로작동할 수 없다는 결론에 이르렀습니다.


The demo code worked as the code just showed the same pattern on each of the four planes.  This is largely because the initialisation routines set the four Ardunio data pins to low, and then never did anything else with them!  There is some mention of pins 16 and 17, but no mention of pins 18 and 19, and actually in the main display routines, there is nothing done to actually set any of these pins once initialisation is complete.  So at this point I decided to read a bit more about the 74HC595 and just go it alone.  Attached is the result.  Feel free to use as you see fit.


그 데모 코드는 4개의 면 각각이 동일한 패턴으로 보여지도록 작동하고 있습니다. 초기화 루틴이 4 개의 Ardunio 데이터 핀을 로우로 설정 한 후 그것을 아무곳에서도 사용하지 않습니다. 핀 16과 핀 17에 대해서는 언급이 있지만, 핀 18과 19에 대한 언급이 없습니다, 메인 디스플레이 루틴에서, 초기화가 완료되면 실제로 이러한 핀들을 설정하는 일은 없습니다. 그래서 이 시점에서 필자는 74HC595에 대해 좀 더 읽고 혼자서 결정했습니다. 첨부 된 결과입니다. 이것을 토대로 당신이 적합하다고 생각하는대로 자유롭게 사용하십시오.


Basic initialisation


The two shift registers seem fairly simple to setup.  The Arduino needs some control pins setting up as outputs alongside the four digital outs used for the LEDs.  The initialisation is quite straight forward as follows:


두 개의 시프트 레지스터는 설정하는 것이 매우 간단합니다. Arduino는 LED에 사용되는 4 개의 디지털 출력과 함께 출력으로 설정되는 일부 제어 핀을 필요로합니다. 초기화는 다음과 같이 매우 간단합니다.


#include <Arduino.h>

int HC595_clockPin=0;   // SH_CP of 74HC595 
int HC595_latchPin=1;   // ST_CP of 74HC595 
int HC595_dataPin=3;    // DS of 74HC595 
int HC595_enablePin=2;  // Not OE of 74HC595
int LED_Pin16= 4;
int LED_Pin17= 5;
int LED_Pin18= 6;
int LED_Pin19= 7;

void setup() {
  // put your setup code here, to run once:
  pinMode( HC595_latchPin,  OUTPUT );
  pinMode( HC595_clockPin,  OUTPUT );
  pinMode( HC595_dataPin,   OUTPUT );
  pinMode( HC595_enablePin, OUTPUT );
  
  pinMode( LED_Pin16, OUTPUT );
  pinMode( LED_Pin17, OUTPUT );
  pinMode( LED_Pin18, OUTPUT );
  pinMode( LED_Pin19, OUTPUT );
  
  digitalWrite(LED_Pin16,HIGH);
  digitalWrite(LED_Pin17,HIGH);
  digitalWrite(LED_Pin18,HIGH);
  digitalWrite(LED_Pin19,HIGH);
//  digitalWrite(HC595_enablePin, LOW);  // Enable Not OE (negative logic)
}


I never did quite work out if I needed to do anything with the enable pin, but as it is active low, I assumed that by not doing anything, everything would be enabled by default anyway.

enable pin과 관련해서는 아무것도 하지 않았습니다. active 상태 값이 low 이기 때문입니다. 이렇게 아무것도 정의하지 않으면 디폴트로  enable이 될 것으로 생각 됩니다.


In terms of actually writing a value to the 74HC595, again that is fairly straight forward.

74HC595에 적용된 값들은 그냥 보시는 대로 입니다. 



/*
  Protocol for sending the data to the hc595 is as follows:
   (see: http://www.arduino.cc/en/Tutorial/ShiftOut)
   
   "when the clock pin goes from low to high, the shift register
    reads the state of the data pin ... when the latch pin goes
    from low to high the sent data gets moved from the shift
    registers ... to the output pins"
   
   As we have two HC595s chained together, we use a 16 bit input value
*/
void write_74HC595 (unsigned int hc595value) { 
   digitalWrite(HC595_latchPin, LOW);   // ensures LEDs don't light whilst changing values
   
   // Shift each 8 bit value in sequence - the two chained HC595s automatically grab
   // the right bits - the first 8 to the first chip, second 8 to the second chip
   shiftOut(HC595_dataPin, HC595_clockPin, LSBFIRST, hc595value);  
   shiftOut(HC595_dataPin, HC595_clockPin, LSBFIRST, (hc595value >> 8));
   
   digitalWrite(HC595_latchPin, HIGH);  // data transferred from shift register to outputs when latch goes LOW->HIGH
}


So 16 bits of the hc595value variable are sent in two 8-bit chunks over the serial port to the shift registers and with the appropriate signalling via the latch pin, that is basically that.  This sets the outputs of the 74HC595 to high, but in order to make the LEDs come on, the Arduino data pins corresponding to the horizontal planes must be set low.  If a different pattern is required for each plane, then some kind of simple ‘scanning’ is required as illustrated below.



따라서 hc595value 변수의 16 비트는 두 개의 8 비트 chunk로 직렬 포트를 통해 shift register로 전송 되며 이것은 latch pin을 통해 적절한 신호로 전송됩니다. 이것은 74HC595의 출력을 high로 설정하지만 LED를 켜기 위해 수평면에 해당하는 Arduino 데이터 핀을 low로 설정 해야합니다. 각 평면에 다른 패턴이 필요한 경우 아래에 설명 된 것처럼 일종의 간단한 '스캐닝'이 필요합니다.



int LED_Plane[] = {LED_Pin16, LED_Pin17, LED_Pin18, LED_Pin19};

/*
  Inputs: Array of 4 integers - one for each plane
*/
void display (unsigned int *pPattern)
{
  int i;
  for (i=0; i<4; i++)
  {
    int j;
    for (j=0; j<1000; j++)
    {
      // Slow this down so that there is time for the LEDS to light
      // Experimentation shows that 200+ gives brighter LEDs
      // NB: Do it this way so an empty loop isn't optimised out
      if (j==0)
      {
        digitalWrite(LED_Plane[0], HIGH);
        digitalWrite(LED_Plane[1], HIGH);
        digitalWrite(LED_Plane[2], HIGH);
        digitalWrite(LED_Plane[3], HIGH);
        write_74HC595 (pPattern[i]);
        digitalWrite(LED_Plane[i], LOW);
      }
    }
  }
}


I guess the only thing to really note here is that without the loop involving j then the ‘scanning’ was happening too fast to allow the LEDs to have any significant brightness at all.  I initially had a simple for (j=0; j<1000; j++) {}; statement at the end, but this seemed to be optimised out – at least it didn’t seem to have the delay effect I wanted, so instead I made the code only act on one pass through the loop.


여기서 정말로 주목할 것은, j를 포함하는 루프가 없으면 '스캐닝'이 너무 빠르게 진행 되어 LED가 충분히 밝게 되지 않는 다는 겁니다. 나는 처음에는  간단한 for 문을 (j = 0; j <1000; j ++) {}; 를 끝에 사용했습니다.  이것이 최적화 된 것처럼 보였지만 내가 원한 delay 효과를 보여주지는 못했습니다. 그래서 그렇게 하는 대신에 loop를 통과하는 것을 한번만 실행되도록 코딩했습니다. 



So, with these basics, it is now possible to get a 64 bit pattern, in the form of four 16 bit values, each representing one plane of 16 LEDs, onto the cube.


이렇게 함으로서 64 bit pattern이 가능해 졌습니다. 4개의 16 비트 값 형태로 각각이 큐브의 16 LEDs 의 한 평면을 나타내게 됩니다.



I have the full demo code file below – it isn’t massively pretty, and its not cpp (sorry – I’ve always been more of a C person I’m afraid, and my C is a little rusty), but it works for me.  Your proverbial mileage, as they say, may vary.


아래에 전체 코드가 있습니다. 코드가 깔끔하지 않고 cpp 로 돼 있지 않습니다. (나는 C 언어에 대해 그렇게 능숙하지가 못해서요.) 아무튼 이 소스코드는 잘 작동합니다. 



Kevin




#include <Arduino.h>

int HC595_clockPin=0;   // SH_CP of 74HC595 
int HC595_latchPin=1;   // ST_CP of 74HC595 
int HC595_dataPin=3;    // DS of 74HC595 
int HC595_enablePin=2;  // Not OE of 74HC595
int LED_Pin16= 4;
int LED_Pin17= 5;
int LED_Pin18= 6;
int LED_Pin19= 7;
int LED_Plane[] = {LED_Pin16, LED_Pin17, LED_Pin18, LED_Pin19};

// Each line (8 bytes) is an entire cube, with two consecutive bytes per plane of LEDS,
// and 16 LEDS per plane. LEDs are encoded in the following order:
//    Lowest plane byte 1, lowest plane byte 2, second lowerst plane 1, then 2,
//    second from top plane 1, then 2, highest plane 1, highest plane 2.
//
//    Each plane is encoded looking at the Arduino oriented with the USB/power
//    designated by 'south' by started 'north west' as follows:
//        D0    D1    D2    D3
//        D4    D5    D6    D7
//        D8    D9    D10   D11
//        D12   D13   D14   D15
//
//        D16   D17   D18   D19
//          (USB)      (Power)
//    With D16 being the lowest plane, through to D19 being the highest plane
//    Of course, if you wire the planes up differently, that is up to you!
//
//    Each two bytes of the pattern are therefore:
//        B00000000, B00000000 -> D0-7, D8-15
//    with D0 = msb of the first value, D7 being the lsb of the first value,
//    and  D8 = msb of the second value, D15 being the lsb of the second value.
//
//    So the entire pattern is:
//    B10010000,B00001001,B00000000,B00000000,B00000000,B00000000,B10010000,B00001001,
//     |      |  |     ||                                          |      |  |     ||
//     |      |  |     |\ D15 bottom plane                         |      |  |     |\ D15 top plane
//     |      |  |     \ D14 bottom plane                          |      |  |     \ D14 top plane
//     |      |  \ D8 bottom plane                                 |      |  \ D8 top plane
//     |      \ D7 bottom plane                                    |      \ D7 top plane
//     \ D0 bottom plane                                           \ D0 top plane
//
// Comment following in or out to switch patterns in or out
#define SWAP   1
#define SNAKE  1
#define BURST  1
#define SPIRAL 1
#define ALT    1
unsigned char pattern[] = {
#ifdef SWAP
  B10010000,B00001001,B00000000,B00000000,B00000000,B00000000,B10010000,B00001001,
  B00000000,B00000000,B10010000,B00001001,B10010000,B00001001,B00000000,B00000000,
  B00000000,B00000000,B01100000,B00000110,B01100000,B00000110,B00000000,B00000000,
  B01100000,B00000110,B00000000,B00000000,B00000000,B00000000,B01100000,B00000110,
  B00001001,B10010000,B00000000,B00000000,B00000000,B00000000,B00001001,B10010000,
  B00000000,B00000000,B00001001,B10010000,B00001001,B10010000,B00000000,B00000000,
  B00000000,B00000000,B00000110,B01100000,B00000110,B01100000,B00000000,B00000000,
  B00000110,B01100000,B00000000,B00000000,B00000000,B00000000,B00000110,B01100000,
#endif
#ifdef SNAKE
  B11001100,B00000000,B11001100,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B11001100,B00000000,B11001100,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B11001100,B00000000,B11001100,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00001100,B11000000,B00001100,B11000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B11001100,B00000000,B11001100,
  B00000000,B00000000,B00000000,B00000000,B00000000,B01100110,B00000000,B01100110,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00110011,B00000000,B00110011,
  B00000000,B00000000,B00000000,B00110011,B00000000,B00110011,B00000000,B00000000,
  B00000000,B00110011,B00000000,B00110011,B00000000,B00000000,B00000000,B00000000,
  B00000011,B00110000,B00000011,B00110000,B00000000,B00000000,B00000000,B00000000,
  B00110011,B00000000,B00110011,B00000000,B00000000,B00000000,B00000000,B00000000,
  B01100110,B00000000,B01100110,B00000000,B00000000,B00000000,B00000000,B00000000,
#endif
#ifdef BURST
  B00000000,B00000000,B00000110,B01100000,B00000110,B01100000,B00000000,B00000000,
  B00000110,B01100000,B01101001,B10010110,B01101001,B10010110,B00000110,B01100000,
  B01101001,B10010110,B10010000,B00001001,B10010000,B00001001,B01101001,B10010110,
  B10010000,B00001001,B00000000,B00000000,B00000000,B00000000,B10010000,B00001001,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
#endif
#ifdef SPIRAL
  B11001100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B01100110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00110011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000011,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00110011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B01100110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B11001100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00001100,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B11001100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B11001100,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B01100110,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00110011,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000011,B00110000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00110011,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01100110,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B11001100,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00001100,B11000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B11001100,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B11001100,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B01100110,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00110011,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000011,B00110000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00110011,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B01100110,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B11001100,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00001100,B11000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B11001100,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11001100,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01100110,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110011,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B00110000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110011,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01100110,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11001100,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001100,B11000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11001100,B00000000,
#endif
#ifdef ALT
  B11111001,B10011111,B10010000,B00001001,B10010000,B00001001,B11111001,B10011111,
  B00000110,B01100000,B01101001,B10010110,B01101001,B10010110,B00000110,B01100000,
  B00000000,B00000000,B00000110,B01100000,B00000110,B01100000,B00000000,B00000000,
  B00000110,B01100000,B01101001,B10010110,B01101001,B10010110,B00000110,B01100000,
#endif
};
int patternNumber=0;
int numPatterns=sizeof(pattern)/8;
int tickCount=0;
int tickCountMax=50;      // How many times to loop before changing the pattern
unsigned int currentPattern[4];

void setup() {
  // put your setup code here, to run once:
  pinMode( HC595_latchPin,  OUTPUT );
  pinMode( HC595_clockPin,  OUTPUT );
  pinMode( HC595_dataPin,   OUTPUT );
  pinMode( HC595_enablePin, OUTPUT );
  
  pinMode( LED_Pin16, OUTPUT );
  pinMode( LED_Pin17, OUTPUT );
  pinMode( LED_Pin18, OUTPUT );
  pinMode( LED_Pin19, OUTPUT );
  
  digitalWrite(LED_Pin16,HIGH);
  digitalWrite(LED_Pin17,HIGH);
  digitalWrite(LED_Pin18,HIGH);
  digitalWrite(LED_Pin19,HIGH);
//  digitalWrite(HC595_enablePin, LOW);  // Enable Not OE (negative logic)

  patternNumber=0;
  tickCount = tickCountMax;
}

/*
  Protocol for sending the data to the hc595 is as follows:
   (see: http://www.arduino.cc/en/Tutorial/ShiftOut)
   
   "when the clock pin goes from low to high, the shift register
    reads the state of the data pin ... when the latch pin goes
    from low to high the sent data gets moved from the shift
    registers ... to the output pins"
   
   As we have two HC595s chained together, we use a 16 bit input value
*/
void write_74HC595 (unsigned int hc595value) { 
   digitalWrite(HC595_latchPin, LOW);   // ensures LEDs don't light whilst changing values
//   digitalWrite(HC595_enablePin, HIGH); // OE is negative logic
   
   // Shift each 8 bit value in sequence - the two chained HC595s automatically grab
   // the right bits - the first 8 to the first chip, second 8 to the second chip
   shiftOut(HC595_dataPin, HC595_clockPin, LSBFIRST, hc595value);  
   shiftOut(HC595_dataPin, HC595_clockPin, LSBFIRST, (hc595value >> 8));
   
   digitalWrite(HC595_latchPin, HIGH);  // data transferred from shift register to outputs when latch goes LOW->HIGH
//   digitalWrite(HC595_enablePin, LOW);  // re-enable (negative logic again)
}

/*
  Inputs: Array of 4 integers - one for each plane
*/
void display (unsigned int *pPattern)
{
  int i;
  for (i=0; i<4; i++)
  {
    int j;
    for (j=0; j<1000; j++)
    {
      // Slow this down so that there is time for the LEDS to light
      // Experimentation shows that 200+ gives brighter LEDs
      // NB: Do it this way so an empty loop isn't optimised out
      if (j==0)
      {
        digitalWrite(LED_Plane[0], HIGH);
        digitalWrite(LED_Plane[1], HIGH);
        digitalWrite(LED_Plane[2], HIGH);
        digitalWrite(LED_Plane[3], HIGH);
        write_74HC595 (pPattern[i]);
        digitalWrite(LED_Plane[i], LOW);
      }
    }
  }
}

void displayPattern ()
{
  int i;
  // only update it every tick otherwise just display as is
  tickCount--;
  if (tickCount <= 0)
  {
    tickCount = tickCountMax;
    for (i=0; i<4; i++)
    {
      currentPattern[i] = pattern[i*2 + patternNumber*8] * 256 + pattern[i*2 + 1 + patternNumber*8];
    }
    patternNumber++;
    if (patternNumber >= numPatterns)
    {
      patternNumber = 0;
    }
  }
  display(&currentPattern[0]);
}

void loop() {
  // put your main code here, to run repeatedly:
  displayPattern();
}



반응형


반응형

Simple version of LED Light stand base for 3D crystal laser cube



I have Taj Mahal 3D crystal laser Cube.

You can get it from ebay also.





I found there are many stand bases for these kind of 3D crystal cube and it makes gorgeous view of it. like below.



So I've decided to develop it using Arduino.


The result is this.





This is the Source code.


/*

  For LED Light stand for 3D Crystal laser cube


  version : 0.4


  created 03 May 2017


  by Douglas Changsoo Park

*/


// Define Pins

#define RED1 3

#define GREEN1 4

#define BLUE1 5

#define RED2 6

#define GREEN2 7

#define BLUE2 8

#define delayTime 100


// define variables

int redValue1;

int greenValue1;

int blueValue1;

int redValue2;

int greenValue2;

int blueValue2;


void setup() {

  pinMode(RED1, OUTPUT);

  pinMode(GREEN1, OUTPUT);

  pinMode(BLUE1, OUTPUT);

  digitalWrite(RED1, HIGH);

  digitalWrite(GREEN1, HIGH);

  digitalWrite(BLUE1, HIGH);


  pinMode(RED2, OUTPUT);

  pinMode(GREEN2, OUTPUT);

  pinMode(BLUE2, OUTPUT);

  digitalWrite(RED2, HIGH);

  digitalWrite(GREEN2, HIGH);

  digitalWrite(BLUE2, HIGH);


  redValue1 = random(1, 255);

  greenValue1  = random(1, 255);

  blueValue1  = random(1, 255);

  redValue2 = random(1, 255);

  greenValue2  = random(1, 255);

  blueValue2  = random(1, 255);

}


void loop() {

  LEDLights(redValue1, greenValue1, blueValue1, redValue2, greenValue2, blueValue2);

  delay(delayTime * 4);

}


void LEDLights(int red1, int green1, int blue1, int red2, int green2, int blue2) {


  redValue1 = red1;

  greenValue1 = green1;

  blueValue1 = blue1;

  redValue2 = red2;

  greenValue2 = green2;

  blueValue2 = blue2;


  int redResult1 = randomValue(redValue1);

  int greenResult1 = randomValue(greenValue1);

  int blueResult1 = randomValue(blueValue1);


  int redResult2 = randomValue(redValue2);

  int greenResult2 = randomValue(greenValue2);

  int blueResult2 = randomValue(blueValue2);


  for (int i = 0; i < 25; i += 1) {

    analogWrite(RED1, redValue1 + redResult1);

    analogWrite(GREEN1, greenValue1 + greenResult1);

    analogWrite(BLUE1, blueValue1 + blueResult1);

    analogWrite(RED2, redValue2 + redResult2);

    analogWrite(GREEN2, greenValue2 + greenResult2);

    analogWrite(BLUE2, blueValue2 + blueResult2);


    redValue1 = redValue1 + redResult1;

    greenValue1 = greenValue1 + greenResult1;

    blueValue1 = blueValue1 + blueResult1;

    redValue2 = redValue2 + redResult2;

    greenValue2 = greenValue2 + greenResult2;

    blueValue2 = blueValue2 + blueResult2;


    delay(delayTime);

  }

}


int randomValue(int value) {

  int result;

  int minN;

  int maxN;


  int interval = random(1, 5);


  if (interval == 1) {

    minN = 26;

    maxN = 229;

  } else if (interval == 2) {

    minN = 51;

    maxN = 204;

  } else if (interval == 3) {

    minN = 76;

    maxN = 179;

  } else if (interval == 4) {

    minN = 101;

    maxN = 154;

  } else {

    minN = 126;

    maxN = 129;

  }


  if (value < minN) {

    result = interval;

  } else if (value > maxN) {

    result = -interval;

  } else {

    int randomVal = random(0, 1);

    if (randomVal == 0) {

      result = interval;

    } else {

      result = -interval;

    }

  }


  return result;

}




I wanted to make a combination and change of a more varied and softer color using random() in randomValue() function.


LEDLights() function will turn on and change the LED Light with the return value of the randomValue() function.


The loop() function will call the LED LIghts() function repeatedly every given time.


The components will be configured as below.





I've used Arduino Nano, 12V battery pack with 8 AAA batteries, 1 car charger adapter, small bread board and 2 RGB LEDs.


all parts are what I already have. 


It will cost about $ 15 for a new purchase.



Link to my project in hackster.


https://www.hackster.io/solkit/portable-led-light-stand-for-3d-crystal-laser-cube-5d8bd1







반응형


반응형

I don't like you

Practice scripting for the project 'I like you'


Source Code


/*

  For I don't like you. (practice project for the project 'I like you')


  version : 0.1


  created 07 May 2017


  by Douglas Changsoo Park

*/


#include <Servo.h>

#include <NewPing.h>


#define TRIGGER_PIN  12  // Arduino pin tied to trigger pin on the ultrasonic sensor.

#define ECHO_PIN     11  // Arduino pin tied to echo pin on the ultrasonic sensor.

#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.


NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

Servo myservo;//create servo object to control a servo


int distance;


void setup() {

  myservo.attach(9);//attachs the servo on pin 9 to servo object

  myservo.write(0);//back to 0 degrees 

  delay(1000);//wait for a second


  Serial.begin(9600); // Open serial monitor at 115200 baud to see ping results.

}


void loop() {

  delay(500);  // 

  unsigned int uS = sonar.ping(); // Send ping, get ping time in microseconds (uS).

  Serial.print("Ping: ");

  Serial.print(uS / US_ROUNDTRIP_CM); // Convert ping time to distance and print result (0 = outside set distance range, no ping echo)

  Serial.println("cm");

 

  distance = uS / US_ROUNDTRIP_CM;


  delay(500);

  // Servo motor moves when the distance is less than 5cm

  if (distance < 5 && distance != 0) {

    Serial.println("distance : ");

    Serial.println(distance); 

    myservo.write(90);//goes to 45 degrees 

    delay(500);

    myservo.write(-90);//goes to 45 degrees

    delay(500);

  }


}


==> Servo motor will move 90 degree and -90 degree when ultrasonic sensor detects object (person) in 5 cm.
Ultrasonic sonic sensor is going to be a pet's head so it looks like the pet is shaking his head because he doesn't like the person.

==> This is practice project of the project "I like you"
with the project, As you move, the pet will keep looking at you.
So the project name is "I like you" 

==> to do that I am planning to use 2 (or 3) ultrasonic sensor.

Anyway for the practice project "I don't like you", Arduino components should be configured as follows.



It will print the distance in 'cm' if it is run.




반응형


반응형

MIT App Inventor



Today I've developed Mega Millions Jackpot number generator using MIT App Inventor.

MIT App Inventor is GUI Android Mobile App Development tool.



Wikipedia

App Inventor for Android

App Inventor for Android is an open-source web application originally provided by Google, and now maintained by the Massachusetts Institute of Technology (MIT).

It allows newcomers to computer programming to create software applications for the Android operating system (OS). It uses a graphical interface, very similar to Scratch and the StarLogo TNG user interface, which allows users to drag-and-drop visual objects to create an application that can run on Android devices. In creating App Inventor, Google drew upon significant prior research in educational computing, as well as work done within Google on online development environments.[1]



MIT App Inventor Website


What is MIT App Inventor?

MIT App Inventor is an innovative beginner's introduction to programming and app creation that transforms the complex language of text-based coding into visual, drag-and-drop building blocks. The simple graphical interface grants even an inexperienced novice the ability to create a basic, fully functional app within an hour or less.






This is the Mega Jackpot Number generator what I've developed today.





This is the apk file. so you can install in your android phone if you have.


LotteryNumber.apk





See the graphical design of the app here.




Here is core logic of the app.





The first 'for' statement is the one to get 5 quick pick numbers.

The second 'for' statement makes list who has numbers from 1~75.

3rd 'for' statement will remove 70 items from the list randomly.

so we will get 5 jackpot numbers for Mega Million.


The good point of this logic is simplification.


If you pickup random numbers from the 75 list then you need to use double 'for' statement to sort the numbers.

The logic is going to be much more complicated.


Above logic is much simpler because it is already sorted.




반응형


반응형

Grew up like this in 4 days. :)





In a meanwhile, I've updated the source code.


/*
* For Automated Mung Bean Sprouts growing machine
*
* Watering every 2 hours
* play music when watering
*
 * Relay pin 12
* speaker pin 8
*
 * created 22 Jan 2017
 *
 * updated 24 Jan 2017
 * -Added one more song (Butterfly)
 * -Randomly select a song (Schoolbell or Butterfly)
 * -watering every an hour from every 2 hours.
 * -increase watering time (Schoolbell - play 3 times, Butterfly - play 2 times)
*
 *by Douglas Changsoo Park
*
 */
 
#include <SimpleTimer.h>
#include "pitches.h"
 
int relay = 12;
int melodyPin = 8;
 
SimpleTimer timer;
 
int schoolbell_melody[] = {
  NOTE_G4,  NOTE_G4,  NOTE_A4,  NOTE_A4,  NOTE_G4,  NOTE_G4,  NOTE_E4,  NOTE_G4,  NOTE_G4,  NOTE_E4,  NOTE_E4,  NOTE_D4,  0,
  NOTE_G4,  NOTE_G4,  NOTE_A4,  NOTE_A4,  NOTE_G4,  NOTE_G4,  NOTE_E4,  NOTE_G4,  NOTE_E4,  NOTE_D4,  NOTE_E4,  NOTE_C4,  0 };
 
int schoolbell_noteDurations[] = {  1,1,1,1,  1,1,2,  1,1,1,1,  3,1,  1,1,1,1,  1,1,2,  1,1,1,1,  3,1  };

int butterfly_melody[] = {
  NOTE_G4,NOTE_E4,NOTE_E4,NOTE_F4,NOTE_D4,NOTE_D4,NOTE_C4,NOTE_D4,NOTE_E4,NOTE_F4,NOTE_G4,NOTE_G4,NOTE_G4,
  NOTE_G4,NOTE_E4,NOTE_E4,NOTE_E4,NOTE_F4,NOTE_D4,NOTE_D4,NOTE_C4,NOTE_E4,NOTE_G4,NOTE_G4,NOTE_E4,NOTE_E4,NOTE_E4,0,
  NOTE_D4,NOTE_D4,NOTE_D4,NOTE_D4,NOTE_D4,NOTE_E4,NOTE_F4,NOTE_E4,NOTE_E4,NOTE_E4,NOTE_E4,NOTE_E4,NOTE_F4,NOTE_G4,
  NOTE_G4,NOTE_E4,NOTE_E4,NOTE_F4,NOTE_D4,NOTE_D4,NOTE_C4,NOTE_E4,NOTE_G4,NOTE_G4,NOTE_E4,NOTE_E4,NOTE_E4,0
};

int butterflyNoteDurations[] = {
  1,1,2,1,1,2, 1,1,1,1,1,1,2,  1,1,1,1,1,1,2, 1,1,1,1,1,1,3,1,
  1,1,1,1,1,1,2,1,1,1,1,1,1,2,  1,1,2,1,1,2,1,1,1,1,1,1,3,1
};

void setup() {
  // put your setup code here, to run once:
  pinMode(relay, OUTPUT);
 digitalWrite(relay, HIGH);
  //timer.setInterval(7200000, watering);
  timer.setInterval(3600000, watering);
  //timer.setInterval(25000, watering); // Test Mode
}
 
void loop() {
  // put your main code here, to run repeatedly:
  timer.run();
}
 
void watering() {
  digitalWrite(relay, LOW);
  int song = random(1,3);
  if(song == 1) {
    music_schoolBell();
    music_schoolBell();
    music_schoolBell();
  } else {
    music_butterfly();
    music_butterfly();
  }
  digitalWrite(relay, HIGH);
  noTone(8);
}
 
void music_schoolBell() {
    int size = sizeof(schoolbell_melody) / sizeof(int);
  for(int thisNote = 0; thisNote < size; thisNote++) {
      int noteDuration = 250 * schoolbell_noteDurations[thisNote];
      tone(melodyPin, schoolbell_melody[thisNote], noteDuration);
      int pauseBetweenNotes = noteDuration * 1.30;
      delay(pauseBetweenNotes);
      noTone(melodyPin);
  }
}

void music_butterfly(){
  int size = sizeof(butterfly_melody) / sizeof(int);
  for (int thisNote = 0; thisNote < size; thisNote++) {
      int noteDuration = 250 * butterflyNoteDurations[thisNote];
      tone(melodyPin, butterfly_melody[thisNote], noteDuration);
      int pauseBetweenNotes = noteDuration * 1.30;
      delay(pauseBetweenNotes);
      noTone(melodyPin);
  }
}


반응형


반응형

Automated Mung Bean Sprouts growing machine

(자동 콩나물 재배기)




※ How to grow mung bean sprouts


1. Rinse over beans and soak around for a day (24 hours)
2. Place net in pot and spread beans on the net and then cover the pot with something to make inside dark.
3. watering every 2 hours ==> Automate this step



※ Target : develop automated watering machine using Arduino



※  Components and Supplies



- Arduino Uno : $13.98



- 12V mini water pump  : $7.72



- 1 channel Relay : $3.37



- 12V Adapter + Barrel Jack : $5.3


- Small Breadboard and some jumper wires


- a piece of hose





※ Circuit




※ Source Code


/*
* For Automated Mung Bean Sprouts growing machine
*
* Watering every 2 hours
* play music when watering
*
 * Relay pin 12
* speaker pin 8
*
 * created 22 Jan 2017
*
 *by Douglas Changsoo Park
*
 */
 
#include <SimpleTimer.h>
#include "pitches.h"
 
int relay = 12;
 
SimpleTimer timer;
 
int melody[] = {
  NOTE_G4,
  NOTE_G4,
  NOTE_A4,
  NOTE_A4,
  NOTE_G4,
  NOTE_G4,
  NOTE_E4,
  NOTE_G4,
  NOTE_G4,
  NOTE_E4,
  NOTE_E4,
  NOTE_D4,
  0,
  NOTE_G4,
  NOTE_G4,
  NOTE_A4,
  NOTE_A4,
  NOTE_G4,
  NOTE_G4,
  NOTE_E4,
  NOTE_G4,
  NOTE_E4,
  NOTE_D4,
  NOTE_E4,
  NOTE_C4,
  0 };
 
  int noteDurations[] = {
  1,1,1,1,
  1,1,2,
  1,1,1,1,
  3,1,
  1,1,1,1,
  1,1,2,
  1,1,1,1,
  3,1
  };
 
void setup() {
  // put your setup code here, to run once:
  pinMode(relay, OUTPUT);
 digitalWrite(relay, HIGH);
  timer.setInterval(7200000, watering);

}
 
void loop() {
  // put your main code here, to run repeatedly:
  timer.run();
}
 
void watering() {
  digitalWrite(relay, LOW);
  music();

  music();

  digitalWrite(relay, HIGH);
  noTone(8);
}
 
void music() {
  for(int thisNote = 0; thisNote < 26; thisNote++) {
      int noteDuration = 250 * noteDurations[thisNote];
      tone(8, melody[thisNote], noteDuration);
      int pauseBetweenNotes = noteDuration * 1.30;
      delay(pauseBetweenNotes);
      noTone(8);
  }
}




※ Picture





※ Youtube



반응형


반응형

Configuring the onboard WiFi  (English)



Yún(雲)은 액세스 포인트 역할을하지만 기존 네트워크에도 연결할 수 있습니다. 이 지침은 Yún(雲)을 무선 네트워크에 연결하는 과정을 안내합니다. Yún(雲)은 WEP, WPA 및 WPA2 암호화를 지원하는 네트워크는 물론 암호화되지 않은 네트워크에도 연결할 수 있습니다.


처음 Yún(雲)의 전원을 켜면 Linino-XXXXXXXX라는 WiFi 네트워크가 생성됩니다. 컴퓨터를 이 네트워크에 연결하십시오.


IP 주소를 얻은 다음 웹 브라우저를 열고 주소 표시 줄에 http : //linino.local 또는 192.168.240.1을 입력하십시오. 잠시 후 암호를 묻는 웹 페이지가 나타납니다. "doghunter"를 입력하고 로그인 버튼을 클릭하십시오.






현재 네트워크 연결에 대한 진단 정보가있는 페이지를 찾을 수 있습니다. 첫 번째는 WiFi 인터페이스이고, 두 번째는 Ethernet 연결입니다. 진행하려면 Configuration 버튼을 누르십시오.





새 페이지에서 Yún(雲)을 구성하고 고유 한 이름을 지정하고 연결할 네트워크를 식별합니다.


board 이름 입력란에 Arduino의 고유 이름을 입력하십시오. 이것을 나중에 참조 할 때 사용할 것입니다.


Arduino에 8 자 이상의 암호를 선택하십시오. 이 필드를 공백으로두면 기본 암호 인 doghunter가 유지됩니다


원하는 경우 시간대와 국가를 설정할 수 있습니다. 이러한 옵션은 로컬 WiFi 네트워크 연결에 도움이되므로 설정하는 것이 좋습니다. 현지 시간대를 설정하면 해당 국가의 규제 도메인도 선택됩니다.


연결하려는 WiFi 네트워크의 이름을 입력하십시오.


보안 유형을 선택하고 암호를 입력하십시오.





Configure & Restart (구성 및 재시작) 버튼을 누르면 Arduino가 재설정되고 지정된 네트워크에 연결됩니다. Arduino 네트워크는 잠시 후 종료됩니다.





이제 Yún(雲)에게 지정한 네트워크에 가입 할 수 있습니다.





Programming the 32U4 over WiFi


Yún(雲)이 컴퓨터와 동일한 네트워크에 있으면 무선으로 연결하여 프로그래밍 할 수 있습니다.

Yún(雲)을 구성한 후 구성 설정에서 지정한 네트워크에 연결하십시오. Arduino IDE를 엽니 다.

Tools> Port 메뉴에서 Yún(雲)의 이름과 IP 주소를 나열하는 항목이 보여야 합니다. board 메뉴에서 Arduino Yún(雲)을 선택하십시오.

Blink example (File > Examples > 01Basics > Blink)을 열고 board에 스케치를 업로드하십시오. 관리자 암호를 묻는 메시지가 나타납니다. 구성 화면에서 입력 한 것을 사용하십시오.

프로그램이 업로드되면 32U4 프로세서가 다시 시작됩니다. 13 번 핀에 연결된 LED가 깜박 거려야합니다.


Using the onboard Ethernet


Yun을 Ethernet 케이블로 유선 네트워크에 연결하면 DHCP를 통해 자동으로 연결을 시도합니다. board는 Wi-Fi와 마찬가지로 포트 메뉴에 표시됩니다.

Yun을 컴퓨터에 직접 연결하려면 컴퓨터의 인터페이스가 고정 IP 주소를 갖도록 구성하거나 DHCP 서버의 역할을 수행하십시오.

NB : Ethernet 인터페이스는 eth1이 아니라 eth0입니다.


Tutorial (English)





Tutorial (Korean)






Communicating with LininoOS via Bridge


Bridge 라이브러리는 Arduino와 LininoOS 간의 통신을 가능하게합니다. 아래에 표현된 대로 둘 사이에서 서로 다른 종류의 커뮤니케이션을 용이하게 해 주는 여러개의 utility class들이 있습니다. 좀 더 자세한 내용은 Bridge library reference 페이지를 참조하세요.





WiFi 및 Ethernet 인터페이스, USB 호스트 및 SD 카드는 모두 AR9331에 연결됩니다. Bridge 라이브러리를 사용하면 이러한 장치로 작업하고 스크립트를 실행하고 웹 서비스와 통신 할 수 있습니다.


The Console

Bridge를 기반으로 한 콘솔을 사용하면 직렬 모니터에서와 같이 무선으로 정보를 Yún(雲)에서 컴퓨터로 보낼 수 있습니다. 그것은 SSH를 통해 Yún(雲)과 컴퓨터 사이의 보안 연결을 만듭니다.

다음을 Yún(雲)에 Load 하세요.

#include <Console.h>

const int ledPin = 13; // the pin that the LED is attached to
int incomingByte;      // a variable to read incoming serial data into

void setup() {
  // initialize serial communication:
  Bridge.begin();
  Console.begin();

  while (!Console){
    ; // wait for Console port to connect.
  }
  Console.println("You're connected to the Console!!!!");
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // see if there's incoming serial data:
  if (Console.available() > 0) {
    // read the oldest byte in the serial buffer:
    incomingByte = Console.read();
    // if it's a capital H (ASCII 72), turn on the LED:
    if (incomingByte == 'H') {
      digitalWrite(ledPin, HIGH);
    }
    // if it's an L (ASCII 76) turn off the LED:
    if (incomingByte == 'L') {
      digitalWrite(ledPin, LOW);
    }
  }
  delay(100);
}




콘솔을 보려면 포트 메뉴에서 Yún(雲)의 이름과 IP 주소를 선택하십시오. Yún(雲)은 컴퓨터가 Yún(雲)과 동일한 LAN에있는 경우에만 포트 메뉴에 나타납니다. board가 다른 네트워크에 있으면 Ports (포트) 메뉴에 표시되지 않습니다. 포트 모니터를 엽니 다. Yún(雲)의 암호를 묻는 메시지가 나타납니다.


터미널 창을 열고 ssh root@yourYunsName.local 'telnet localhost 6571'을 입력 한 다음 enter를 눌러 콘솔을 볼 수도 있습니다.


주의 : Windows를 사용하는 경우 터미널 에뮬레이터를 설치해야합니다. PuTTY는 좋은 프로그램입니다. PuTTY에서는 위의 두 명령을 별도로 입력해야합니다.


'H'를 입력하면 핀 13의 LED가 켜지고 'L'을 입력하면 LED가 꺼집니다.


Process


프로세스 명령을 사용하면 Arduino를 통해 LininoOS에서 Linux 프로세스를 실행할 수 있습니다.

다음 예에서 LininoOS는 curl을 사용하여 서버에 연결하고 ASCII 텍스트를 다운로드합니다. 텍스트를 직렬 연결로 인쇄합니다.

#include <Process.h>

void setup() {
  // Initialize Bridge
  Bridge.begin();

  // Initialize Serial
  Serial.begin(9600);

  // Wait until a Serial Monitor is connected.
  while (!Serial);

  // run various example processes
  runCurl();
}

void loop() {
  // Do nothing here.
}

void runCurl() {
  // Launch "curl" command and get Arduino ascii art logo from the network
  // curl is command line program for transferring data using different internet protocols
  Process p;        // Create a process and call it "p"
  p.begin("curl");  // Process that launch the "curl" command
  p.addParameter("http://arduino.cc/asciilogo.txt"); // Add the URL parameter to "curl"
  p.run();      // Run the process and wait for its termination

  // Print arduino logo over the Serial
  // A process output can be read with the stream methods
  while (p.available()>0) {
    char c = p.read();
    Serial.print(c);
  }
  // Ensure the last bit of data is sent.
  Serial.flush();
}




Using Bridge to pass information between processors

Bridge를 사용하면 키 / 값 쌍을 사용하여 두 프로세서간에 정보를 전달할 수 있습니다.

이 예제는 Bridge 라이브러리를 사용하여 REST 호출을 통해 board의 디지털 및 아날로그 핀에 액세스하는 방법을 보여줍니다. 브라우저를 통해 REST 스타일 호출을 사용할 때 자신의 API를 만드는 방법을 보여줍니다.

이 예제를 실행할 때 컴퓨터가 Yun과 동일한 네트워크에 있는지 확인하십시오.

board를 프로그래밍했으면 핀에 값을 요청하고 핀에 값을 쓰고 핀을 입력 또는 출력으로 구성 할 수 있습니다.

REST 암호가 해제되어 있으면 다음과 같은 URL 구조의 브라우저를 사용할 수 있습니다.



원하는 경우 브라우저 대신 명령 행에서 curl 명령을 사용할 수 있습니다.

Bridge, YunServer 및 YunClient 라이브러리를 포함해야합니다.


#include <Bridge.h>
#include <YunServer.h>
#include <YunClient.h>



Yun이 연결된 클라이언트를 청취 할 수 있도록 서버를 인스턴스화하십시오.

YunServer server;

setup ()에서 디버깅을 위해 직렬 통신을 시작하고 Bridge가 시작되는 동안 핀 13의 내장 LED를 HIGH로 설정하십시오. Bridge.begin ()이 (가) 차단 중이며 완료하는 데 약 2 초가 걸립니다. 브리지가 시동되면 LED를 끄십시오.

void setup() {
  Serial.begin(9600);
  pinMode(13,OUTPUT);
  digitalWrite(13, LOW);
  Bridge.begin();
  digitalWrite(13, HIGH);



setup ()의 두 번째 부분에서는 YunServer의 인스턴스에 localhost에서만 들어오는 연결을 수신 대기하도록 지시합니다. LininoOS와의 연결은 핀 분석 및 제어를 위해 32U4 프로세서로 전달됩니다. 이것은 포트 5555에서 발생합니다. server.begin ()을 사용하여 서버를 시작합니다.



server.listenOnLocalhost();
  server.begin();
}


loop ()에서 YunClient의 인스턴스를 만들어 연결을 관리합니다. 클라이언트가 연결되면 사용자 정의 기능 (아래 설명 참조)에서 요청을 처리하고 완료되면 연결을 닫습니다.

루프 ()의 끝 부분에 지연을 두는 것은 프로세서가 너무 많은 일을하지 않도록하는 데 도움이됩니다.


void loop() {
  YunClient client = server.accept();

  if (client) {
    process(client);
    client.stop();
  }

  delay(50);
}



YunClient를 인수로 사용하는 process라는 함수를 만듭니다. 들어오는 정보를 보관할 문자열을 작성하여 명령을 읽으십시오. REST 명령을 기능 (디지털, 아날로그 및 모드)별로 구문 분석하고 해당 이름이 지정된 함수에 정보를 전달하십시오.


void process(YunClient client) {
  String command = client.readStringUntil('/');

  if (command == "digital") {
    digitalCommand(client);
  }
  if (command == "analog") {
    analogCommand(client);
  }
  if (command == "mode") {
    modeCommand(client);
  }
}




디지털 명령을 처리하는 함수를 만듭니다. 클라이언트를 인수로 승인하십시오. 명령의 핀과 값을 보유 할 로컬 변수를 작성하십시오.

void digitalCommand(YunClient client) {
  int pin, value;


 
client.parseInt ()를 사용하여 핀에 대한 클라이언트의 요청을 구문 분석하십시오.

핀의 뒤의 문자가 「/」의 경우는, URL가 1 또는 0의 값을 가지는 것을 의미합니다. 이 값은 핀에 값을 할당하여 HIGH 또는 LOW로 만듭니다. 말미의 「/」가없는 경우, 지정된 핀으로부터 값을 읽어들입니다.

pin = client.parseInt();

  if (client.read() == '/') {
    value = client.parseInt();
    digitalWrite(pin, value);
  }
  else {
    value = digitalRead(pin);
  }


값을 클라이언트에 인쇄하고 데이터 저장소 키를 현재 핀 값으로 업데이트하십시오.

F ()에서 클라이언트에 값을 래핑하면 플래시 메모리 형태로 인쇄됩니다. 이렇게하면 URL과 같은 긴 문자열을 처리 할 때 유용한 SRAM의 공간을 절약 할 수 있습니다.

키는 핀이 될 것이고, 타입이 될 것이다. 예를 들어 디지털 핀 2에 대해 D2가 저장됩니다.이 값은 핀이 현재 설정되어 있거나 핀에서 읽은 값이됩니다.

client.print(F("Pin D"));
  client.print(pin);
  client.print(F(" set to "));
  client.println(value);

  String key = "D";
  key += pin;
  Bridge.put(key, String(value));
}


아날로그 입력 핀으로 작업 할 때 D 대신 A로 키를 설정하는 것을 제외하면 동일한 방식으로 아날로그 통화를 처리하는 기능을 설정하십시오.


void analogCommand(YunClient client) {
  int pin, value;

  pin = client.parseInt();

  if (client.read() == '/') {
    value = client.parseInt();
    analogWrite(pin, value);

    // Send feedback to client
    client.print(F("Pin D"));
    client.print(pin);
    client.print(F(" set to analog "));
    client.println(value);

    String key = "D";
    key += pin;
    Bridge.put(key, String(value));
  }
  else {
    value = analogRead(pin);

    client.print(F("Pin A"));
    client.print(pin);
    client.print(F(" reads analog "));
    client.println(value);

    String key = "A";
    key += pin;
    Bridge.put(key, String(value));
  }
}




핀 모드 변경을 처리하는 하나 이상의 함수를 만듭니다. YunClient를 인수로 받아들이고 핀 번호를 저장할 로컬 변수를 만듭니다. 디지털 및 아날로그 기능에서와 마찬가지로 핀 값을 읽습니다.

void modeCommand(YunClient client) {
  int pin;
  pin = client.parseInt();



URL이 올바른지 확인하십시오.


if (client.read() != '/') {
    client.println(F("error"));
    return;
  }



유효한 URL 인 경우 URL을 문자열로 저장하십시오. 모드가 입출력이면, 핀을 구성하여 클라이언트에보고하십시오. 문자열이이 값과 일치하지 않으면 오류를 반환합니다.

String mode = client.readStringUntil('\r');

  if (mode == "input") {
    pinMode(pin, INPUT);
    // Send feedback to client
    client.print(F("Pin D"));
    client.print(pin);
    client.print(F(" configured as INPUT!"));
    return;
  }

  if (mode == "output") {
    pinMode(pin, OUTPUT);
    // Send feedback to client
    client.print(F("Pin D"));
    client.print(pin);
    client.print(F(" configured as OUTPUT!"));
    return;
  }

  client.print(F("error: invalid mode "));
  client.print(mode);
}


이 예제에 대한 자세한 내용은 Bridge Example 페이지에서 확인할 수 있습니다.




최종 수정 2011 년 11 월 4 일 SM

Arduino 시작 안내서의 텍스트는 Creative Commons Attribution-ShareAlike 3.0 License에 따라 사용이 허가되었습니다. 가이드의 코드 샘플은 공개 도메인으로 배포됩니다.

반응형


반응형

Getting Started with the Arduino Yún LininoOS



Arduino Yún(雲)은 다른 Arduino board와는 많이 다릅니다. 프로그래밍 중에는 Arduino Leonardo와 매우 유사하며 동일한 프로세서 인 Atmel ATmega32U4를 사용합니다. 그리고 LininoOS 및 OpenWrt 무선 스택을 실행하는 Atheros AR9331이라는 추가 프로세서가 있습니다. USB를 통해 32U4를 프로그래밍하는 것은 Arduino Leonardo와 동일합니다. Wi-Fi 네트워크에 연결하도록 Yún(雲)을 구성하면 Wi-Fi를 통해 32U4를 프로그래밍 할 수 있습니다.


Quick Start

Arduino Yún(雲)은 모든 board에 공통적 인 통합 개발 환경 인 Arduino Software (IDE)를 사용하여 프로그래밍됩니다. Getting Started에서 설명 된대로 PC에 이 IDE가 설치되어 있어야합니다.



Installing Drivers for the Yún(雲)

OSX


첫 번째로 Yún(雲)을 Mac에 연결하면 "Keyboard Setup Assistant"가 시작됩니다. Yún(雲)을 위해 따로 구성 할 것은 없습니다. 창 왼쪽 상단의 빨간색 버튼을 클릭하여이 대화 상자를 닫을 수 있습니다.




Windows


Arduino Software (IDE)의 Windows 버전에는 이미 적절한 드라이버가 들어 있습니다. 설치하면 운영 체제에서 설치하게됩니다. Yún(雲)을 연결하면 드라이버가 자동으로 설치됩니다.



Linux
Ubuntu 10.0.4 이상용 드라이버를 설치할 필요는 없지만 포트 5353이 방화벽에 의해 차단되지 않도록하십시오.


Open your first sketch

LED blink 예제 스케치를 엽니 다 : File > Examples >01.Basics > Blink.





Select your board type and port


Arduino 또는 Genuino board에 해당하는 Tools> Board 메뉴에서 항목을 선택해야합니다.





Tools | Serial Port menu에서 board의 serial device를 선택하십시오. COM3 나 그 이상이 될 것입니다. (COM1 및 COM2는 일반적으로 하드웨어 직렬 포트 용으로 예약 됨). 이것을 알려면 board를 disconnect 한 후 메뉴를 다시 여세요. 사라지는 항목이 Arduino 또는 Genuino board 입니다. board를 다시 연결하고 해당 직렬 포트를 선택하십시오. board가 WiFi에서 제대로 구성되면 스크린 샷과 같이 포트 목록에서 board를 찾을 수 있습니다.





Upload the program

이제 environment에서 'Upload'버튼을 클릭하기 만하면됩니다. 잠시 기다린 후 - board의 RX 및 TX LED가 깜박이는 것이 보여야 합니다. 업로드가 완료되면 'Done uploading'라는 메시지가 상태 표시 줄에 나타납니다.





업로드가 완료되고 몇 초 후에 on-board LED가 깜박일 것입니다. If it does, congratulations! Arduino Yún(雲)을 잘 사용하고 있는 겁니다. 문제가있는 경우 troubleshooting suggestions을 참조하십시오.




Get inspired

이제 Yún(雲) board를 설정하고 프로그래밍 했으므로  Project Hub 튜토리얼 플랫폼에서 영감을 얻거나 Bridge library and examples를 더 깊이 파고들 수 있습니다. Yún(雲)  hardware page에서 추가 기술 정보를 확인할 수도 있습니다.






Please Read...



Arduino Leonardo와의 차이점





YUn은 32U4 칩 외에도 OpenWrt를 기반으로 한 LininoOS라는 임베디드 시스템 용 Linux 배포판을 실행하는 Atheros AR9331이라는 추가 프로세서를 보유하고 있습니다. Python 2.7의 full install도 포함되어 있습니다.

Yún(雲)은 Leonardo보다 다양한 물리적 특성과 connectors 를 가지고 있습니다. on-board SD 슬롯, Ethernet jack 및 USB-A Host connector가 있습니다. Yún(雲)에는 ower barrel connector가 없습니다. 마이크로 USB 커넥터에서 전원을 공급받을 수 있습니다.

5V 레귤레이터가 내장되어 있지 않습니다. 5V 이상으로 Yún(雲)에 전원을 공급하면 손상 될 수 있습니다. 마이크로 USB 연결에서 Yún(雲)에 전원을 공급하지 않으면 board의 VIN 및 5V 핀에 전원을 공급할 수 있습니다. VIN 핀을 사용하는 경우 5V 이상을 공급할 수 없으므로 board가 손상 될 수 있습니다. 되도록 USB 연결로 Yún(雲)에 전원을 공급하는 것이 권장됩니다.

SD, Ethernet 및 USB-A 커넥터는 물리적으로 32U4 프로세서에 연결되지 않으며 AR9331에 연결됩니다.

Yún(雲)의 32U4는 Serial1을 사용할 수 없다는 점을 제외하면 Leonardo와 같은 방식으로 작동합니다. AR9331 프로세서와 통신하기 위해 예약되어 있습니다.

또한 Yún(雲)에는 WiFi 모듈이 내장되어있어 무선 라우터에 연결하거나 액세스 포인트 역할을 할 수 있습니다.

32u4, WiFi 및 AR9331 프로세서에는 모두 자체 재설정 단추가 있습니다.






Yún(雲)에는 전원, WLAN 연결, WAN 연결 및 USB를 나타내는 몇 가지 상태 LED가 있습니다. 또한 핀 13은 상태 표시등 중 하나에 연결됩니다.





OpenWrt LininoOS


LininoOS는 약 3000 개의 패키지가 내장되어 있으며 OpenWRT 배포를 기반으로합니다. LininoOS는 GPG 서명이있는 패키지 관리 기능을 갖춘 완벽하게 쓰기 가능한 파일 시스템을 제공합니다. LininoIO와 통합되어 IoT 공간을위한 완벽한 리눅스 시스템입니다. LininoOS는 Arduino Yun을 위해 많은 혁신적인 기능들을 제공합니다.


    LininoIO는 마이크로 프로세서 환경에 마이크로 컨트롤러 기능을 통합 할 수있는 소프트웨어 프레임 워크입니다. LininoOS를 사용하여 Linux 측에서 Node.js, Python, Bash 등을 사용하여 응용 프로그램을 간단하게 작성하여 board와 모든 장치를 완벽하게 제어 할 수 있습니다.


    Ideino Node.js가 포함 된 Node.js는 빠르고 확장 가능한 네트워크 애플리케이션을 손쉽게 구축 할 수 있도록 Chrome의 JavaScript 런타임에 구축 된 플랫폼입니다. Node.js는 가볍고 효율적이며 분산 장치에서 실행되는 데이터 집약적 인 실시간 애플리케이션에 완벽한 이벤트 구동 비 차단 I / O 모델을 사용합니다. Ideino는 node.js 응용 프로그램을 작성하고 디버깅 할 수있는 임베디드 편집기입니다.


    AllJoyn은 범용 소프트웨어 프레임 워크와 연결된 제품 및 소프트웨어 응용 프로그램 간의 상호 운용성을 지원하여 동적 인 근거리 네트워크를 만들 수있는 핵심 시스템 세트를 제공하는 오픈 소스 프로젝트입니다.


지속적인 개선과 OpenWrt 커뮤니티와 Arduino 커뮤니티의 제안으로 인해 LininoOS는 계속 개선 되고 있습니다. Yún(雲)에 설치된 LininoOS 를 설치한 지 오래 된 경우 upgrade tutorial 을 확인하고 사용 가능한 최신 버전을 실행하고 있는지 확인하십시오.


웹 인터페이스에 액세스하는 방법은 아래에 설명되어 있습니다.



Install additional software on Linux


Yún(雲)은 "curl"과 "python"을 포함하여 LininoOS에 사전 설치된 여러 소프트웨어를 제공합니다. Yún(雲)에 다른 소프트웨어를 설치 할 수 있습니다. Linux 시스템에서는 "opkg"도구를 사용하여 추가 소프트웨어를 설치할 수 있습니다. LininoOS에 대한 사전 컴파일 된 패키지는 최신 버전에서 찾을 수 있습니다.
LininoOS 시스템과 인터페이스 할 때 Arduino 's Bridge 라이브러리를 통해 액세스하거나 SSH를 통해 명령 행을 사용해야합니다. command line에 익숙하지 않다면 자주 사용되는 프로그램과 몇 가지 기본 사항에 대해 읽어보십시오.


Python



LininoOS에는 Python 2.7 설치가 포함되어 있으며, 여기에 응용 프로그램이나 스크립트를 작성할 수 있습니다. Python에 대한 자세한 내용은 Python 2.7 documentation pages를 참조하십시오.


처음으로 Python을 시작한다면 많은 훌륭한 자료가 온라인에 있습니다. "Learn Python the Hard Way" 는 자신 만의 스크립트로 시작하고 실행하기 위해 알아야 할 모든 것을 다루고 있습니다.



External storage on the Yún


Yún(雲)에 내장 된 비 휘발성 메모리는 쓰기가 제한되어 있으므로 사용하지 않는 것이 좋습니다.


데이터 저장을 위해 microSD 카드 나 thumb drive와 같은 외부 메모리를 사용하거나 스크립트, 웹 페이지 등을 사용할 수 있습니다. Yún(雲)이 32U4를 통해 이러한 드라이브에 대한 정보에 액세스하여 저장하려면 volume의 root에 arduino라는 디렉토리가 있어야합니다.


Web services


LininoOS는 클라이언트와 서버에 REST를 사용합니다. REST는 "Representational State Transfer"의 머리 글자입니다. Arduino 하드웨어의 여러 부분을 URL을 통해 노출하는 소프트웨어 아키텍처입니다.


기본적으로 REST API 액세스는 비밀번호로 보호됩니다. 암호를 변경하지 않고 서비스에 액세스하려면이 설정을 변경할 수 있습니다. 이 설정을 변경하려면 Yún(雲) 구성 패널을 입력하십시오. 페이지 하단에 액세스 변경을위한 토글이 표시됩니다.



REST의 개념에 대한 훌륭한 소개는 여기에서 찾을 수 있습니다.


Yún(雲)이 인식하는 세 가지 REST 엔드 포인트는 다음과 같습니다.


    / arduino
    /데이터
    /mailbox



"/ arduino"디렉토리에는 사전 구성된 것이 없습니다. end point 다음에 URL에 추가 된 것은 웹 서버에서 32U4의 스케치로 전달됩니다. 스케치 내부에서 API를 정의 할 수 있습니다. board의 핀에 액세스하는 방법을 보려면 Bridge 예제를 참조하십시오.


"/ data"는 내부 키 / 값 저장에 액세스하는 데 사용됩니다. 사용할 수있는 통화는 다음과 같습니다.


    / put / KEY / VALUE : 저장소에 값을 저장합니다.
    / get / KEY : JSON에서 요청한 키의 값을 얻습니다.
    / get : JSON에서 전체 저장 목록을 가져옵니다.
    / delete : 내부 저장소를 삭제합니다.



"mailbox"은 Mailbox라는 대기열에 메시지를 추가하는 데 사용됩니다. 메시지 대기열은 Linux 시스템에 저장되며 Arduino 마이크로 컨트롤러에서 읽을 수 있습니다. 사용 가능한 REST 호출은 다음과 같습니다.


    "/ mailbox / message"
   



Resetting the processors (AR9331, WiFi, and 32U4)


LininoOS를 재부팅하는 AR9331을 다시 시작하려면 아날로그 입력 핀과 board의 LED에 가까운 "Yún(雲) RST"재설정 버튼을 누릅니다.


32U4를 다시 시작하고 현재 설치된 Arduino 스케치를 다시 시작하려면 Ethernet 포트 옆에있는 버튼을 두 번 누릅니다.


WiFi 용 재설정 버튼은 USB-A 커넥터 옆에 있습니다. "WLAN RST"라고 표시되어 있습니다. 버튼을 누르면 WLAN LED가 깜박입니다.


다른 네트워크로 이동하여 더 이상 웹 인터페이스를 통해 Yún(雲)에 무선으로 액세스 할 수없는 경우 Wi-Fi 재설정 버튼 (WLAN RST)을 5 초 이상 30 초 미만으로 길게 눌러 Yún(雲)의 네트워크 구성을 재설정 할 수 있습니다. AR9331 프로세서가 재부팅됩니다. WiFi 구성이 재설정되고 Yún(雲)이 자체 Wi-Fi 네트워크 Arduino Yún(雲)-XXXXXXXXXXXXX를 시작합니다. 다른 모든 수정 / 구성은 유지됩니다.


LininoOS 배포를 기본 상태로 재설정하려면 WiFi 재설정 버튼 (WLAN RST)을 30 초 이상 누릅니다. board는 원래 설정으로 되돌아갑니다. 상자에서 꺼내거나 이전에 다시 플래시 한 LininoOS 이미지의 최신 업데이트로 가져 왔습니다. 무엇보다도 이것은 설치된 모든 파일과 네트워크 설정을 제거합니다.



Resetting the password


웹 패널 암호를 재설정하고 변경할 수 있습니다. USB 케이블로 Arduino Yún(雲)을 컴퓨터에 연결하고 YunSerialTerminal 스케치를 업로드하십시오. Arduino IDE의 Bridge 예제에서 찾을 수 있습니다. Yún(雲) 부팅이 완료되면 직렬 모니터를 열고 드롭 다운 메뉴에서 New Line 문자를 선택한 다음 Enter 키를 누릅니다. 아래와 같은 것이 직렬 모니터에 나타나야합니다.






이제 암호를 변경하려면 passwd 명령을 실행해야합니다. passwd를 직렬 모니터 입력에 입력하고 Enter 키를 누릅니다. 새 암호를 입력하라는 메시지가 나타나면 암호를 다시 입력하여 확인하십시오. 원하는 경우 약한 암호 오류를 무시할 수 있습니다. 입력 한 두 암호가 일치하면 시스템 암호가 변경되고 새 암호로 웹 패널에 액세스 할 수 있습니다.



Serial re-enumeration on reset.


Yún(雲)에는 직렬 통신을 처리하는 전용 칩이 없기 때문에 직렬 포트가 가상이라는 것을 의미합니다. 이는 운영 체제와 board 자체의 소프트웨어 루틴입니다. Arduino를 연결할 때 컴퓨터가 직렬 포트 드라이버 인스턴스를 생성하는 것처럼 32u4는 부트 로더를 실행할 때마다 직렬 인스턴스를 생성합니다. 이 board는 USB의 CDC (Connected Device Class) 드라이버의 인스턴스입니다.


즉, 32U4 프로세서를 리셋 할 때마다 USB 직렬 연결이 끊어지고 다시 설정됩니다. board가 직렬 포트 목록에서 사라지고 목록이 다시 열거됩니다. Yún(雲)에 대한 직렬 연결이 열려있는 프로그램은 연결을 끊습니다. 이것은 USB 연결 (보조 ATmega8U2 또는 ATmega16U2 프로세서에서 유지 관리)을 닫지 않고 주 프로세서 (ATmega328P)를 재설정 할 수있는 Arduino Uno와는 대조적입니다. 이 차이점은 드라이버 설치, 업로드 및 통신에 영향을 미칩니다.
직렬 포트를 열면 재설정되지 않습니다.


Yún(雲)은 컴퓨터에서 직렬 포트를 열 때 스케치를 다시 시작하지 않습니다. 즉, board에서 컴퓨터로 이미 전송 된 직렬 데이터 (예 : setup ()에서 전송 된 대부분의 데이터 포함)가 표시되지 않습니다.


이는 아래에 설명 된 콘솔에도 적용됩니다.



즉, 직렬 또는 콘솔 print (), println () 또는 write () 문을 setup ()에 사용하면 직렬 모니터 또는 콘솔 연결을 열 때 해당 문구가 표시되지 않습니다. 이 문제를 해결하려면 포트가 다음과 같이 열려 있는지 여부를 확인할 수 있습니다.

// Serial Monitor가 열릴 때까지 프로그램을 멈춘다.
   while (! Serial);


또는
// Console이 열릴 때까지 프로그램을 중지합니다.
   while (! Console);

반응형

[Arduino 雲] Overview Arduino Yún LininoOS

2017. 1. 20. 08:31 | Posted by 솔웅


반응형

Arduino Yun





Overview (English)



Arduino Yún(雲)은 ATmega32u4와 Atheros AR9331을 기반으로 한 마이크로 컨트롤러 보드입니다. Atheros 프로세서는 Linino OS 라는 이름의 OpenWrt 기반의 Linux distribution을 지원합니다. 보드에는 내장 Ethernet 및 WiFi 지원, USB-A 포트, 마이크로 SD 카드 슬롯, 20 개의 디지털 입 / 출력 핀 (7 개는 PWM 출력으로, 12 개는 아날로그 입력으로 사용 가능), 16 MHz crystal oscillator, 마이크로 USB connection, ICSP 헤더 및 3 개의 리셋 버튼이 있습니다.



NB : 일부 국가에서는 정부 승인없이 WiFi 지원 장치를 판매 할 수 없습니다. 적절한 인증을 기다리는 동안 일부 지역 배급 업체는 WiFi 기능을 비활성화합니다. 그런 나라에 사신다면 Yún(雲)을 구입하기 전에 대리점에 문의하십시오. WiFi를 사용하지 않으려면 이 스케치를 실행하십시오.



Yún(雲)은 보드에 내장 된 Linux distribution onboard 그리고  강력한 네트워크 된 컴퓨터와 communicate 할 수 있는 면에서 다른 Arduino 보드와 차별화됩니다. 거기에다가 cURL과 같은 Linux 명령를 사용해 사용자의 shell이나 python 스크립트를 만들어 이러한 상호작용을 견고하게 할 수 있습니다. Yún(雲)은 ATmega32u4를 사용하는 Leonardo와 유사하지만, Linux에 탑재되어 있는 면이 다릅니다. (USB 통신 기능이 내장되어있어 보조 프로세서가 필요 없음).


NB : Yun Release 5 새로운 Arduino Yun R5는 이러한 기능들이 이전 릴리스와 다릅니다.

    - 전원 공급 시스템은 AREF에 5V를 제공합니다.
    - 레이아웃이 수정되어 USB 신호용 구멍 2 개와 GP6 및 GPIO13 (LED2) 용 구멍 2 개가 추가되었습니다.

여기서 board  warranty  정보를 찾을 수 있습니다.



Getting Started




이 섹션에서 보드 구성에 필요한 모든 정보를 찾을 수 있습니다. 시작할 준비가 되셨습니까? 2014 년 10 월 이전에 Arduino Yún(雲)을 구입 한 경우에는 Yún(雲) Open WRT OS Getting Started Page를 참조하시고 2015 년 이 후에 구입했으면  Arduino Yún(雲)  Linino OS Getting Started page 페이지를 확인하십시오.


Need Help?



   
Technical specs

Yún(雲)에는 두 개의 프로세서가 있기 때문에 이 섹션에서는 두 테이블 각각의 특성을 보여줍니다.


AVR Arduino microcontroller


Microcontroller


ATmega32U4
Operating Voltage 5V
Input Voltage 5 V
Digital I/O Pins 20
PWM Output 7
Analog I/O Pins 12
DC Current per I/O Pin 40 mA on I/O Pins; 50 mA on 3,3 Pin
Flash Memory 32 KB (of which 4 KB used by bootloader)
SRAM 2.5 KB
EEPROM 1 KB
Clock Speed 16 MHz



Arduino Microprocessor


Processor


Atheros AR9331
Architecture MIPS
Operating Voltage 3.3V
Ethernet 802.3 10/100Mbit/s
WiFi 802.11b/g/n 2.4 GHz
USB Type 2.0 Host
Card Reader Micro-SD
RAM 64 MB DDR2
Flash Memory 16 MB
SRAM 2.5 KB
EEPROM 1 KB
Clock Speed 400 MHz




Documentation
 


OSH: Schematics



Arduino Yún(雲)은 오픈 소스 하드웨어입니다! 다음 파일을 사용하여 자신의 보드를 만들 수 있습니다.






Power


5V DC로 micro-USB 연결을 통해 보드에 전원을 공급하는 것을 권장합니다. Vin 핀을 통해 보드에 전원을 공급하는 경우, 규정 된 5VDC를 공급해야합니다. 높은 전압에 대비한 on-board voltage regulator가 없으므로 보드가 손상 될 수 있습니다.


Yún(雲)도 PoE 전원 공급 장치와 호환되지만 이 기능을 사용하려면 보드에 PoE 모듈을 장착하거나 사전 조립 된 보드를 구입해야합니다.


참고 : PoE 어댑터가있는 Yún(雲)의 초기 모델은 보드에 12V를 잘못 제공했습니다. 곧 업데이트 된 버전에서는 5V를 전달하는 distributors가 제공 될 것입니다. 보드에 잘못된 PoE 어댑터가 있다고 생각 되시면 support@arduino.org로 문의하십시오.
   

전원 핀은 다음과 같습니다.

    VIN. Arduino 보드의 입력 전압. 다른 Arduino 보드와 달리,이 핀을 통해 보드에 전원을 공급하려는 경우 규정 된 5V를 제공해야합니다.
    5V. 전원 공급 장치는 보드의 마이크로 컨트롤러 및 기타 구성 요소에 전원을 공급하는 데 사용됩니다. 이것은 VIN 또는 USB에 의해 제공 될 수 있습니다.
    3V3. on-board regulator에서 생성되는 3.3V 전원. 최대 전류 소모는 50mA입니다.
    GND. Ground pins.
    IOREF. 보드의 I / O 핀이 작동하는 전압 (예, 보드의 VCC). 이것은 Yún(雲)에서 5V입니다.



Memory


ATmega32u4는 32KB (부트 로더 용으로 4KB 사용)입니다. 또한 2.5KB의 SRAM과 1KB의 EEPROM (EEPROM 라이브러리로 읽고 쓸 수 있음)이 있습니다.


AR9331의 메모리는 프로세서 내부에 내장되어 있지 않습니다. RAM과 저장 메모리는 외부에서 연결됩니다. Yún(雲)에는 64 MB의 DDR2 RAM과 16 MB의 플래시 메모리가 있습니다. 플래시 메모리는 공장에서 Linino OS라는 OpenWrt 기반의 Linux 배포판으로 미리 로드됩니다. 프로그램을 설치할 때나 구성 파일을 변경할 때와 같이 공장 출하시 이미지의 내용을 변경할 수 있습니다. "WLAN RST" 버튼을 30 초 동안 눌러 공장 출하 상태로 되돌릴 수 있습니다.


Linino OS 설치는 사용 가능한 16MB의 내장 플래시 메모리 중 약 9MB를 차지합니다. 응용 프로그램 설치를 위한 디스크 공간이 더 필요하면 마이크로 SD 카드를 사용할 수 있습니다.


Input and Output


Atheros AR9331의 I / O 핀에 액세스 할 수 없습니다. 모든 I / O 라인은 32U4에 연결됩니다.


Yún(雲)에있는 20 개의 디지털 I / O 핀 각각은 pinMode (), digitalWrite () 및 digitalRead () 함수를 사용하여 입력 또는 출력으로 사용할 수 있습니다. 그것들은 5 볼트에서 작동합니다. 각 핀은 최대 40 mA를 제공하거나 수신 할 수 있으며 20-50 kOhms의 내부 풀업 저항 (기본적으로 연결이 끊어짐)이 있습니다. 또한 일부 핀에는 특수 기능이 있습니다 : 직렬 : 0 (RX) 및 1 (TX). ATmega32U4 하드웨어 직렬 기능을 사용하여 TTL 직렬 데이터를 수신 (RX) 및 전송 (TX)하는 데 사용됩니다. Yún(雲)에서 Serial 클래스는 USB (CDC) 통신을 의미합니다. 0 번과 1 번 핀의 TTL 직렬을 위해서는 Serial1 클래스를 사용하십시오.


ATmega32U4의 하드웨어 시리얼과 Yún(雲)의 AR9331은 함께 연결되어 두 프로세서 간의 통신에 사용됩니다. Linux 시스템에서 일반적인 것처럼 AR9331의 직렬 포트는 시스템에 액세스하기위한 콘솔에 노출되어 있습니다. 즉, 스케치에서 Linux가 제공하는 프로그램과 도구에 액세스 할 수 있습니다.


    TWI : 2 (SDA) 및 3 (SCL). 와이어 라이브러리를 사용하여 TWI 통신을 지원.
    외부 인터럽트 : 3 (인터럽트 0), 2 (인터럽트 1), 0 (인터럽트 2), 1 (인터럽트 3) 및 7 (인터럽트 4). 이 핀들은 낮은 값, 상승 또는 하강 edge 또는 값 변경시 인터럽트를 트리거하도록 구성 할 수 있습니다. 자세한 내용은 attachInterrupt () 함수를 참조하십시오. 핀 0과 1은 Linux 프로세서와 통신하는 데 사용되는 하드웨어 직렬 포트이기 때문에 인터럽트로 사용하지 않는 것이 좋습니다. 핀 7은 AR9331 프로세서에 연결되며 장래에 핸드 쉐이크 신호로 사용될 수 있습니다. 인터럽트로 사용하려는 경우 충돌(conflict) 할 가능성이 있으니 주의하세요.
    PWM : 3, 5, 6, 9, 10, 11 및 13. analogWrite () 기능으로 8 비트 PWM 출력을 제공합니다.
    SPI : ICSP 헤더에 있습니다. 이 핀은 SPI 라이브러리를 사용하여 SPI 통신을 지원합니다. SPI 핀은 우노 (Uno)에있는 디지털 I / O 핀에 연결되어 있지 않으므로 ICSP 커넥터에서만 사용할 수 있습니다. 즉, SPI를 사용하지만 Yún(雲)의 6 핀 ICSP 헤더에 연결된 6 핀 ICSP 커넥터가없는 Shild가있는 경우 Shild가 작동하지 않습니다. SPI 핀은 소프트웨어에서 SPI 인터페이스로 구현 된 AR9331 gpio 핀에도 연결됩니다. 이것은 ATMega32u4와 AR9331이 SPI 프로토콜을 사용하여 통신 할 수 있음을 의미합니다.
    LED : 13. 디지털 핀 13에 연결된 내장 LED가 있습니다. 핀이 HIGH 값일 때 LED가 켜지고 핀이 LOW이면 꺼집니다. Yún(雲)에는 전원, WLAN 연결, WAN 연결 및 USB를 나타내는 몇 가지 다른 상태 LED가 있습니다.


    아날로그 입력 : A0 - A5, A6 - A11 (디지털 핀 4, 6, 8, 9, 10 및 12). Yún(雲)에는 A0 ~ A11로 표시된 12 개의 아날로그 입력이 있으며이 모두는 디지털 I / O로도 사용할 수 있습니다. 핀 A0-A5는 Uno와 같은 위치에 나타납니다. 입력 A6-A11은 각각 디지털 I / O 핀 4, 6, 8, 9, 10 및 12에 있습니다. 각각의 아날로그 입력은 10 비트의 분해능 (즉, 1024 개의 상이한 값)을 제공한다. 기본적으로 아날로그 입력은 접지에서 5V까지 측정되지만, AREF 핀과 analogReference () 기능을 사용하여 범위의 상단을 변경할 수 있습니다.
     AREF. 아날로그 입력을위한 기준 전압. analogReference ()와 함께 사용됩니다.
     




보드에는 기능이 다른 3 개의 리셋 버튼이 있습니다.



    Yún(雲) RST. AR9331 마이크로 프로세서를 재설정하려면이 wire를 LOW로하십시오. AR9331을 재설정하면 Linux 시스템이 재부팅됩니다. RAM에 저장된 모든 데이터가 손실되고 실행중인 모든 프로그램이 종료됩니다.
    32U4 RST. 이 라인을 LOW로 설정하면 ATmega32U4 마이크로 컨트롤러를 재설정 할 수 있습니다. 일반적으로 리셋 버튼을 실드에 추가하여 보드의 블록을 막습니다.
    WLAN RST. 이 버튼에는 두 가지 기능이 있습니다. Primarly는 WiFi를 공장 구성으로 복원합니다. 출고시 구성은 Yún(雲)의 WiFi를 액세스 포인트 모드 (AP)에두고 기본 IP 주소 192.168.240.1을 할당하는 것으로 구성됩니다.이 경우 컴퓨터와 함께 Wi-Fi 네트워크에 표시되는 WiFi 네트워크에 연결할 수 있습니다 SSID 이름 "Arduino Yun-XXXXXXXXXXXX", 여기서 12 개의 'X'는 Yún(雲)의 MAC 주소입니다. 연결되면 브라우저의 192.168.240.1 또는 "http : //arduino.local"주소로 Yún(雲)의 웹 패널에 접속할 수 있습니다. WiFi 구성을 복원하면 Linux 환경이 재부팅됩니다. WiFi 구성을 복원하려면 WLAN RST 버튼을 5 초 동안 누르고 있어야합니다. 버튼을 누르면 WLAN 파란색 LED가 깜박이기 시작하고 5 초 후에 버튼을 놓으면 WiFi가 복원 절차가 기록되었음을 나타내는 깜박임을 계속합니다. WLAN RST 버튼의 두 번째 기능은 Linux 이미지를 기본 팩토리 이미지로 복원하는 것입니다. Linux 환경을 복원하려면 버튼을 30 초 동안 눌러야합니다. 공장 이미지를 복원하면 AR9331에 연결된 온보드 플래시 메모리에 저장된 모든 파일과 소프트웨어가 손실됩니다.

   
   
Communication    



Yún(雲)은 컴퓨터와 다른 Arduino 또는 기타 마이크로 컨트롤러와 통신하기위한 여러 가지 기능을 제공합니다. ATmega32U4는 전용 UART TTL (5V) 직렬 통신을 제공합니다. 또한 32U4는 USB를 통한 직렬 (CDC) 통신을 허용하며 컴퓨터의 소프트웨어에 대한 가상 COM 포트로 나타납니다. 또한 이 칩은 표준 USB COM 드라이버를 사용하여 최대 속도 USB 2.0 장치로 작동합니다. Arduino 소프트웨어에는 Arduino 보드와 간단한 텍스트 데이터를주고받을 수있는 직렬 모니터가 포함되어 있습니다. 데이터가 USB 연결을 통해 컴퓨터로 전송되면 보드의 RX 및 TX LED가 깜박입니다.
디지털 핀 0과 1은 32U4와 AR9331 간의 직렬 통신에 사용됩니다.
Ciao 라이브러리를 사용하여 프로세서 간의 통신을 할 수 있습니다.


SoftwareSerial 라이브러리를 사용하면 Yún(雲)의 디지털 핀 중 하나에서 직렬 통신이 가능합니다. 핀 0과 1은 Bridge 라이브러리에서 사용되므로 피해야합니다. 또한 ATmega32U4는 I2C (TWI) 및 SPI 통신을 지원합니다. Arduino 소프트웨어에는 I2C 버스의 사용을 단순화하는 Wire 라이브러리가 포함되어 있습니다. SPI 통신의 경우 SPI 라이브러리를 사용하십시오.


Yún(雲)은 일반 키보드 및 마우스로 표시되며 키보드 및 마우스 클래스를 사용하여 이러한 입력 장치를 제어하도록 프로그래밍 할 수 있습니다.



onboard Ethernet 및 WiFi 인터페이스는 AR9331 프로세서에 직접 노출됩니다. 데이터를 보내고 받으려면 Bridge 라이브러리를 사용하십시오.


Yún(雲)은 또한 Linino OS를 통해 USB 호스트 기능을 제공합니다. USB 플래시 장치와 같은 주변 장치를 추가 저장 장치, 키보드 또는 웹캠에 연결할 수 있습니다. 이러한 장치가 작동하려면 추가 소프트웨어를 다운로드하여 설치해야 할 수 있습니다.




Programming


Yún(雲)은 Arduino 소프트웨어로 프로그래밍 할 수 있습니다 (다운로드). 도구> 보드 메뉴에서 "Arduino Yún(雲)"을 선택하십시오 (여러분 board의 마이크로 컨트롤러에 맞게).


Arduino Yún(雲)의 ATmega32U4에는 external hardware programmer 없이 새로운 코드를 업로드 할 수있는 부트 로더가 미리 설치되어 있습니다. AVR109 프로토콜을 사용하여 통신합니다.


Arduino ISP 또는 이와 유사한 것을 사용하여 ICSP (In-Circuit Serial Programming) 헤더를 통해 부트 로더를 우회하여 마이크로 컨트롤러를 프로그래밍 할 수도 있습니다.



Automatic (Software) Reset


Yún(雲)은 업로드하기 전에 리셋 버튼을 물리적으로 누르지 않고 연결된 컴퓨터에서 실행되는 소프트웨어로 재설정 할 수 있도록 설계되었습니다. 리셋은 Yún(雲)의 가상 (CDC) 직렬 / COM 포트가 1200 보오 (baud)에서 열리고 나서 닫힐 때 트리거됩니다. 이 경우 프로세서가 재설정되어 USB 연결이 끊어집니다 (즉, 가상 직렬 / COM 포트가 사라짐). 프로세서가 재설정되면 부트 로더가 시작되고 약 8 초 동안 활성 상태를 유지합니다.


부트 로더는 Yún(雲)의 재설정 버튼을 눌러 시작할 수도 있습니다. 보드가 처음 전원을 켤 때 부트 로더를 시작하는 대신 사용자 스케치 (있는 경우)로 곧장 점프합니다. Yún(雲)이 리셋을 처리하는 방식 때문에 Arduino 소프트웨어가 업로드 전에 재설정을 시작하게하는 것이 가장 좋습니다. 특히 다른 보드에 업로드하기 전에 재설정 버튼을 누르는 습관이있는 경우에 특히 유용합니다. 소프트웨어가 보드를 재설정 할 수 없으면 보드의 재설정 버튼을 눌러 부트 로더를 시작할 수 있습니다.



USB Overcurrent Protection


Yún(雲)에는 컴퓨터의 USB 포트를 단락 및 과전류로부터 보호하는 재설정 가능한 폴리 퓨즈가 있습니다. 대부분의 컴퓨터가 자체적 인 내부 보호 기능을 제공하지만 퓨즈는 추가 보호 기능을 제공합니다. USB 포트에 500 mA 이상이 인가되면 단락 또는 과부화가 제거 될 때까지 퓨즈가 자동으로 연결을 끊습니다.



Physical Characteristics


Yún(雲) PCB의 최대 길이와 너비는 각각 2.7과 2.1 인치이며 USB 커넥터는 이전 치수를 초과하여 확장됩니다. 4 개의 나사 구멍으로 보드를 표면이나 케이스에 부착 할 수 있습니다. 디지털 핀 7과 8 사이의 거리는 160mil (0.16 ")이며 다른 핀의 100mil 간격의 배수가 아닙니다. 보드의 무게는 32g입니다.


Pin Out




Previous Versions

이 제품의 이전 버전을 소유하고 있습니까? 2014 년 10 월 이전에 Arduino Yún(雲)을 구입 한 경우 Yún(雲) Open WRT OS Getting Started Page를 확인하십시오. 2015 년에 구입 한 경우 Arduino Yún(雲) Linino OS Getting Started page를 확인하십시오.

반응형