mbed Hands-On Instructor Workshop ESWEEK 2013 1 Agenda • mbed Hands-On Instructor Workshop – – – – – – – – – – The ARM University Program - Khaled Benkrid, ARM UP Manager Introduction to mbed – Professor James Hamblen Georgia Tech Hands-on Lab 1: mbed registration and Hello World demo Hands-on Lab 2: Bubble Level on mbed application board Hands-on Lab 3: Interfacing with a temperature sensor & PC I/O Hands-on Lab 4: RTOS and Threads Instructor Demo Lab 5: Internet Clock Instructor Demo Lab 6 : HTML5 Web sockets Instructor Demo Lab 7 : Debugging and Breakpoints in offline compiler Q&A with Khaled Benkrid and Joe Bungo ARM University Program Introduction to mbed James Hamblen Georgia Tech ECE Atlanta, GA USA 3 What’s happening in Microcontrollers? • Microcontrollers are getting cheap – 32-bit ARM Cortex-M3 Microcontrollers @ $1 – 32-bit ARM Cortex-M0+ Microcontrollers @ $0.50 • Microcontrollers are getting powerful – Lots of processing, memory, I/O in one package • Microcontrollers are getting interactive – Internet connectivity, new sensors and actuators • Creates new opportunities for microcontrollers Rapid Prototyping • Rapid Prototyping helps industries create new products – Control, communication and interaction increasingly define products – Development cycles for microelectronics have not kept pace 3D Moulding 3D Printing 2D/3D Design Web Frameworks mbed.org - Rapid Prototyping for MCUs • Fastest way to get started with ARM microcontrollers – Plug ‘n’ Play Hardware, Online Compiler – Get setup and run “Hello World!” in 60 seconds – Removes entry barriers to MCU technology • Focused on rapid prototyping for a diverse audience – DIP form-factor, High-level APIs, Developer website – Technology and trade-offs to enable fast experiments – Creates new applications for MCU technology • Launched at ESC Boston with live demo – Internet-enabled “Twittering Billy” read out tweets – An embedded internet device, prototyped in ½ day – Over ¼ million video views in first week! mbed Rapid Prototyping Platform • Complete Hardware, Software and Web 2.0 Solution Dedicated Developer Website Lightweight Online Compiler High-level Peripheral APIs Prototyping Form-Factor mbed Website • Dedicated Developer Web Platform – Custom Web 2.0 tools and environment focused on developers – Simple route to get started, comprehensive resources and support http://mbed.org mbed Compiler • Lightweight Online C/C++ Compiler – – – – Web 2.0 browser-based IDE with personal workspace “in the cloud” Nothing to install or configure, login from anywhere Industry leading RVCT 4.1 back end. It is a real tool! Very easy to use, great for students! mbed SDK • C/C++ SDK for ARM Microcontrollers – High-level APIs and standard environment – Low level control as needed – Portable across different ARM silicon vendor MCUs • Built on industry standard technology – ANSI/ISO C/C++ – CMSIS Compliant – Compatible with all major professional MCU tools • Open Source – Released under permissive Apache 2.0 license – Suitable for commercial and non-commercial use – Managed, maintained and tested by ARM mbed API Library • High-level Peripheral APIs using C++ Classes – – – – Trading a bit of memory and CPU performance for ease of use Abstract software interfaces for controlling microcontroller hardware Intuitive peripheral access, encapsulation of implementation details Treat hardware and software the same mbed-enabled Hardware • Expanding range of off-the-shelf mbed-enabled hardware – – – – ARM Cortex-M0, M0+, M3 all represented; M4 TBA All boards implement the mbed HDK Hardware is designed and/or made by ARM or 3rd parties mbed HDK enables anyone to build alternate board designs mbed LPC1768 Microcontroller • Cortex-M3 MCU in a Prototyping Form-Factor – 0.1” pitch DIP with “USB Flash Drive” interface and support components – Nothing to install or configure, practical for breadboard and PCBs What IO is there? Courses that could utilize an embedded computer • C/C++ Programing Class – Need easy to use full C++ support • Computer Architecture – Need C and ARM? Assembly Language • Microprocessor/Embedded Systems Design - Need C/C++, most common I/O interfaces, Networking and OS support. • Senior Design Projects– Needs to be easy to add custom hardware and build prototypes. Networking and RTOS needed in many cases. • Elective Courses – Robotics/Mechatronics: Need extensive easy-to-use I/O support – Networking: Need Ethernet TCP/IP support for “Internet of Things” Devices – Operating Systems: Need RTOS (Open Source) Using mbed at Georgia Tech • For the past two years, all undergraduate ECE students purchase their own mbed computer board and a parts kit that is used in several undergraduate classes for hands-on laboratory assignments. Total cost is just under $100. • Supports full C/C++, ARM Assembly Language, Networking, and an optional Operating System along with a wide range of I/O interfaces. • The cloud compiler and a C++ I/O API library make it easy to use • Student breadboards can be used to build custom embedded systems and this also enables use later in design projects. Students can work anywhere with mbed • A PC or Mac with a Wi Fi or wired network connection and a web browser is all that is needed with the cloud compiler • Downloads new C/C++ code files just like a USB flash drive • Breadboard is powered by the USB connection (5V and 3.3V) • A Wi Fi to Ethernet bridge setup can even be used on a laptop for developing and testing “Internet of Things” applications • Wiki eliminates requirement for a dedicated textbook on the device ECE students working in hallway A traditional student laboratory setup Rapid Prototyping using a Breadboard GT student mbed Inventor’s Kit Internet of Things Example: NTP Clock on a Breadboard Experience using mbed at Georgia Tech • The cloud compiler and breadboard approach works well and greatly reduces the student computer and lab support issues. Breadboarding provides increased flexibility for laboratory and design projects. • Higher-level I/O support with C/C++ APIs and wiki documentation enables the introduction of embedded systems earlier in the curriculum. • Assembly Language, RTOS, and networking support enables future use in additional undergraduate courses and senior design projects. • The majority of students wanted more embedded assignments and felt that the breadboarding experience was worthwhile. ECE Students working on mbed project HKN mbed inventor’s kit sales Breadboard or Baseboard? • A breadboard allows students to generate a custom hardware design adding new parts as needed. There is some educational value in having students connect parts. Most I/O connections are serial, so few wires are needed. • The mbed module can also plug into a baseboard with an assortment of parts already hooked up. To use parts on baseboard a breadboard and jumper wires are not needed. Can still run long jumper wires to a breadboard. Less time to get started, but perhaps harder to use in design projects with custom hardware needs. • The mbed application board is a new low-cost baseboard option for mbed that will be used in the hands-on demos mbed application board 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 128x32 Graphics LCD 5 way joystick 2 x Potentiometers 3.5mm Audio jack (Analog Out) Speaker, PWM Connected 3 Axis +/1 1.5g Accelerometer 3.5mm Audio jack (Analog In) 2 x Servo motor headers RGB LED, PWM connected USB-B Connector Temperature sensor Socket for for Xbee (Zigbee) or RN-XV (Wifi) USB-A Connector RJ45 Ethernet connector 1.3mm DC Jack input http://mbed.org/cookbook/mbed-application-board Connecting up the TextLCD • The LCD module has an SPI interface and a few digital outputs for reset, chips select and so on • mbed keeps it simple – Libraries in Cookbook Wiki for many common I/O devices – Standard C/C++ interface via printf – Hello World : http://mbed.org/users/chris/code/app-board-LCD Hands-On Labs • First Connect to Wi-Fi – needed for cloud compiler! – Connect to “Marriot_CONF” using auth code: 98HKM – If above not working, try “Marriot_GUEST” using room number and last name • Open the page below in a web browser: https://mbed.org/users/4180_1/notebook/mbed-applicationboard-hands-on-demos/ Note: Keep this web page open while using the compiler in another browser tab for links to import demo projects and follow along instructions throughout the demos ARM University Program mbed workshop videos • http://www.youtube.com/playlist?list=PLgyFKd2HIZlaJM1b0Y q0tvWnddQ7D6Dae • Application boards and mbeds are available at: www.sparkfun.com/products/11695 • Other sources at: • mbed.org/cookbook/mbed-application-board#where-to-buy Summary • There is huge opportunity for microcontroller applications – A major barrier to adoption is simple experimentation • mbed helps with getting started and rapid prototyping – – – – Fast turnaround of experiments and prototyping new ideas Try out new technology and new ideas Easy for students to use Handbook and Cookbook Wiki provide documentation and examples • Makes the technology very accessible for students – Hands-on demos will show a start to finish prototyping example – From getting a user started to enabling an application experiment Q&A