12.07.2015 Views

Download the Session 2 companion slides. - TimeSys

Download the Session 2 companion slides. - TimeSys

Download the Session 2 companion slides. - TimeSys

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Track OneBuilding a connected home automation device with <strong>the</strong>Digi ConnectCore Wi-i.MX51 using LinuxLink<strong>Session</strong> 2How to build a control application using Qt Embedded for Linuxto design a UI experienceAudio streaming is available for this event.Turn on your speakers to listen.www.timesys.com©2011 Timesys Corp.


2 Tools You Can Use• Q&A• Click on Q&A panel (?) orchat icon in <strong>the</strong> bottom rightcorner• Type in your question in<strong>the</strong> space provided• Click on “Submit”www.timesys.com©2011 Timesys Corp.


3 Tools You Can Use• Polling• The poll will appear onyour screen• Select your answer foreach question• Click on “Submit”www.timesys.com©2011 Timesys Corp.


4 <strong>Session</strong> Information• You can download <strong>the</strong> <strong>slides</strong> for today’s session athttp://www.timesys.com/embedded-linux/training/timesysuniversity/digi_wi-imx51• You can view a recording of today’s session athttp://www.timesys.com/embedded-linux/training/timesysuniversity/digi_wi-imx51• Today’s speakers:Maciej HalaszDirector, Product ManagementTimesysBob BlumenscheidProduct Marketing ManagerDigi Internationalwww.timesys.com©2011 Timesys Corp.


5 Building a Connected Home AutomationDevice• <strong>Session</strong> 1 – Recording availableHow to assemble and deploy an initial BSP and setupdevelopment environment with <strong>the</strong> matching SDKhttp://www.timesys.com/embedded-linux/training/timesys-university/digi_wi-imx51• <strong>Session</strong> 2 – TodayHow to build a control application using Qt Embedded for Linuxto design a UI experience• <strong>Session</strong> 3 – March 17 @ 1pm ESTHow to integrate a WIFI and Bluetooth functionality with <strong>the</strong>control application• <strong>Session</strong> 4 – March 24 @ 1pm ESTHow to optimize, test and integrate <strong>the</strong> solution for quickdeploymentwww.timesys.com©2011 Timesys Corp.


6 Today’s Agenda• Recap of what we have done so far• Introduction to <strong>the</strong> ConnectCore Wi-i.MX51• Qt development tools installation/setup• Home Automation Application – GUI development• Add labels, control lights• Add code for a custom widget• Test your application locally• Setup GPIO lines to control two GPIO connectedLEDs (lights in a kitchen and a living room)• Linux kernel and GPIO features• Summarywww.timesys.com©2011 Timesys Corp.


7<strong>Session</strong> 1 Recapwww.timesys.com©2011 Timesys Corp.


8 What We Have Accomplished So Far• Learned about ConnectCore Wi-i.MX51 LinuxLink –needed for all exercises• Reflected product requirements in Linux BSPand SDK• Built a custom BSP with LinuxLink Web Edition• Experiment on day one with a pre-built starting point• Setup a development environment• System level development and optimizations• Development of a value-add software (applications)• Deployed <strong>the</strong> system on <strong>the</strong> target via NFS forfuture development• Transferred images• Configured bootloaderwww.timesys.com©2011 Timesys Corp.


9 Project Requirements (Digi CC Wi-i.MX51)• Graphics• Touchscreen• Applications− Screen calibration− Home automationapplication• E<strong>the</strong>rnet− Secure Connection− Transfer (FTP/SCP)− Console(Telnet/SSH)• Serial portcommunication• USB− Storage(USB stick)− Extensions• Audio (optional)− Alsa Mixer− Sound playback• Bluetooth− Sensorconnections• GPIOcontrolledLEDs• SD/MMC Card- Filesystem• NAND Flash− Boot from− Additional storage• WiFi− Data upload to aserverwww.timesys.com©2011 Timesys Corp.


10Home Automation Device (Blueprint)Connected Home Automation Control ApplicationUser Interface, Buttons, Lights, etcLightControlAlarmsoundBluetooth SensorWireless DataLoggingMiddlewareLCDcalibrationQt Embeddedsetupscriptsalsa-utilscwiiddbusopensshnetworkingshellalsabluezWireless toolsLinux kernelDriverDriverDriverDriverDriverDriverDriverU-Boot bootloaderDriverDriverWi-i.MX51LCDTouchScreenGPIOAudioUSBBluetoothWiFiE<strong>the</strong>rnetSerialNANDSDIOwww.timesys.com©2011 Timesys Corp.


11Introduction to <strong>the</strong>Digi ConnectCore Wi-i.MX51www.timesys.com©2011 Timesys Corp.


12 Giveaway• If you attend at least 3 out of4 sessions in our Track 1,we will automatically enter youinto a drawing for a prize.• The winner will receive acomplete ConnectCore Wi-i.MX51Development Kit.• Toge<strong>the</strong>r with Digi International, we also offer <strong>the</strong>above mentioned kit at a discount price of $249+S&H• If interested in buying a kit, send an email tosales@timesys.com with “CC-Wi-i.MX51 Kit SPECIALOFFER” in subject line.www.timesys.com©2011 Timesys Corp.


