Ruby

Summarized using AI

Ruby on Robots

Andrew Carmer • October 02, 2015 • Earth

The video titled "Ruby on Robots" features Andrew Carmer speaking at the Rocky Mountain Ruby 2015 conference. The presentation emphasizes the imaginative and creative potential of programming with Ruby, specifically in relation to automation and the Internet of Things (IoT).

Carmer begins by acknowledging the audience and his own novice experience with Ruby, stating his goal is to inspire growth through creative coding. He discusses the significance of automation in everyday life, suggesting that IoT should focus on solving common obstacles faced by people by utilizing technology to create smart, connected objects.

Key Points Discussed:
- Introduction to Automation: Carmer introduces the concept of automation, exploring how various everyday tasks can be enhanced through technology. He mentions potential applications, such as smart roads equipped with sensors that improve public transportation safety and efficiency.
- Concept of Smart Objects: The presentation outlines how interconnected devices can act intelligently. Definitions of awareness, reaction, intuition, and consciousness are provided to illustrate what makes an object "smart".
- Utilization of Arduino: Carmer provides insights into using Arduino for creating automated devices. He describes Arduino as accessible hardware ideally suited for DIY projects and outlines various types such as the LilyPad and Uno, which cater to different applications.
- Programming with Ruby: A notable focus is placed on using Ruby for automating hardware rather than traditional languages like JavaScript or C, driven by its readability and ease of use. He introduces the Dino gem, which simplifies interaction with Arduino boards through Ruby.
- Demonstrations: The talk includes demonstrations showcasing simple projects such as a Morse code blinking LED and servo-controlled model sprinklers, emphasizing Ruby's capabilities for rapid prototyping of smart devices.

Conclusion:
Carmer concludes by reinforcing the idea that anyone can build and experiment with hardware projects to address both mundane and complex problems in creative ways. His excitement about using Ruby to make automation accessible underlines a central message of the talk: technology should enhance lives, driven by curiosity and innovation.

The overall takeaway is the encouragement for developers, novices and experts alike, to engage in imaginative programming with Ruby to explore new possibilities in automation and IoT.

Ruby on Robots
Andrew Carmer • October 02, 2015 • Earth

Ruby was designed to be enjoyable and to make its programmer's life easier. You know what makes life easier in the short term? Robot servants. In the long term, there are problems like the singularity and the inevitable robot uprising. But in the mean time, we can all sit back, relax, and control the lights in our home with our favorite programming language. In this talk, we'll explore how to get started using Ruby with Arduino and the Raspberry Pi. We'll bend some hardware to our whim and look at how we can use Ruby to improve our everyday life.

Help us caption & translate this video!

http://amara.org/v/HKqc/

Rocky Mountain Ruby 2015

