Summarized using AI

Now is the time to create your own (m)Ruby computer

Katsuhiko Kageyama • September 04, 2020 • online • Talk

In the video titled "Now is the time to create your own (m)Ruby computer," speaker Katsuhiko Kageyama discusses the exciting possibilities of constructing custom computers using mruby, especially for gaming applications. He begins by reflecting on childhood dreams of creating and playing video games, leading to the realization that one can create personal video game hardware today. Kageyama outlines his agenda to explain the process of building a computer with mruby and dives into detailed steps and techniques necessary for such development.

Key points include:

  • Introduction to Mruby: Kageyama highlights mruby's capabilities as an efficient tool for developing applications on devices with smaller CPUs, especially in the context of the evolving microprocessor landscape.
  • Creation Steps: He provides a step-by-step guide:

    • Identify your requirements based on your concept.
    • Source components to build the hardware.
    • Create schematics using tools like KiCAD.
    • Manufacture the device through affordable services.
    • Implement software using Ruby scripts.
  • Choosing the Right Hardware: Kageyama discusses various processors suitable for mruby, emphasizing the advantages of the ESP32, which provides ample memory compared to Arduino boards. He advocates for a methodical approach in selecting hardware.

  • Software Implementation: He acknowledges the challenges of developing software for small processors, including memory management and performance optimization. Techniques like using hardware functions and creating a software layer for managing interrupts are emphasized.

  • Demonstration of Family mruby: Kageyama showcases his created device, labeled Family mruby, which allows running Ruby scripts without the need for a connected PC. He demonstrates how it loads scripts akin to a gaming console, solidifying the practical application of his teachings.

  • Conclusions: The session wraps up with Kageyama expressing his desire to further develop devices, improve firmware, and foster creativity within the audience for their projects. He encourages viewers to explore the potential of creating their own devices with mruby.

Overall, Kageyama's talk at RubyKaigi Takeout 2020 inspires engineers, especially those familiar with Ruby, to venture into custom hardware development, combining personal interests with technical skills.

Now is the time to create your own (m)Ruby computer
Katsuhiko Kageyama • September 04, 2020 • online • Talk

Now is the time to create your own (m)Ruby computer
mruby has been known as a good tool for supporting server applications and embedded softwares like an IoT application on a small CPU whose resource is limited. Now times are changing. mruby gets more power from recent micro processors. I believe now Ruby engineers can create their own computer as per their wish. Basic process and essential technique how to create an original (m)Ruby computer will be shown in the talk with a live demonstration of the computer.

RubyKaigi 2020 Takeout

