Differences

This shows you the differences between two versions of the page.

Link to this comparison view

iot:labs:09 [2016/06/27 10:30]
ioana_maria.culic created
iot:labs:09 [2020/01/07 12:03] (current)
jan.vaduva [Implement a project from scratch]
Line 1: Line 1:
-====== Lab 9: Connect and use an LCD ======+======Lab 9: Yocto Project first steps====== 
 +=====Implement a project from scratch=====
  
-In this project you are going to connect an LCD to your board and write a short message on it. +Open the Quick start guide to Yocto Project, located at: [[https://​www.yoctoproject.org/​docs/​current/​yocto-project-qs/​yocto-project-qs.html|Quick start guide]]
-===== What you need =====+
  
-  *  One Raspberry Pi connected to Wyliodrin STUDIO; +Set up your Linux system with the right packages (instruction are provided for Ubuntu, Fedora, CentOS and openSUSE)
-  *  One 16x2 LCD; +
-  *  One breadboard;​ +
-  * Jumper wires;+
  
-===== The Setup ===== +  - Install prerequisites:​ <​code>​sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \ 
-{{ :​iot:​labs:​lcd-expander.jpg?500 |}} +     build-essential chrpath socat libsdl1.2-dev xterm</​code>​ 
-The LCD in the kit is connected to a port expander (MCP23008)This allows the LCD to be controlled via the I2C protocol, thus reducing the number of pins you need to connect the LCD toIn this case, you just need to connect the expander to GND, 5V, SCL and SDA pins, according to the indicators on the expanderYou can find the appropriate pins in the **Pin Layout** tabYou just need to connect the SDA port on the port expander with the SDA pin on the board and so on. +  - Download ​the latest stable release: <​code>​$ git clone -b zeus git://git.yoctoproject.org/poky.git</​code>​ //or// <​code>​$ wget downloads.yoctoproject.org/​releases/​yocto/​yocto-3.0/poky-zeus-22.0.0.tar.bz2</​code>​ 
-===== The Code ===== +  - Source //​oe-init-build-env//​ script, ​to create ​the build directory: <​code>​$ source poky/​oe-init-build-env my_dir</​code>​ 
-{{ :​iot:​labs:​lcd-simple-example.png?600 |}} +  - Edit //​conf/​local.conf// ​and set //​MACHINE// ​as //qemux86// and any extra required variables. 
-You go to the Wyliodrin Applications page and create a new applicationYou name it and select Streams ​as programming languageOnce created, you click on the new application'​s name to open it.+  - Build the OS image: <​code>​$ bitbake core-image-minimal</​code>​ 
 +  - Boot the OS image of your choice: <​code>​$ runqemu qemux86</​code>​ Where: <​code>​MACHINE=qemux86</​code>​
  
-First of all, you need to initialise the LCD. For this, you drag the **run** node and select **Fire once at start** so you make sure that once you run the application a first message is sent. This is only required to trigger the **init LCD** node, so you can assure there is no other message being sent again. For this, drag the **trigger** node and double click on it. 
  
-{{ :​iot:​labs:​trigger-block.png?400 |}}+===== Exercises===== 
 +  ​Finish a successful Yocto Project build. 
 +  - Find a poky version that contains Hob and configure a Hob image. 
 +  - Setup  and start Toaster on port //8399//. 
 +  - Get the standards SDK installer and build **htop** package for your OS. 
 +  - Create a **htop** recipe and build it for your OS. 
 +  - Create a custom layer which should contain the **htop** recipes and **busybox** bbappend. 
 +  - Add support for **htop** inside //​core-image-minimal//​ image. The enhanced //​core-image-minimal//​ should be available inside the newly created layer.
  
-You need to set this node to **wait until reset**. This will make the node to send the first message and then wait until it receives a message containing the property **reset**, which will never happen. ​ 
-Next, the **init LCD** node initializes the LCD. 
  
-First of all, you need to require the **wyliodrin** module, which exposes some simple functions in order to control the LCD. Otherwise you would need to implement the protocol in order to control it.  
  
-Once you have the **wyliodrin** variable, call the **LiquidCrystal** constructor in order to obtain a **LiquidCrystal** object. The constructer receives 0 as parameter. 
  
-Why is the value 0 the parameter of the contructor? This type of LCD communicates with the Raspberry Pi board via that I2C protocol. Taking into account how the I2C protocol behaves, you would need to mention the bus specific to the LCD, that usually is 32. However, in order to be able to connect multiple LCDs at once, they have three jumpers which can be connected in order to represent values from 0 to 7, thus being able to identify eight different LCDs. This is the value you need to pass to the constructor,​ in this case, no jumper is connected so we passed the value 0. 
- 
-{{ :​iot:​labs:​init-lcd.png?​400 |}} 
- 
-What is new at the code presented above is the **context.global.lcd** structure. You need to use this because you want the **lcd** variable to be available from other nodes also (Display on LCD node) and **context.global** is a variable accessible to all the nodes, so you just set the lcd property and you will be able to use it from any other node. 
- 
-{{ :​iot:​labs:​display-lcd-simple.png?​400 |}} 
- 
-The **display LCD** node is another function node which first clears the LCD, then prints a string on it. Notice that the global **lcd** variable is used. 
- 
-===== Exercises===== 
-  - Use a temperature sensor and display the temperature on the LCD. 
iot/labs/09.1467012657.txt.gz · Last modified: 2016/06/27 10:30 by ioana_maria.culic
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0