Previous Posts in the series
Prelude
Hackers and hobbyists have used the arduino for a diverse number of projects and have made it a very popular. Its simple to use and easy to program. For people who have a slightly 'more' requirement, ARM based single boards came into the market. Initially the ARM boards were tougher to build and program and costlier to make. In order to fully exploit the power of a 32-bit processor, the Linux Kernel was ported to the fanless ARM systems making the Single Board Computers. The OS was stored on either an SD Card or an EEPROM. This new class of boards had the familiar OS system of a regular PC and the digital and analog outputs of the arduino but at a slightly higher cost. Additionally they had varying performance but they started to add something more- peripherals! Keyboard, then Ethernet, then Bluetooth and Wifi- the list goes on. In this article we discuss the Arduino YUN and what exactly it is.
Single Board Computers Explained
Raspberry Pi, BeagleBone Black and the RIOT Board are some of the more popular names. These run Linux or Android and everything runs on top of that. The OS takes care of the memory management as well as peripheral access. The newer kids on the block are the Intel Galileo and the Yun. Thats right! The Arduino Yun runs linux and we will discuss this a little later. For people who want more power and connectivity such as Wifi for IOT applications, we have offerings such as the Texas Instruments CC3200, CC3100 and the CC3000(used in the spark Core). They lack Linux as an OS(CC3200 can have TI RTOS or FREE RTOS though) but have a lot more power than the arduino.
Single board computers have come a long way and the linux that runs on them has also shrunk down. Linux tailor-made for a particular Board can go low as 2-10MB in size without support for floating point math. The point it Single board computers make it easy for the IT people and general people to easily get started with a project. The code also becomes a lot more portable because there is an underlying layer of OS which takes care of driving the peripherals like Wi-Fi. This also means that you can start working with languages such as python and do not have to worry about the kernel or C-programming or driving the peripherals. It is simplified into an import statement. On the flip side if you wish to get down into the pits and write your own C-code(or even assembly) you could prefer options such as CC3200 and the like. Its actually not that bad since manufacturers produces a lot of example code and starter projects for these boards. I usually start with the given code and add or delete parts that I need. This increases the prototyping speed as well as the dependability of the code and if you think thats cheating, please feel free to write device drivers for your systems and your own database management systems and let me know
A comparison of the most popular boards is given at https://learn.adafruit.com/embedded-linux-board-comparison/overview and I will do one myself once I get to setting up some tests.
Who is the Yun
The word 'YUN' is a Chinese word and means 'Cloud'. That simplifies the purpose of the board right? The Arduino YUN is a modified Arduino with the number of processing elements upped to two. One is the ATmega 32u4 which is directly accessed via USB and the Arduino IDE. The second is the AR9331 which runs linux and can be accessed via the ethernet/Wifi interface or the BRIDGE. The basic block diagram of the system is shown below. The OS is stored on a 16Mb Flash memory and the processor running it is a Atheros AR9331 @400MHz with 64Mb DDR2. Thats pretty good actually.
(Image : http://fc07.deviantart.net/fs71/f/2013/290/a/e/yun_by_pighixxx-d6qvbq4.png))
Another thing I want to clarify is that the Arduino Website says that it runs Linino Linux but the banner says OpenWRT. Linino is based off OpenWRT which is a linux distro meant for Embedded devices which are typically wireless routers. Its a completely different animal and is build ground up to be easily modifiable using modules. In short the YUN is a single board computer with a small amount of RAM and Flash which can connect to the Internet and also has an arduino connected on the same board. This gives you two worlds on the same board and if want to build something with the libraries of arduino and have internet applications connected via python or nodejs or the link this is definitely the board for you. If you want something faster and can spend more, the other kid is the Intel Galileo which runs everything on a 32-bit quark processor which runs arduino sketches and everything else on the same core. But thats a different story.
Getting started with the YUN
There are a lot of good tutorials already on the internet and I try to refrain from rebuilding the wheel hence I will link them below. The only thing I want to point out is that the arduino is quite simple to get started with and its not necessary that you go into the nits and grits of the Linux part. Its designed for people who work with the Arduino and want wifi and a few other facilities and do not want to mess with connectors and addons and stuff. Once you are done with the basics, you can start work on python and nodejs and other stuff. But because the RAM and flash is severely limited, you might want to watch your memory usage. Adafruit has a great tutorial on using the YUN as a networked Cam which means that it can take photos from a USB camera(there is USB HOST controller present) and send it over the network. What you do with it depends on your creativity.
There is another tutorial on extending your linux space to the SDCARD and you can store a lot of data on the memcard. The link is given below and if I ever get around to that requirement I will make another post and link it here as well. For now I am more interested in seeing how this little peice of tech can be used for IOT Applications.
LINKS:
- http://arduino.cc/en/Guide/ArduinoYun
- http://wiki.dragino.com/index.php?title=Getting_Start_with_Arduino_Yun
- http://arduino.cc/en/Tutorial/ExpandingYunDiskSpace
Getting a little more started - Enter Temboo
The internet of things means connecting devices to the internet and for the beginners this may seem like a daunting task. With the YUN, I recommend visiting temboo.com . Temboo is a service which generates code for IOT application tasks such as reading twitter, facebook, dropbox and even google services. The generated code can be in your favourite language such as Java, Python or JS and if you go into IOT mode it will generate code for the CC3200 or the YUN! This allows for simplification of some tasks and then you can build your application around it. Temboo has choreos which are essentially steps for performing a task and the system is pretty simple. The basics are available at
I am still digging at it and my objective is be able to control the YUN using MQTT however I have a Raspberry Pi which is running OpenHAB and an MQTT server hence all messages are to be generate by the PI. No problem since my RPi can run the same Python or NodeJS script as the YUN so I am currently working on formulating a NodeJS/Python script which is a Choreo from Temboo. More on this in the next post since I am still working out some bugs.
Conclusion
The Arduino Yun is easy to use and for those who want to play with IOT and want to be able to use the Arduino IDE, you can use the Arduino Ethernet. For Wifi connectivity there are other options which will be cheaper than the YUN. The YUN is for people who want to start with Single Board Computers, Linux and want to start scripting and move up to more complicated use cases. Arduino cannot do encryption nor the more processor intensive stuff and thats where the YUN steps in. If you want databases and some multimedia stuff, then move upwards to the RPi or the BBB or RIOT but for people working with mid range IOT applications and have the budget for it, the YUN comes highly recommended. Buy one, make a project and see where that goes...