Home

Arduino for the Cloud: Arduino Yún and Dragino

image

Contents

1. GND _ Ground IOREF Voltage of the I O pins VCC 5 V 5V 3V3 14 Arduino for the Cloud 2 4 23 Dragino Yun Shield The Dragino Yun shield gets its supply voltage from the connected Arduino board The Dragino HE draws under full load approximately 200 mA Its supply voltage is derived from the voltage at VIN of the Arduino board and will be converted on the Dragino Yun shield itself to 3 3 V DC The Dragino Yun shield should be powered under these condi tions via a VIN voltage of the Arduino board between 7 and 15 V DC and not via the USB connection The supply voltage for the USB host is derived from 5 V DC of the Arduino To avoid ovetheating of the voltage regulator on Ar duino when using the USB host the voltage at VIN should be limited to 7 V DC When using the Dragino Yun shield I have always worked with a voltage of 7 V DC on pin VIN The average cutrent consumption was 0 15 A in this case 2 2 Memory 2 2 1 Arduino Yun The ATmega32u4 used on Arduino Yun has a 32 KB flash memory The boot loader uses 4 KB of this memory The ATmega32u4 pro vides 2 5 KB of RAM and 1 KB of EEPROM for use The EEPROM library supports reading and writing of that EEPROM The Atheros AR9331 has no internal memory On board is 64 MB of DDR2RAM and a 16 MB flash memory The Linux distribu tion Linino OpenWRT is factory installed in the flash memory This factory image can be changed A reset to the factory insta
2. TWI 2 SDA WC interface 3 SCL The Wire library supports this communi cation External 0 INT2 These pins can be used as interrupt Interrupts 1 INT3 Hines 2 INT1 The pins can be configured to the follow 3 INTO ling interrupt requests Low at pin rising 7 INT4 Jor falling edge or change of the level Details are described at function attachInterrupt Pins 0 and 1 should not be used as inter 16 Arduino for the Cloud PWM 3 5 6 9 10 11 13 rupt line because these lines are used for serial communication between AT mega32u4 and AR9331 Pin 7 is connect ed to the AR9331 too and could be used as handshake line later Therefore only pins 2 and 3 are available for unscrupulous use as interrupt lines if you do not use the I C interface 8 bit PWM output using the function analogWrite SPI ICSP Header SPI data transfer using the SPI library The SPI pins of Arduino Yun are con nected to the ICSP header only This can mean restrictions for the use of Arduino shields The SPI pins are connected to the AR9331 hence ATmega32u4 and AR9331 can transfer data via SPI too LED 13 This is the well known internal LED con nected to pin 13 onboard Hi LED on Lo LED off Analog Input A0 A5 4 A6 6 A7 8 A8 9 A9 10 A10 12 A11 Arduino Yun has 12 analog inputs A0 A11 with a resolution of 10 bits Per default the input vol
3. program after this upload The UART interface OO and IO1 serves as a bridge between both controllers as in Arduino Yun 2 5 Initial Startup The statements for the initial startup refer to the Arduino Yun and the combination of Arduino Leonardo Dragino Yun Shield alike I use here an Arduino Leonardo for the combination with the Dragino Yun shield because it can be connected without additional modifica tions The steps required for connecting an Arduino Uno Duemi lanove Diecimila as well as Mega2560 are described in detail in the Yun Shield User Manual version 1 1 therefore the link to the user manual http www dragino com downloads downloads YunShield YUN_ SHIELD_USER_MANUAL_v1 0 pdf seems sufficient here In addi tion the relevant boards are to be considered in the software configu ration 20 Arduino for the Cloud Before the initial startup of the Arduino Yun the Arduino De velopment Environment must be downloaded from the Arduino website to the computer used for software development I use here a development PC running Microsoft Windows for which you will find the installer at the URL http downloads arduino cc arduino 1 5 7 windows exe Installers for Linux and MacOS can be found in the same place Arduino 1 6 1 with several fixes and improvement for Arduino Yun also was released on 03 10 2015 Take this revision for new developments although the program samples published here were tested using Arduino 1 5
4. the drivers install automatically and you can find the used COM port with the help of the device manager Figure 7 shows that our Arduino Y n is connected to the virtual port COM16 and it is possible to communicate via USB with the PC There is another interface named myYUN at 192 168 1 29 Ar duino Yun which I will explain later 22 Arduino for the Cloud Auto Format Archive Sketch Fix Encoding amp Reload Serial Monitor Ctrl Shift M Board ones e Port M COMI Arduino Yun i v COMI6 Arduino Yun myYun at 192 168 1 29 Arduino Yun Programmer const int led Burn Bootloader the setup routine runs once when you press void setup initialize the digital pin as an output pinMode led OUTPUT initialize serial port Serial begin 9600 the loop routine runs over and over again forever void loop digitalUrite led HIGH turn the LED on HIGH is the volta Figure 7 Arduino Y n communication interfaces The Arduino program blink ino which may be inspected in the editor can be uploaded via COM16 into the Arduino Yun This program provides a blinking red LED and periodic output of the character via the USB port which can be displayed in a moni tor program Figure 8 The baud rate of the monitor program must be equal to the baud rate defined in the function setup 23 Arduino for the Cloud r SS COM16 Arduino Y n oi Merton nn d Autoscrol Cariageretum 9600bau
5. 7 The Arduino Yun is only supported as of version 1 5 4 of the development environment which is important to remember before download Arduino enthusiasts not unexpectedly will get the known user interface to face However there is some news here Figure 6 shows the list of supported Arduino boards including our Arduino Yun at the top of the list 21 Arduino for the Cloud File Edit Sketch Help Auto Format Archive Sketch Fix Encoding amp Reload Serial Monitor Ctrl Shift M Arduino AVR Boards Arduino Y n Arduino Uno isa Programmer deduce Dam Dizisdis 13 has ung Duemilanove or Diecimil Burn Bootloader EES Arduino Nano the setup routine runs once t Arduino Mega 2560 or Mega ADK void setup Arduino Mega ATmegal280 initialize the digital pin as an output Arduino Leonardo pinMode led OUTPUT d D FANRAN e Arduino Micro initialize serial port Serial begin 9600 Arduino Esplora Arduino Mini Arduino Ethernet the loop routir over over again for i void loop Arduino Fio sed ee Eed maires EEEEEE s S na ten s Arduino BT LilyPad Arduino USB LilyPad Arduino Arduino Pro or Pro Mini Arduino NG or older Arduino Robot Control Arduino Robot Motor Arduino ARM 32 bits Boards i lt Arduino Due Programming Port Arduino Due Native USB Port Figure 6 Arduino boards in the Tools menu After connecting the micro USB connector of the Arduino Y n with an USB port of your PC
6. All listed sources and some explanations can be found at Soutce Forge under http sourceforge net projects arduinoynsnippets For ease of readability I follow in the textual representation the conventions listed below Commands and output to the console are represented in Courier New Inputs via console are in Courier New Program and file names appear in Italian All existing links were checked in the autumn of 2014 As the in ternet changes continuously it cannot be assured that these links will wotk ot lead to the same content as at the time of admission Please inform me about broken links Altendorf spring 2015 Claus K hnel vi Content 1 eier 11 Arduino diia 14 2 1 Power SUPPLY uocat teni dte tree tereti diet 14 2 1 1 Arduino YUN aie pneter tecti orgia 14 24 2 Dragino Y n Shield sss 15 VIAM og 9 15 224 Arduino Yn sss T t 15 2 22 Dragino Yuin Shield sss 15 E e 4 pee 16 2 9 1 Arduino Non Li 16 2 3 2 Dragino Y n Shield I O sssi 18 2 4 Communication 8 39 eese 19 24 1 Arduino Von SS Lees 19 24 2 Dragirfoay tn Shield ennt 20 2 5 Initial Star tty A EEN 20 2 6 Architec Wb cce br enit 24 2 7 Arduino Yun in Network EEN 27 2 8 Mirfiwate Upgrade eerte netten 32 Arduino Microcontroller eee 36 3 1 Classical Arduino Development 36 3 1 1 Hello TEE 39 3 1 2 Interrupt driven
7. Arduino for the Cloud Arduino for the Cloud Arduino Yun and Dragino Yun Shield Claus K hnel g Universal Publishers Boca Raton Arduino for the Cloud Arduino Y n and Dragino Y n Shield Copyright 2015 Claus K hnel All rights reserved No part of this book may be reproduced or transmitted in any form or by any means electronic or mechanical including photocopying recotding or by any information storage and retrieval system without written permission from the publisher Universal Publishers Boca Raton Florida e USA 2015 ISBN 10 1 62734 035 1 ISBN 13 978 1 62734 035 9 www universal publishers com The Linux Penguin is a work of authors Larry Ewing Simon Budig and Anja Gerwinski This book and the circuits described procedures and programs have been carefully created and tested Nevertheless errors and mistakes cannot be excluded Preface Raspberry Pi and comparable computer modules use embedded Linux as an operating system with the result that embedded Linux is no longer reserved for specialists alone but can be used by amateurs and enthusiasts as well At the same time a way has been opened to start with a class of completely new tasks The base for communica tion among several components has been laid and we are able to de velop the Internet of Things IoT Wikipedia provides a comprehensive description of the IoT Embedded systems with limited resources can collect data from natu ral ecosystems as
8. Digital Input 40 3 1 3 Query Of SenSoft Sisinnio 43 3 1 8 Ardunio Weather Shield sss 49 3 1 5 Internal ADC and PWM as DAC eee 56 3 1 6 Internal ADC in Free Running Mode 59 3 4 7 AD DA Module PCF8591 sss 64 vil Arduino for the Cloud Ske E e E 67 2 2 Bridge Libfaty i oett edet ettet 73 3 2 1 Executing Linux Commandes een 74 3 22 Execution of Sept 82 3 23 Writing and Reading Files En 86 3 24 YunServer and YunClient sss 92 ENEE 98 3 3 1 Data in a Google Spreadsheet 101 3 3 J Send Email through Google Mail 109 ERKENNEN w M 114 3 3 4 Temboo Device Coder sss 120 4 Linux Device AtherosAR9331 sse 129 4 1 1 KEE A e 129 41 2 SCP Access 9 9 mms 131 4 1 3 Package Manager OPKG ses 133 41 4 LuCI Web Interface eee 135 41 5 BditorWEM endete cim baies 143 41 6 File Manager Midnight Commandet 144 41 7 Data Transfer by RI ee 145 4 1 8 Process Monitor op 149 EMI Bp DIBITIIDIDE eerste 149 KE 151 ER cese eseneoneeetetietan iie 169 423 ET 174 qM GE 178 5 Append T 179 5 1 Fine Break iisetecetee teinte iie inis rn 179 5 2 Access Data zitat ede tie ee itii e eed 182 5 3 Python Packages ente eoe eerte tette 183 vili 6 8 Arduino for the Cloud ix 1 Introduc
9. ased on classic microcon trollers In most cases the networking of components is indispensa Arduino for the Cloud ble In the absence of these preconditions the IoT would be wishful thinking Arduino Yun combines the classic Arduino based on Atmel s AVR microcontrollers with an Atheros AR9331 System on a Chip SoC This SOC is used in WLAN access points and routers and runs the Linux distribution Linino OpenWRT as operating system The family of Arduino shields has recently been extended by Dragino s Yun shield The combination of the Dragino Yun shield with an Arduino Leonardo can be compared with an Arduino Yun While an Arduino Leonardo with the Dragino Yun shield togeth er is functionally identical to Arduino Yun the Yun shield offers more flexibility through possible combinations with Arduino Uno Duemilanove Mega etc In addition the Dragino Yun shield uses an external WiFi antenna that promises more stability and robustness of the wireless connection The operating system Linino OpenWRT offers interface driv ers a file system and multi threading among other things and is responsible for recurring tasks using stable software components This book is a translation of Arduino fur die Cloud ISBN 978 3 907857 25 0 which was published in German It deals with the Arduino Yun and the combination of Arduino Leonardo with the Dragino Yun shield and considers both implemented controllers and their interaction
10. ctor This interface can also be used for monitoring The data transfer through this interface is indicated by the flashing of the RX and TX LEDs on the board Using the Software Serial Library software UART s can be im plemented so that each pin of the ATmega32u4 can be used for serial 19 Arduino for the Cloud communication But IOO and IO1 are reserved for the hardware UART The ATmega32u4 supports DC and SPI communication as well The Wire library supports communication via the DC bus and the SPI library that for the SPI bus Arduino Y n can be programmed as a generic keyboard and mouse Por this keyboard and mouse classes are available The Atheros AR9331 provides the Ethernet and WiFi interfaces The Bridge library is responsible for this communication too The Arduino Yun offers through Linux support another USB host interface Via this USB port we can connect a memory stick for memoty enhancement a keyboard a mouse and a webcam It may be necessaty to install other software packages I will return to this later 2 4 2 Dragino Yun Shield The Dragino HE module uses SPI and UART to communicate with the connected Arduino board The Dragino Yun shield is compatible with 3 3 V and 5 V Arduino boards The jumper SV1 on the Dragino Yun shield selects the used voltage level 3 3 V or 5 V The program upload from Arduino IDE uses the SPI interface and connects both controllers SPI is free for other SPI slaves in an application
11. d v Figure 8 Monitor output For those who already have experience in programming Arduino these steps are not new For the person who is using Arduino for the first time the Arduino website http arduino cc offers good sup pott There is also a lot of literature explaining Arduino now Ama zon com shows 1 128 results for books with Arduino in the title Please use your preferred search engine to find your solution As of Version 1 0 of the Arduino IDE some changes have been introduced which must be considered when porting programs from previous versions 2 6 Architecture On the Arduino Yun two worlds meet Figure 9 shows a block dia gram of the Arduino Yun http arduino cc en Main ArduinoBoardYun On the left side we see the Arduino based on an ATmega32u4 http www atmel com devices ATmega32u4 aspx with a micro USB connector for programming and communication with the Arduino IDE which can be used to power the Arduino Yun simultaneously On the right side we see the Linux device based on an Atheros AR9331 http www datasheetspdf com PDF AR9331 743003 24 The 24 Arduino for the Cloud Linux device is running Linino http linino2013 wordptess com about derived from OpenWRT https openwrt org With an Ethernet interface eth1 and a wireless interface wlan0 the Atheros AR9331 provides opportunities for integration into a network In addition an SD card interface and a USB host p
12. lled image can be achieved by pressing the key WLAN RST for 30 seconds The existing memory can be enhanced by a micro SD card or a USB memory stick SD card and USB connectors are available on board 2 2 2 Dragino Yun Shield The Dragino Yun shield also has a 64 MB RAM and a 16 MB flash memory but the memory on the Arduino side is defined by the con nected Arduino board 15 Arduino for the Cloud I use here an Arduino Leonardo and the ATmega32u4 used on Arduino Leonardo provides 32 KB of flash memory once again 4 KB are occupied by the boot loader as well as 2 5 KB RAM and 1 KB EEPROM The EEPROM library supports reading and writing of the EEPROM again 2 5 I O 2 3 1 Arduino Yun I O All I O pins on Arduino Yun that can be connected externally are pins of the ATmega32u4 microcontroller The programming of these pins occurs Arduino conform with the instructions pinMode digitalWrite anddigitalRead All pins operate with 5 V defined by IOREF and can source or draw a current of 40 mA pro pin maximum Pull up resistors are available in a range between 20 and 50 kQ but these are disabled by default Several pins have alternative functions Description Serial 0 RX Receiving RX and transmitting TX 1 TX serial data with TTL level from to the ATmega32u4 hardware interface The class Serial refers to the USB CDC interface The class Seriall refers to the TTL communication to the AR9331 via pins 0 and 1
13. no for the Cloud against a connected computer additionally to the virtual communica tion device class COM port as mouse keyboard or another HID interface Figure 3 shows the front side of an Arduino Y n In the upper part you can see the Atheros AR9331 a 2 4 GHz System on a Chip SoC developed for WLAN and router applications Figure 4 shows the rear of an Arduino Yun with an AU6350 Sin gle Chip USB 2 0 hub and multimedia card reader controller and an SD card holder On the rear you can see the internationality of this product The fathers of the Arduino are from Italy Dog Hunter which is located in the U S A developed the board The layout work was done in Swit zerland and production in Taiwan oo0o000 TILLERI La Figure 3 Figure 4 Arduino Yun front view Arduino Yun trear view Launched by the Chinese company Dragino http www dragino com the Dragino Yun shield includes all the components of the Arduino Yun without the ATmega32u4 The Dragino Yun shield gets the Arduino Yun functionality by connecting it to an Arduino Leonardo But it is possible to connect alternative Arduino boards with the Dragino Yun shield too The encapsulated Dragino HE Module is the core of the Dragino Yun shield Its Atheros AR9331 SoC runs the same Linino Open WRT as Linux distribution as for Arduino Yun Figure 5 shows the top view of the Dragino Yun shield 12 Arduino for the Cloud Figure 5 Dragino Yun shield This b
14. ook explains the start up of the Arduino Y n and the Dragino Yun shield connected to an Arduino Leonardo and their use These explanations should provide a quick overview of the enhanced possibilities of these LAN and WLAN capable Arduinos Detail information about the Arduino Yun and the Dragino Yun shield can be found via the following URLs http arduino cc en Main ArduinoBoardYun http www dragino com ptoducts yunshield item 86 yun shield html 13 2 Arduino Yun This chapter describes the similarities and differences between the Arduino Yun and the Dragino Yun shield Hence possible hurdles are largely eliminated when using one of the two platforms 2 1 Power Supply 2 1 1 Arduino Yun The micro USB interface is a common way to connect an Arduino with a power supply Furthermore this connection serves as a com munication path to the Arduino development environment IDE The Arduino Yun has no voltage regulator onboard therefore the voltage at pin VIN has to be 5V DC constant Pay attention to this requirement when choosing the power supply Another possibility is to source the Arduino Yun via the Ether net The board is prepared for the use of a Power over Ethernet PoE module Power supply details VIN External connection for supply voltage of 5 V DC Internal 5 V supply voltage Voltage source can be VIN ot USB Internal 3 3 V supply voltage generated by an on board regulator Load can be 50 mA
15. ort are available for external expansion The Bridge library makes the communication between Atheros AR9331 and ATmega32u4 easier We get the opportunity to run shell scripts communicate with the network and obtain information from the AR9331 processor for an Arduino sketch out The USB host as well as the network interface and the SD card are not connected to the ATmega32u4 but with the AR9331 The Bridge library also allows the ATmega32u4 to access the AR9331 periphery E HOST ATmega Linino 32u4 AR 9331 D USB Prog ARDUINO ENVIROMENT LINUX ENVIROMENT Figure 9 Arduino Y n block diagram At Arduino Y n the focus remains on the Arduino However Arduino enthusiasts get the opportunity to use web services over wired or wireless Ethernet without deep knowledge of Linux Due to the Atheros AR9331 which takes over the entire network manage ment the Linux side is encapsulated but remains fully available Some technical features of the Arduino Y n are summarized in Table 1 The part for the Atheros AR9331 applies to the Dragino Y n shield too while the part for the ATmega32u4 applies for the Ar duino Y n only For the combination of Dragino Y n shield with an Arduino the technical data of the used Arduino apply 25
16. ragino Yun shield the available I O pins come solely from the Arduino board Differences from the Arduino Yun 18 Arduino for the Cloud S1 serves as reset key Pressing it for five seconds resets the WiFi configuration All S1 other settings remain unchanged Pressing it for 30 seconds resets the Linux system to the facto ry image The jumper SV1 configures the voltage level for SPI and SV1 UART 5 V and 3 3 V respectively Arduino Leonardo works with 5 V levels Additionally the Dragino Y n shield has some LEDs onboard Marking Function PWR Power indicator LAN LAN Ethernet indicator WLAN WLAN WiFi indicator LED for USB memory On USB is connected to the SYS Arduino Yun default SD directory mnt sd or www sd connected 2 4 Communication 2 4 1 Arduino Yun The Arduino Yun has several interfaces for communicating with a computer another Arduino or another microcontroller The ATmega32u4 provides UART hardware with TTL levels for serial communication This interface OO and IO1 is used for serial communication between the ATmega32u4 and the Atheros AR9331 The Bridge library supports the softwate side In addition the ATmega32u4 offers the possibility of serial communication over USB and is then viewed from a connected PC as a virtual COM port The software download from the PC to the Ar duino usually occurs through this interface equipped with a micro USB conne
17. tage range is 0 5 V This range can be reduced by the use of the AREF pin and the function analogReference AREF Reference voltage for analog inputs Us age with the function analogRefer ence Yun RST A low level on this pin resets the AR9331 The Linux system will be re booted All data in the RAM are lost Running programs will be stopped Files can be corrupted 32U4 RST A low level on this pin resets the AT mega32u4 17 Arduino for the Cloud WLANRST The primary function is to reset WiFi to the factory setup The factory setup is the Access Point Mode AP and the fix IP address 192 168 240 1 In this mode the Arduino Yun can be configured A reset of the WiFi configuration forces a reboot of the Linux system To reset the WiFi configuration press the key WLAN RST for five seconds The secondary function is to reset the Linux system to the factory image To reset the Linux system press the key WLAN RST for 30 seconds All data stored in the flash memory is lost Additionally the Arduino Y n has some LEDs onboatd Marking Function RX Serial receiver TX Serial transmitter L13 LED at IO13 WAN WAN Ethernet indicator ON Power indicator WLAN WLAN WiFi indicator USB USB 2 3 2 Dragino Yun Shield I O The Dragino Yun shield does not make any I O pins available out watds In the combination of Arduino Board and the D
18. tion If you want to extend an Arduino so that it is network enabled then you could use for example an Arduino Uno supplemented with an Ethernet shield or you could use an Arduino Ethernet The Ethernet shield and the Arduino Ethernet provide an Ethernet interface based on the WIZnet Hardwired TCP IP Embedded Ethernet Controller W5100 Figure 1 shows an Ethernet shield that can be placed on an Ar duino and provides them an Ethernet interface Figure 2 shows an Arduino Ethernet a combination of an Ar duino and an Ethernet interface on one board The difference from other Arduino boards is the missing USB to serial chip The Ethernet part is identical to the Ethernet shield Figure 1 Ethernet shield Figure 2 Arduino Ethernet The Arduino Yun differs from other Arduino boards through its capabilities to communicate with the Linux system running on the Atheros AR9331 These capabilities make the Arduino Yun a power ful platform for Linux application in a network and IoT projects combined with the simplicity of the Arduino Additionally to power ful Linux commands like cURL an option is to use one s own Shell ot Python scripts for a robust interaction with Arduino Yun The Arduino Yun is similar to the Arduino Leonardo because Arduino Leonardo uses an ATmega32u4 too Since the ATmega32u4 has an integrated USB controller it has no need for a second control ler like an FT232 for example The Arduino Yun represents itself 11 Ardui
19. well as from buildings and factories Otherwise these systems could also be responsible for performing actions like ordering missing goods in a storage system Energy management and transport optimization as heard of these days at the Port of Ham burg are further examples In the paper entitled The Computer for the 21st Century 1 Mark Weiser http en wikipedia org wiki Mark Weiser spoke about this vision for the first time in 1991 Today the Arduino family comprises more than 20 boards not including Arduino clones and creates a largely mature platform for building professional prototypes The unusual concept of open source hardware and software was awarded the Prix Ars Electronica in Linz in 2006 If we look into the relevant forums and portals covering micto controller technology we cannot miss the topic of Arduino Google provided a further impulse through its decision to use Arduino as the Android Open Accessory kit 2 Arduino is an open source prototyping platform based on flexible and easy to use hard wate and software The primary goal for using Arduino is direct contact with the en vironment Arduino can detect signals from sensors and control this environment via several actors The term physical computing de scribes the kind of applications for which access to the environment is an important attribute The high complexity of today s requirements for electronic sys tems cannot be implemented by concepts b

Download Pdf Manuals

image

Related Search

Related Contents

Manual de Instalación de Teja Asfáltica Top  MOEN A501BN Installation Guide  PAVIFER 350 EPOXI SANITARIO – 2 componentes  Modes d`emploi / Compteur de bulles  Model 8501 Rain-Trip™ Rain Sensor NC NO C Sensor de lluvia  STDP STUN & Dial-peer User Manual PORTech Communications Inc.      Approx APPKBMVLV2  Benutzerhandbuch  

Copyright © All rights reserved.
Failed to retrieve file