00:00:00.480 Thank you for taking the time to see my session. I'm Katsuhiko Kageyama, and today I'd like to talk about creating your own computer.
00:00:15.440 My first question is: What were your childhood dreams? I had a dream to play video games freely. Additionally, I had a dream of creating video games by myself.
00:00:29.359 In order to make video games, we need a tool. For example, this was Family Basic, which can be used with a family computer or Nintendo system. We can make small games using this hardware and software along with cassette software.
00:01:20.159 Today, while we may not be children anymore, I am considering how to create my own video game hardware. In this session, I want to tell you that you can make your own computer with mruby.
00:01:37.600 Let me make my introduction. I’m an embedded software engineer in a manufacturing company and I make some embedded devices as a hobby. I'm also involved in writing technical books. Let me show you some of my devices. I made a small computer using a Raspberry Pi Zero and created a small game using a microprocessor.
00:02:58.400 Now, let me outline the agenda. I’d like to explain how to create your computer, then discuss why I chose mruby. Finally, I will explain the important technical aspects regarding mruby and demonstrate some examples.
00:03:38.560 The goal of my development is to create a small computer that runs Ruby scripts, similar to the Family Basic. I want to call it Family mruby since I will be using mruby. I also made a long mark, which I think is fun. Now I want to show you how to create your computer.
00:04:22.720 There are some steps involved. The first step is to find requirements. The second step is to find components to build the devices. Additionally, you need to create schematics. Based on these schematics, we will manufacture the device. After that, we will implement the software.
00:05:06.880 Let me explain each step in more detail. Requirements come from your idea, and defining what you want is essential. Today, there are many great online tools available for finding components. I'm using one of these tools to help find the necessary components.
00:05:45.199 After that, it’s important to create schematics. This might be difficult for software engineers, but making digital signal schematics is actually manageable. We can use KiCAD, which is a CAD tool for creating schematics.
00:06:57.760 Once the schematics are complete, we can move on to manufacturing the devices. For example, various companies offer affordable manufacturing services for hardware. Quality can be quite good, and prices can start at around five dollars.
00:07:41.680 Finally, we implement software on the hardware. Without software, your hardware won't function. In the last step, I will write applications using Ruby. The reason I use Ruby is that I love it. Moreover, no one likes to wait for compliance when flashing images to their devices.
00:08:45.760 As I mentioned earlier, I use mruby because it can run on small processors with limited memory. Generally, mruby requires more than 400 kilobytes, and simple implementations help integrate it into your hardware.
00:09:56.640 Next, let’s find suitable processors for running mruby. I put together a table showing major processors. For instance, Arduino is famous among makers, but its memory is quite limited. On the other hand, the ESP32 has larger memory options available.
00:10:55.360 I found that the ESP32 Dev Board offers 8 megabytes of RAM, which is suitable for mruby development. This is significant when considering a platform for your projects.
00:11:50.320 Now that I've outlined the hardware, let's shift to implementing basic software. The ESP32 lacks support for high-level environments like Windows, so we often rely on C or C++ for programming.
00:12:08.880 Based on the information from this session, I developed a system diagram. It includes an Arduino board, and I'm implementing libraries that support video output and audio. I created the mruby gem combined machine, which allows users to run their Ruby scripts on this system.
00:13:44.720 In the development phase, I used a development PC to build the firmware with a USB development tool, compiling it and transferring the software via serial communication. Once the software is loaded into the device, there’s no need to connect to the host PC.
00:14:26.480 Let me show you my hardware. It was manufactured by a Chinese company, and I also designed a black case using a 3D printer. Additionally, I created an aqua cover for the top of the case.
00:15:36.880 Now, let’s discuss the challenges we face with software implementation. Small processors have limited memory, so it's crucial to be mindful of memory usage. Ruby allows for the creation of many objects, which may lead to higher memory consumption.
00:16:28.080 Another challenge is performance. Since the hardware runs at a relatively low clock speed, we need to optimize for better performance. Utilizing hardware functions, such as direct memory access, can help significantly.
00:17:38.080 I want to focus on the use of interrupts in hardware. For example, when a button connected to the CPU is pressed, an electric signal is sent to the CPU, which then transitions from the main program to the interrupt handler automatically.
00:18:35.440 However, mruby does not handle hardware interrupts natively, making it a little more complex to implement what you'd need. To mimic this functionality, we utilize a different method involving manual checks.
00:19:36.160 By using this software layer for interrupts, users can manage input via Ruby script. This code is an experimental implementation, and further investigation will be needed to refine the process.
00:20:30.400 Let's check out my Family mruby. You can see the console screen loading Ruby source files. This is akin to playing an RPG game, where characters can be moved using a gamepad.
00:21:50.080 Now I'll demonstrate connecting using an Arduino interface. Moving on to the next demonstration, you can see a database storing source code files.
00:22:29.760 I hope to summarize my session succinctly. I shared insights on creating your own devices. Additionally, I presented Family mruby, which supports Ruby programming without requiring a PC. Furthermore, I proposed a software interrupt method.
00:23:08.560 I aspire to develop more devices and update the firmware based on this family mruby system. I hope you can appreciate and enjoy the possibilities of making your own projects.
00:23:40.800 Thank you for your time, and see you next time!
Explore all talks recorded at RubyKaigi 2020 Takeout
+21