13Qt Development ToolsInstallation/Setupwww.timesys.com©2011 Timesys Corp.


30 Bulletinself-efficacy and motivates her or him to perform <strong>the</strong> same tasks. This isespecially true among children who have experienced difficulties in learningskills (Schunk and Hanson, 1985). Moreover, Schunk et al. (1987) andBandura and Menlove (1968) find advantages for multiple peers, presumablyas <strong>the</strong>se increase <strong>the</strong> probability that observers will perceive <strong>the</strong>mselves assimilar in competence to at least one of <strong>the</strong> role models. Especially whensubjects doubt <strong>the</strong>ir learning capabilities, observation of multiple peerssucceeding may better promote subjects’ self-efficacy (Bandura, 1986). 7,8Given <strong>the</strong> pupil’s own IQ, <strong>the</strong> expected number of o<strong>the</strong>r pupils in <strong>the</strong> classwith similar IQ increases with class size. 9 Whe<strong>the</strong>r this mechanism indeedexplains a zero net effect of class size reduction can be tested by including <strong>the</strong>number of pupils in <strong>the</strong> class with similar IQ as an additional regressor in <strong>the</strong>test score equations. As <strong>the</strong> PRIMA data include for each pupil in <strong>the</strong> sample itsown IQ and <strong>the</strong> IQ-score of each of its classmates, we are able to construct <strong>the</strong>variable ‘‘number of classmates with similar IQ’’. This variable has anexpected value which increases with <strong>the</strong> size of <strong>the</strong> class. 10 Our hypo<strong>the</strong>sis isthus twofold: inclusion of this variable should reduce (or possibly even reverse)positive class size effects on achievement, and <strong>the</strong> new variable should have apositive direct effect on achievement. To make this test operational we havedefined students with similar competence as those in a class that fall within arange of plus or minus half a grade-level standard deviation (+/–2 IQ-points)around <strong>the</strong> given pupil’s IQ. The correlation coefficient between this variableand actual class size equals 0.46 in grade 4, 0.31 in grade 6, and 0.40 in grade 8.It should also be noted that <strong>the</strong> number of similar pupils is not a direct measureof class homogeneity. Class homogeneity is best measured by a statistic like <strong>the</strong>variance. Although <strong>the</strong> number of pupils in <strong>the</strong> class with similar IQ and <strong>the</strong>7 Ano<strong>the</strong>r possible mechanism leading to a positive relation between performance and <strong>the</strong> numberof similar classmates is that teachers may target <strong>the</strong>ir instruction to groups of children with similarcompetence. If instruction time is divided in proportion to <strong>the</strong> size of <strong>the</strong> group, members of largergroups receive more instruction time.8 In a recent paper Lazear (1999) proposes ano<strong>the</strong>r peer group mechanism in relation with class sizeeffects. The driving force in his model is <strong>the</strong> presence of disruptive children who cause negativeexternalities (congestion). To explain our findings, we are, however, in search for a mechanismcausing positive externalities.9 An alternative hypo<strong>the</strong>sis is that children learn from individuals that are smarter than <strong>the</strong>mselves.We tested this hypo<strong>the</strong>sis by including number of students in an individual’s class with an IQ higherthan <strong>the</strong>ir own. Even after controlling for pupils’ own IQ, this served merely as a proxy for IQ rankwithin a class producing a large negative effect with no significant decrease in <strong>the</strong> positive class sizeeffect.10 As mentioned earlier, IQ was measured at <strong>the</strong> same time as <strong>the</strong> test scores. Although individualIQ scores have probably been affected by <strong>the</strong> size of <strong>the</strong> class, <strong>the</strong>re seems no reason to assume thatclass size affects <strong>the</strong> number of classmates with similar IQ, in ano<strong>the</strong>r way than <strong>the</strong> simple mechanismthat with a larger number of classmates <strong>the</strong> expected number of similar classmates increases.Notice that with IQ measured afterwards, explicit ability tracking on <strong>the</strong> basis of measured IQ isprevented.Ó Blackwell Publishers 2002


15Home Automation Application –GUI Developmentwww.timesys.com©2011 Timesys Corp.


16 Home Automation Application• Create a new Workspace• Create a new Qt GUI Project• UI Type - QMainWindow• No additional QT frameworks are necessary• Create <strong>the</strong> following components• Remove menu bar and status bar• Use layouts• Add labels for Living Room and Kitchen lights and Garage door• Add Qwidget placeholders for buttons• Use Spacers• Custom Widget• Develop or adapt an existing custom widget for a buttonwww.timesys.com©2011 Timesys Corp.


17 Home Automation Application (Cont’d)• Define/Connect signals• Define a signal in a custom widget• Capture <strong>the</strong> signal in a service class• Implement <strong>the</strong> service routine• Change <strong>the</strong> stylesheet of <strong>the</strong> design• Create a resource file• Add a new JPG with a background• Make your application use your stylesheetwww.timesys.com©2011 Timesys Corp.


18Setup GPIO Lines to ControlTwo GPIO Connected LEDswww.timesys.com©2011 Timesys Corp.


