Jumpstarting the Onion Omega2

Jumpstarting the Onion Omega2

Jumpstarting the Onion Omega2 An Introduction to a New Low-Cost Internet of Things Computer WOLFRAM DONAT JUMPSTARTING the Onion Omega2 AN INTRODUCTION TO A NEW LOW-COST INTERNET OF THINGS COMPUTER Wolfram Donat Maker Media, Inc. San Francisco Copyright © 2018 Wolfram Donat. All rights reserved. Published by Maker Media, Inc. 1700 Montgomery Street, Suite 240 San Francisco, CA 94111 Maker Media books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (safari- booksonline.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or [email protected]. Editorial Director: Roger Stewart Editor: Patrick DiJusto Copy Editor: Elizabeth Welch, Happenstance Type-O-Rama Proofreader: Scout Festa, Happenstance Type-O-Rama Cover and Interior Designer: Maureen Forys, Happenstance Type-O-Rama All the circuit and component diagrams in this book are created using Fritz- ing (http://fritzing.org/home). June 2018: First Edition Revision History for the First Edition 2018-06-18 First Release See oreilly.com/catalog/errata.csp?isbn=9781680455229 for release details. Make:, Maker Shed, and Maker Faire are registered trademarks of Maker Media, Inc. The Maker Media logo is a trademark of Maker Media, Inc. Jumpstarting the Onion Omega2 and related trade dress are trademarks of Maker Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and Maker Media, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While the publisher and the author have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the author disclaim all responsibility for errors or omis- sions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other tech- nology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights. 978-1-680-45522-9 Safari® Books Online Safari Books Online is an on-demand digital library that delivers expert content in both book and video form from the world’s leading authors in technology and business. Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training. Safari Books Online offers a range of plans and pricing for enterprise, government, education, and individuals. Members have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like O’Reilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and hundreds more. For more information about Safari Books Online, please visit us online. How to Contact Us Please address comments and questions to the publisher: Maker Media, Inc. 1700 Montgomery Street, Suite 240 San Francisco, CA 94111 You can send comments and questions to us by email at [email protected]. Maker Media unites, inspires, informs, and entertains a growing community of resourceful people who undertake amazing projects in their backyards, basements, and garages. Maker Media celebrates your right to tweak, hack, and bend any Technology to your will. The Maker Media audience continues to be a growing culture and community that believes in bettering ourselves, our environment, our educational system—our entire world. This is much more than an audience, it’s a worldwide movement that Maker Media is leading. We call it the Maker Movement. To learn more about Make: visit us at makezine.com. You can learn more about the company at the following websites: Maker Media: makermedia.com Maker Faire: makerfaire.com Maker Shed: makershed.com Maker Share: makershare.com CONTENTS Introduction vii 1 Setting Up Everything 1 Graphical Setup 3 Trouble Connecting? 5 Connecting via the Command Line 6 Upgrading Firmware and Installing the Console 7 2 Getting to Know the Console 11 GPIO Tool 12 OLED Control 13 Settings 15 The Terminal App 16 The Editor 16 The Webcam Application 18 Relay and PWM Control 19 OPKG and Python 22 3 The Tweetin’ Onion 25 The Temperature Tweet 25 Install Modules 26 The Twitter Side of Things 27 The Hardware 29 The Code 31 4 The Photovore 35 Parts 36 The Voltage Divider 37 Hardware Setup 39 Software and Code 43 v INTRODUCTION In the proud tradition of computers named after fruit—the Apple, the Raspberry Pi, the Banana Pi, the Pine (okay, maybe not that last one)—comes a new entry into the small, single-board computer (SBC) market: the Onion Omega2. Let’s ignore the fact that an onion is a vegetable, not a fruit, and talk about the Onion Omega2’s origins for a moment. The Onion Omega2 (and its big brother, the Omega2+) are the second offering from a company called, appropriately enough, Onion. The original Omega cost about $18 and ran on a Qual- comm Atheros AR9331 chip. Onion ran a Kickstarter campaign in 2016 to replace the Omega with the Omega2, using a different system on a chip, the MediaTek MT7688. They were ultimately successful, raising well over their goal of $440,000, and the Omega2 shipped late in 2016. A nice feature of the newer ver- sion was the price drop; the new board started at $5, though it was later increased to $7.50. The Omega2+ is only $9. The Omega2 is an SBC geared for the Internet of Things (IoT) market, billed as the “world’s smallest Linux server.” It runs a vari- ant of Linux known as OpenWRT, which is most commonly found on embedded devices like routers. It’s low power and really tiny; at 43mm×26mm×10mm, it’s just a little larger than an Arduino Pro Mini. Don’t let that fool you into thinking it’s not a real computer, however. It’s surprisingly powerful for the size, with its MIPS pro- cessor running at 580MHz. It supports up to 256MB of RAM, and it can support SD card storage. It supports 802.11b/g/n 2.4GHz WiFi and 10/100M Ethernet, as well as a multitude of other pro- tocols like UART, I2S, I2C, and SPI. It operates at 3.3V, but its vii docks and expansion boards come with a convenient onboard voltage regulator, which means you can power it with a variety of power supplies without having to worry about blowing it up. There are just a few differences between the Omega2 and the Omega2+, since they have the same processor. The O2 has 64MB of DDR2 DRAM memory, whereas the O2+ has 128. The O2 has 16MB of onboard flash storage, and the O2+ has 32. Finally, the O2+ has a microSD card slot, which gives you signifi- cantly more room for programs. Given the small difference in price, I suggest you pick up the O2+, but all of the projects in this book will work on either model, so if you’ve already purchased the O2, not to worry. I would like to interject a small observation here. If you really go back and look at those specs, it is insane how far we’ve come when it comes to putting computing power into small packages. My first computer was a Commodore VIC-20, which had a whop- ping 5KB of RAM. That’s less than the size of a standard image thumbnail on the web today, and almost thirteen thousand times smaller than the Omega2’s DRAM package. Quite a few expansion boards and docks are available; you’re going to need at least one right off the bat, as the Onion’s head- ers are at a 2mm pitch instead of the more common 0.1g pitch, which means you can’t just plug it into your breadboard. You’ll have to use either a dock or a breadboard expansion piece, so my suggestion is to purchase the power dock (Figure I-1). It allows you to power the board and whatever add-ons you happen to have using not just a microUSB cable, but also a 2-pin JST-PH connector—the standard connector on many lithium-ion (Li-ion) batteries. None of the expansion boards are very expensive, so it’s worth the time to look around and see what’s available when you’re shopping for your Onion. viii Jumpstarting the Onion Omega2 FIGURE I-1: The power dock Ordinarily this is where I’d walk you through the board and show you what’s on it, but these devices are covered by a metal cover so you can’t really see anything. I can, however, tell you what pins are made available to you when you plug it into a dock. The number of pins depends on the board; the power dock gives you 30 (you lose a power-in pin and a few GPIOs and gain a 5V and a few GNDs), and the breadboard dock gives you all 32. These include the standard 3.3V and GND pins, as well as I2C, Serial, and even Ethernet pins. In this book I’ll be using the Omega2+, the power dock, the relay expansion board, and the OLED expansion board, so if you still have some shopping to do you’ll know what you need.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    62 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us