00:00:24.310 Alright, so the title is 'Ruby on Robots'. Like I said, there isn't a whole lot directly on robots here, but I hope you enjoy it anyway. My name is Andrew Carmer, and I'd like to thank Graham and Alissa for putting this all on. I know we all really appreciate it. I think there was also Zach involved, too.
00:00:39.050 At the core of this talk, it's not very technical; it's not necessarily about robots. It's more about imagination, creativity, and maybe a little bit about growth as well. What I mean by growth is that through free and open thought communication, we can all grow—grow as people, as developers, and we can grow our society through curiosity and exploration. We can expand our minds, our world, and our possibilities. You know, code can make our lives better. So, I hope you find some value in this talk.
00:01:19.929 As I mentioned, I am Andrew Carmer; you can find me on Twitter at @ajakecarmer or on GitHub at Karma. This is my first conference, and this is actually my first talk at any conference. So, thank you, I hope it goes alright!
00:01:36.890 Last January, all I really knew about Ruby was that I could print 'Hello, world!' in my terminal. I've been programming for a little over seven months, and I think it’s gone pretty well so far. I’m really excited to be here and to be able to talk to you all. You might be asking what gives me the authority to talk to you, who are probably very seasoned professional developers, about this topic today. I guess it's just that Graham here said I could. If you want to bring it up, just talk to them, the whole committee.
00:02:22.370 The main reason I'm here is because a friend of mine, Steve Kinney, helped me put together a really great proposal that was accepted, so big thanks to him. Also, a quick shout-out and thank you to the School of Software and Design, where Steve is an instructor; I wouldn't be here without them.
00:02:44.650 Today, we're going to talk a little bit about automation. If you read the introduction, it was kind of more about automation in lighting, but I'm also going to sprinkle in some ideas I have about the Internet of Things (IoT). That's because I believe the future is all about IoT technologies that deal with data and automation.
00:03:15.280 I think IoT should focus on everyday people and the everyday problems and obstacles that we all face. It should be about the solutions to those obstacles, and with the technology we have, we can conquer both mundane and extraordinary problems alike.
00:03:28.510 The way we conquer any kind of problem is simply by building things. In regards to automation and the Internet of Things, what kind of things can we automate? Just about anything that has a sensor can collect data. Anything that you can touch or control can act on that data, and we can automate quite a few things.
00:03:44.420 For example, roads are a great possibility for automation. Smart roads could have sensors that collect data to inform public transportation or our vehicles about dangerous conditions, delays, or anything like that. If we build things and connect them to the Internet, we can achieve some pretty extraordinary outcomes.
00:04:03.720 To me, the Internet is a place we all go every day for information—whether it's news, radio, social interaction, or any sort of resource. At its core, the Internet is an interconnected global communication network; it allows people and things to communicate.
00:04:19.090 When we connect these 'things' together, we create smart objects—objects that are intelligent. Some people may think that the concept of things being smart and intelligent is a little crazy, but if you stick with me, I think I can put it into perspective. When I think about things being smart or intelligent, I think about awareness, reaction, consciousness, and intuition.
00:04:52.710 Awareness is simply gathered and stored data, which is where sensors come in. Reaction is just a response to that data. Next is intuition, which is the recognition of patterns in historical data. Finally, consciousness is the aggregate process of awareness, reaction, and intuition.
00:05:19.440 What kinds of things can be smart? Anything that has a sensor or controller attached to it can be made to respond and improve our everyday lives. Although not all of these things are practical, some of them are certainly fun. For instance, the Nest thermostat is one of these smart devices that many consider practical.
00:05:43.170 Then there's the Smart Smoker; this device has dozens of sensors that measure everything from smoke velocity to heat—it’s pretty cool. You also have gadgets like the Fitbit, which is practical, and one of my favorites—the June oven—which can sense what is inside it, adjusting the temperature and cook time based on the item.
00:06:11.190 Now, let's talk about what we as hardware hackers can do. By building and experimenting with small projects, we can expand on our ideas and create new items. This can help influence what people think is possible and accessible. We can write code to enhance our everyday lives, and one of the ways to start doing this is with Arduino.
00:06:32.800 Before we dive into this section, I want to give a shout-out to Austin Vance. I've never met him directly, but he was pivotal in creating the Dino gem, which I'll be talking about shortly. Many of the ideas I'm sharing stem from him.
00:06:48.020 So, what is the Arduino? According to Wikipedia, the Arduino is an open-source computer hardware and software project—it's a community that designs and manufactures kits for building digital devices and interactive objects that can sense and control the physical world.
00:07:02.500 The Arduino board is essentially a single processor microcontroller; it's like a small computer that can perform specific tasks. We have various types of Arduinos at our disposal. For example, the LilyPad can be sewn into clothing, while the Uno is our most versatile Arduino. There are also the Leonardo, Micro, and many others.
00:07:22.620 You might wonder, practically, what can we really do with an Arduino? The possibilities are endless. For example, you can automate tasks like tying your shoes or creating an autonomous lawnmower—there’s even a pumpkin flamethrower out there. We have bubble machines, yogurt makers, night lamp camera accessories, and automated camera sliders.
00:07:51.310 To get started with Arduino, you'll use the IDE—Integrated Development Environment. With the IDE, you can write and compile code onto your Arduino. Once you compile the code, it's saved there until overridden or replaced, which means the Arduino can now operate independently. The only downside is that you need to write in C++ to interact with it.
00:08:22.500 C is complicated, and I appreciate that Ruby handles many of those complexities like memory allocation and garbage collection for you. Fortunately, there’s hope. One of the ideas I got from Austin Vance is to think of the Arduino as a service. This way, it can read sensors and interact with the physical world.
00:09:00.480 We'll just talk with the Arduino via a computer. The challenge is if I connect it to my laptop, it’s no longer a standalone unit; I'm tethered, which creates some constraints. However, we have the Raspberry Pi to assist. You can install Ruby on your Raspberry Pi and interact with it just like you would with your laptop.
00:09:31.540 Now, there is no JavaScript out there that rivals Ruby for this purpose. Ruby is great for programming hardware, particularly with Arduino libraries like Johnny-Five. But unfortunately, Ruby doesn't have the same asynchronous capabilities as JavaScript or C, making it a bit trickier.
00:09:52.780 Regardless, we’re here to talk about Ruby—my personal favorite programming language! Why automate with Ruby instead of JavaScript, especially since JavaScript is ahead in this area? Because Ruby is accessible. By bootstrapping automation with Ruby, we can enable quick prototyping.
00:10:15.540 The appeal of Ruby lies in its ability to let us write fast, easy-to-understand code in a human-readable syntax. This allows anyone to grasp what the code means quickly. I've experimented with a few gems related to automation, including the Dino gem.
00:10:38.850 Getting started with the Dino gem is simple. Once the gem is installed correctly, you should see a small screen that looks something like this. When we dig into the Dino gem, we notice we have a board class. This class allows us to interact with the Arduino’s pins and I/O, providing a way to read inputs and send outputs.
00:10:59.640 There’s also a TX/RX class where all the communication happens. This class sends and receives messages for the Arduino and facilitates the initial handshake with our board. As for components, we have various classes available that are quite straightforward.
00:11:27.420 For example, the LED class has methods to turn the LED on and off. We have servos, which are tiny motors that provide about 180 degrees of rotation with position and angle methods. Stepper motors are also included, designed for more complex motion, allowing for full rotations in either direction.
00:11:45.490 We also have sensors that come with data receive and update methods. There are a few more, but those are the main ones we’ll focus on. It's really that simple. If you want to start digging into Arduino programming, you’ll find plenty of Fritzing diagrams out there for project mimicking.
00:12:03.350 Admittedly, I'm not an electrical engineer, nor do I write much C, so I like to find examples to help me get started. A simple Fritzing diagram for hooking up an LED could represent the hello world of hardware automation.
00:12:25.080 Once you’ve set up some of your hardware, you can select what type of Arduino you're using from the IDE or the Arduino software. Then, you simply create a sketch, which involves typing a command into your terminal. This gives you a directory for your project.
00:12:49.940 That directory will contain a .ino file that you will compile and upload to your Arduino. Now, for a couple of examples—I'm running on about five minutes, so I will quickly outline what I'll show you before demonstrating.
00:13:04.440 First, I’ll show you a simple hello world example with the blinking LED. Since a plain blink is a bit boring, I wrote a Morse code program that types a message for you and has the LED blink it. When you provide a message, it translates it into Morse code.
00:13:26.710 For instance, 'Hello Boulder, Rocky Mountain Ruby 2000,' is sanitized to match my hash and split into two characters for iteration through the Morse code. The sketch will tell the LED to turn on or off based on this input, allowing spaces as well.
00:14:02.390 As you can see, we have intact Ruby Morse code here. This demonstrates minimal Ruby, illustrating how easy it is to get started prototyping straightforward things.
00:14:26.110 Next, I will demonstrate my servo sprinkler example. In this setup, I have three servos that mimic sprinkler heads—don’t worry, no water will spray the crowd! Each head behaves like a mock sprinkler, controlled by the Arduino.
00:14:56.140 You instantiate the board through the Dino gem and specify the communication center via the TX/RX class. After setting up the servos and their associated pins, a simple piece of code will rotate the heads in a cycle, using a range of angles from 0 to 180.
00:15:20.170 Let's see that live demonstration in action! It should illustrate how we can apply the concepts we've just discussed.
00:15:56.960 You’ll notice you can message the servos to rotate at specified angles, demonstrating precision and the ability to program complex tasks by stringing those simple motors together with other small machines like gears and levers.
00:18:04.740 So, as I wrap up my presentation, I’d like to thank you for your attention! I'm Andrew Carmer, and I appreciate this opportunity to share my insights with all of you. Thank you!
Explore all talks recorded at Rocky Mountain Ruby 2015
+9