19 SYSFS and GPIO – What Are They?• What is SYSFS• Virtual in-memory file system• Exports information about devices and drivers from <strong>the</strong> kernel devicemodel to userspace• Used for configuration of GPIO• GPIO-SYSFS• User interface to <strong>the</strong> in kernel gpio framework• Same interface no matter what platform you're developing for• Deals with pins strictly one at a time• Available in all mainline kernels from 2.6.27 onwardswww.timesys.com©2011 Timesys Corp.


20 How to Control GPIO with SYSFS• Procedure• Find <strong>the</strong> correct GPIO lines for <strong>the</strong> two onboard LEDso Use hardware reference manuals• Request <strong>the</strong> GPIO number from <strong>the</strong> kernel (73 and 74)# echo 74 > /sys/class/gpio/export• Once you've done this you'll see a folder/sys/class/gpio/gpio74In this folder you'll see <strong>the</strong> attributes needed to control <strong>the</strong> gpio.We will use attribute value.www.timesys.com©2011 Timesys Corp.


21 How to Control GPIO with SYSFS (Cont’d)• Procedure• Set <strong>the</strong> direction for each GPIO by writing one of "in", "out", "high" or"low" to your gpio's direction attribute. "low" and "out" have <strong>the</strong> sameeffect, to change <strong>the</strong> pin to an output which is initially low. "high"changes <strong>the</strong> pin to an output which is initially high. "in" changes <strong>the</strong>pin to an input.# echo out > /sys/class/gpio/gpio74/direction# cat /sys/class/gpio/gpio74/direction• Control <strong>the</strong> GPIO state (LED on/off) by writing “0” or “1” to <strong>the</strong> valuefile# echo 1 > /sys/class/gpio/gpio74/value• Set links for your applicationwww.timesys.com©2011 Timesys Corp.


22Linux Kernel and GPIO Featureswww.timesys.com©2011 Timesys Corp.


23 LinuxLink Architecturewww.timesys.com©2011 Timesys Corp.


24What We Have Accomplishedwww.timesys.com©2011 Timesys Corp.


25 What We Have Accomplished• Learned about ConnectCore Wi-i.MX51 LinuxLink –needed for all exercises• Installed <strong>the</strong> IDE development tools for Qt design• Developed a GUI with <strong>the</strong> following:• Layers, Custom Widgets, Spacers and Labels• Implemented signals-handlers• Learned about GPIO and SYSFS• Setup two onboard LEDs for user access• Added code to our application to control <strong>the</strong> LEDswww.timesys.com©2011 Timesys Corp.


26 Next <strong>Session</strong>• March 17 @ 1pm ESTHow to integrate a WIFI and Bluetooth functionalitywith <strong>the</strong> control application• Add libraries to support WIIMOTE features• Enable Bluetooth support in <strong>the</strong> Linux kernel• Develop code to pair Bluetooth devices, to connect and read valuesfrom accelerometers• Add support for <strong>the</strong> WIFI – RedPine driver• Add code in <strong>the</strong> application to periodically log data and upload it to aremote server• More fun to come…www.timesys.com©2011 Timesys Corp.


27 Last Week’s Homework – Share YourExperience1. Outline your own requirements2. Assemble a BSP that matches your needs3. Setup your development environment4. Run your custom Linux images on your hardware• Did you have any problems outlining your requirements and <strong>the</strong>ntranslating <strong>the</strong>m into a Linux blueprint?• How did <strong>the</strong> assembly of your custom BSP go?• Were you successful in getting your custom Linux images up andrunning on your boards?www.timesys.com©2011 Timesys Corp.


28 Homework1. Design your own GUI with Qt Embedded2. Adapt/design your own QtWidget3. Locate GPIO lines on <strong>the</strong> board you are using4. Change <strong>the</strong> state of <strong>the</strong> GPIO lines from your GUILet us know if you run into any challenges. We have setup a dedicatedcommunication channel to share questions, comments and replies.Please subscribe at https://lists.timesys.com/listinfo/timesys-universityWhile your questions will be answered by Timesys expert engineers,we encourage you to answer questions asked by o<strong>the</strong>rs. Sharingexperiences is always <strong>the</strong> best way to learn.www.timesys.com©2011 Timesys Corp.


29 GlossaryLinuxLink (Web Edition) – Web-based version of LinuxLinkLinuxLink (Desktop Edition) – Local version with full customizationand third-party tools integrationWorkorder – Stores definition of your software – filenames, versionsBootloader – Runs first, initializes necessary hardware, loads LinuxLinux kernel – Operating system that manages hardware access ando<strong>the</strong>r features for higher level softwareDevice Driver – Code that’s part of a Linux kernel, defines how softwareaccesses specific hardwareFile System – All files (libraries/utilities/scripts/etc.) combined on a singlestorage, e.g. NAND flashMiddleware – Complete frameworks including APIs, utilities that providespecific functionality, e.g. QTAPI (library) – Used by applications, provide functionality, abstracthardware accessToolchain (cross) – The most important part of <strong>the</strong> developmentenvironment. Used to compile source code into binaries.www.timesys.com©2011 Timesys Corp.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!